From: Lee Jones <lee.jones@linaro.org>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: IIO <linux-iio@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
DEVICE TREE <devicetree@vger.kernel.org>,
Carlo Caione <carlo@caione.org>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Aaron Lu <aaron.lu@intel.com>, Alan Cox <alan@linux.intel.com>,
Jean Delvare <khali@linux-fr.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Grant Likely <grant.likely@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh+dt@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Hartmut Knaack <knaack.h@gmx.de>,
Fugang Duan <B38611@freescale.com>, Arnd Bergmann <arnd@arndb.de>,
Zubair Lutfullah <zubair.lutfullah@gmail.com>,
Sebastian Reichel <sre@debian.org>,
Johannes Thumshirn <johannes.thumshirn@men.de>,
Philippe Reynes <tremyfr@yahoo.fr>,
Angelo Compagnucci <angelo.compagnucci@gmail.com>,
Doug Anderson <dianders@chromium.org>,
Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Subject: Re: [PATCH v2 2/4] mfd/axp2xx: extend axp20x to support axp288 pmic
Date: Wed, 10 Sep 2014 10:13:54 +0100 [thread overview]
Message-ID: <20140910091354.GL30307@lee--X1> (raw)
In-Reply-To: <1410267775-4683-3-git-send-email-jacob.jun.pan@linux.intel.com>
On Tue, 09 Sep 2014, Jacob Pan wrote:
> XPower AXP288 is a customized PMIC for Intel Baytrail-CR platforms. Similar
> to AXP202/209, AXP288 comes with USB charger, more LDO and BUCK channels, and
> AD converter. It also provides extended status and interrupt reporting
> capabilities than the devices supported in axp20x.c.
>
> In addition to feature extension, this patch also adds ACPI binding for
> enumeration and hooks for ACPI custom operational region handlers.
>
> Files and common data structures have been renamed from axp20x to axp2xx
> in order to suit the extended scope of devices.
>
> This consolidated driver should support more Xpower PMICs in both device
> tree and ACPI based platforms.
>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
> drivers/mfd/axp2xx.c | 426 +++++++++++++++++++++++++++++++++++----------
> include/linux/mfd/axp2xx.h | 57 +++++-
> 2 files changed, 388 insertions(+), 95 deletions(-)
>
> diff --git a/drivers/mfd/axp2xx.c b/drivers/mfd/axp2xx.c
> index c534443..4830bbe 100644
> --- a/drivers/mfd/axp2xx.c
> +++ b/drivers/mfd/axp2xx.c
> @@ -1,9 +1,9 @@
> /*
> - * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209
> + * axp2xx.c - MFD core driver for the X-Powers AXP202, AXP209, and AXP288
Any renaming should be part of the renaming patch.
Please remove the supported devices from the description.
> - * AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
> - * converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
> - * as well as 4 configurable GPIOs.
> + * AXP2xx typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> + * as well as configurable GPIOs.
> *
> * Author: Carlo Caione <carlo@caione.org>
> *
> @@ -25,9 +25,14 @@
> #include <linux/mfd/core.h>
> #include <linux/of_device.h>
> #include <linux/of_irq.h>
> +#include <linux/acpi.h>
>
> #define AXP20X_OFF 0x80
>
> +static struct mfd_cell *axp2xx_cells;
> +static int axp2xx_nr_cells;
> +static struct regmap_config *regmap_cfg;
Only use globals if you 'really' have to.
[...]
> +static int axp2xx_match_device(struct axp2xx_dev *axp2xx, struct device *dev)
> {
> - struct axp20x_dev *axp20x;
> + const struct acpi_device_id *acpi_id;
> const struct of_device_id *of_id;
> - int ret;
>
> - axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
> - if (!axp20x)
> - return -ENOMEM;
> + of_id = of_match_device(axp2xx_of_match, dev);
> + if (of_id) {
> + axp2xx->variant = (long) of_id->data;
> + goto found_match;
Place the ACPI stuff in an else instead of using goto.
> + }
>
> - of_id = of_match_device(axp20x_of_match, &i2c->dev);
> - if (!of_id) {
> - dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
> + acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
> + if (!acpi_id || !acpi_id->driver_data) {
> + dev_err(dev, "Unable to setup AXP2XX ACPI data\n");
> + return -ENODEV;
> + }
> + axp2xx->variant = (long) acpi_id->driver_data;
I think adding ACPI support should be in its own patch.
[...]
> +static int axp2xx_i2c_probe(struct i2c_client *i2c,
> + const struct i2c_device_id *id)
> +{
> + struct axp2xx_dev *axp2xx;
> + int ret;
> +
> + axp2xx = devm_kzalloc(&i2c->dev, sizeof(*axp2xx), GFP_KERNEL);
> + if (!axp2xx)
> + return -ENOMEM;
> +
> + ret = axp2xx_match_device(axp2xx, &i2c->dev);
> + if (ret)
> + return ret;
'\n'.
> + axp2xx->i2c_client = i2c;
> + axp2xx->dev = &i2c->dev;
> + dev_set_drvdata(axp2xx->dev, axp2xx);
I'll do a more thorough review once all of the patches are split up
and grouped nicely.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: IIO <linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
DEVICE TREE <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>,
Srinivas Pandruvada
<srinivas.pandruvada-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Aaron Lu <aaron.lu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Alan Cox <alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
Fugang Duan <B38611-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Zubair Lutfullah
<zubair.lutfullah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>,
Johannes Thumshirn
<johannes.thumshirn-csrFAY9JiS4@public.gmane.org>,
Philippe Reynes <tremyfr-Qt13gs6zZMY@public.gmane.org>,
Angelo Compagnucci <angelo.compagnu>
Subject: Re: [PATCH v2 2/4] mfd/axp2xx: extend axp20x to support axp288 pmic
Date: Wed, 10 Sep 2014 10:13:54 +0100 [thread overview]
Message-ID: <20140910091354.GL30307@lee--X1> (raw)
In-Reply-To: <1410267775-4683-3-git-send-email-jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
On Tue, 09 Sep 2014, Jacob Pan wrote:
> XPower AXP288 is a customized PMIC for Intel Baytrail-CR platforms. Similar
> to AXP202/209, AXP288 comes with USB charger, more LDO and BUCK channels, and
> AD converter. It also provides extended status and interrupt reporting
> capabilities than the devices supported in axp20x.c.
>
> In addition to feature extension, this patch also adds ACPI binding for
> enumeration and hooks for ACPI custom operational region handlers.
>
> Files and common data structures have been renamed from axp20x to axp2xx
> in order to suit the extended scope of devices.
>
> This consolidated driver should support more Xpower PMICs in both device
> tree and ACPI based platforms.
>
> Signed-off-by: Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
> drivers/mfd/axp2xx.c | 426 +++++++++++++++++++++++++++++++++++----------
> include/linux/mfd/axp2xx.h | 57 +++++-
> 2 files changed, 388 insertions(+), 95 deletions(-)
>
> diff --git a/drivers/mfd/axp2xx.c b/drivers/mfd/axp2xx.c
> index c534443..4830bbe 100644
> --- a/drivers/mfd/axp2xx.c
> +++ b/drivers/mfd/axp2xx.c
> @@ -1,9 +1,9 @@
> /*
> - * axp20x.c - MFD core driver for the X-Powers AXP202 and AXP209
> + * axp2xx.c - MFD core driver for the X-Powers AXP202, AXP209, and AXP288
Any renaming should be part of the renaming patch.
Please remove the supported devices from the description.
> - * AXP20x comprises an adaptive USB-Compatible PWM charger, 2 BUCK DC-DC
> - * converters, 5 LDOs, multiple 12-bit ADCs of voltage, current and temperature
> - * as well as 4 configurable GPIOs.
> + * AXP2xx typically comprises an adaptive USB-Compatible PWM charger, BUCK DC-DC
> + * converters, LDOs, multiple 12-bit ADCs of voltage, current and temperature
> + * as well as configurable GPIOs.
> *
> * Author: Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>
> *
> @@ -25,9 +25,14 @@
> #include <linux/mfd/core.h>
> #include <linux/of_device.h>
> #include <linux/of_irq.h>
> +#include <linux/acpi.h>
>
> #define AXP20X_OFF 0x80
>
> +static struct mfd_cell *axp2xx_cells;
> +static int axp2xx_nr_cells;
> +static struct regmap_config *regmap_cfg;
Only use globals if you 'really' have to.
[...]
> +static int axp2xx_match_device(struct axp2xx_dev *axp2xx, struct device *dev)
> {
> - struct axp20x_dev *axp20x;
> + const struct acpi_device_id *acpi_id;
> const struct of_device_id *of_id;
> - int ret;
>
> - axp20x = devm_kzalloc(&i2c->dev, sizeof(*axp20x), GFP_KERNEL);
> - if (!axp20x)
> - return -ENOMEM;
> + of_id = of_match_device(axp2xx_of_match, dev);
> + if (of_id) {
> + axp2xx->variant = (long) of_id->data;
> + goto found_match;
Place the ACPI stuff in an else instead of using goto.
> + }
>
> - of_id = of_match_device(axp20x_of_match, &i2c->dev);
> - if (!of_id) {
> - dev_err(&i2c->dev, "Unable to setup AXP20X data\n");
> + acpi_id = acpi_match_device(dev->driver->acpi_match_table, dev);
> + if (!acpi_id || !acpi_id->driver_data) {
> + dev_err(dev, "Unable to setup AXP2XX ACPI data\n");
> + return -ENODEV;
> + }
> + axp2xx->variant = (long) acpi_id->driver_data;
I think adding ACPI support should be in its own patch.
[...]
> +static int axp2xx_i2c_probe(struct i2c_client *i2c,
> + const struct i2c_device_id *id)
> +{
> + struct axp2xx_dev *axp2xx;
> + int ret;
> +
> + axp2xx = devm_kzalloc(&i2c->dev, sizeof(*axp2xx), GFP_KERNEL);
> + if (!axp2xx)
> + return -ENOMEM;
> +
> + ret = axp2xx_match_device(axp2xx, &i2c->dev);
> + if (ret)
> + return ret;
'\n'.
> + axp2xx->i2c_client = i2c;
> + axp2xx->dev = &i2c->dev;
> + dev_set_drvdata(axp2xx->dev, axp2xx);
I'll do a more thorough review once all of the patches are split up
and grouped nicely.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2014-09-10 9:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-09 13:02 [PATCH v2 0/4] Initial support for XPowers AXP288 PMIC Jacob Pan
2014-09-09 13:02 ` Jacob Pan
2014-09-09 13:02 ` [PATCH v2 1/4] mfd/axp20x: rename files to support more devices Jacob Pan
2014-09-09 13:02 ` Jacob Pan
2014-09-10 8:12 ` Lee Jones
2014-09-10 8:12 ` Lee Jones
2014-09-09 13:02 ` [PATCH v2 2/4] mfd/axp2xx: extend axp20x to support axp288 pmic Jacob Pan
2014-09-09 13:02 ` Jacob Pan
2014-09-10 8:25 ` Maxime Ripard
2014-09-10 8:25 ` Maxime Ripard
2014-09-10 9:13 ` Lee Jones [this message]
2014-09-10 9:13 ` Lee Jones
2014-09-10 20:11 ` Jacob Pan
2014-09-10 20:11 ` Jacob Pan
2014-09-09 13:02 ` [PATCH v2 3/4] regulator/axp20x: use axp2xx consolidated header Jacob Pan
2014-09-09 13:02 ` Jacob Pan
2014-09-09 13:02 ` [PATCH v2 4/4] iio/adc/axp288: add support for axp288 gpadc Jacob Pan
2014-09-09 13:02 ` Jacob Pan
2014-09-09 13:46 ` Peter Meerwald
2014-09-11 12:05 ` Jacob Pan
2014-09-19 16:43 ` Jacob Pan
2014-09-19 17:31 ` Srinivas Pandruvada
2014-09-19 19:47 ` Jacob Pan
2014-09-21 12:22 ` Jonathan Cameron
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=20140910091354.GL30307@lee--X1 \
--to=lee.jones@linaro.org \
--cc=B38611@freescale.com \
--cc=aaron.lu@intel.com \
--cc=alan@linux.intel.com \
--cc=angelo.compagnucci@gmail.com \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=carlo@caione.org \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jacob.jun.pan@linux.intel.com \
--cc=johannes.thumshirn@men.de \
--cc=khali@linux-fr.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ramakrishna.pallala@intel.com \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.com \
--cc=sre@debian.org \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tremyfr@yahoo.fr \
--cc=zubair.lutfullah@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.