devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Sean Wang" <sean.wang@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	upstream@airoha.com, benjamin.larsson@genexis.eu,
	ansuelsmth@gmail.com, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v5 3/5] mfd: airoha: Add support for Airoha EN7581 MFD
Date: Wed, 2 Oct 2024 14:25:18 +0100	[thread overview]
Message-ID: <20241002132518.GD7504@google.com> (raw)
In-Reply-To: <20241001-en7581-pinctrl-v5-3-dc1ce542b6c6@kernel.org>

On Tue, 01 Oct 2024, Lorenzo Bianconi wrote:

> From: Christian Marangi <ansuelsmth@gmail.com>
> 
> Support for Airoha EN7581 Multi Function Device that
> expose PINCTRL functionality and PWM functionality.

The device is a jumble of pinctrl registers, some of which can oscillate.

This is *still* not an MFD.

If you wish to spread this functionality over 2 drivers, use syscon to
obtain the registers and simple-mfd to automatically probe the drivers.

> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  drivers/mfd/Kconfig                   |  8 ++++
>  drivers/mfd/Makefile                  |  2 +
>  drivers/mfd/airoha-en7581-gpio-mfd.c  | 72 +++++++++++++++++++++++++++++++++++
>  include/linux/mfd/airoha-en7581-mfd.h |  9 +++++
>  4 files changed, 91 insertions(+)
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index f9325bcce1b9..eca221351ab7 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -32,6 +32,14 @@ config MFD_ADP5585
>  	  the core APIs _only_, you have to select individual components like
>  	  the GPIO and PWM functions under the corresponding menus.
>  
> +config MFD_AIROHA_EN7581
> +	bool "Airoha EN7581 Multi Function Device"
> +	depends on (ARCH_AIROHA || COMPILE_TEST) && OF
> +	select MFD_CORE
> +	help
> +	  Support for Airoha EN7581 Multi Function Device that
> +	  expose PINCTRL functionality and PWM functionality.
> +
>  config MFD_ALTERA_A10SR
>  	bool "Altera Arria10 DevKit System Resource chip"
>  	depends on ARCH_INTEL_SOCFPGA && SPI_MASTER=y && OF
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 2a9f91e81af8..be8448e81a5b 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -257,6 +257,8 @@ obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC)	+= intel_soc_pmic_chtwc.o
>  obj-$(CONFIG_INTEL_SOC_PMIC_CHTDC_TI)	+= intel_soc_pmic_chtdc_ti.o
>  obj-$(CONFIG_INTEL_SOC_PMIC_MRFLD)	+= intel_soc_pmic_mrfld.o
>  
> +obj-$(CONFIG_MFD_AIROHA_EN7581)	+= airoha-en7581-gpio-mfd.o
> +
>  obj-$(CONFIG_MFD_ALTERA_A10SR)	+= altera-a10sr.o
>  obj-$(CONFIG_MFD_ALTERA_SYSMGR) += altera-sysmgr.o
>  obj-$(CONFIG_MFD_STPMIC1)	+= stpmic1.o
> diff --git a/drivers/mfd/airoha-en7581-gpio-mfd.c b/drivers/mfd/airoha-en7581-gpio-mfd.c
> new file mode 100644
> index 000000000000..88407ce5747e
> --- /dev/null
> +++ b/drivers/mfd/airoha-en7581-gpio-mfd.c
> @@ -0,0 +1,72 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * MFD driver for Airoha EN7581
> + */
> +
> +#include <linux/io.h>
> +#include <linux/of.h>
> +#include <linux/mfd/airoha-en7581-mfd.h>
> +#include <linux/mfd/core.h>
> +#include <linux/module.h>
> +
> +static struct resource airoha_mfd_pinctrl_intr[] = {
> +	{
> +		.flags = IORESOURCE_IRQ,
> +	},
> +};
> +
> +static const struct mfd_cell airoha_mfd_devs[] = {
> +	{
> +		.name = "pinctrl-airoha",
> +		.resources = airoha_mfd_pinctrl_intr,
> +		.num_resources = ARRAY_SIZE(airoha_mfd_pinctrl_intr),
> +	}, {
> +		.name = "pwm-airoha",
> +	},
> +};
> +
> +static int airoha_mfd_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct airoha_mfd *mfd;
> +	int irq;
> +
> +	mfd = devm_kzalloc(dev, sizeof(*mfd), GFP_KERNEL);
> +	if (!mfd)
> +		return -ENOMEM;
> +
> +	platform_set_drvdata(pdev, mfd);
> +
> +	mfd->base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(mfd->base))
> +		return PTR_ERR(mfd->base);
> +
> +	irq = platform_get_irq(pdev, 0);
> +	if (irq < 0)
> +		return irq;
> +
> +	airoha_mfd_pinctrl_intr[0].start = irq;
> +	airoha_mfd_pinctrl_intr[0].end = irq;
> +
> +	return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, airoha_mfd_devs,
> +				    ARRAY_SIZE(airoha_mfd_devs), NULL, 0,
> +				    NULL);
> +}
> +
> +static const struct of_device_id airoha_mfd_of_match[] = {
> +	{ .compatible = "airoha,en7581-gpio-sysctl" },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, airoha_mfd_of_match);
> +
> +static struct platform_driver airoha_mfd_driver = {
> +	.probe = airoha_mfd_probe,
> +	.driver = {
> +		.name = KBUILD_MODNAME,
> +		.of_match_table = airoha_mfd_of_match,
> +	},
> +};
> +module_platform_driver(airoha_mfd_driver);
> +
> +MODULE_AUTHOR("Christian Marangi <ansuelsmth@gmail.com>");
> +MODULE_DESCRIPTION("Driver for Airoha EN7581 MFD");
> diff --git a/include/linux/mfd/airoha-en7581-mfd.h b/include/linux/mfd/airoha-en7581-mfd.h
> new file mode 100644
> index 000000000000..25e73952a777
> --- /dev/null
> +++ b/include/linux/mfd/airoha-en7581-mfd.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_INCLUDE_MFD_AIROHA_EN7581_MFD_H_
> +#define _LINUX_INCLUDE_MFD_AIROHA_EN7581_MFD_H_
> +
> +struct airoha_mfd {
> +	void __iomem *base;
> +};
> +
> +#endif  /* _LINUX_INCLUDE_MFD_AIROHA_EN7581_MFD_H_ */
> 
> -- 
> 2.46.2
> 

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2024-10-02 13:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01 17:29 [PATCH v5 0/5] Add mfd, pinctrl and pwm support to EN7581 SoC Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 1/5] dt-bindings: arm: airoha: Add the chip-scu node for " Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 2/5] dt-bindings: mfd: Add support for Airoha EN7581 GPIO System Controller Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 3/5] mfd: airoha: Add support for Airoha EN7581 MFD Lorenzo Bianconi
2024-10-02 13:25   ` Lee Jones [this message]
2024-10-02 22:42     ` Christian Marangi
2024-10-08 22:04     ` Lorenzo Bianconi
2024-10-09 10:48       ` Lee Jones
2024-10-09 10:55         ` Lee Jones
2024-10-10 10:14           ` Christian Marangi
2024-10-10 10:41             ` Christian Marangi
2024-10-10 16:25             ` Lee Jones
2024-10-10 19:34             ` Linus Walleij
2024-10-10 21:41               ` Lorenzo Bianconi
2024-10-11  6:51                 ` Linus Walleij
2024-10-01 17:29 ` [PATCH v5 4/5] pinctrl: airoha: Add support for EN7581 SoC Lorenzo Bianconi
2024-10-02 13:27   ` Linus Walleij
2024-10-02 15:37     ` Lorenzo Bianconi
2024-10-01 17:29 ` [PATCH v5 5/5] pwm: " Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241002132518.GD7504@google.com \
    --to=lee@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ansuelsmth@gmail.com \
    --cc=benjamin.larsson@genexis.eu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sean.wang@kernel.org \
    --cc=ukleinek@kernel.org \
    --cc=upstream@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).