public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 01/10] mfd: AXP20x: Add mfd driver for AXP20x PMIC
Date: Fri, 28 Mar 2014 09:21:54 +0000	[thread overview]
Message-ID: <20140328092154.GF17779@lee--X1> (raw)
In-Reply-To: <1395955764-18103-2-git-send-email-carlo@caione.org>

> This patch introduces the preliminary support for PMICs X-Powers AXP202
> and AXP209. The AXP209 and AXP202 are the PMUs (Power Management Unit)
> used by A10, A13 and A20 SoCs and developed by X-Powers, a sister company
> of Allwinner.
> 
> The core enables support for two subsystems:
> - PEK (Power Enable Key)
> - Regulators
> 
> Signed-off-by: Carlo Caione <carlo@caione.org>
> ---
>  drivers/mfd/Kconfig        |  12 +++
>  drivers/mfd/Makefile       |   1 +
>  drivers/mfd/axp20x.c       | 240 +++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/mfd/axp20x.h | 180 ++++++++++++++++++++++++++++++++++
>  4 files changed, 433 insertions(+)
>  create mode 100644 drivers/mfd/axp20x.c
>  create mode 100644 include/linux/mfd/axp20x.h
> 
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index 49bb445..24ba61a 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -59,6 +59,18 @@ config MFD_AAT2870_CORE
>  	  additional drivers must be enabled in order to use the
>  	  functionality of the device.
>  
> +config MFD_AXP20X
> +	bool "X-Powers AXP20X"
> +	select MFD_CORE
> +	select REGMAP_I2C
> +	select REGMAP_IRQ
> +	depends on I2C=y
> +	help
> +	  If you say Y here you get support for the AXP20X.
> +	  This driver provides common support for accessing the device,
> +	  additional drivers must be enabled in order to use the
> +	  functionality of the device.

Please tell us what this device is and what sub-devices are available?

[...]

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> new file mode 100644
> index 0000000..f77a663
> --- /dev/null
> +++ b/drivers/mfd/axp20x.c
> @@ -0,0 +1,240 @@
> +/*
> + * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209

... which consist of ...

[...]

> +static struct resource axp20x_pek_resources[] = {
> +	{
> +		.name	= "PEK_DBR",
> +		.start	= AXP20X_IRQ_PEK_RIS_EDGE,
> +		.end	= AXP20X_IRQ_PEK_RIS_EDGE,
> +		.flags	= IORESOURCE_IRQ,
> +	}, {
> +		.name	= "PEK_DBF",
> +		.start	= AXP20X_IRQ_PEK_FAL_EDGE,
> +		.end	= AXP20X_IRQ_PEK_FAL_EDGE,
> +		.flags	= IORESOURCE_IRQ,
> +	},
> +};

Have you considered doing this in the Device Tree? It's a lot less
code/overhead.

> +static const struct i2c_device_id axp20x_i2c_id[] = {
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(i2c, axp20x_i2c_id);
 
We really should consider changing the I2C subsystem!

Can you add a comment here describing why we have to add this
seemingly pointless empty struct please?

> +static struct mfd_cell axp20x_cells[] = {
> +	{
> +		.name		= "axp20x-pek",
> +		.num_resources	= ARRAY_SIZE(axp20x_pek_resources),
> +		.resources	= axp20x_pek_resources,
> +	}, {
> +		.name		= "axp20x-regulator",
> +	},
> +};

Do these drivers don't look inside the DTB at all?

[...]

> +	of_id = of_match_device(axp20x_of_match, &i2c->dev);
> +	if (!of_id) {
> +		dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
> +		return -ENODEV;
> +	}
> +	axp20x->variant = (int) of_id->data;

'variant' needs to be a (unsigned?) long or it will break on 64bit
architectures.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2014-03-28  9:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 21:29 [PATCH v3 00/10] mfd: AXP20x: Add support for AXP202 and AXP209 Carlo Caione
2014-03-27 21:29 ` [PATCH v3 01/10] mfd: AXP20x: Add mfd driver for AXP20x PMIC Carlo Caione
2014-03-28  9:21   ` Lee Jones [this message]
2014-03-29 15:53     ` [linux-sunxi] " Carlo Caione
2014-04-11  9:26     ` Carlo Caione
2014-03-27 21:29 ` [PATCH v3 02/10] dt-bindings: add vendor-prefix for X-Powers Carlo Caione
2014-03-27 21:29 ` [PATCH v3 03/10] mfd: AXP20x: Add bindings documentation Carlo Caione
2014-03-27 21:29 ` [PATCH v3 04/10] input: misc: Add driver for AXP20x Power Enable Key Carlo Caione
2014-03-28  7:38   ` Dmitry Torokhov
2014-03-29 15:36     ` [linux-sunxi] " Carlo Caione
2014-03-29 19:05       ` Dmitry Torokhov
2014-03-27 21:29 ` [PATCH v3 05/10] input: misc: Add ABI docs for AXP20x PEK Carlo Caione
2014-03-27 21:29 ` [PATCH v3 06/10] regulator: AXP20x: Add support for regulators subsystem Carlo Caione
2014-03-28 13:39   ` Mark Brown
2014-03-29 17:52     ` [linux-sunxi] " Carlo Caione
2014-03-30  0:47       ` Mark Brown
2014-03-27 21:29 ` [PATCH v3 07/10] ARM: sunxi: dt: Add x-powers-axp209.dtsi file Carlo Caione
2014-03-28 13:34   ` Mark Brown
2014-03-29 16:14     ` Carlo Caione
2014-03-27 21:29 ` [PATCH v3 08/10] ARM: sun7i/sun4i: dt: Add AXP209 support to various boards Carlo Caione
2014-03-28  3:12   ` Chen-Yu Tsai
2014-03-28  7:37     ` [linux-sunxi] " Carlo Caione
2014-03-28 10:11   ` Maxime Ripard
2014-03-28 11:38     ` Mark Brown
2014-03-28 12:54       ` Maxime Ripard
2014-03-28 13:12         ` Mark Brown
2014-03-27 21:29 ` [PATCH v3 09/10] ARM: sunxi: Add AXP20x support in defconfig Carlo Caione
2014-03-27 21:29 ` [PATCH v3 10/10] ARM: sunxi: Add AXP20x support multi_v7_defconfig Carlo Caione
2014-03-28  8:01 ` [PATCH v3 00/10] mfd: AXP20x: Add support for AXP202 and AXP209 Lee Jones

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=20140328092154.GF17779@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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