Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5085102imu; Tue, 13 Nov 2018 00:32:00 -0800 (PST) X-Google-Smtp-Source: AJdET5cT2CkRE5eFpzZ4ywm96UlnOUx183jJk7zh/e6up625/X30Kf6im7IOTDj8SyHOZlL6Dvbz X-Received: by 2002:a17:902:d806:: with SMTP id a6mr2306456plz.172.1542097920110; Tue, 13 Nov 2018 00:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542097920; cv=none; d=google.com; s=arc-20160816; b=WeAp6awbg3Av+Xba0wDAsZfMdaEJmSxmTE1sxch2t76sizossNY4gDCCME5LlCKhOx UXS6w+pdzBW0Qm4PZ/e3qNPA5XHdwR7AF2owa0VTuABqucavxYDeqKcDN2ikxcxX+O9k rC0bN+02FKR28fcrg4Tsk6z6LkaWOVcXqfp2IL5Ps8ZqjnpWc8AYlzBY7L2s5D9/FnzY wzxd5ap1mk4aqGMukUxV05gHVodXX97U1ZZx9ukQG/Y0EJ/c+3I5STZGZYqpOD5wVUsp Euzt9ffdkTkpQ1bbugdhE4i5s+EHWr2f9vWZplqIjzyP2LFQE9qauN3AcxlQL4YqNK9m n2Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k/5spv9Cow1i2dfioRqgW2G8AUF3QCGLOMDToSivGQE=; b=MMSGR/Pl04zlRDfdLA851UyNIslNbdGAhaQt4rm2l1wlL6Lh94FKeZkO1xve5Omhhr S9Hjx8R7ijNj9ZoTMSBdSR5jbOKnV+XHX9m9+pat5vNccmNSPJhUAquMnENkUDqR8xfW M24wXJnLqEQSVny2N9gdawiy6Tjr4mgT+7cqIx07CIRWerqWKQUuMWjDG3v3SPXfpXIN lsIeytv1tl+9Kj609kqrtrR8OydNYoqTonesK3QiuR3ywRNVeIlm3fhkfc/8JRr54/th tSr9PnjWV3QH9EkOX7xYGLQAV8JWCjgQC+nsyX7lrv+HiDD79vsafgDf6a4Lqw7YDE28 uw/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I2Y8y48o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7-v6si20073866plk.174.2018.11.13.00.31.45; Tue, 13 Nov 2018 00:32:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I2Y8y48o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731406AbeKMS2M (ORCPT + 99 others); Tue, 13 Nov 2018 13:28:12 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36626 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731378AbeKMS2M (ORCPT ); Tue, 13 Nov 2018 13:28:12 -0500 Received: by mail-wm1-f67.google.com with SMTP id s11so1162297wmh.1 for ; Tue, 13 Nov 2018 00:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=k/5spv9Cow1i2dfioRqgW2G8AUF3QCGLOMDToSivGQE=; b=I2Y8y48ojZ1CDqYlFdJr7GN/qrGsQq1TaZ7lCEn5sBQquS04mrCtxnM2LOJKs6dbwO YWTuMYoPb8LRwhcJm1IS6udl/3D2dRCO1izxjku3v3WIGFEikPIIm+dRd77qqtZS37xY 1/FKVAyMnbEu8WGACab0ObiX96UjqON6nUYtQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=k/5spv9Cow1i2dfioRqgW2G8AUF3QCGLOMDToSivGQE=; b=tCIvZw3cu5Yj5XAtqKPY12nOmxjaDbY75KxoVwH6XN0sr//WAIs3uE8iLWOQgMCJsd 0yy40fMG/lAfHH+OXgWdhonoBMqFq5pq/YALebRpH3rqoYqS951qSwvqmDa8JchptKCe jE6UWWqT4NQSxMJkS2LcbhRj4lzSOOmXuIwZb0HLbOe0KS2AoIwN5J++QHxxQbF9F5ll 2k+o+Nk/2dNxRzb7hP3l2eNLlSvO2HcgBbkMYV3B4KUa8H6B+0wKst6EMSHzHKtitS66 hmIY1iM+NguOwcVMw45Xb9XazaKx8q/0cWwI0Os+ovIgJh9URKdaheDAVA6aTYRLxmVO Q9Zw== X-Gm-Message-State: AGRZ1gLEKBonMeY41NiimhRBd8XU1wGHhR740d5d+pONA0t7waqpttw2 Z7mWh2vT5dft4GfzlQ8DeaBcxw== X-Received: by 2002:a1c:e108:: with SMTP id y8-v6mr2197043wmg.2.1542097868273; Tue, 13 Nov 2018 00:31:08 -0800 (PST) Received: from dell ([2.31.167.205]) by smtp.gmail.com with ESMTPSA id l8-v6sm9780772wrm.88.2018.11.13.00.31.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Nov 2018 00:31:07 -0800 (PST) Date: Tue, 13 Nov 2018 08:31:05 +0000 From: Lee Jones To: Charles Keepax Cc: mturquette@baylibre.com, sboyd@kernel.org, broonie@kernel.org, linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, lgirdwood@gmail.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH v4 4/6] mfd: lochnagar: Add support for the Cirrus Logic Lochnagar Message-ID: <20181113083105.GC3513@dell> References: <20181108101405.14062-1-ckeepax@opensource.cirrus.com> <20181108101405.14062-5-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181108101405.14062-5-ckeepax@opensource.cirrus.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 08 Nov 2018, Charles Keepax wrote: > Lochnagar is an evaluation and development board for Cirrus > Logic Smart CODEC and Amp devices. It allows the connection of > most Cirrus Logic devices on mini-cards, as well as allowing > connection of various application processor systems to provide a > full evaluation platform. This driver supports the board > controller chip on the Lochnagar board. Audio system topology, > clocking and power can all be controlled through the Lochnagar > controller chip, allowing the device under test to be used in > a variety of possible use cases. > > As the Lochnagar is a fairly complex device this MFD driver > allows the drivers for the various features to be bound > in. Initially clocking, regulator and pinctrl will be added as > these are necessary to configure the system. But in time at least > audio and voltage/current monitoring will also be added. > > Signed-off-by: Charles Keepax > --- > > Changes since v3: > - Bind in child drivers through device tree rather than using mfd_add_devices > - Remove defaults arrays for regmap > - Use a lot of ... in the regmap readable/volatile callbacks > - Explicitly include register headers, rather than relying on lochnagar.h > - Add some kernel doc > - Some minor cosmetic fixups > - Add a lockdep_assert in lochnagar_update_config > > Thanks, > Charles > > MAINTAINERS | 17 ++ > drivers/mfd/Kconfig | 8 + > drivers/mfd/Makefile | 2 + > drivers/mfd/lochnagar-i2c.c | 394 ++++++++++++++++++++++++++++++++++++ > include/linux/mfd/lochnagar.h | 55 +++++ > include/linux/mfd/lochnagar1_regs.h | 157 ++++++++++++++ > include/linux/mfd/lochnagar2_regs.h | 253 +++++++++++++++++++++++ > 7 files changed, 886 insertions(+) > create mode 100644 drivers/mfd/lochnagar-i2c.c > create mode 100644 include/linux/mfd/lochnagar.h > create mode 100644 include/linux/mfd/lochnagar1_regs.h > create mode 100644 include/linux/mfd/lochnagar2_regs.h > > diff --git a/MAINTAINERS b/MAINTAINERS > index f4855974f3250..0398c8752e610 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -3567,6 +3567,23 @@ L: netdev@vger.kernel.org > S: Maintained > F: drivers/net/ethernet/cirrus/ep93xx_eth.c > > +CIRRUS LOGIC LOCHNAGAR DRIVER > +M: Charles Keepax > +M: Richard Fitzgerald > +L: patches@opensource.cirrus.com > +S: Supported > +F: drivers/clk/clk-lochnagar.c > +F: drivers/mfd/lochnagar-i2c.c > +F: drivers/pinctrl/cirrus/pinctrl-lochnagar* > +F: drivers/regulator/lochnagar-regulator.c > +F: include/dt-bindings/clk/lochnagar.h > +F: include/dt-bindings/pinctrl/lochnagar.h > +F: include/linux/mfd/lochnagar* > +F: Documentation/devicetree/bindings/mfd/cirrus,lochnagar.txt > +F: Documentation/devicetree/bindings/clock/cirrus,lochnagar.txt > +F: Documentation/devicetree/bindings/pinctrl/cirrus,lochnagar.txt > +F: Documentation/devicetree/bindings/regulator/cirrus,lochnagar.txt > + > CISCO FCOE HBA DRIVER > M: Satish Kharat > M: Sesidhar Baddela > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig > index 8c5dfdce4326c..51de2db3f6537 100644 > --- a/drivers/mfd/Kconfig > +++ b/drivers/mfd/Kconfig > @@ -1685,6 +1685,14 @@ config MFD_VX855 > VIA VX855/VX875 south bridge. You will need to enable the vx855_spi > and/or vx855_gpio drivers for this to do anything useful. > > +config MFD_LOCHNAGAR > + bool "Cirrus Logic Lochnagar Audio Development Board" > + select MFD_CORE > + select REGMAP_I2C > + depends on I2C=y && OF > + help > + Support for Cirrus Logic Lochnagar audio development board. > + > config MFD_ARIZONA > select REGMAP > select REGMAP_IRQ > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile > index 12980a4ad4608..93284316d5307 100644 > --- a/drivers/mfd/Makefile > +++ b/drivers/mfd/Makefile > @@ -37,6 +37,8 @@ obj-$(CONFIG_MFD_T7L66XB) += t7l66xb.o tmio_core.o > obj-$(CONFIG_MFD_TC6387XB) += tc6387xb.o tmio_core.o > obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o tmio_core.o > > +obj-$(CONFIG_MFD_LOCHNAGAR) += lochnagar-i2c.o > + > obj-$(CONFIG_MFD_ARIZONA) += arizona-core.o > obj-$(CONFIG_MFD_ARIZONA) += arizona-irq.o > obj-$(CONFIG_MFD_ARIZONA_I2C) += arizona-i2c.o > diff --git a/drivers/mfd/lochnagar-i2c.c b/drivers/mfd/lochnagar-i2c.c > new file mode 100644 > index 0000000000000..133159d7646ed > --- /dev/null > +++ b/drivers/mfd/lochnagar-i2c.c > @@ -0,0 +1,394 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Lochnagar I2C bus interface > + * > + * Copyright (c) 2012-2018 Cirrus Logic, Inc. and > + * Cirrus Logic International Semiconductor Ltd. > + * > + * Author: Charles Keepax > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#define LOCHNAGAR_BOOT_RETRIES 10 > +#define LOCHNAGAR_BOOT_DELAY_MS 350 > + > +#define LOCHNAGAR_CONFIG_POLL_US 10000 > + > +static bool lochnagar1_readable_register(struct device *dev, unsigned int reg) > +{ > + switch (reg) { > + case LOCHNAGAR_SOFTWARE_RESET: > + case LOCHNAGAR_FIRMWARE_ID1...LOCHNAGAR_FIRMWARE_ID2: > + case LOCHNAGAR1_CDC_AIF1_SEL...LOCHNAGAR1_CDC_AIF3_SEL: > + case LOCHNAGAR1_CDC_MCLK1_SEL...LOCHNAGAR1_CDC_MCLK2_SEL: > + case LOCHNAGAR1_CDC_AIF_CTRL1...LOCHNAGAR1_CDC_AIF_CTRL2: > + case LOCHNAGAR1_EXT_AIF_CTRL: > + case LOCHNAGAR1_DSP_AIF1_SEL...LOCHNAGAR1_DSP_AIF2_SEL: > + case LOCHNAGAR1_DSP_CLKIN_SEL: > + case LOCHNAGAR1_DSP_AIF: > + case LOCHNAGAR1_GF_AIF1...LOCHNAGAR1_GF_AIF2: > + case LOCHNAGAR1_PSIA_AIF: > + case LOCHNAGAR1_PSIA1_SEL...LOCHNAGAR1_PSIA2_SEL: > + case LOCHNAGAR1_SPDIF_AIF_SEL: > + case LOCHNAGAR1_GF_AIF3_SEL...LOCHNAGAR1_GF_AIF4_SEL: > + case LOCHNAGAR1_GF_CLKOUT1_SEL: > + case LOCHNAGAR1_GF_AIF1_SEL...LOCHNAGAR1_GF_AIF2_SEL: > + case LOCHNAGAR1_GF_GPIO2...LOCHNAGAR1_GF_GPIO7: > + case LOCHNAGAR1_RST: > + case LOCHNAGAR1_LED1...LOCHNAGAR1_LED2: > + case LOCHNAGAR1_I2C_CTRL: > + return true; > + default: > + return false; > + } > +} Niiiiiice! Driver is much better for me to swallow like this. For my own reference: Acked-for-MFD-by: Lee Jones -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog