All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: "Zhu, Lejun" <lejun.zhu@linux.intel.com>
Cc: broonie@kernel.org, sameo@linux.intel.com,
	linux-kernel@vger.kernel.org, jacob.jun.pan@linux.intel.com,
	bin.yang@intel.com
Subject: Re: [PATCH v4 1/3] mfd: intel_soc_pmic: Core driver
Date: Thu, 29 May 2014 12:40:52 +0100	[thread overview]
Message-ID: <20140529114052.GI1954@lee--X1> (raw)
In-Reply-To: <1401347968-24410-2-git-send-email-lejun.zhu@linux.intel.com>

> This patch provides the common I2C driver code for Intel SoC PMICs.
> 
> Signed-off-by: Yang, Bin <bin.yang@intel.com>
> Signed-off-by: Zhu, Lejun <lejun.zhu@linux.intel.com>
> ---
> v2:
> - Use regmap instead of creating our own I2C read/write callbacks.
> - Add one missing EXPORT_SYMBOL.
> - Remove duplicate code and put them into pmic_regmap_load_from_hw.
> v3:
> - Use regmap-irq. Remove our own pmic_regmap_* and IRQ handling code.
> - Remove intel_soc_pmic_dev() and intel_soc_pmic_set_pdata().
> - Use EXPORT_SYMBOL_GPL for exposed APIs.
> - Use gpiod interface instead of gpio numbers.
> - Remove redundant I2C IDs.
> - Use managed allocations.
> v4:
> - Remove all exported APIs which are wrappers of regmap API, export
>   the regmap in data structure instead.
> - Combine I2C and core .c files.
> - Clean up include files.
> - Use intel_soc_pmic_ prefix to replace pmic_ and intel_pmic_.
> - Fix various coding style issues.
> ---
>  drivers/mfd/intel_soc_pmic_core.c  | 164 +++++++++++++++++++++++++++++++++++++
>  drivers/mfd/intel_soc_pmic_core.h  |  32 ++++++++
>  include/linux/mfd/intel_soc_pmic.h |  30 +++++++
>  3 files changed, 226 insertions(+)
>  create mode 100644 drivers/mfd/intel_soc_pmic_core.c
>  create mode 100644 drivers/mfd/intel_soc_pmic_core.h
>  create mode 100644 include/linux/mfd/intel_soc_pmic.h
> 
> diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
> new file mode 100644
> index 0000000..664eaef
> --- /dev/null
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -0,0 +1,164 @@

[...]

> +static int intel_soc_pmic_find_gpio_irq(struct device *dev)
> +{
> +	struct gpio_desc *desc;
> +	int irq;
> +
> +	desc = devm_gpiod_get_index(dev, KBUILD_MODNAME, 0);

What does "KBUILD_MODNAME" translate to?

> +	if (IS_ERR(desc)) {
> +		dev_dbg(dev, "Not using GPIO as interrupt.\n");

You can't have a debug print, then return an err - use dev_err().

[...]

> +static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
> +				    const struct i2c_device_id *id)
> +{
> +	struct device *dev = &i2c->dev;
> +	struct intel_soc_pmic_config *config =
> +		(struct intel_soc_pmic_config *)id->driver_data;
> +	struct intel_soc_pmic *pmic;
> +	int ret;
> +	int irq;
> +
> +	pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
> +	dev_set_drvdata(dev, pmic);
> +
> +	pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
> +
> +	irq = intel_soc_pmic_find_gpio_irq(dev);
> +	if (irq < 0)
> +		pmic->irq = i2c->irq;
> +	else
> +		pmic->irq = irq;

pmic->irq = (irq < 0) ? i2c->irq : irq;

> +	ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,
> +				  config->irq_flags | IRQF_ONESHOT,
> +				  0, config->irq_chip,
> +				  &pmic->irq_chip_data);
> +	if (ret)
> +		goto err;

Just return ret here and remove the 'err:' label.

[...]

> +static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
> +	{"INT33FD:00", (kernel_ulong_t)&intel_soc_pmic_config_crc},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
> +
> +static struct acpi_device_id intel_soc_pmic_acpi_match[] = {
> +	{"INT33FD", (kernel_ulong_t)&intel_soc_pmic_config_crc},
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);

Does ACPI have a match function to extact it's .driver_data attribute?

If so, are you using it here? If not, why not?

[...]

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

  reply	other threads:[~2014-05-29 11:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  7:19 [PATCH v4 0/3] mfd: Intel SoC Power Management IC Zhu, Lejun
2014-05-29  7:19 ` [PATCH v4 1/3] mfd: intel_soc_pmic: Core driver Zhu, Lejun
2014-05-29 11:40   ` Lee Jones [this message]
2014-05-30  4:58     ` Zhu, Lejun
2014-05-30  8:08       ` Lee Jones
2014-05-30  9:03         ` Zhu, Lejun
2014-05-30  9:28           ` Lee Jones
2014-05-31  2:27             ` Zhu, Lejun
2014-05-29  7:19 ` [PATCH v4 2/3] mfd: intel_soc_pmic: Crystal Cove support Zhu, Lejun
2014-05-29 11:49   ` Lee Jones
2014-05-30  5:01     ` Zhu, Lejun
2014-05-29  7:19 ` [PATCH v4 3/3] mfd: intel_soc_pmic: Build files Zhu, Lejun
2014-05-29 11:43   ` Lee Jones
2014-05-30  5:00     ` Zhu, Lejun

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=20140529114052.GI1954@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=bin.yang@intel.com \
    --cc=broonie@kernel.org \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=lejun.zhu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.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.