Re: [PATCH 4/9] mfd: max8925: fix trivial build warning for non-dt
On 02/15/2013 06:26 AM, Arnd Bergmann wrote: Patch fe527ea5a "mfd: max8925: Support dt for backlight" added a new function for DT probing but introduced a build warning for the case where CONFIG_OF is disabled: drivers/video/backlight/max8925_bl.c: In function 'max8925_backlight_probe': drivers/video/backlight/max8925_bl.c:177:3: warning: statement with no effect [-Wunused-value] A much nicer fix is to use the IS_ENABLED keyword to have the same effect of dropping the device tree specific function when it's not needed. Signed-off-by: Arnd Bergmann Cc: Qing Xu Cc: Haojian Zhuang Cc: Samuel Ortiz --- drivers/video/backlight/max8925_bl.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 5ca11b0..9958fb1 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,14 +101,13 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; -#ifdef CONFIG_OF static int max8925_backlight_dt_init(struct platform_device *pdev, struct max8925_backlight_pdata *pdata) { struct device_node *nproot = pdev->dev.parent->of_node, *np; int dual_string; - if (!nproot) + if (!nproot || !IS_ENABLED(CONFIG_OF)) return -ENODEV; np = of_find_node_by_name(nproot, "backlight"); if (!np) { @@ -120,9 +119,6 @@ static int max8925_backlight_dt_init(struct platform_device *pdev, pdata->dual_string = dual_string; return 0; } -#else -#define max8925_backlight_dt_init(x, y)(-1) -#endif static int max8925_backlight_probe(struct platform_device *pdev) { thanks, I am ok with the change. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/9] mfd: max8925: fix trivial build warning for non-dt
On 02/15/2013 06:26 AM, Arnd Bergmann wrote: Patch fe527ea5a mfd: max8925: Support dt for backlight added a new function for DT probing but introduced a build warning for the case where CONFIG_OF is disabled: drivers/video/backlight/max8925_bl.c: In function 'max8925_backlight_probe': drivers/video/backlight/max8925_bl.c:177:3: warning: statement with no effect [-Wunused-value] A much nicer fix is to use the IS_ENABLED keyword to have the same effect of dropping the device tree specific function when it's not needed. Signed-off-by: Arnd Bergmann a...@arndb.de Cc: Qing Xu qi...@marvell.com Cc: Haojian Zhuang haojian.zhu...@gmail.com Cc: Samuel Ortiz sa...@linux.intel.com --- drivers/video/backlight/max8925_bl.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 5ca11b0..9958fb1 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,14 +101,13 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; -#ifdef CONFIG_OF static int max8925_backlight_dt_init(struct platform_device *pdev, struct max8925_backlight_pdata *pdata) { struct device_node *nproot = pdev-dev.parent-of_node, *np; int dual_string; - if (!nproot) + if (!nproot || !IS_ENABLED(CONFIG_OF)) return -ENODEV; np = of_find_node_by_name(nproot, backlight); if (!np) { @@ -120,9 +119,6 @@ static int max8925_backlight_dt_init(struct platform_device *pdev, pdata-dual_string = dual_string; return 0; } -#else -#define max8925_backlight_dt_init(x, y)(-1) -#endif static int max8925_backlight_probe(struct platform_device *pdev) { thanks, I am ok with the change. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/6] mfd: max8925: add irqdomain for dt
On 02/05/2013 04:19 PM, Samuel Ortiz wrote: Hi Haojian, On Mon, Feb 04, 2013 at 11:40:42PM +0800, Haojian Zhuang wrote: From: Qing Xu Add irqdomains for max8925's main irq, wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu Signed-off-by: Haojian Zhuang --- drivers/mfd/max8925-core.c | 73 +-- drivers/mfd/max8925-i2c.c | 36 +++-- include/linux/mfd/max8925.h |3 +- 3 files changed, 78 insertions(+), 34 deletions(-) This and the next 5 patches applied, thanks for the heads up. Cheers, Samuel. Hi Samuel, Haojian, Thank you very much! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/6] mfd: max8925: add irqdomain for dt
On 02/05/2013 04:19 PM, Samuel Ortiz wrote: Hi Haojian, On Mon, Feb 04, 2013 at 11:40:42PM +0800, Haojian Zhuang wrote: From: Qing Xu qi...@marvell.com Add irqdomains for max8925's main irq, wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu qi...@marvell.com Signed-off-by: Haojian Zhuang haojian.zhu...@gmail.com --- drivers/mfd/max8925-core.c | 73 +-- drivers/mfd/max8925-i2c.c | 36 +++-- include/linux/mfd/max8925.h |3 +- 3 files changed, 78 insertions(+), 34 deletions(-) This and the next 5 patches applied, thanks for the heads up. Cheers, Samuel. Hi Samuel, Haojian, Thank you very much! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/4] mfd: 88pm80x: move to regmap irq base implementation
On 12/03/2012 01:40 PM, Qing Xu wrote: From: Qing Xu get irq_base for mfd sub-device Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); - + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mfd: 88pm80x: fix no interrupt mask reg
On 12/03/2012 04:11 PM, Qing Xu wrote: From: Qing Xu 1.88pm80x do not have interrupt mask registers and we use interrupt enable register. So we need to set mask_invert flag. 2.add support for D0 version Signed-off-by: Xiaofan Tian Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c |4 +++- drivers/mfd/88pm805.c |1 + 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index e1525ab..3fcc8dd 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -119,7 +119,8 @@ enum { PM800_CHIP_A1 = 0x61, PM800_CHIP_B0 = 0x62, PM800_CHIP_C0 = 0x63, - PM800_CHIP_END = PM800_CHIP_C0, + PM800_CHIP_D0 = 0x64, + PM800_CHIP_END = PM800_CHIP_D0, /* Make sure to update this to the last stepping */ PM8XXX_CHIP_END = PM800_CHIP_END @@ -362,6 +363,7 @@ static struct regmap_irq_chip pm800_irq_chip = { .status_base = PM800_INT_STATUS1, .mask_base = PM800_INT_ENA_1, .ack_base = PM800_INT_STATUS1, + .mask_invert = 1, }; static int pm800_pages_init(struct pm80x_chip *chip) diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 8c9e25a..39a91bd 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -187,6 +187,7 @@ static struct regmap_irq_chip pm805_irq_chip = { .status_base = PM805_INT_STATUS1, .mask_base = PM805_INT_MASK1, .ack_base = PM805_INT_STATUS1, + .mask_invert = 1, }; static int __devinit device_805_init(struct pm80x_chip *chip) Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/4] mfd: 88pm80x: move to regmap irq base implementation
On 12/03/2012 01:45 PM, Qing Xu wrote: From: Qing Xu get irq_base for mfd sub-device Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); - + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] rtc: 88pm80x: update irq base
On 12/03/2012 01:43 PM, Qing Xu wrote: From: Qing Xu irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/rtc/rtc-88pm80x.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c index 6367984..7c3a264 100644 --- a/drivers/rtc/rtc-88pm80x.c +++ b/drivers/rtc/rtc-88pm80x.c @@ -256,7 +256,7 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) struct pm80x_rtc_info *info; struct rtc_time tm; unsigned long ticks = 0; - int ret; + int irq, ret; pdata = pdev->dev.platform_data; if (pdata == NULL) @@ -266,12 +266,13 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) devm_kzalloc(>dev, sizeof(struct pm80x_rtc_info), GFP_KERNEL); if (!info) return -ENOMEM; - info->irq = platform_get_irq(pdev, 0); - if (info->irq < 0) { + irq = platform_get_irq(pdev, 0); + if (irq < 0) { dev_err(>dev, "No IRQ resource!\n"); ret = -EINVAL; goto out; } + info->irq = irq + chip->irq_base; info->chip = chip; info->map = chip->regmap; Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/4] onkey: 88pm80x: update irq base
On 12/03/2012 01:42 PM, Qing Xu wrote: From: Qing Xu irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/input/misc/88pm80x_onkey.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c index 7f26e7b..cc352f9 100644 --- a/drivers/input/misc/88pm80x_onkey.c +++ b/drivers/input/misc/88pm80x_onkey.c @@ -67,7 +67,7 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); struct pm80x_onkey_info *info; - int err; + int irq, err; info = kzalloc(sizeof(struct pm80x_onkey_info), GFP_KERNEL); if (!info) @@ -75,13 +75,14 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) info->pm80x = chip; - info->irq = platform_get_irq(pdev, 0); - if (info->irq < 0) { + irq = platform_get_irq(pdev, 0); + if (irq < 0) { dev_err(>dev, "No IRQ resource!\n"); err = -EINVAL; goto out; } + info->irq = irq + chip->irq_base; info->map = info->pm80x->regmap; if (!info->map) { dev_err(>dev, "no regmap!\n"); Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] mfd: 88pm80x: fix regmap not init before used
On 12/03/2012 01:38 PM, Qing Xu wrote: From: Qing Xu 1.put the pm800_page_init before 800_init, otherwise power and gpadc regmap handle are not inited before being used. 2.remove regmap exit, as it will be called in driver release 3.add lost "return 0" in probe() 4.update driver's name Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c | 25 - drivers/mfd/88pm805.c |5 +++-- drivers/mfd/88pm80x.c |2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index ce229ea..73b2c9f 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -401,9 +401,6 @@ static void pm800_pages_exit(struct pm80x_chip *chip) { struct pm80x_subchip *subchip; - regmap_exit(chip->regmap); - i2c_unregister_device(chip->client); - subchip = chip->subchip; if (subchip->power_page) { regmap_exit(subchip->regmap_power); @@ -413,6 +410,7 @@ static void pm800_pages_exit(struct pm80x_chip *chip) regmap_exit(subchip->regmap_gpadc); i2c_unregister_device(subchip->gpadc_page); } + i2c_unregister_device(chip->client); } static int __devinit device_800_init(struct pm80x_chip *chip, @@ -528,25 +526,26 @@ static int __devinit pm800_probe(struct i2c_client *client, subchip->gpadc_page_addr = pdata->gpadc_page_addr; chip->subchip = subchip; - ret = device_800_init(chip, pdata); - if (ret) { - dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id); - goto err_800_init; - } - ret = pm800_pages_init(chip); if (ret) { dev_err(>dev, "pm800_pages_init failed!\n"); goto err_page_init; } + ret = device_800_init(chip, pdata); + if (ret) { + dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id); + goto err_800_init; + } + if (pdata->plat_config) pdata->plat_config(chip, pdata); -err_page_init: - mfd_remove_devices(chip->dev); - device_irq_exit_800(chip); + return 0; + err_800_init: + pm800_pages_exit(chip); +err_page_init: devm_kfree(>dev, subchip); err_subchip_alloc: pm80x_deinit(client); @@ -571,7 +570,7 @@ static int __devexit pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { - .name = "88PM80X", + .name = "88PM800", .owner = THIS_MODULE, .pm = _pm_ops, }, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index c20a311..7878013 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,7 +168,6 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); - out: return ret; } @@ -256,6 +255,8 @@ static int __devinit pm805_probe(struct i2c_client *client, if (pdata->plat_config) pdata->plat_config(chip, pdata); + return 0; + err_805_init: pm80x_deinit(client); out_init: @@ -276,7 +277,7 @@ static int __devexit pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { - .name = "88PM80X", + .name = "88PM805", .owner = THIS_MODULE, .pm = _pm_ops, }, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index cd0bf52..1adb355 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -31,7 +31,7 @@ const struct regmap_config pm80x_regmap_config = { }; EXPORT_SYMBOL_GPL(pm80x_regmap_config); -int __devinit pm80x_init(struct i2c_client *client, +int pm80x_init(struct i2c_client *client, const struct i2c_device_id *id) { struct pm80x_chip *chip; Samuel, Could you help to review the patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/7] mfd: update on max8925 for DT support
On 12/04/2012 03:11 PM, Haojian Zhuang wrote: On Thu, Nov 29, 2012 at 1:54 PM, Qing Xu wrote: On 11/23/2012 05:09 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:35 PM, Qing Xu wrote: From: Qing Xu 1. add irqdomain for max8925, it is necessary for dt support 2. bug fix in max8925 mfd devices'irq base and device registry failure 3. support DT for max8925 mfd devices Qing Xu (7): mfd: max8925: add irqdomain for dt mfd: max8925: fix mfd device register failure mfd: max8925: fix onkey driver irq base mfd: max8925: support dt for power supply mfd: max8925: support dt for regulator mfd: max8925: support dt for backlight mfd: max8925: add dts arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- drivers/input/misc/max8925_onkey.c|3 - drivers/mfd/max8925-core.c| 107 + drivers/mfd/max8925-i2c.c | 32 ++- drivers/power/max8925_power.c | 57 ++- drivers/regulator/max8925-regulator.c | 35 +++- drivers/video/backlight/max8925_bl.c | 31 ++- include/linux/mfd/max8925.h | 12 ++- 9 files changed, 389 insertions(+), 58 deletions(-) No document on devicetree binding? I added a new patch of "Documentation: add docs for max8925 dt", please help to review, thanks a lot! Acked. Samuel, How do you think about this patch series? From my view, it's ok. Best Regards Haojian Samuel, Do you have any comments on these patches? Could they be merged? Thanks a lot! Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/7] mfd: update on max8925 for DT support
On 12/04/2012 03:11 PM, Haojian Zhuang wrote: On Thu, Nov 29, 2012 at 1:54 PM, Qing Xu qi...@marvell.com wrote: On 11/23/2012 05:09 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:35 PM, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com 1. add irqdomain for max8925, it is necessary for dt support 2. bug fix in max8925 mfd devices'irq base and device registry failure 3. support DT for max8925 mfd devices Qing Xu (7): mfd: max8925: add irqdomain for dt mfd: max8925: fix mfd device register failure mfd: max8925: fix onkey driver irq base mfd: max8925: support dt for power supply mfd: max8925: support dt for regulator mfd: max8925: support dt for backlight mfd: max8925: add dts arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- drivers/input/misc/max8925_onkey.c|3 - drivers/mfd/max8925-core.c| 107 + drivers/mfd/max8925-i2c.c | 32 ++- drivers/power/max8925_power.c | 57 ++- drivers/regulator/max8925-regulator.c | 35 +++- drivers/video/backlight/max8925_bl.c | 31 ++- include/linux/mfd/max8925.h | 12 ++- 9 files changed, 389 insertions(+), 58 deletions(-) No document on devicetree binding? I added a new patch of Documentation: add docs for max8925 dt, please help to review, thanks a lot! Acked. Samuel, How do you think about this patch series? From my view, it's ok. Best Regards Haojian Samuel, Do you have any comments on these patches? Could they be merged? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/4] mfd: 88pm80x: fix regmap not init before used
On 12/03/2012 01:38 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com 1.put the pm800_page_init before 800_init, otherwise power and gpadc regmap handle are not inited before being used. 2.remove regmap exit, as it will be called in driver release 3.add lost return 0 in probe() 4.update driver's name Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c | 25 - drivers/mfd/88pm805.c |5 +++-- drivers/mfd/88pm80x.c |2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index ce229ea..73b2c9f 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -401,9 +401,6 @@ static void pm800_pages_exit(struct pm80x_chip *chip) { struct pm80x_subchip *subchip; - regmap_exit(chip-regmap); - i2c_unregister_device(chip-client); - subchip = chip-subchip; if (subchip-power_page) { regmap_exit(subchip-regmap_power); @@ -413,6 +410,7 @@ static void pm800_pages_exit(struct pm80x_chip *chip) regmap_exit(subchip-regmap_gpadc); i2c_unregister_device(subchip-gpadc_page); } + i2c_unregister_device(chip-client); } static int __devinit device_800_init(struct pm80x_chip *chip, @@ -528,25 +526,26 @@ static int __devinit pm800_probe(struct i2c_client *client, subchip-gpadc_page_addr = pdata-gpadc_page_addr; chip-subchip = subchip; - ret = device_800_init(chip, pdata); - if (ret) { - dev_err(chip-dev, %s id 0x%x failed!\n, __func__, chip-id); - goto err_800_init; - } - ret = pm800_pages_init(chip); if (ret) { dev_err(client-dev, pm800_pages_init failed!\n); goto err_page_init; } + ret = device_800_init(chip, pdata); + if (ret) { + dev_err(chip-dev, %s id 0x%x failed!\n, __func__, chip-id); + goto err_800_init; + } + if (pdata-plat_config) pdata-plat_config(chip, pdata); -err_page_init: - mfd_remove_devices(chip-dev); - device_irq_exit_800(chip); + return 0; + err_800_init: + pm800_pages_exit(chip); +err_page_init: devm_kfree(client-dev, subchip); err_subchip_alloc: pm80x_deinit(client); @@ -571,7 +570,7 @@ static int __devexit pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { - .name = 88PM80X, + .name = 88PM800, .owner = THIS_MODULE, .pm = pm80x_pm_ops, }, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index c20a311..7878013 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,7 +168,6 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); - out: return ret; } @@ -256,6 +255,8 @@ static int __devinit pm805_probe(struct i2c_client *client, if (pdata-plat_config) pdata-plat_config(chip, pdata); + return 0; + err_805_init: pm80x_deinit(client); out_init: @@ -276,7 +277,7 @@ static int __devexit pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { - .name = 88PM80X, + .name = 88PM805, .owner = THIS_MODULE, .pm = pm80x_pm_ops, }, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index cd0bf52..1adb355 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -31,7 +31,7 @@ const struct regmap_config pm80x_regmap_config = { }; EXPORT_SYMBOL_GPL(pm80x_regmap_config); -int __devinit pm80x_init(struct i2c_client *client, +int pm80x_init(struct i2c_client *client, const struct i2c_device_id *id) { struct pm80x_chip *chip; Samuel, Could you help to review the patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/4] onkey: 88pm80x: update irq base
On 12/03/2012 01:42 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/input/misc/88pm80x_onkey.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c index 7f26e7b..cc352f9 100644 --- a/drivers/input/misc/88pm80x_onkey.c +++ b/drivers/input/misc/88pm80x_onkey.c @@ -67,7 +67,7 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) struct pm80x_chip *chip = dev_get_drvdata(pdev-dev.parent); struct pm80x_onkey_info *info; - int err; + int irq, err; info = kzalloc(sizeof(struct pm80x_onkey_info), GFP_KERNEL); if (!info) @@ -75,13 +75,14 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) info-pm80x = chip; - info-irq = platform_get_irq(pdev, 0); - if (info-irq 0) { + irq = platform_get_irq(pdev, 0); + if (irq 0) { dev_err(pdev-dev, No IRQ resource!\n); err = -EINVAL; goto out; } + info-irq = irq + chip-irq_base; info-map = info-pm80x-regmap; if (!info-map) { dev_err(pdev-dev, no regmap!\n); Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] rtc: 88pm80x: update irq base
On 12/03/2012 01:43 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/rtc/rtc-88pm80x.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c index 6367984..7c3a264 100644 --- a/drivers/rtc/rtc-88pm80x.c +++ b/drivers/rtc/rtc-88pm80x.c @@ -256,7 +256,7 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) struct pm80x_rtc_info *info; struct rtc_time tm; unsigned long ticks = 0; - int ret; + int irq, ret; pdata = pdev-dev.platform_data; if (pdata == NULL) @@ -266,12 +266,13 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) devm_kzalloc(pdev-dev, sizeof(struct pm80x_rtc_info), GFP_KERNEL); if (!info) return -ENOMEM; - info-irq = platform_get_irq(pdev, 0); - if (info-irq 0) { + irq = platform_get_irq(pdev, 0); + if (irq 0) { dev_err(pdev-dev, No IRQ resource!\n); ret = -EINVAL; goto out; } + info-irq = irq + chip-irq_base; info-chip = chip; info-map = chip-regmap; Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 2/4] mfd: 88pm80x: move to regmap irq base implementation
On 12/03/2012 01:45 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com get irq_base for mfd sub-device Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); - + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mfd: 88pm80x: fix no interrupt mask reg
On 12/03/2012 04:11 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com 1.88pm80x do not have interrupt mask registers and we use interrupt enable register. So we need to set mask_invert flag. 2.add support for D0 version Signed-off-by: Xiaofan Tian tia...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c |4 +++- drivers/mfd/88pm805.c |1 + 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index e1525ab..3fcc8dd 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -119,7 +119,8 @@ enum { PM800_CHIP_A1 = 0x61, PM800_CHIP_B0 = 0x62, PM800_CHIP_C0 = 0x63, - PM800_CHIP_END = PM800_CHIP_C0, + PM800_CHIP_D0 = 0x64, + PM800_CHIP_END = PM800_CHIP_D0, /* Make sure to update this to the last stepping */ PM8XXX_CHIP_END = PM800_CHIP_END @@ -362,6 +363,7 @@ static struct regmap_irq_chip pm800_irq_chip = { .status_base = PM800_INT_STATUS1, .mask_base = PM800_INT_ENA_1, .ack_base = PM800_INT_STATUS1, + .mask_invert = 1, }; static int pm800_pages_init(struct pm80x_chip *chip) diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 8c9e25a..39a91bd 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -187,6 +187,7 @@ static struct regmap_irq_chip pm805_irq_chip = { .status_base = PM805_INT_STATUS1, .mask_base = PM805_INT_MASK1, .ack_base = PM805_INT_STATUS1, + .mask_invert = 1, }; static int __devinit device_805_init(struct pm80x_chip *chip) Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/4] mfd: 88pm80x: move to regmap irq base implementation
On 12/03/2012 01:40 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com get irq_base for mfd sub-device Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); - + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; Samuel, Could you help to review my patch? Thanks a lot! Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] Documentation: add docs for 88pm80x dt
On 12/06/2012 06:55 AM, Grant Likely wrote: On Wed, 5 Dec 2012 13:42:00 +0800, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu No commit text? This patch needs to be squashed together with the patch that changes the driver. There is no value in separating them. --- Documentation/devicetree/bindings/mfd/88pm80x.txt | 52 + 1 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/88pm80x.txt diff --git a/Documentation/devicetree/bindings/mfd/88pm80x.txt b/Documentation/devicetree/bindings/mfd/88pm80x.txt new file mode 100644 index 000..8a0ed07 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/88pm80x.txt @@ -0,0 +1,52 @@ +* Marvell 88pm80x Power Management IC + +Required parent device properties: +- compatible : "marvell,88pm80x" +- reg : the I2C slave address for the 88pm80x chip +- interrupts : IRQ line for the 88pm80x chip +- interrupt-controller: describes the 88pm80x as an interrupt controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the 88pm80x local IRQ number + +Optional parent device properties: +- marvell,88pm80x-irqmode: inicates whether interrupt status is cleared by read +- marvell,88pm80x-poweraddr: 88pm80x are multi-chips solution. stores the I2C address + of one chip, and this property stores the I2C address of + power related chip. +- marvell,88pm80x-gpadcaddr: 88pm80x are multi-chips solution. stores the I2C address + of one chip, and this property stores the I2C address of + gpadc related chip. If it is multichip, then I would expect either a separate node for each chip and these properties use phandles (instead of i2c addresses) to point to the other chip nodes. Alternately, if the cluster is described using a single node, then you can put all three i2c addresses into the 'reg' property. g. combined to one patch. please help review again. Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: 88pm80x: add dt support
From: Qing Xu add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu --- Documentation/devicetree/bindings/mfd/88pm80x.txt | 52 + drivers/mfd/88pm800.c | 26 +- drivers/mfd/88pm805.c | 26 +- drivers/mfd/88pm80x.c | 32 + include/linux/mfd/88pm80x.h |3 + 5 files changed, 133 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/88pm80x.txt diff --git a/Documentation/devicetree/bindings/mfd/88pm80x.txt b/Documentation/devicetree/bindings/mfd/88pm80x.txt new file mode 100644 index 000..8a0ed07 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/88pm80x.txt @@ -0,0 +1,52 @@ +* Marvell 88pm80x Power Management IC + +Required parent device properties: +- compatible : "marvell,88pm80x" +- reg : the I2C slave address for the 88pm80x chip +- interrupts : IRQ line for the 88pm80x chip +- interrupt-controller: describes the 88pm80x as an interrupt controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the 88pm80x local IRQ number + +Optional parent device properties: +- marvell,88pm80x-irqmode: inicates whether interrupt status is cleared by read +- marvell,88pm80x-poweraddr: 88pm80x are multi-chips solution. stores the I2C address + of one chip, and this property stores the I2C address of + power related chip. +- marvell,88pm80x-gpadcaddr: 88pm80x are multi-chips solution. stores the I2C address + of one chip, and this property stores the I2C address of + gpadc related chip. + +88pm80x consists of various groups of sub-devices: + +Device Supply NamesDescription +-- --- +88pm80x-onkey : : On key +88pm80x-rtc: : RTC + +Example: + pmic: 88pm800@30 { + compatible = "marvell,88pm80x"; + reg = <0x30>; + interrupts = <4>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + + marvell,88pm80x-irqmode = 0; + marvell,88pm80x-poweraddr = <0x31>; + marvell,88pm80x-gpadcaddr = <0x32>; + }; + + + pmic: 88pm805@38 { + compatible = "marvell,88pm80x"; + reg = <0x38>; + interrupts = <124>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + + marvell,88pm80x-irqmode = 0; + }; + diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = "marvell,88pm800", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static in
[PATCH] mfd: 88pm80x: add dt support
From: Qing Xu qi...@marvell.com add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu qi...@marvell.com --- Documentation/devicetree/bindings/mfd/88pm80x.txt | 52 + drivers/mfd/88pm800.c | 26 +- drivers/mfd/88pm805.c | 26 +- drivers/mfd/88pm80x.c | 32 + include/linux/mfd/88pm80x.h |3 + 5 files changed, 133 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/88pm80x.txt diff --git a/Documentation/devicetree/bindings/mfd/88pm80x.txt b/Documentation/devicetree/bindings/mfd/88pm80x.txt new file mode 100644 index 000..8a0ed07 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/88pm80x.txt @@ -0,0 +1,52 @@ +* Marvell 88pm80x Power Management IC + +Required parent device properties: +- compatible : marvell,88pm80x +- reg : the I2C slave address for the 88pm80x chip +- interrupts : IRQ line for the 88pm80x chip +- interrupt-controller: describes the 88pm80x as an interrupt controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the 88pm80x local IRQ number + +Optional parent device properties: +- marvell,88pm80x-irqmode: inicates whether interrupt status is cleared by read +- marvell,88pm80x-poweraddr: 88pm80x are multi-chips solution. reg stores the I2C address + of one chip, and this property stores the I2C address of + power related chip. +- marvell,88pm80x-gpadcaddr: 88pm80x are multi-chips solution. reg stores the I2C address + of one chip, and this property stores the I2C address of + gpadc related chip. + +88pm80x consists of various groups of sub-devices: + +Device Supply NamesDescription +-- --- +88pm80x-onkey : : On key +88pm80x-rtc: : RTC + +Example: + pmic: 88pm800@30 { + compatible = marvell,88pm80x; + reg = 0x30; + interrupts = 4; + interrupt-parent = intc; + interrupt-controller; + #interrupt-cells = 1; + + marvell,88pm80x-irqmode = 0; + marvell,88pm80x-poweraddr = 0x31; + marvell,88pm80x-gpadcaddr = 0x32; + }; + + + pmic: 88pm805@38 { + compatible = marvell,88pm80x; + reg = 0x38; + interrupts = 124; + interrupt-parent = gpio; + interrupt-controller; + #interrupt-cells = 1; + + marvell,88pm80x-irqmode = 0; + }; + diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = marvell,88pm800, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = 88PM800, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct
Re: [PATCH 2/2] Documentation: add docs for 88pm80x dt
On 12/06/2012 06:55 AM, Grant Likely wrote: On Wed, 5 Dec 2012 13:42:00 +0800, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com No commit text? This patch needs to be squashed together with the patch that changes the driver. There is no value in separating them. --- Documentation/devicetree/bindings/mfd/88pm80x.txt | 52 + 1 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/88pm80x.txt diff --git a/Documentation/devicetree/bindings/mfd/88pm80x.txt b/Documentation/devicetree/bindings/mfd/88pm80x.txt new file mode 100644 index 000..8a0ed07 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/88pm80x.txt @@ -0,0 +1,52 @@ +* Marvell 88pm80x Power Management IC + +Required parent device properties: +- compatible : marvell,88pm80x +- reg : the I2C slave address for the 88pm80x chip +- interrupts : IRQ line for the 88pm80x chip +- interrupt-controller: describes the 88pm80x as an interrupt controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the 88pm80x local IRQ number + +Optional parent device properties: +- marvell,88pm80x-irqmode: inicates whether interrupt status is cleared by read +- marvell,88pm80x-poweraddr: 88pm80x are multi-chips solution. reg stores the I2C address + of one chip, and this property stores the I2C address of + power related chip. +- marvell,88pm80x-gpadcaddr: 88pm80x are multi-chips solution. reg stores the I2C address + of one chip, and this property stores the I2C address of + gpadc related chip. If it is multichip, then I would expect either a separate node for each chip and these properties use phandles (instead of i2c addresses) to point to the other chip nodes. Alternately, if the cluster is described using a single node, then you can put all three i2c addresses into the 'reg' property. g. combined to one patch. please help review again. Thanks! -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mfd: 88pm80x: add dt support
On 12/05/2012 10:28 AM, Haojian Zhuang wrote: On Wed, Dec 5, 2012 at 10:23 AM, Qing Xu wrote: From: Qing Xu add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c | 26 +++--- drivers/mfd/88pm805.c | 26 +++--- drivers/mfd/88pm80x.c | 32 include/linux/mfd/88pm80x.h |3 +++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = "marvell,88pm800", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -254,9 +270,6 @@ static int __devinit pm805_probe(struct i2c_client *client, goto err_805_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_805_init: @@ -277,11 +290,18 @@ static int __devexit pm805_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm805_dt_ids[] = { + { .compatible = "marvell,88pm805", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm805_dt_ids); + static struct i2c_driver pm805_driver = { .driver = { .name = "88PM805", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm805_dt_ids), }, .probe = pm805_probe, .remove = __devexit_p(pm805_remove), diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index 1adb355..bd59202 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -111,6 +111,38 @@ int pm80x_deinit(struct i2c_client *client) } EXPORT_SYMBOL_GPL(pm80x_deinit); +int pm80x_dt_init(struct device_node *np, + struct device *dev, + struct pm80x_platform_data *pdata) +{ + int ret; + ret = of_property_read_u32(np, "marvell,88pm80x-irqmode", + >irq_mode); + if (ret) { +
[PATCH 2/2] Documentation: add docs for 88pm80x dt
From: Qing Xu Signed-off-by: Qing Xu --- Documentation/devicetree/bindings/mfd/88pm80x.txt | 52 + 1 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/88pm80x.txt diff --git a/Documentation/devicetree/bindings/mfd/88pm80x.txt b/Documentation/devicetree/bindings/mfd/88pm80x.txt new file mode 100644 index 000..8a0ed07 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/88pm80x.txt @@ -0,0 +1,52 @@ +* Marvell 88pm80x Power Management IC + +Required parent device properties: +- compatible : "marvell,88pm80x" +- reg : the I2C slave address for the 88pm80x chip +- interrupts : IRQ line for the 88pm80x chip +- interrupt-controller: describes the 88pm80x as an interrupt controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the 88pm80x local IRQ number + +Optional parent device properties: +- marvell,88pm80x-irqmode: inicates whether interrupt status is cleared by read +- marvell,88pm80x-poweraddr: 88pm80x are multi-chips solution. stores the I2C address + of one chip, and this property stores the I2C address of + power related chip. +- marvell,88pm80x-gpadcaddr: 88pm80x are multi-chips solution. stores the I2C address + of one chip, and this property stores the I2C address of + gpadc related chip. + +88pm80x consists of various groups of sub-devices: + +Device Supply NamesDescription +-- --- +88pm80x-onkey : : On key +88pm80x-rtc: : RTC + +Example: + pmic: 88pm800@30 { + compatible = "marvell,88pm80x"; + reg = <0x30>; + interrupts = <4>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + + marvell,88pm80x-irqmode = 0; + marvell,88pm80x-poweraddr = <0x31>; + marvell,88pm80x-gpadcaddr = <0x32>; + }; + + + pmic: 88pm805@38 { + compatible = "marvell,88pm80x"; + reg = <0x38>; + interrupts = <124>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + + marvell,88pm80x-irqmode = 0; + }; + -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] mfd: 88pm80x: add dt support
From: Qing Xu add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c | 26 +++--- drivers/mfd/88pm805.c | 26 +++--- drivers/mfd/88pm80x.c | 32 include/linux/mfd/88pm80x.h |3 +++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = "marvell,88pm800", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -254,9 +270,6 @@ static int __devinit pm805_probe(struct i2c_client *client, goto err_805_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_805_init: @@ -277,11 +290,18 @@ static int __devexit pm805_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm805_dt_ids[] = { + { .compatible = "marvell,88pm805", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm805_dt_ids); + static struct i2c_driver pm805_driver = { .driver = { .name = "88PM805", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm805_dt_ids), }, .probe = pm805_probe, .remove = __devexit_p(pm805_remove), diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index 1adb355..ad42d2a 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -111,6 +111,38 @@ int pm80x_deinit(struct i2c_client *client) } EXPORT_SYMBOL_GPL(pm80x_deinit); +int pm80x_dt_init(struct device_node *np, + struct device *dev, + struct pm80x_platform_data *pdata) +{ + int ret; + ret = of_property_read_u32(np, "marvell,88pm80x-irqmode", + >irq_mode); + if (ret) { + dev_err(dev, "Not found \"marvell,88pm80x-irqmode\" " + "property\n"); +
[PATCH] mfd: 88pm80x: add dt support
From: Qing Xu add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c | 26 +++--- drivers/mfd/88pm805.c | 26 +++--- drivers/mfd/88pm80x.c | 32 include/linux/mfd/88pm80x.h |3 +++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = "marvell,88pm800", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client->dev.platform_data; + struct device_node *node = client->dev.of_node; + + if (node && !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(>dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, >dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info("No platform data in %s!\n", __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -254,9 +270,6 @@ static int __devinit pm805_probe(struct i2c_client *client, goto err_805_init; } - if (pdata->plat_config) - pdata->plat_config(chip, pdata); - return 0; err_805_init: @@ -277,11 +290,18 @@ static int __devexit pm805_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm805_dt_ids[] = { + { .compatible = "marvell,88pm805", }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm805_dt_ids); + static struct i2c_driver pm805_driver = { .driver = { .name = "88PM805", .owner = THIS_MODULE, .pm = _pm_ops, + .of_match_table = of_match_ptr(pm805_dt_ids), }, .probe = pm805_probe, .remove = __devexit_p(pm805_remove), diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index 1adb355..bd59202 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -111,6 +111,38 @@ int pm80x_deinit(struct i2c_client *client) } EXPORT_SYMBOL_GPL(pm80x_deinit); +int pm80x_dt_init(struct device_node *np, + struct device *dev, + struct pm80x_platform_data *pdata) +{ + int ret; + ret = of_property_read_u32(np, "marvell,88pm80x-irqmode", + >irq_mode); + if (ret) { + dev_err(dev, "Not found \"marvell,88pm80x-irqmode\" " + "property\n"); +
[PATCH] mfd: 88pm80x: add dt support
From: Qing Xu qi...@marvell.com add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c | 26 +++--- drivers/mfd/88pm805.c | 26 +++--- drivers/mfd/88pm80x.c | 32 include/linux/mfd/88pm80x.h |3 +++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = marvell,88pm800, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = 88PM800, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -254,9 +270,6 @@ static int __devinit pm805_probe(struct i2c_client *client, goto err_805_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_805_init: @@ -277,11 +290,18 @@ static int __devexit pm805_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm805_dt_ids[] = { + { .compatible = marvell,88pm805, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm805_dt_ids); + static struct i2c_driver pm805_driver = { .driver = { .name = 88PM805, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm805_dt_ids), }, .probe = pm805_probe, .remove = __devexit_p(pm805_remove), diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index 1adb355..bd59202 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -111,6 +111,38 @@ int pm80x_deinit(struct i2c_client *client) } EXPORT_SYMBOL_GPL(pm80x_deinit); +int pm80x_dt_init(struct device_node *np, + struct device *dev, + struct pm80x_platform_data *pdata) +{ + int ret; + ret = of_property_read_u32(np, marvell,88pm80x-irqmode, + pdata-irq_mode); + if (ret) { + dev_err(dev, Not found \marvell,88pm80x-irqmode\ + property\n); + return -EINVAL; + } + + ret = of_property_read_u32(np, marvell,88pm80x-poweraddr
[PATCH 1/2] mfd: 88pm80x: add dt support
From: Qing Xu qi...@marvell.com add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c | 26 +++--- drivers/mfd/88pm805.c | 26 +++--- drivers/mfd/88pm80x.c | 32 include/linux/mfd/88pm80x.h |3 +++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = marvell,88pm800, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = 88PM800, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -254,9 +270,6 @@ static int __devinit pm805_probe(struct i2c_client *client, goto err_805_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_805_init: @@ -277,11 +290,18 @@ static int __devexit pm805_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm805_dt_ids[] = { + { .compatible = marvell,88pm805, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm805_dt_ids); + static struct i2c_driver pm805_driver = { .driver = { .name = 88PM805, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm805_dt_ids), }, .probe = pm805_probe, .remove = __devexit_p(pm805_remove), diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index 1adb355..ad42d2a 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -111,6 +111,38 @@ int pm80x_deinit(struct i2c_client *client) } EXPORT_SYMBOL_GPL(pm80x_deinit); +int pm80x_dt_init(struct device_node *np, + struct device *dev, + struct pm80x_platform_data *pdata) +{ + int ret; + ret = of_property_read_u32(np, marvell,88pm80x-irqmode, + pdata-irq_mode); + if (ret) { + dev_err(dev, Not found \marvell,88pm80x-irqmode\ + property\n); + return -EINVAL; + } + + ret = of_property_read_u32(np, marvell,88pm80x-poweraddr
[PATCH 2/2] Documentation: add docs for 88pm80x dt
From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- Documentation/devicetree/bindings/mfd/88pm80x.txt | 52 + 1 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/88pm80x.txt diff --git a/Documentation/devicetree/bindings/mfd/88pm80x.txt b/Documentation/devicetree/bindings/mfd/88pm80x.txt new file mode 100644 index 000..8a0ed07 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/88pm80x.txt @@ -0,0 +1,52 @@ +* Marvell 88pm80x Power Management IC + +Required parent device properties: +- compatible : marvell,88pm80x +- reg : the I2C slave address for the 88pm80x chip +- interrupts : IRQ line for the 88pm80x chip +- interrupt-controller: describes the 88pm80x as an interrupt controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the 88pm80x local IRQ number + +Optional parent device properties: +- marvell,88pm80x-irqmode: inicates whether interrupt status is cleared by read +- marvell,88pm80x-poweraddr: 88pm80x are multi-chips solution. reg stores the I2C address + of one chip, and this property stores the I2C address of + power related chip. +- marvell,88pm80x-gpadcaddr: 88pm80x are multi-chips solution. reg stores the I2C address + of one chip, and this property stores the I2C address of + gpadc related chip. + +88pm80x consists of various groups of sub-devices: + +Device Supply NamesDescription +-- --- +88pm80x-onkey : : On key +88pm80x-rtc: : RTC + +Example: + pmic: 88pm800@30 { + compatible = marvell,88pm80x; + reg = 0x30; + interrupts = 4; + interrupt-parent = intc; + interrupt-controller; + #interrupt-cells = 1; + + marvell,88pm80x-irqmode = 0; + marvell,88pm80x-poweraddr = 0x31; + marvell,88pm80x-gpadcaddr = 0x32; + }; + + + pmic: 88pm805@38 { + compatible = marvell,88pm80x; + reg = 0x38; + interrupts = 124; + interrupt-parent = gpio; + interrupt-controller; + #interrupt-cells = 1; + + marvell,88pm80x-irqmode = 0; + }; + -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mfd: 88pm80x: add dt support
On 12/05/2012 10:28 AM, Haojian Zhuang wrote: On Wed, Dec 5, 2012 at 10:23 AM, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com add dt support for 88pm800 and 88pm805 Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c | 26 +++--- drivers/mfd/88pm805.c | 26 +++--- drivers/mfd/88pm80x.c | 32 include/linux/mfd/88pm80x.h |3 +++ 4 files changed, 81 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 3fcc8dd..20b67d7 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -506,6 +506,22 @@ static int __devinit pm800_probe(struct i2c_client *client, struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; struct pm80x_subchip *subchip; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -540,9 +556,6 @@ static int __devinit pm800_probe(struct i2c_client *client, goto err_800_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_800_init: @@ -570,11 +583,18 @@ static int __devexit pm800_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm800_dt_ids[] = { + { .compatible = marvell,88pm800, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm800_dt_ids); + static struct i2c_driver pm800_driver = { .driver = { .name = 88PM800, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm800_dt_ids), }, .probe = pm800_probe, .remove = __devexit_p(pm800_remove), diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 39a91bd..b0fb3ff 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -239,6 +239,22 @@ static int __devinit pm805_probe(struct i2c_client *client, int ret = 0; struct pm80x_chip *chip; struct pm80x_platform_data *pdata = client-dev.platform_data; + struct device_node *node = client-dev.of_node; + + if (node !pdata) { + /* parse DT to get platform data */ + pdata = devm_kzalloc(client-dev, +sizeof(struct pm80x_platform_data), +GFP_KERNEL); + if (!pdata) + return -ENOMEM; + ret = pm80x_dt_init(node, client-dev, pdata); + if (ret) + return -EINVAL; + } else if (!pdata) { + pr_info(No platform data in %s!\n, __func__); + return -EINVAL; + } ret = pm80x_init(client, id); if (ret) { @@ -254,9 +270,6 @@ static int __devinit pm805_probe(struct i2c_client *client, goto err_805_init; } - if (pdata-plat_config) - pdata-plat_config(chip, pdata); - return 0; err_805_init: @@ -277,11 +290,18 @@ static int __devexit pm805_remove(struct i2c_client *client) return 0; } +static const struct of_device_id pm805_dt_ids[] = { + { .compatible = marvell,88pm805, }, + {}, +}; +MODULE_DEVICE_TABLE(of, pm805_dt_ids); + static struct i2c_driver pm805_driver = { .driver = { .name = 88PM805, .owner = THIS_MODULE, .pm = pm80x_pm_ops, + .of_match_table = of_match_ptr(pm805_dt_ids), }, .probe = pm805_probe, .remove = __devexit_p(pm805_remove), diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index 1adb355..bd59202 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -111,6 +111,38 @@ int pm80x_deinit(struct i2c_client *client) } EXPORT_SYMBOL_GPL(pm80x_deinit); +int pm80x_dt_init(struct device_node *np, + struct device *dev, + struct pm80x_platform_data *pdata) +{ + int ret; + ret = of_property_read_u32(np, marvell,88pm80x-irqmode, + pdata-irq_mode); + if (ret) { + dev_err(dev, Not found \marvell,88pm80x-irqmode
[PATCH] mfd: 88pm80x: fix no interrupt mask reg
From: Qing Xu 1.88pm80x do not have interrupt mask registers and we use interrupt enable register. So we need to set mask_invert flag. 2.add support for D0 version Signed-off-by: Xiaofan Tian Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c |4 +++- drivers/mfd/88pm805.c |1 + 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index e1525ab..3fcc8dd 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -119,7 +119,8 @@ enum { PM800_CHIP_A1 = 0x61, PM800_CHIP_B0 = 0x62, PM800_CHIP_C0 = 0x63, - PM800_CHIP_END = PM800_CHIP_C0, + PM800_CHIP_D0 = 0x64, + PM800_CHIP_END = PM800_CHIP_D0, /* Make sure to update this to the last stepping */ PM8XXX_CHIP_END = PM800_CHIP_END @@ -362,6 +363,7 @@ static struct regmap_irq_chip pm800_irq_chip = { .status_base = PM800_INT_STATUS1, .mask_base = PM800_INT_ENA_1, .ack_base = PM800_INT_STATUS1, + .mask_invert = 1, }; static int pm800_pages_init(struct pm80x_chip *chip) diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 8c9e25a..39a91bd 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -187,6 +187,7 @@ static struct regmap_irq_chip pm805_irq_chip = { .status_base = PM805_INT_STATUS1, .mask_base = PM805_INT_MASK1, .ack_base = PM805_INT_STATUS1, + .mask_invert = 1, }; static int __devinit device_805_init(struct pm80x_chip *chip) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: 88pm80x: fix no interrupt mask reg
From: Qing Xu qi...@marvell.com 1.88pm80x do not have interrupt mask registers and we use interrupt enable register. So we need to set mask_invert flag. 2.add support for D0 version Signed-off-by: Xiaofan Tian tia...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c |4 +++- drivers/mfd/88pm805.c |1 + 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index e1525ab..3fcc8dd 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -119,7 +119,8 @@ enum { PM800_CHIP_A1 = 0x61, PM800_CHIP_B0 = 0x62, PM800_CHIP_C0 = 0x63, - PM800_CHIP_END = PM800_CHIP_C0, + PM800_CHIP_D0 = 0x64, + PM800_CHIP_END = PM800_CHIP_D0, /* Make sure to update this to the last stepping */ PM8XXX_CHIP_END = PM800_CHIP_END @@ -362,6 +363,7 @@ static struct regmap_irq_chip pm800_irq_chip = { .status_base = PM800_INT_STATUS1, .mask_base = PM800_INT_ENA_1, .ack_base = PM800_INT_STATUS1, + .mask_invert = 1, }; static int pm800_pages_init(struct pm80x_chip *chip) diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 8c9e25a..39a91bd 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -187,6 +187,7 @@ static struct regmap_irq_chip pm805_irq_chip = { .status_base = PM805_INT_STATUS1, .mask_base = PM805_INT_MASK1, .ack_base = PM805_INT_STATUS1, + .mask_invert = 1, }; static int __devinit device_805_init(struct pm80x_chip *chip) -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/4] mfd: 88pm80x: move to regmap irq base implementation
From: Qing Xu get irq_base for mfd sub-device Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); - + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] rtc: 88pm80x: update irq base
From: Qing Xu irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/rtc/rtc-88pm80x.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c index 6367984..7c3a264 100644 --- a/drivers/rtc/rtc-88pm80x.c +++ b/drivers/rtc/rtc-88pm80x.c @@ -256,7 +256,7 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) struct pm80x_rtc_info *info; struct rtc_time tm; unsigned long ticks = 0; - int ret; + int irq, ret; pdata = pdev->dev.platform_data; if (pdata == NULL) @@ -266,12 +266,13 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) devm_kzalloc(>dev, sizeof(struct pm80x_rtc_info), GFP_KERNEL); if (!info) return -ENOMEM; - info->irq = platform_get_irq(pdev, 0); - if (info->irq < 0) { + irq = platform_get_irq(pdev, 0); + if (irq < 0) { dev_err(>dev, "No IRQ resource!\n"); ret = -EINVAL; goto out; } + info->irq = irq + chip->irq_base; info->chip = chip; info->map = chip->regmap; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] onkey: 88pm80x: update irq base
From: Qing Xu irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/input/misc/88pm80x_onkey.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c index 7f26e7b..cc352f9 100644 --- a/drivers/input/misc/88pm80x_onkey.c +++ b/drivers/input/misc/88pm80x_onkey.c @@ -67,7 +67,7 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); struct pm80x_onkey_info *info; - int err; + int irq, err; info = kzalloc(sizeof(struct pm80x_onkey_info), GFP_KERNEL); if (!info) @@ -75,13 +75,14 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) info->pm80x = chip; - info->irq = platform_get_irq(pdev, 0); - if (info->irq < 0) { + irq = platform_get_irq(pdev, 0); + if (irq < 0) { dev_err(>dev, "No IRQ resource!\n"); err = -EINVAL; goto out; } + info->irq = irq + chip->irq_base; info->map = info->pm80x->regmap; if (!info->map) { dev_err(>dev, "no regmap!\n"); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] mfd: 88pm80x: move to regmap irq base implementation
From: Qing Xu get irq_base for mfd sub-device Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); - + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); + chip->irq_base = regmap_irq_chip_get_base(chip->irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] mfd: 88pm80x: fix regmap not init before used
From: Qing Xu 1.put the pm800_page_init before 800_init, otherwise power and gpadc regmap handle are not inited before being used. 2.remove regmap exit, as it will be called in driver release 3.add lost "return 0" in probe() 4.update driver's name Signed-off-by: Qiao Zhou Signed-off-by: Qing Xu --- drivers/mfd/88pm800.c | 25 - drivers/mfd/88pm805.c |5 +++-- drivers/mfd/88pm80x.c |2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index ce229ea..73b2c9f 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -401,9 +401,6 @@ static void pm800_pages_exit(struct pm80x_chip *chip) { struct pm80x_subchip *subchip; - regmap_exit(chip->regmap); - i2c_unregister_device(chip->client); - subchip = chip->subchip; if (subchip->power_page) { regmap_exit(subchip->regmap_power); @@ -413,6 +410,7 @@ static void pm800_pages_exit(struct pm80x_chip *chip) regmap_exit(subchip->regmap_gpadc); i2c_unregister_device(subchip->gpadc_page); } + i2c_unregister_device(chip->client); } static int __devinit device_800_init(struct pm80x_chip *chip, @@ -528,25 +526,26 @@ static int __devinit pm800_probe(struct i2c_client *client, subchip->gpadc_page_addr = pdata->gpadc_page_addr; chip->subchip = subchip; - ret = device_800_init(chip, pdata); - if (ret) { - dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id); - goto err_800_init; - } - ret = pm800_pages_init(chip); if (ret) { dev_err(>dev, "pm800_pages_init failed!\n"); goto err_page_init; } + ret = device_800_init(chip, pdata); + if (ret) { + dev_err(chip->dev, "%s id 0x%x failed!\n", __func__, chip->id); + goto err_800_init; + } + if (pdata->plat_config) pdata->plat_config(chip, pdata); -err_page_init: - mfd_remove_devices(chip->dev); - device_irq_exit_800(chip); + return 0; + err_800_init: + pm800_pages_exit(chip); +err_page_init: devm_kfree(>dev, subchip); err_subchip_alloc: pm80x_deinit(client); @@ -571,7 +570,7 @@ static int __devexit pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { - .name = "88PM80X", + .name = "88PM800", .owner = THIS_MODULE, .pm = _pm_ops, }, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index c20a311..7878013 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,7 +168,6 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip->regmap, chip->irq, flags, -1, chip->regmap_irq_chip, >irq_data); - out: return ret; } @@ -256,6 +255,8 @@ static int __devinit pm805_probe(struct i2c_client *client, if (pdata->plat_config) pdata->plat_config(chip, pdata); + return 0; + err_805_init: pm80x_deinit(client); out_init: @@ -276,7 +277,7 @@ static int __devexit pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { - .name = "88PM80X", + .name = "88PM805", .owner = THIS_MODULE, .pm = _pm_ops, }, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index cd0bf52..1adb355 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -31,7 +31,7 @@ const struct regmap_config pm80x_regmap_config = { }; EXPORT_SYMBOL_GPL(pm80x_regmap_config); -int __devinit pm80x_init(struct i2c_client *client, +int pm80x_init(struct i2c_client *client, const struct i2c_device_id *id) { struct pm80x_chip *chip; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] mfd: 88pm80x: fix regmap not init before used
From: Qing Xu qi...@marvell.com 1.put the pm800_page_init before 800_init, otherwise power and gpadc regmap handle are not inited before being used. 2.remove regmap exit, as it will be called in driver release 3.add lost return 0 in probe() 4.update driver's name Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c | 25 - drivers/mfd/88pm805.c |5 +++-- drivers/mfd/88pm80x.c |2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index ce229ea..73b2c9f 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -401,9 +401,6 @@ static void pm800_pages_exit(struct pm80x_chip *chip) { struct pm80x_subchip *subchip; - regmap_exit(chip-regmap); - i2c_unregister_device(chip-client); - subchip = chip-subchip; if (subchip-power_page) { regmap_exit(subchip-regmap_power); @@ -413,6 +410,7 @@ static void pm800_pages_exit(struct pm80x_chip *chip) regmap_exit(subchip-regmap_gpadc); i2c_unregister_device(subchip-gpadc_page); } + i2c_unregister_device(chip-client); } static int __devinit device_800_init(struct pm80x_chip *chip, @@ -528,25 +526,26 @@ static int __devinit pm800_probe(struct i2c_client *client, subchip-gpadc_page_addr = pdata-gpadc_page_addr; chip-subchip = subchip; - ret = device_800_init(chip, pdata); - if (ret) { - dev_err(chip-dev, %s id 0x%x failed!\n, __func__, chip-id); - goto err_800_init; - } - ret = pm800_pages_init(chip); if (ret) { dev_err(client-dev, pm800_pages_init failed!\n); goto err_page_init; } + ret = device_800_init(chip, pdata); + if (ret) { + dev_err(chip-dev, %s id 0x%x failed!\n, __func__, chip-id); + goto err_800_init; + } + if (pdata-plat_config) pdata-plat_config(chip, pdata); -err_page_init: - mfd_remove_devices(chip-dev); - device_irq_exit_800(chip); + return 0; + err_800_init: + pm800_pages_exit(chip); +err_page_init: devm_kfree(client-dev, subchip); err_subchip_alloc: pm80x_deinit(client); @@ -571,7 +570,7 @@ static int __devexit pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { - .name = 88PM80X, + .name = 88PM800, .owner = THIS_MODULE, .pm = pm80x_pm_ops, }, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index c20a311..7878013 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,7 +168,6 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); - out: return ret; } @@ -256,6 +255,8 @@ static int __devinit pm805_probe(struct i2c_client *client, if (pdata-plat_config) pdata-plat_config(chip, pdata); + return 0; + err_805_init: pm80x_deinit(client); out_init: @@ -276,7 +277,7 @@ static int __devexit pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { - .name = 88PM80X, + .name = 88PM805, .owner = THIS_MODULE, .pm = pm80x_pm_ops, }, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index cd0bf52..1adb355 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -31,7 +31,7 @@ const struct regmap_config pm80x_regmap_config = { }; EXPORT_SYMBOL_GPL(pm80x_regmap_config); -int __devinit pm80x_init(struct i2c_client *client, +int pm80x_init(struct i2c_client *client, const struct i2c_device_id *id) { struct pm80x_chip *chip; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] mfd: 88pm80x: move to regmap irq base implementation
From: Qing Xu qi...@marvell.com get irq_base for mfd sub-device Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); - + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] onkey: 88pm80x: update irq base
From: Qing Xu qi...@marvell.com irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/input/misc/88pm80x_onkey.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c index 7f26e7b..cc352f9 100644 --- a/drivers/input/misc/88pm80x_onkey.c +++ b/drivers/input/misc/88pm80x_onkey.c @@ -67,7 +67,7 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) struct pm80x_chip *chip = dev_get_drvdata(pdev-dev.parent); struct pm80x_onkey_info *info; - int err; + int irq, err; info = kzalloc(sizeof(struct pm80x_onkey_info), GFP_KERNEL); if (!info) @@ -75,13 +75,14 @@ static int __devinit pm80x_onkey_probe(struct platform_device *pdev) info-pm80x = chip; - info-irq = platform_get_irq(pdev, 0); - if (info-irq 0) { + irq = platform_get_irq(pdev, 0); + if (irq 0) { dev_err(pdev-dev, No IRQ resource!\n); err = -EINVAL; goto out; } + info-irq = irq + chip-irq_base; info-map = info-pm80x-regmap; if (!info-map) { dev_err(pdev-dev, no regmap!\n); -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] rtc: 88pm80x: update irq base
From: Qing Xu qi...@marvell.com irq base is stored in 88pm80x's drv data, we need to add irq base to get the correct irq num Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/rtc/rtc-88pm80x.c |7 --- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/rtc/rtc-88pm80x.c b/drivers/rtc/rtc-88pm80x.c index 6367984..7c3a264 100644 --- a/drivers/rtc/rtc-88pm80x.c +++ b/drivers/rtc/rtc-88pm80x.c @@ -256,7 +256,7 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) struct pm80x_rtc_info *info; struct rtc_time tm; unsigned long ticks = 0; - int ret; + int irq, ret; pdata = pdev-dev.platform_data; if (pdata == NULL) @@ -266,12 +266,13 @@ static int __devinit pm80x_rtc_probe(struct platform_device *pdev) devm_kzalloc(pdev-dev, sizeof(struct pm80x_rtc_info), GFP_KERNEL); if (!info) return -ENOMEM; - info-irq = platform_get_irq(pdev, 0); - if (info-irq 0) { + irq = platform_get_irq(pdev, 0); + if (irq 0) { dev_err(pdev-dev, No IRQ resource!\n); ret = -EINVAL; goto out; } + info-irq = irq + chip-irq_base; info-chip = chip; info-map = chip-regmap; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/4] mfd: 88pm80x: move to regmap irq base implementation
From: Qing Xu qi...@marvell.com get irq_base for mfd sub-device Signed-off-by: Qiao Zhou zhouq...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/88pm800.c |2 +- drivers/mfd/88pm805.c |1 + include/linux/mfd/88pm80x.h |1 + 3 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index 73b2c9f..e1525ab 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -343,7 +343,7 @@ static int __devinit device_irq_init_800(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); - + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 7878013..8c9e25a 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -168,6 +168,7 @@ static int __devinit device_irq_init_805(struct pm80x_chip *chip) ret = regmap_add_irq_chip(chip-regmap, chip-irq, flags, -1, chip-regmap_irq_chip, chip-irq_data); + chip-irq_base = regmap_irq_chip_get_base(chip-irq_data); out: return ret; } diff --git a/include/linux/mfd/88pm80x.h b/include/linux/mfd/88pm80x.h index a0ca0dc..904efb9 100644 --- a/include/linux/mfd/88pm80x.h +++ b/include/linux/mfd/88pm80x.h @@ -303,6 +303,7 @@ struct pm80x_chip { int id; int irq; int irq_mode; + int irq_base; unsigned long wu_flag; spinlock_t lock; }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/7] mfd: update on max8925 for DT support
On 11/23/2012 05:09 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:35 PM, Qing Xu wrote: From: Qing Xu 1. add irqdomain for max8925, it is necessary for dt support 2. bug fix in max8925 mfd devices'irq base and device registry failure 3. support DT for max8925 mfd devices Qing Xu (7): mfd: max8925: add irqdomain for dt mfd: max8925: fix mfd device register failure mfd: max8925: fix onkey driver irq base mfd: max8925: support dt for power supply mfd: max8925: support dt for regulator mfd: max8925: support dt for backlight mfd: max8925: add dts arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- drivers/input/misc/max8925_onkey.c|3 - drivers/mfd/max8925-core.c| 107 + drivers/mfd/max8925-i2c.c | 32 ++- drivers/power/max8925_power.c | 57 ++- drivers/regulator/max8925-regulator.c | 35 +++- drivers/video/backlight/max8925_bl.c | 31 ++- include/linux/mfd/max8925.h | 12 ++- 9 files changed, 389 insertions(+), 58 deletions(-) No document on devicetree binding? I added a new patch of "Documentation: add docs for max8925 dt", please help to review, thanks a lot! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] Documentation: add docs for max8925 dt
From: Qing Xu add docs for dt of max8925-mfd, max8925-backlight, and max8925-battery Signed-off-by: Qing Xu --- Documentation/devicetree/bindings/mfd/max8925.txt | 64 .../bindings/power_supply/max8925_batter.txt | 18 ++ .../bindings/video/backlight/max8925-backlight.txt | 10 +++ 3 files changed, 92 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/max8925.txt create mode 100644 Documentation/devicetree/bindings/power_supply/max8925_batter.txt create mode 100644 Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt diff --git a/Documentation/devicetree/bindings/mfd/max8925.txt b/Documentation/devicetree/bindings/mfd/max8925.txt new file mode 100644 index 000..13bb62b --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/max8925.txt @@ -0,0 +1,64 @@ +* Maxim max8925 Power Management IC + +Required parent device properties: +- compatible : "maxim,max8925" +- reg : the I2C slave address for the max8925 chip +- interrupts : IRQ line for the max8925 chip +- interrupt-controller: describes the max8925 as an interrupt + controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the max8925 local IRQ number + +Optional parent device properties: +- tsc-irq: there are 2 IRQ lines for max8925, one is indicated in + interrupts property, the other is indicated here. + +max8925 consists of a large and varied group of sub-devices: + +Device Supply NamesDescription +-- --- +max8925-onkey : : On key +max8925-rtc: : RTC +max8925-regulator : : Regulators +max8925-backlight : : Backlight +max8925-touch : : Touchscreen +max8925-power : : Charger + +Example: + + pmic: max8925@3c { + compatible = "maxim,max8925"; + reg = <0x3c>; + interrupts = <1>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + tsc-irq = <0>; + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + + LDO1 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + + }; + backlight { + max8925-dual-string = <0>; + }; + charger { + batt-detect = <0>; + topoff-threshold = <1>; + fast-charge = <7>; + no-temp-support = <0>; + no-insert-detect = <0>; + }; + }; diff --git a/Documentation/devicetree/bindings/power_supply/max8925_batter.txt b/Documentation/devicetree/bindings/power_supply/max8925_batter.txt new file mode 100644 index 000..d7e3e0c --- /dev/null +++ b/Documentation/devicetree/bindings/power_supply/max8925_batter.txt @@ -0,0 +1,18 @@ +max8925-battery bindings + + +Optional properties : + - batt-detect: whether support battery detect + - topoff-threshold: set charging current in topoff mode + - fast-charge: set charging current in fast mode + - no-temp-support: whether support temperature protection detect + - no-insert-detect: whether support insert detect + +Example: + charger { + batt-detect = <0>; + topoff-threshold = <1>; + fast-charge = <7>; + no-temp-support = <0>; + no-insert-detect = <0>; + }; diff --git a/Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt b/Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt new file mode 100644 index 000..d692db3 --- /dev/null +++ b/Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt @@ -0,0 +1,10 @@ +88pm860x-backlight bindings + +Optional properties: + - max8925-dual-string: whether support dual string + +Example: + + backlights { + max8925-dual-string = <0>; + }; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 7/7] mfd: max8925: add dts
From: Qing Xu add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..f03d4f4 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = "okay"; + pmic: max8925@3c { + compatible = "maxim,max8925"; + reg = <0x3c>; + interrupts = <1>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + tsc-irq = <0>; + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <2225000>; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { +
[PATCH] mfd: max8925: add dts
From: Qing Xu add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..f03d4f4 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = "okay"; + pmic: max8925@3c { + compatible = "maxim,max8925"; + reg = <0x3c>; + interrupts = <1>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + tsc-irq = <0>; + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <2225000>; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { +
[PATCH v3 1/7] mfd: max8925: add irqdomain for dt
From: Qing Xu Add irqdomains for max8925's main irq, wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu --- drivers/mfd/max8925-core.c | 69 ++- drivers/mfd/max8925-i2c.c | 37 +-- include/linux/mfd/max8925.h |3 +- 3 files changed, 78 insertions(+), 31 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..d0ebdbf 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,13 @@ #include #include #include +#include #include #include #include #include +#include +#include static struct resource bk_resources[] __devinitdata = { { 0x84, 0x84, "mode control", IORESOURCE_REG, }, @@ -639,17 +642,33 @@ static struct irq_chip max8925_irq_chip = { .irq_disable= max8925_irq_disable, }; +static int max8925_irq_domain_map(struct irq_domain *d, unsigned int virq, +irq_hw_number_t hw) +{ + irq_set_chip_data(virq, d->host_data); + irq_set_chip_and_handler(virq, _irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + return 0; +} + +static struct irq_domain_ops max8925_irq_domain_ops = { + .map= max8925_irq_domain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + + static int max8925_irq_init(struct max8925_chip *chip, int irq, struct max8925_platform_data *pdata) { unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; - int i, ret; - int __irq; + int ret; + struct device_node *node = chip->dev->of_node; - if (!pdata || !pdata->irq_base) { - dev_warn(chip->dev, "No interrupt support on IRQ base\n"); - return -EINVAL; - } /* clear all interrupts */ max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ1); max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ2); @@ -667,35 +686,32 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq, max8925_reg_write(chip->rtc, MAX8925_RTC_IRQ_MASK, 0xff); mutex_init(>irq_lock); - chip->core_irq = irq; - chip->irq_base = pdata->irq_base; - /* register with genirq */ - for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { - __irq = i + chip->irq_base; - irq_set_chip_data(__irq, chip); - irq_set_chip_and_handler(__irq, _irq_chip, -handle_edge_irq); - irq_set_nested_thread(__irq, 1); -#ifdef CONFIG_ARM - set_irq_flags(__irq, IRQF_VALID); -#else - irq_set_noprobe(__irq); -#endif - } - if (!irq) { - dev_warn(chip->dev, "No interrupt support on core IRQ\n"); - goto tsc_irq; + chip->irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_IRQS, 0); + if (chip->irq_base < 0) { + dev_err(chip->dev, "Failed to allocate interrupts, ret:%d\n", + chip->irq_base); + return -EBUSY; } + irq_domain_add_legacy(node, MAX8925_NR_IRQS, chip->irq_base, 0, + _irq_domain_ops, chip); + + /* request irq handler for pmic main irq*/ + + chip->core_irq = irq; + if (!chip->core_irq) + return -EBUSY; ret = request_threaded_irq(irq, NULL, max8925_irq, flags, "max8925", chip); if (ret) { dev_err(chip->dev, "Failed to request core IRQ: %d\n", ret); chip->core_irq = 0; + return -EBUSY; } -tsc_irq: + /* request irq handler for pmic tsc irq*/ + /* mask TSC interrupt */ max8925_reg_write(chip->adc, MAX8925_TSC_IRQ_MASK, 0x0f); @@ -704,7 +720,6 @@ tsc_irq: return 0; } chip->tsc_irq = pdata->tsc_irq; - ret = request_threaded_irq(chip->tsc_irq, NULL, max8925_tsc_irq, flags, "max8925-tsc", chip); if (ret) { @@ -876,7 +891,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, if (pdata && pdata->power) { ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(power_devs), - _supply_resources[0], 0, NULL); + _supply_resources[0], 0, NULL); if (ret < 0) { dev_err(chip->dev, "Failed to add power supply "
[PATCH v3 1/7] mfd: max8925: add irqdomain for dt
From: Qing Xu qi...@marvell.com Add irqdomains for max8925's main irq, wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/max8925-core.c | 69 ++- drivers/mfd/max8925-i2c.c | 37 +-- include/linux/mfd/max8925.h |3 +- 3 files changed, 78 insertions(+), 31 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..d0ebdbf 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,13 @@ #include linux/i2c.h #include linux/irq.h #include linux/interrupt.h +#include linux/irqdomain.h #include linux/platform_device.h #include linux/regulator/machine.h #include linux/mfd/core.h #include linux/mfd/max8925.h +#include linux/of.h +#include linux/of_platform.h static struct resource bk_resources[] __devinitdata = { { 0x84, 0x84, mode control, IORESOURCE_REG, }, @@ -639,17 +642,33 @@ static struct irq_chip max8925_irq_chip = { .irq_disable= max8925_irq_disable, }; +static int max8925_irq_domain_map(struct irq_domain *d, unsigned int virq, +irq_hw_number_t hw) +{ + irq_set_chip_data(virq, d-host_data); + irq_set_chip_and_handler(virq, max8925_irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + return 0; +} + +static struct irq_domain_ops max8925_irq_domain_ops = { + .map= max8925_irq_domain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + + static int max8925_irq_init(struct max8925_chip *chip, int irq, struct max8925_platform_data *pdata) { unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; - int i, ret; - int __irq; + int ret; + struct device_node *node = chip-dev-of_node; - if (!pdata || !pdata-irq_base) { - dev_warn(chip-dev, No interrupt support on IRQ base\n); - return -EINVAL; - } /* clear all interrupts */ max8925_reg_read(chip-i2c, MAX8925_CHG_IRQ1); max8925_reg_read(chip-i2c, MAX8925_CHG_IRQ2); @@ -667,35 +686,32 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq, max8925_reg_write(chip-rtc, MAX8925_RTC_IRQ_MASK, 0xff); mutex_init(chip-irq_lock); - chip-core_irq = irq; - chip-irq_base = pdata-irq_base; - /* register with genirq */ - for (i = 0; i ARRAY_SIZE(max8925_irqs); i++) { - __irq = i + chip-irq_base; - irq_set_chip_data(__irq, chip); - irq_set_chip_and_handler(__irq, max8925_irq_chip, -handle_edge_irq); - irq_set_nested_thread(__irq, 1); -#ifdef CONFIG_ARM - set_irq_flags(__irq, IRQF_VALID); -#else - irq_set_noprobe(__irq); -#endif - } - if (!irq) { - dev_warn(chip-dev, No interrupt support on core IRQ\n); - goto tsc_irq; + chip-irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_IRQS, 0); + if (chip-irq_base 0) { + dev_err(chip-dev, Failed to allocate interrupts, ret:%d\n, + chip-irq_base); + return -EBUSY; } + irq_domain_add_legacy(node, MAX8925_NR_IRQS, chip-irq_base, 0, + max8925_irq_domain_ops, chip); + + /* request irq handler for pmic main irq*/ + + chip-core_irq = irq; + if (!chip-core_irq) + return -EBUSY; ret = request_threaded_irq(irq, NULL, max8925_irq, flags, max8925, chip); if (ret) { dev_err(chip-dev, Failed to request core IRQ: %d\n, ret); chip-core_irq = 0; + return -EBUSY; } -tsc_irq: + /* request irq handler for pmic tsc irq*/ + /* mask TSC interrupt */ max8925_reg_write(chip-adc, MAX8925_TSC_IRQ_MASK, 0x0f); @@ -704,7 +720,6 @@ tsc_irq: return 0; } chip-tsc_irq = pdata-tsc_irq; - ret = request_threaded_irq(chip-tsc_irq, NULL, max8925_tsc_irq, flags, max8925-tsc, chip); if (ret) { @@ -876,7 +891,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, if (pdata pdata-power) { ret = mfd_add_devices(chip-dev, 0, power_devs[0], ARRAY_SIZE(power_devs), - power_supply_resources[0], 0, NULL); + power_supply_resources[0], 0, NULL); if (ret 0) { dev_err(chip-dev, Failed to add power supply
[PATCH] mfd: max8925: add dts
From: Qing Xu qi...@marvell.com add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu qi...@marvell.com --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..f03d4f4 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = okay; + pmic: max8925@3c { + compatible = maxim,max8925; + reg = 0x3c; + interrupts = 1; + interrupt-parent = intcmux4; + interrupt-controller; + #interrupt-cells = 1; + tsc-irq = 0; + + regulators { + SDV1 { + regulator-min-microvolt = 637500; + regulator-max-microvolt = 1425000; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 2225000; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390
[PATCH v4 7/7] mfd: max8925: add dts
From: Qing Xu qi...@marvell.com add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu qi...@marvell.com --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..f03d4f4 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = okay; + pmic: max8925@3c { + compatible = maxim,max8925; + reg = 0x3c; + interrupts = 1; + interrupt-parent = intcmux4; + interrupt-controller; + #interrupt-cells = 1; + tsc-irq = 0; + + regulators { + SDV1 { + regulator-min-microvolt = 637500; + regulator-max-microvolt = 1425000; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 2225000; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390
[PATCH] Documentation: add docs for max8925 dt
From: Qing Xu qi...@marvell.com add docs for dt of max8925-mfd, max8925-backlight, and max8925-battery Signed-off-by: Qing Xu qi...@marvell.com --- Documentation/devicetree/bindings/mfd/max8925.txt | 64 .../bindings/power_supply/max8925_batter.txt | 18 ++ .../bindings/video/backlight/max8925-backlight.txt | 10 +++ 3 files changed, 92 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/max8925.txt create mode 100644 Documentation/devicetree/bindings/power_supply/max8925_batter.txt create mode 100644 Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt diff --git a/Documentation/devicetree/bindings/mfd/max8925.txt b/Documentation/devicetree/bindings/mfd/max8925.txt new file mode 100644 index 000..13bb62b --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/max8925.txt @@ -0,0 +1,64 @@ +* Maxim max8925 Power Management IC + +Required parent device properties: +- compatible : maxim,max8925 +- reg : the I2C slave address for the max8925 chip +- interrupts : IRQ line for the max8925 chip +- interrupt-controller: describes the max8925 as an interrupt + controller (has its own domain) +- #interrupt-cells : should be 1. + - The cell is the max8925 local IRQ number + +Optional parent device properties: +- tsc-irq: there are 2 IRQ lines for max8925, one is indicated in + interrupts property, the other is indicated here. + +max8925 consists of a large and varied group of sub-devices: + +Device Supply NamesDescription +-- --- +max8925-onkey : : On key +max8925-rtc: : RTC +max8925-regulator : : Regulators +max8925-backlight : : Backlight +max8925-touch : : Touchscreen +max8925-power : : Charger + +Example: + + pmic: max8925@3c { + compatible = maxim,max8925; + reg = 0x3c; + interrupts = 1; + interrupt-parent = intcmux4; + interrupt-controller; + #interrupt-cells = 1; + tsc-irq = 0; + + regulators { + SDV1 { + regulator-min-microvolt = 637500; + regulator-max-microvolt = 1425000; + regulator-boot-on; + regulator-always-on; + }; + + LDO1 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + + }; + backlight { + max8925-dual-string = 0; + }; + charger { + batt-detect = 0; + topoff-threshold = 1; + fast-charge = 7; + no-temp-support = 0; + no-insert-detect = 0; + }; + }; diff --git a/Documentation/devicetree/bindings/power_supply/max8925_batter.txt b/Documentation/devicetree/bindings/power_supply/max8925_batter.txt new file mode 100644 index 000..d7e3e0c --- /dev/null +++ b/Documentation/devicetree/bindings/power_supply/max8925_batter.txt @@ -0,0 +1,18 @@ +max8925-battery bindings + + +Optional properties : + - batt-detect: whether support battery detect + - topoff-threshold: set charging current in topoff mode + - fast-charge: set charging current in fast mode + - no-temp-support: whether support temperature protection detect + - no-insert-detect: whether support insert detect + +Example: + charger { + batt-detect = 0; + topoff-threshold = 1; + fast-charge = 7; + no-temp-support = 0; + no-insert-detect = 0; + }; diff --git a/Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt b/Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt new file mode 100644 index 000..d692db3 --- /dev/null +++ b/Documentation/devicetree/bindings/video/backlight/max8925-backlight.txt @@ -0,0 +1,10 @@ +88pm860x-backlight bindings + +Optional properties: + - max8925-dual-string: whether support dual string + +Example: + + backlights { + max8925-dual-string = 0; + }; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/7] mfd: update on max8925 for DT support
On 11/23/2012 05:09 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:35 PM, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com 1. add irqdomain for max8925, it is necessary for dt support 2. bug fix in max8925 mfd devices'irq base and device registry failure 3. support DT for max8925 mfd devices Qing Xu (7): mfd: max8925: add irqdomain for dt mfd: max8925: fix mfd device register failure mfd: max8925: fix onkey driver irq base mfd: max8925: support dt for power supply mfd: max8925: support dt for regulator mfd: max8925: support dt for backlight mfd: max8925: add dts arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- drivers/input/misc/max8925_onkey.c|3 - drivers/mfd/max8925-core.c| 107 + drivers/mfd/max8925-i2c.c | 32 ++- drivers/power/max8925_power.c | 57 ++- drivers/regulator/max8925-regulator.c | 35 +++- drivers/video/backlight/max8925_bl.c | 31 ++- include/linux/mfd/max8925.h | 12 ++- 9 files changed, 389 insertions(+), 58 deletions(-) No document on devicetree binding? I added a new patch of Documentation: add docs for max8925 dt, please help to review, thanks a lot! -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/7] mfd: max8925: support dt for backlight
On 11/23/2012 05:08 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:47 PM, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index f72ba54..7de02ed 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; +#ifdef CONFIG_OF +static int max8925_backlight_dt_init(struct platform_device *pdev, + struct max8925_backlight_pdata *pdata) +{ + struct device_node *nproot = pdev->dev.parent->of_node, *np; + int dual_string; + + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, "backlight"); + if (!np) { + dev_err(>dev, "failed to find backlight node\n"); + return -ENODEV; + } + + of_property_read_u32(np, "dual-string", _string); Please use the property like "maxium,max8925-dual-string" at here. It's used to avoid naming conflict. patch updated in v2, and dts patch update in v3 + pdata->dual_string = dual_string; + return 0; +} +#else +#define max8925_backlight_dt_init(x, y)(-1) +#endif + static int __devinit max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -150,6 +173,13 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; + if (pdev->dev.parent->of_node && !pdata) { + pdata = devm_kzalloc(>dev, +sizeof(struct max8925_backlight_pdata), +GFP_KERNEL); + max8925_backlight_dt_init(pdev, pdata); + } + if (pdata) { if (pdata->lxw_scl) value |= (1 << 7); @@ -161,7 +191,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) ret = max8925_set_bits(chip->i2c, data->reg_mode_cntl, 0xfe, value); if (ret < 0) goto out_brt; - backlight_update_status(bl); return 0; out_brt: -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 7/7] mfd: max8925: add dts
From: Qing Xu add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..d94210b 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = "okay"; + pmic: max8925@3c { + compatible = "maxium,max8925"; + reg = <0x3c>; + interrupts = <1>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + tsc-irq = <0>; + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <2225000>; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { +
[PATCH v2 6/7] mfd: max8925: support dt for backlight
From: Qing Xu Signed-off-by: Qing Xu --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index f72ba54..1682d00 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; +#ifdef CONFIG_OF +static int max8925_backlight_dt_init(struct platform_device *pdev, + struct max8925_backlight_pdata *pdata) +{ + struct device_node *nproot = pdev->dev.parent->of_node, *np; + int dual_string; + + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, "backlight"); + if (!np) { + dev_err(>dev, "failed to find backlight node\n"); + return -ENODEV; + } + + of_property_read_u32(np, "max8925-dual-string", _string); + pdata->dual_string = dual_string; + return 0; +} +#else +#define max8925_backlight_dt_init(x, y)(-1) +#endif + static int __devinit max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -150,6 +173,13 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; + if (pdev->dev.parent->of_node && !pdata) { + pdata = devm_kzalloc(>dev, +sizeof(struct max8925_backlight_pdata), +GFP_KERNEL); + max8925_backlight_dt_init(pdev, pdata); + } + if (pdata) { if (pdata->lxw_scl) value |= (1 << 7); @@ -161,7 +191,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) ret = max8925_set_bits(chip->i2c, data->reg_mode_cntl, 0xfe, value); if (ret < 0) goto out_brt; - backlight_update_status(bl); return 0; out_brt: -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/7] mfd: max8925: fix mfd device register failure
On 11/23/2012 04:41 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:38 PM, Qing Xu wrote: From: Qing Xu we encounter rtc/power/touch driver registry failure, root cause it is resources confilict in insert_resouce, solved by changing mfd_add_devices 5th parameter to NULL Since resources are not used in power/rtc driver and touch driver isn't implemented, it's OK to avoid use resources. Please remove those resources in max8925-core.c also. oh, we can not remove those resources, it is include in mfd_cell, such as : static struct resource rtc_resources[] = { { ... }, }; static struct mfd_cell rtc_devs[] = { { .name = "max8925-rtc", ... .resources = _resources[0], ... }, }; In the struct, the resources is for rtc dev itself's resource, but in: ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(rtc_devs), _resources[0], chip->irq_base, NULL); the 5th parameter, it is for rtc's child, not rtc itself, we should remove it to NULL, otherwise, device register will find conflict on child's and parent's resource. Signed-off-by: Qing Xu --- drivers/mfd/max8925-core.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index dcc218a..b1eacae 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -873,7 +873,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(rtc_devs), - _resources[0], chip->irq_base, NULL); + NULL, chip->irq_base, NULL); if (ret < 0) { dev_err(chip->dev, "Failed to add rtc subdev\n"); goto out; @@ -881,7 +881,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(onkey_devs), - _resources[0], 0, NULL); + NULL, 0, NULL); if (ret < 0) { dev_err(chip->dev, "Failed to add onkey subdev\n"); goto out_dev; @@ -900,21 +900,19 @@ int __devinit max8925_device_init(struct max8925_chip *chip, goto out_dev; } - if (pdata && pdata->power) { - ret = mfd_add_devices(chip->dev, 0, _devs[0], - ARRAY_SIZE(power_devs), - _supply_resources[0], 0, NULL); - if (ret < 0) { - dev_err(chip->dev, "Failed to add power supply " - "subdev\n"); - goto out_dev; - } + ret = mfd_add_devices(chip->dev, 0, _devs[0], + ARRAY_SIZE(power_devs), + NULL, 0, NULL); + if (ret < 0) { + dev_err(chip->dev, "Failed to add power supply " + "subdev, err = %d\n", ret); + goto out_dev; } if (pdata && pdata->touch) { ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(touch_devs), - _resources[0], 0, NULL); + NULL, chip->tsc_irq_base, NULL); if (ret < 0) { dev_err(chip->dev, "Failed to add touch subdev\n"); goto out_dev; -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/7] mfd: max8925: fix mfd device register failure
On 11/23/2012 04:41 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:38 PM, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com we encounter rtc/power/touch driver registry failure, root cause it is resources confilict in insert_resouce, solved by changing mfd_add_devices 5th parameter to NULL Since resources are not used in power/rtc driver and touch driver isn't implemented, it's OK to avoid use resources. Please remove those resources in max8925-core.c also. oh, we can not remove those resources, it is include in mfd_cell, such as : static struct resource rtc_resources[] = { { ... }, }; static struct mfd_cell rtc_devs[] = { { .name = max8925-rtc, ... .resources = rtc_resources[0], ... }, }; In the struct, the resources is for rtc dev itself's resource, but in: ret = mfd_add_devices(chip-dev, 0, rtc_devs[0], ARRAY_SIZE(rtc_devs), rtc_resources[0], chip-irq_base, NULL); the 5th parameter, it is for rtc's child, not rtc itself, we should remove it to NULL, otherwise, device register will find conflict on child's and parent's resource. Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/max8925-core.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index dcc218a..b1eacae 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -873,7 +873,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, ret = mfd_add_devices(chip-dev, 0, rtc_devs[0], ARRAY_SIZE(rtc_devs), - rtc_resources[0], chip-irq_base, NULL); + NULL, chip-irq_base, NULL); if (ret 0) { dev_err(chip-dev, Failed to add rtc subdev\n); goto out; @@ -881,7 +881,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, ret = mfd_add_devices(chip-dev, 0, onkey_devs[0], ARRAY_SIZE(onkey_devs), - onkey_resources[0], 0, NULL); + NULL, 0, NULL); if (ret 0) { dev_err(chip-dev, Failed to add onkey subdev\n); goto out_dev; @@ -900,21 +900,19 @@ int __devinit max8925_device_init(struct max8925_chip *chip, goto out_dev; } - if (pdata pdata-power) { - ret = mfd_add_devices(chip-dev, 0, power_devs[0], - ARRAY_SIZE(power_devs), - power_supply_resources[0], 0, NULL); - if (ret 0) { - dev_err(chip-dev, Failed to add power supply - subdev\n); - goto out_dev; - } + ret = mfd_add_devices(chip-dev, 0, power_devs[0], + ARRAY_SIZE(power_devs), + NULL, 0, NULL); + if (ret 0) { + dev_err(chip-dev, Failed to add power supply + subdev, err = %d\n, ret); + goto out_dev; } if (pdata pdata-touch) { ret = mfd_add_devices(chip-dev, 0, touch_devs[0], ARRAY_SIZE(touch_devs), - touch_resources[0], 0, NULL); + NULL, chip-tsc_irq_base, NULL); if (ret 0) { dev_err(chip-dev, Failed to add touch subdev\n); goto out_dev; -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 6/7] mfd: max8925: support dt for backlight
From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index f72ba54..1682d00 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; +#ifdef CONFIG_OF +static int max8925_backlight_dt_init(struct platform_device *pdev, + struct max8925_backlight_pdata *pdata) +{ + struct device_node *nproot = pdev-dev.parent-of_node, *np; + int dual_string; + + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, backlight); + if (!np) { + dev_err(pdev-dev, failed to find backlight node\n); + return -ENODEV; + } + + of_property_read_u32(np, max8925-dual-string, dual_string); + pdata-dual_string = dual_string; + return 0; +} +#else +#define max8925_backlight_dt_init(x, y)(-1) +#endif + static int __devinit max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); @@ -150,6 +173,13 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; + if (pdev-dev.parent-of_node !pdata) { + pdata = devm_kzalloc(pdev-dev, +sizeof(struct max8925_backlight_pdata), +GFP_KERNEL); + max8925_backlight_dt_init(pdev, pdata); + } + if (pdata) { if (pdata-lxw_scl) value |= (1 7); @@ -161,7 +191,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) ret = max8925_set_bits(chip-i2c, data-reg_mode_cntl, 0xfe, value); if (ret 0) goto out_brt; - backlight_update_status(bl); return 0; out_brt: -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 7/7] mfd: max8925: add dts
From: Qing Xu qi...@marvell.com add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu qi...@marvell.com --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..d94210b 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = okay; + pmic: max8925@3c { + compatible = maxium,max8925; + reg = 0x3c; + interrupts = 1; + interrupt-parent = intcmux4; + interrupt-controller; + #interrupt-cells = 1; + tsc-irq = 0; + + regulators { + SDV1 { + regulator-min-microvolt = 637500; + regulator-max-microvolt = 1425000; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 2225000; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390
Re: [PATCH 6/7] mfd: max8925: support dt for backlight
On 11/23/2012 05:08 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:47 PM, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index f72ba54..7de02ed 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; +#ifdef CONFIG_OF +static int max8925_backlight_dt_init(struct platform_device *pdev, + struct max8925_backlight_pdata *pdata) +{ + struct device_node *nproot = pdev-dev.parent-of_node, *np; + int dual_string; + + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, backlight); + if (!np) { + dev_err(pdev-dev, failed to find backlight node\n); + return -ENODEV; + } + + of_property_read_u32(np, dual-string, dual_string); Please use the property like maxium,max8925-dual-string at here. It's used to avoid naming conflict. patch updated in v2, and dts patch update in v3 + pdata-dual_string = dual_string; + return 0; +} +#else +#define max8925_backlight_dt_init(x, y)(-1) +#endif + static int __devinit max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); @@ -150,6 +173,13 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; + if (pdev-dev.parent-of_node !pdata) { + pdata = devm_kzalloc(pdev-dev, +sizeof(struct max8925_backlight_pdata), +GFP_KERNEL); + max8925_backlight_dt_init(pdev, pdata); + } + if (pdata) { if (pdata-lxw_scl) value |= (1 7); @@ -161,7 +191,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) ret = max8925_set_bits(chip-i2c, data-reg_mode_cntl, 0xfe, value); if (ret 0) goto out_brt; - backlight_update_status(bl); return 0; out_brt: -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/7] mfd: max8925: add irqdomain for dt
On 11/23/2012 05:05 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:37 PM, Qing Xu wrote: From: Qing Xu Add irqdomains for max8925's main irq, and touch irq. Wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu --- drivers/mfd/max8925-core.c | 87 --- drivers/mfd/max8925-i2c.c | 32 +++- include/linux/mfd/max8925.h | 12 - 3 files changed, 96 insertions(+), 35 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..dcc218a 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,14 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include static struct resource bk_resources[] __devinitdata = { { 0x84, 0x84, "mode control", IORESOURCE_REG, }, @@ -639,17 +643,34 @@ static struct irq_chip max8925_irq_chip = { .irq_disable= max8925_irq_disable, }; +static int max8925_irq_domain_map(struct irq_domain *d, unsigned int virq, +irq_hw_number_t hw) +{ + irq_set_chip_data(virq, d->host_data); + irq_set_chip_and_handler(virq, _irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + return 0; +} + +static struct irq_domain_ops max8925_irq_domain_ops = { + .map= max8925_irq_domain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + + static int max8925_irq_init(struct max8925_chip *chip, int irq, struct max8925_platform_data *pdata) { unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; - int i, ret; - int __irq; + int ret; + int tsc_irq; + struct device_node *node = chip->dev->of_node; - if (!pdata || !pdata->irq_base) { - dev_warn(chip->dev, "No interrupt support on IRQ base\n"); - return -EINVAL; - } /* clear all interrupts */ max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ1); max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ2); @@ -667,45 +688,51 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq, max8925_reg_write(chip->rtc, MAX8925_RTC_IRQ_MASK, 0xff); mutex_init(>irq_lock); - chip->core_irq = irq; - chip->irq_base = pdata->irq_base; - /* register with genirq */ - for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { - __irq = i + chip->irq_base; - irq_set_chip_data(__irq, chip); - irq_set_chip_and_handler(__irq, _irq_chip, -handle_edge_irq); - irq_set_nested_thread(__irq, 1); -#ifdef CONFIG_ARM - set_irq_flags(__irq, IRQF_VALID); -#else - irq_set_noprobe(__irq); -#endif - } - if (!irq) { - dev_warn(chip->dev, "No interrupt support on core IRQ\n"); - goto tsc_irq; + /* domain1: init charger/rtc/onkey irq domain*/ + chip->irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_IRQS, 0); + if (chip->irq_base < 0) { + dev_err(chip->dev, "Failed to allocate interrupts, ret:%d\n", + chip->irq_base); + return -EBUSY; } + irq_domain_add_legacy(node, MAX8925_NR_IRQS, chip->irq_base, 0, + _irq_domain_ops, chip); + chip->core_irq = irq; + if (!chip->core_irq) + return -EBUSY; + ret = request_threaded_irq(irq, NULL, max8925_irq, flags, "max8925", chip); if (ret) { dev_err(chip->dev, "Failed to request core IRQ: %d\n", ret); chip->core_irq = 0; + return -EBUSY; } -tsc_irq: + /* domain2: init touch irq domain*/ /* mask TSC interrupt */ max8925_reg_write(chip->adc, MAX8925_TSC_IRQ_MASK, 0x0f); - if (!pdata->tsc_irq) { + chip->tsc_irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_TSC_IRQS, 0); + if (chip->tsc_irq < 0) { + dev_err(chip->dev, "Failed to allocate interrupts, ret:%d\n", + chip->tsc_irq_base); + return -EBUSY; + } + + irq_domain_add_legacy(node, MAX8925_NR_TSC_IRQS, chip->tsc_irq_base, 0, + _irq_domain_ops, chip); + + tsc_irq = irq_of_parse_and_map(node, 1); + I'm confused on this. Let's look at your definition in DTS. + pmic: max8925@3c { +
[PATCH v2 7/7] mfd: max8925: add dts
From: Qing Xu add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..221e8f4 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = "okay"; + pmic: max8925@3c { + compatible = "maxium,max8925"; + reg = <0x3c>; + interrupts = <1>; + interrupt-parent = <>; + interrupt-controller; + #interrupt-cells = <1>; + tsc-irq = <0>; + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <2225000>; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = <65>; + regulator-max-microvolt = <225>; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = <75>; + regulator-max-microvolt = <390>; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { +
[PATCH v2 1/7] mfd: max8925: add irqdomain for dt
From: Qing Xu Add irqdomains for max8925's main irq, wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu --- drivers/mfd/max8925-core.c | 69 ++- drivers/mfd/max8925-i2c.c | 37 +-- include/linux/mfd/max8925.h |3 +- 3 files changed, 78 insertions(+), 31 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..d0ebdbf 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,13 @@ #include #include #include +#include #include #include #include #include +#include +#include static struct resource bk_resources[] __devinitdata = { { 0x84, 0x84, "mode control", IORESOURCE_REG, }, @@ -639,17 +642,33 @@ static struct irq_chip max8925_irq_chip = { .irq_disable= max8925_irq_disable, }; +static int max8925_irq_domain_map(struct irq_domain *d, unsigned int virq, +irq_hw_number_t hw) +{ + irq_set_chip_data(virq, d->host_data); + irq_set_chip_and_handler(virq, _irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + return 0; +} + +static struct irq_domain_ops max8925_irq_domain_ops = { + .map= max8925_irq_domain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + + static int max8925_irq_init(struct max8925_chip *chip, int irq, struct max8925_platform_data *pdata) { unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; - int i, ret; - int __irq; + int ret; + struct device_node *node = chip->dev->of_node; - if (!pdata || !pdata->irq_base) { - dev_warn(chip->dev, "No interrupt support on IRQ base\n"); - return -EINVAL; - } /* clear all interrupts */ max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ1); max8925_reg_read(chip->i2c, MAX8925_CHG_IRQ2); @@ -667,35 +686,32 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq, max8925_reg_write(chip->rtc, MAX8925_RTC_IRQ_MASK, 0xff); mutex_init(>irq_lock); - chip->core_irq = irq; - chip->irq_base = pdata->irq_base; - /* register with genirq */ - for (i = 0; i < ARRAY_SIZE(max8925_irqs); i++) { - __irq = i + chip->irq_base; - irq_set_chip_data(__irq, chip); - irq_set_chip_and_handler(__irq, _irq_chip, -handle_edge_irq); - irq_set_nested_thread(__irq, 1); -#ifdef CONFIG_ARM - set_irq_flags(__irq, IRQF_VALID); -#else - irq_set_noprobe(__irq); -#endif - } - if (!irq) { - dev_warn(chip->dev, "No interrupt support on core IRQ\n"); - goto tsc_irq; + chip->irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_IRQS, 0); + if (chip->irq_base < 0) { + dev_err(chip->dev, "Failed to allocate interrupts, ret:%d\n", + chip->irq_base); + return -EBUSY; } + irq_domain_add_legacy(node, MAX8925_NR_IRQS, chip->irq_base, 0, + _irq_domain_ops, chip); + + /* request irq handler for pmic main irq*/ + + chip->core_irq = irq; + if (!chip->core_irq) + return -EBUSY; ret = request_threaded_irq(irq, NULL, max8925_irq, flags, "max8925", chip); if (ret) { dev_err(chip->dev, "Failed to request core IRQ: %d\n", ret); chip->core_irq = 0; + return -EBUSY; } -tsc_irq: + /* request irq handler for pmic tsc irq*/ + /* mask TSC interrupt */ max8925_reg_write(chip->adc, MAX8925_TSC_IRQ_MASK, 0x0f); @@ -704,7 +720,6 @@ tsc_irq: return 0; } chip->tsc_irq = pdata->tsc_irq; - ret = request_threaded_irq(chip->tsc_irq, NULL, max8925_tsc_irq, flags, "max8925-tsc", chip); if (ret) { @@ -876,7 +891,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, if (pdata && pdata->power) { ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(power_devs), - _supply_resources[0], 0, NULL); + _supply_resources[0], 0, NULL); if (ret < 0) { dev_err(chip->dev, "Failed to add power supply "
[PATCH v2 1/7] mfd: max8925: add irqdomain for dt
From: Qing Xu qi...@marvell.com Add irqdomains for max8925's main irq, wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/max8925-core.c | 69 ++- drivers/mfd/max8925-i2c.c | 37 +-- include/linux/mfd/max8925.h |3 +- 3 files changed, 78 insertions(+), 31 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..d0ebdbf 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,13 @@ #include linux/i2c.h #include linux/irq.h #include linux/interrupt.h +#include linux/irqdomain.h #include linux/platform_device.h #include linux/regulator/machine.h #include linux/mfd/core.h #include linux/mfd/max8925.h +#include linux/of.h +#include linux/of_platform.h static struct resource bk_resources[] __devinitdata = { { 0x84, 0x84, mode control, IORESOURCE_REG, }, @@ -639,17 +642,33 @@ static struct irq_chip max8925_irq_chip = { .irq_disable= max8925_irq_disable, }; +static int max8925_irq_domain_map(struct irq_domain *d, unsigned int virq, +irq_hw_number_t hw) +{ + irq_set_chip_data(virq, d-host_data); + irq_set_chip_and_handler(virq, max8925_irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + return 0; +} + +static struct irq_domain_ops max8925_irq_domain_ops = { + .map= max8925_irq_domain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + + static int max8925_irq_init(struct max8925_chip *chip, int irq, struct max8925_platform_data *pdata) { unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; - int i, ret; - int __irq; + int ret; + struct device_node *node = chip-dev-of_node; - if (!pdata || !pdata-irq_base) { - dev_warn(chip-dev, No interrupt support on IRQ base\n); - return -EINVAL; - } /* clear all interrupts */ max8925_reg_read(chip-i2c, MAX8925_CHG_IRQ1); max8925_reg_read(chip-i2c, MAX8925_CHG_IRQ2); @@ -667,35 +686,32 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq, max8925_reg_write(chip-rtc, MAX8925_RTC_IRQ_MASK, 0xff); mutex_init(chip-irq_lock); - chip-core_irq = irq; - chip-irq_base = pdata-irq_base; - /* register with genirq */ - for (i = 0; i ARRAY_SIZE(max8925_irqs); i++) { - __irq = i + chip-irq_base; - irq_set_chip_data(__irq, chip); - irq_set_chip_and_handler(__irq, max8925_irq_chip, -handle_edge_irq); - irq_set_nested_thread(__irq, 1); -#ifdef CONFIG_ARM - set_irq_flags(__irq, IRQF_VALID); -#else - irq_set_noprobe(__irq); -#endif - } - if (!irq) { - dev_warn(chip-dev, No interrupt support on core IRQ\n); - goto tsc_irq; + chip-irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_IRQS, 0); + if (chip-irq_base 0) { + dev_err(chip-dev, Failed to allocate interrupts, ret:%d\n, + chip-irq_base); + return -EBUSY; } + irq_domain_add_legacy(node, MAX8925_NR_IRQS, chip-irq_base, 0, + max8925_irq_domain_ops, chip); + + /* request irq handler for pmic main irq*/ + + chip-core_irq = irq; + if (!chip-core_irq) + return -EBUSY; ret = request_threaded_irq(irq, NULL, max8925_irq, flags, max8925, chip); if (ret) { dev_err(chip-dev, Failed to request core IRQ: %d\n, ret); chip-core_irq = 0; + return -EBUSY; } -tsc_irq: + /* request irq handler for pmic tsc irq*/ + /* mask TSC interrupt */ max8925_reg_write(chip-adc, MAX8925_TSC_IRQ_MASK, 0x0f); @@ -704,7 +720,6 @@ tsc_irq: return 0; } chip-tsc_irq = pdata-tsc_irq; - ret = request_threaded_irq(chip-tsc_irq, NULL, max8925_tsc_irq, flags, max8925-tsc, chip); if (ret) { @@ -876,7 +891,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, if (pdata pdata-power) { ret = mfd_add_devices(chip-dev, 0, power_devs[0], ARRAY_SIZE(power_devs), - power_supply_resources[0], 0, NULL); + power_supply_resources[0], 0, NULL); if (ret 0) { dev_err(chip-dev, Failed to add power supply
[PATCH v2 7/7] mfd: max8925: add dts
From: Qing Xu qi...@marvell.com add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu qi...@marvell.com --- arch/arm/boot/dts/mmp2-brownstone.dts | 158 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 161 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts index c9b4f27..221e8f4 100644 --- a/arch/arm/boot/dts/mmp2-brownstone.dts +++ b/arch/arm/boot/dts/mmp2-brownstone.dts @@ -29,6 +29,164 @@ }; twsi1: i2c@d4011000 { status = okay; + pmic: max8925@3c { + compatible = maxium,max8925; + reg = 0x3c; + interrupts = 1; + interrupt-parent = intcmux4; + interrupt-controller; + #interrupt-cells = 1; + tsc-irq = 0; + + regulators { + SDV1 { + regulator-min-microvolt = 637500; + regulator-max-microvolt = 1425000; + regulator-boot-on; + regulator-always-on; + }; + SDV2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 2225000; + regulator-boot-on; + regulator-always-on; + }; + SDV3 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO1 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO2 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO3 { + regulator-min-microvolt = 65; + regulator-max-microvolt = 225; + regulator-boot-on; + regulator-always-on; + }; + LDO4 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO5 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390; + regulator-boot-on; + regulator-always-on; + }; + LDO6 { + regulator-min-microvolt = 75; + regulator-max-microvolt = 390
Re: [PATCH 1/7] mfd: max8925: add irqdomain for dt
On 11/23/2012 05:05 PM, Haojian Zhuang wrote: On Tue, Nov 6, 2012 at 3:37 PM, Qing Xu qi...@marvell.com wrote: From: Qing Xu qi...@marvell.com Add irqdomains for max8925's main irq, and touch irq. Wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/max8925-core.c | 87 --- drivers/mfd/max8925-i2c.c | 32 +++- include/linux/mfd/max8925.h | 12 - 3 files changed, 96 insertions(+), 35 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..dcc218a 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,14 @@ #include linux/i2c.h #include linux/irq.h #include linux/interrupt.h +#include linux/irqdomain.h #include linux/platform_device.h #include linux/regulator/machine.h #include linux/mfd/core.h #include linux/mfd/max8925.h +#include linux/of.h +#include linux/of_platform.h +#include linux/of_irq.h static struct resource bk_resources[] __devinitdata = { { 0x84, 0x84, mode control, IORESOURCE_REG, }, @@ -639,17 +643,34 @@ static struct irq_chip max8925_irq_chip = { .irq_disable= max8925_irq_disable, }; +static int max8925_irq_domain_map(struct irq_domain *d, unsigned int virq, +irq_hw_number_t hw) +{ + irq_set_chip_data(virq, d-host_data); + irq_set_chip_and_handler(virq, max8925_irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + return 0; +} + +static struct irq_domain_ops max8925_irq_domain_ops = { + .map= max8925_irq_domain_map, + .xlate = irq_domain_xlate_onetwocell, +}; + + static int max8925_irq_init(struct max8925_chip *chip, int irq, struct max8925_platform_data *pdata) { unsigned long flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT; - int i, ret; - int __irq; + int ret; + int tsc_irq; + struct device_node *node = chip-dev-of_node; - if (!pdata || !pdata-irq_base) { - dev_warn(chip-dev, No interrupt support on IRQ base\n); - return -EINVAL; - } /* clear all interrupts */ max8925_reg_read(chip-i2c, MAX8925_CHG_IRQ1); max8925_reg_read(chip-i2c, MAX8925_CHG_IRQ2); @@ -667,45 +688,51 @@ static int max8925_irq_init(struct max8925_chip *chip, int irq, max8925_reg_write(chip-rtc, MAX8925_RTC_IRQ_MASK, 0xff); mutex_init(chip-irq_lock); - chip-core_irq = irq; - chip-irq_base = pdata-irq_base; - /* register with genirq */ - for (i = 0; i ARRAY_SIZE(max8925_irqs); i++) { - __irq = i + chip-irq_base; - irq_set_chip_data(__irq, chip); - irq_set_chip_and_handler(__irq, max8925_irq_chip, -handle_edge_irq); - irq_set_nested_thread(__irq, 1); -#ifdef CONFIG_ARM - set_irq_flags(__irq, IRQF_VALID); -#else - irq_set_noprobe(__irq); -#endif - } - if (!irq) { - dev_warn(chip-dev, No interrupt support on core IRQ\n); - goto tsc_irq; + /* domain1: init charger/rtc/onkey irq domain*/ + chip-irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_IRQS, 0); + if (chip-irq_base 0) { + dev_err(chip-dev, Failed to allocate interrupts, ret:%d\n, + chip-irq_base); + return -EBUSY; } + irq_domain_add_legacy(node, MAX8925_NR_IRQS, chip-irq_base, 0, + max8925_irq_domain_ops, chip); + chip-core_irq = irq; + if (!chip-core_irq) + return -EBUSY; + ret = request_threaded_irq(irq, NULL, max8925_irq, flags, max8925, chip); if (ret) { dev_err(chip-dev, Failed to request core IRQ: %d\n, ret); chip-core_irq = 0; + return -EBUSY; } -tsc_irq: + /* domain2: init touch irq domain*/ /* mask TSC interrupt */ max8925_reg_write(chip-adc, MAX8925_TSC_IRQ_MASK, 0x0f); - if (!pdata-tsc_irq) { + chip-tsc_irq_base = irq_alloc_descs(-1, 0, MAX8925_NR_TSC_IRQS, 0); + if (chip-tsc_irq 0) { + dev_err(chip-dev, Failed to allocate interrupts, ret:%d\n, + chip-tsc_irq_base); + return -EBUSY; + } + + irq_domain_add_legacy(node, MAX8925_NR_TSC_IRQS, chip-tsc_irq_base, 0, + max8925_irq_domain_ops, chip); + + tsc_irq = irq_of_parse_and_map(node, 1); + I'm confused on this. Let's look at your definition in DTS. + pmic
Re: [PATCH] regulator: max8925: fix compiler warnings
On 11/25/2012 01:55 AM, Mark Brown wrote: On Fri, Nov 23, 2012 at 10:27:12AM +0800, Qing Xu wrote: But, in fact, it is not necessary to initialize regulator_idx. for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) { ri = _regulator_info[i]; if (ri->vol_reg == res->start) { ** if regulator_idx can not get a match "i" here, it will return -EINVAL in below code regulator_idx = i; break; } } if (i == ARRAY_SIZE(max8925_regulator_info)) { dev_err(>dev, "Failed to find regulator %llu\n", (unsigned long long)res->start); return -EINVAL; } How to solve such compiler warning? Typically by reporting a compiler bug, though sometimes in the process of doing that one finds out that there's some non-obvious way in which the code can break. It seems not like a compiler bug, its logic is: for(...; ihttp://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] regulator: max8925: fix compiler warnings
On 11/25/2012 01:55 AM, Mark Brown wrote: On Fri, Nov 23, 2012 at 10:27:12AM +0800, Qing Xu wrote: But, in fact, it is not necessary to initialize regulator_idx. for (i = 0; i ARRAY_SIZE(max8925_regulator_info); i++) { ri = max8925_regulator_info[i]; if (ri-vol_reg == res-start) { ** if regulator_idx can not get a match i here, it will return -EINVAL in below code regulator_idx = i; break; } } if (i == ARRAY_SIZE(max8925_regulator_info)) { dev_err(pdev-dev, Failed to find regulator %llu\n, (unsigned long long)res-start); return -EINVAL; } How to solve such compiler warning? Typically by reporting a compiler bug, though sometimes in the process of doing that one finds out that there's some non-obvious way in which the code can break. It seems not like a compiler bug, its logic is: for(...; ixxx; ...) { if (...) { regulator_idx = i break; } } if (i == xxx) return ERROR; If regulator_idx can not get a matched i value, code will return ERROR. But it seems that compiler can not do so complex judge. And, I think the code is safe even if regulator_idx is not initialized, also because of the return ERROR judge. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 7/7] mfd: max8925: add dts
On 11/06/2012 03:49 PM, Qing Xu wrote: From: Qing Xu add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu --- arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 169 insertions(+), 1 deletions(-) Hi Russell, Haojian, Could you help to review my patch, thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/7] mfd: max8925: support dt for backlight
On 11/06/2012 03:47 PM, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) Hi Richard, Florian, Could you help to review this patch, thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/7] mfd: max8925: support dt for backlight
On 11/06/2012 03:47 PM, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index f72ba54..7de02ed 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; +#ifdef CONFIG_OF +static int max8925_backlight_dt_init(struct platform_device *pdev, + struct max8925_backlight_pdata *pdata) +{ + struct device_node *nproot = pdev->dev.parent->of_node, *np; + int dual_string; + + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, "backlight"); + if (!np) { + dev_err(>dev, "failed to find backlight node\n"); + return -ENODEV; + } + + of_property_read_u32(np, "dual-string", _string); + pdata->dual_string = dual_string; + return 0; +} +#else +#define max8925_backlight_dt_init(x, y)(-1) +#endif + static int __devinit max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -150,6 +173,13 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; + if (pdev->dev.parent->of_node && !pdata) { + pdata = devm_kzalloc(>dev, +sizeof(struct max8925_backlight_pdata), +GFP_KERNEL); + max8925_backlight_dt_init(pdev, pdata); + } + if (pdata) { if (pdata->lxw_scl) value |= (1 << 7); @@ -161,7 +191,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) ret = max8925_set_bits(chip->i2c, data->reg_mode_cntl, 0xfe, value); if (ret < 0) goto out_brt; - backlight_update_status(bl); return 0; out_brt: Hi Liam, Mark, Could you help me review this patch, Thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/7] mfd: max8925: fix onkey driver irq base
On 11/06/2012 03:39 PM, Qing Xu wrote: From: Qing Xu update onkey driver's irq base, it should get from max8925, but not save in a private value Signed-off-by: Qing Xu --- drivers/input/misc/max8925_onkey.c |3 --- drivers/mfd/max8925-core.c |2 +- 2 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 0a12b74..6527789 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c @@ -100,9 +100,6 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev) input->dev.parent = >dev; input_set_capability(input, EV_KEY, KEY_POWER); - irq[0] += chip->irq_base; - irq[1] += chip->irq_base; - error = request_threaded_irq(irq[0], NULL, max8925_onkey_handler, IRQF_ONESHOT, "onkey-down", info); if (error < 0) { diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index b1eacae..37a372d 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -881,7 +881,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, ret = mfd_add_devices(chip->dev, 0, _devs[0], ARRAY_SIZE(onkey_devs), - NULL, 0, NULL); + NULL, chip->irq_base, NULL); if (ret < 0) { dev_err(chip->dev, "Failed to add onkey subdev\n"); goto out_dev; Hi Dmitry, Could you help to review my patch? Thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/7] mfd: max8925: fix mfd device register failure
On 11/06/2012 03:38 PM, Qing Xu wrote: From: Qing Xu we encounter rtc/power/touch driver registry failure, root cause it is resources confilict in insert_resouce, solved by changing mfd_add_devices 5th parameter to NULL Signed-off-by: Qing Xu --- drivers/mfd/max8925-core.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) Hi Haojian, Sameo, Could you help to review my patches? Can it be merged? Thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/7] mfd: max8925: add irqdomain for dt
On 11/06/2012 03:37 PM, Qing Xu wrote: From: Qing Xu Add irqdomains for max8925's main irq, and touch irq. Wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu --- drivers/mfd/max8925-core.c | 87 --- drivers/mfd/max8925-i2c.c | 32 +++- include/linux/mfd/max8925.h | 12 - 3 files changed, 96 insertions(+), 35 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..dcc218a 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,14 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include Hi Haojian, Sameo, Could you help to review my patches? Can it be merged? Thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/7] mfd: update on max8925 for DT support
On 11/06/2012 03:35 PM, Qing Xu wrote: From: Qing Xu 1. add irqdomain for max8925, it is necessary for dt support 2. bug fix in max8925 mfd devices'irq base and device registry failure 3. support DT for max8925 mfd devices Qing Xu (7): mfd: max8925: add irqdomain for dt mfd: max8925: fix mfd device register failure mfd: max8925: fix onkey driver irq base mfd: max8925: support dt for power supply mfd: max8925: support dt for regulator mfd: max8925: support dt for backlight mfd: max8925: add dts arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- drivers/input/misc/max8925_onkey.c|3 - drivers/mfd/max8925-core.c| 107 + drivers/mfd/max8925-i2c.c | 32 ++- drivers/power/max8925_power.c | 57 ++- drivers/regulator/max8925-regulator.c | 35 +++- drivers/video/backlight/max8925_bl.c | 31 ++- include/linux/mfd/max8925.h | 12 ++- 9 files changed, 389 insertions(+), 58 deletions(-) Hi Haojian, Sameo, Could you help to review my patches? Can it be merged? Thanks a lot! -Qing -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] regulator: max8925: fix compiler warnings
On 11/23/2012 09:41 AM, Mark Brown wrote: On Thu, Nov 22, 2012 at 10:11:06AM +0800, Qing Xu wrote: - int i, regulator_idx; + int i; + int regulator_idx = 0; This sort of fix is rarely good without some analysis as to why this is a sensible initialisation to do, just unconditionally initialising may be masking a real issue in the control flow which the compiler has identified. In my build environment, there is no such compiler warning. :( Adding this patch is just want to avoid kbuild test robot's warning. But, in fact, it is not necessary to initialize regulator_idx. for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) { ri = _regulator_info[i]; if (ri->vol_reg == res->start) { ** if regulator_idx can not get a match "i" here, it will return -EINVAL in below code regulator_idx = i; break; } } if (i == ARRAY_SIZE(max8925_regulator_info)) { dev_err(>dev, "Failed to find regulator %llu\n", (unsigned long long)res->start); return -EINVAL; } How to solve such compiler warning? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] regulator: max8925: fix compiler warnings
From: Qing Xu Fixed following compiler warning: - drivers/regulator/max8925-regulator.c:269:51: warning: 'regulator_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Qing Xu --- drivers/regulator/max8925-regulator.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 2b54979..187b29b 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c @@ -282,7 +282,8 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) struct max8925_regulator_info *ri; struct resource *res; struct regulator_dev *rdev; - int i, regulator_idx; + int i; + int regulator_idx = 0; res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (!res) { -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] regulator: max8925: fix compiler warnings
From: Qing Xu qi...@marvell.com Fixed following compiler warning: - drivers/regulator/max8925-regulator.c:269:51: warning: 'regulator_idx' may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Qing Xu qi...@marvell.com --- drivers/regulator/max8925-regulator.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 2b54979..187b29b 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c @@ -282,7 +282,8 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) struct max8925_regulator_info *ri; struct resource *res; struct regulator_dev *rdev; - int i, regulator_idx; + int i; + int regulator_idx = 0; res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (!res) { -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] regulator: max8925: fix compiler warnings
On 11/23/2012 09:41 AM, Mark Brown wrote: On Thu, Nov 22, 2012 at 10:11:06AM +0800, Qing Xu wrote: - int i, regulator_idx; + int i; + int regulator_idx = 0; This sort of fix is rarely good without some analysis as to why this is a sensible initialisation to do, just unconditionally initialising may be masking a real issue in the control flow which the compiler has identified. In my build environment, there is no such compiler warning. :( Adding this patch is just want to avoid kbuild test robot's warning. But, in fact, it is not necessary to initialize regulator_idx. for (i = 0; i ARRAY_SIZE(max8925_regulator_info); i++) { ri = max8925_regulator_info[i]; if (ri-vol_reg == res-start) { ** if regulator_idx can not get a match i here, it will return -EINVAL in below code regulator_idx = i; break; } } if (i == ARRAY_SIZE(max8925_regulator_info)) { dev_err(pdev-dev, Failed to find regulator %llu\n, (unsigned long long)res-start); return -EINVAL; } How to solve such compiler warning? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/7] mfd: update on max8925 for DT support
On 11/06/2012 03:35 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com 1. add irqdomain for max8925, it is necessary for dt support 2. bug fix in max8925 mfd devices'irq base and device registry failure 3. support DT for max8925 mfd devices Qing Xu (7): mfd: max8925: add irqdomain for dt mfd: max8925: fix mfd device register failure mfd: max8925: fix onkey driver irq base mfd: max8925: support dt for power supply mfd: max8925: support dt for regulator mfd: max8925: support dt for backlight mfd: max8925: add dts arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- drivers/input/misc/max8925_onkey.c|3 - drivers/mfd/max8925-core.c| 107 + drivers/mfd/max8925-i2c.c | 32 ++- drivers/power/max8925_power.c | 57 ++- drivers/regulator/max8925-regulator.c | 35 +++- drivers/video/backlight/max8925_bl.c | 31 ++- include/linux/mfd/max8925.h | 12 ++- 9 files changed, 389 insertions(+), 58 deletions(-) Hi Haojian, Sameo, Could you help to review my patches? Can it be merged? Thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/7] mfd: max8925: add irqdomain for dt
On 11/06/2012 03:37 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com Add irqdomains for max8925's main irq, and touch irq. Wrap irq register operations into irqdomain's map func. it is necessary for dt support. Also, add dt support for max8925 driver. Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/max8925-core.c | 87 --- drivers/mfd/max8925-i2c.c | 32 +++- include/linux/mfd/max8925.h | 12 - 3 files changed, 96 insertions(+), 35 deletions(-) diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 1e0ab0a..dcc218a 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -14,10 +14,14 @@ #include linux/i2c.h #include linux/irq.h #include linux/interrupt.h +#include linux/irqdomain.h #include linux/platform_device.h #include linux/regulator/machine.h #include linux/mfd/core.h #include linux/mfd/max8925.h +#include linux/of.h +#include linux/of_platform.h +#include linux/of_irq.h Hi Haojian, Sameo, Could you help to review my patches? Can it be merged? Thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/7] mfd: max8925: fix mfd device register failure
On 11/06/2012 03:38 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com we encounter rtc/power/touch driver registry failure, root cause it is resources confilict in insert_resouce, solved by changing mfd_add_devices 5th parameter to NULL Signed-off-by: Qing Xu qi...@marvell.com --- drivers/mfd/max8925-core.c | 22 ++ 1 files changed, 10 insertions(+), 12 deletions(-) Hi Haojian, Sameo, Could you help to review my patches? Can it be merged? Thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/7] mfd: max8925: fix onkey driver irq base
On 11/06/2012 03:39 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com update onkey driver's irq base, it should get from max8925, but not save in a private value Signed-off-by: Qing Xu qi...@marvell.com --- drivers/input/misc/max8925_onkey.c |3 --- drivers/mfd/max8925-core.c |2 +- 2 files changed, 1 insertions(+), 4 deletions(-) diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 0a12b74..6527789 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c @@ -100,9 +100,6 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev) input-dev.parent = pdev-dev; input_set_capability(input, EV_KEY, KEY_POWER); - irq[0] += chip-irq_base; - irq[1] += chip-irq_base; - error = request_threaded_irq(irq[0], NULL, max8925_onkey_handler, IRQF_ONESHOT, onkey-down, info); if (error 0) { diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index b1eacae..37a372d 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -881,7 +881,7 @@ int __devinit max8925_device_init(struct max8925_chip *chip, ret = mfd_add_devices(chip-dev, 0, onkey_devs[0], ARRAY_SIZE(onkey_devs), - NULL, 0, NULL); + NULL, chip-irq_base, NULL); if (ret 0) { dev_err(chip-dev, Failed to add onkey subdev\n); goto out_dev; Hi Dmitry, Could you help to review my patch? Thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/7] mfd: max8925: support dt for backlight
On 11/06/2012 03:47 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index f72ba54..7de02ed 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -101,6 +101,29 @@ static const struct backlight_ops max8925_backlight_ops = { .get_brightness = max8925_backlight_get_brightness, }; +#ifdef CONFIG_OF +static int max8925_backlight_dt_init(struct platform_device *pdev, + struct max8925_backlight_pdata *pdata) +{ + struct device_node *nproot = pdev-dev.parent-of_node, *np; + int dual_string; + + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, backlight); + if (!np) { + dev_err(pdev-dev, failed to find backlight node\n); + return -ENODEV; + } + + of_property_read_u32(np, dual-string, dual_string); + pdata-dual_string = dual_string; + return 0; +} +#else +#define max8925_backlight_dt_init(x, y)(-1) +#endif + static int __devinit max8925_backlight_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); @@ -150,6 +173,13 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) platform_set_drvdata(pdev, bl); value = 0; + if (pdev-dev.parent-of_node !pdata) { + pdata = devm_kzalloc(pdev-dev, +sizeof(struct max8925_backlight_pdata), +GFP_KERNEL); + max8925_backlight_dt_init(pdev, pdata); + } + if (pdata) { if (pdata-lxw_scl) value |= (1 7); @@ -161,7 +191,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev) ret = max8925_set_bits(chip-i2c, data-reg_mode_cntl, 0xfe, value); if (ret 0) goto out_brt; - backlight_update_status(bl); return 0; out_brt: Hi Liam, Mark, Could you help me review this patch, Thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/7] mfd: max8925: support dt for backlight
On 11/06/2012 03:47 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/video/backlight/max8925_bl.c | 31 ++- 1 files changed, 30 insertions(+), 1 deletions(-) Hi Richard, Florian, Could you help to review this patch, thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 7/7] mfd: max8925: add dts
On 11/06/2012 03:49 PM, Qing Xu wrote: From: Qing Xu qi...@marvell.com add max8925 dts support into mmp2 brownstone platform Signed-off-by: Qing Xu qi...@marvell.com --- arch/arm/boot/dts/mmp2-brownstone.dts | 166 + arch/arm/boot/dts/mmp2.dtsi |4 +- 2 files changed, 169 insertions(+), 1 deletions(-) Hi Russell, Haojian, Could you help to review my patch, thanks a lot! -Qing -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/7] mfd: max8925: support dt for power supply
From: Qing Xu Signed-off-by: Qing Xu --- drivers/power/max8925_power.c | 50 - 1 files changed, 49 insertions(+), 1 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..2d77107 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,6 +426,54 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata * +max8925_power_dt_init(struct platform_device *pdev) +{ + struct device_node *nproot = pdev->dev.parent->of_node; + struct device_node *np; + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev->dev.platform_data; + + np = of_find_node_by_name(nproot, "charger"); + if (!np) { + dev_err(>dev, "failed to find charger node\n"); + return NULL; + } + + pdata = devm_kzalloc(>dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, "topoff-threshold", _threshold); + of_property_read_u32(np, "batt-detect", _detect); + of_property_read_u32(np, "fast-charge", _charge); + of_property_read_u32(np, "no-insert-detect", _insert_detect); + of_property_read_u32(np, "no-temp-support", _temp_support); + + pdata->batt_detect = batt_detect; + pdata->fast_charge = fast_charge; + pdata->topoff_threshold = topoff_threshold; + pdata->no_insert_detect = no_insert_detect; + pdata->no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata * +max8925_power_dt_init(struct platform_device *pdev) +{ + return pdev->dev.platform_data; +} +#endif + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -433,7 +481,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) struct max8925_power_info *info; int ret; - pdata = pdev->dev.platform_data; + pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(>dev, "platform data isn't assigned to " "power supply\n"); -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 4/7] mfd: max8925: support dt for power supply
On 11/19/2012 03:06 PM, Anton Vorontsov wrote: On Mon, Nov 19, 2012 at 02:52:24PM +0800, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu --- drivers/power/max8925_power.c | 61 +--- 1 files changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..aca3f68 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,6 +426,57 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata* Need a whitespace before *. +max8925_power_dt_init( struct platform_device *pdev) Unneeded tab. +{ + struct device_node *nproot = pdev->dev.parent->of_node, *np; Hmmm. No, this is cryptic. One variable declaration per line please. + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev->dev.platform_data; + + np = of_find_node_by_name(nproot, "charger"); + if (!np) { + dev_err(>dev, "failed to find charger node\n"); + return NULL; + } + + pdata = devm_kzalloc(>dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, "topoff-threshold", _threshold); + of_property_read_u32(np, "batt-detect", _detect); + of_property_read_u32(np, "fast-charge", _charge); + of_property_read_u32(np, "no-insert-detect", _insert_detect); + of_property_read_u32(np, "no-temp-support", _temp_support); + + pdata->batt_detect = batt_detect; + pdata->fast_charge = fast_charge; + pdata->topoff_threshold = topoff_threshold; + pdata->no_insert_detect = no_insert_detect; + pdata->no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata* +max8925_power_dt_init( struct platform_device *pdev) Unneeded tab. +{ + return pdev->dev.platform_data; +} +#endif + +static char *power_supplicants[] = { The rest of the driver uses max8925_ prefix. Also, should it be const char *? + "max8925-battery", +}; + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -433,7 +484,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) struct max8925_power_info *info; int ret; - pdata = pdev->dev.platform_data; + pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(>dev, "platform data isn't assigned to " "power supply\n"); @@ -453,8 +504,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info->ac.properties = max8925_ac_props; info->ac.num_properties = ARRAY_SIZE(max8925_ac_props); info->ac.get_property = max8925_ac_get_prop; - info->ac.supplied_to = pdata->supplied_to; - info->ac.num_supplicants = pdata->num_supplicants; + info->ac.supplied_to = power_supplicants; So you no longer able to change supplied_to via platform data. This is a backwards-incompatible change. Commit message should at least explain why this is safe to do (no users in the kernel?). oh, I take test_power.c as example. I will remove this modification. + info->ac.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(>dev, >ac); if (ret) goto out; @@ -465,8 +516,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info->usb.properties = max8925_usb_props; info->usb.num_properties = ARRAY_SIZE(max8925_usb_props); info->usb.get_property = max8925_usb_get_prop; - info->usb.supplied_to = pdata->supplied_to; - info->usb.num_supplicants = pdata->num_supplicants; + info->usb.supplied_to = power_supplicants; Ditto. + info->usb.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(>dev, >usb); if (ret) -- 1.7.0.4 Thanks, Anton. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/7] mfd: max8925: support dt for power supply
On 11/19/2012 08:24 AM, Anton Vorontsov wrote: On Tue, Nov 06, 2012 at 03:42:44PM +0800, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu --- W/ this patch I'm getting this warning: CC drivers/power/max8925_power.o drivers/power/max8925_power.c: In function ‘max8925_power_probe’: drivers/power/max8925_power.c:479:3: warning: statement with no effect [-Wunused-value] drivers/power/max8925_power.c | 57 1 files changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..dd2ac2d 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,14 +426,58 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static int max8925_power_dt_init(struct platform_device *pdev, + struct max8925_power_pdata *pdata) +{ + struct device_node *nproot = pdev->dev.parent->of_node, *np; + int batt_detect, topoff_threshold, fast_charge, + no_temp_support, no_insert_detect; One variable declaration per line please. + + if (!nproot) + return -ENODEV; Please add an empty line here. + np = of_find_node_by_name(nproot, "charger"); + if (!np) { + dev_err(>dev, "failed to find charger node\n"); + return -ENODEV; + } ditto. + of_property_read_u32(np, "topoff-threshold", _threshold); + of_property_read_u32(np, "batt-detect", _detect); + of_property_read_u32(np, "fast-charge", _charge); + of_property_read_u32(np, "no-insert-detect", _insert_detect); + of_property_read_u32(np, "no-temp-support", _temp_support); + + pdata->batt_detect = batt_detect; + pdata->fast_charge = fast_charge; + pdata->topoff_threshold = topoff_threshold; + pdata->no_insert_detect = no_insert_detect; + pdata->no_temp_support = no_temp_support; ditto + pr_err("batt_detect%d, topoff_threshold%d, fast_charge%d,no_temp_support%d, no_insert_detect%d\n", + batt_detect, topoff_threshold, fast_charge, + no_temp_support, no_insert_detect); pr_err, are you sure? :) + return 0; +} +#else +#define max8925_power_dt_init(x, y)(-1) You should make it static inline function to get rid of the warning above. +#endif + +static char *power_supplicants[] = { + "max8925-battery", +}; + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); - struct max8925_power_pdata *pdata = NULL; + struct max8925_power_pdata *pdata = pdev->dev.platform_data; struct max8925_power_info *info; int ret; - pdata = pdev->dev.platform_data; + if (pdev->dev.parent->of_node && !pdata) { + pdata = devm_kzalloc(>dev, +sizeof(struct max8925_power_pdata), +GFP_KERNEL); Please move this logic into max8925_power_dt_init(). So it will look like if (!pdata) pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(...); return ...; } + max8925_power_dt_init(pdev, pdata); + } if (!pdata) { dev_err(>dev, "platform data isn't assigned to " "power supply\n"); @@ -453,8 +497,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info->ac.properties = max8925_ac_props; info->ac.num_properties = ARRAY_SIZE(max8925_ac_props); info->ac.get_property = max8925_ac_get_prop; - info->ac.supplied_to = pdata->supplied_to; - info->ac.num_supplicants = pdata->num_supplicants; + info->ac.supplied_to = power_supplicants; + info->ac.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(>dev, >ac); if (ret) goto out; @@ -465,8 +509,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info->usb.properties = max8925_usb_props; info->usb.num_properties = ARRAY_SIZE(max8925_usb_props); info->usb.get_property = max8925_usb_get_prop; - info->usb.supplied_to = pdata->supplied_to; - info->usb.num_supplicants = pdata->num_supplicants; + info->usb.supplied_to = power_supplicants; + info->usb.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(>dev, >usb); if (ret) @@ -491,6 +535,7 @@ static __devinit int max8925_power_probe(struct platform_device *p
[PATCH v2 4/7] mfd: max8925: support dt for power supply
From: Qing Xu Signed-off-by: Qing Xu --- drivers/power/max8925_power.c | 61 +--- 1 files changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..aca3f68 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,6 +426,57 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata* +max8925_power_dt_init( struct platform_device *pdev) +{ + struct device_node *nproot = pdev->dev.parent->of_node, *np; + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev->dev.platform_data; + + np = of_find_node_by_name(nproot, "charger"); + if (!np) { + dev_err(>dev, "failed to find charger node\n"); + return NULL; + } + + pdata = devm_kzalloc(>dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, "topoff-threshold", _threshold); + of_property_read_u32(np, "batt-detect", _detect); + of_property_read_u32(np, "fast-charge", _charge); + of_property_read_u32(np, "no-insert-detect", _insert_detect); + of_property_read_u32(np, "no-temp-support", _temp_support); + + pdata->batt_detect = batt_detect; + pdata->fast_charge = fast_charge; + pdata->topoff_threshold = topoff_threshold; + pdata->no_insert_detect = no_insert_detect; + pdata->no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata* +max8925_power_dt_init( struct platform_device *pdev) +{ + return pdev->dev.platform_data; +} +#endif + +static char *power_supplicants[] = { + "max8925-battery", +}; + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -433,7 +484,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) struct max8925_power_info *info; int ret; - pdata = pdev->dev.platform_data; + pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(>dev, "platform data isn't assigned to " "power supply\n"); @@ -453,8 +504,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info->ac.properties = max8925_ac_props; info->ac.num_properties = ARRAY_SIZE(max8925_ac_props); info->ac.get_property = max8925_ac_get_prop; - info->ac.supplied_to = pdata->supplied_to; - info->ac.num_supplicants = pdata->num_supplicants; + info->ac.supplied_to = power_supplicants; + info->ac.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(>dev, >ac); if (ret) goto out; @@ -465,8 +516,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info->usb.properties = max8925_usb_props; info->usb.num_properties = ARRAY_SIZE(max8925_usb_props); info->usb.get_property = max8925_usb_get_prop; - info->usb.supplied_to = pdata->supplied_to; - info->usb.num_supplicants = pdata->num_supplicants; + info->usb.supplied_to = power_supplicants; + info->usb.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(>dev, >usb); if (ret) -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 4/7] mfd: max8925: support dt for power supply
From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/power/max8925_power.c | 61 +--- 1 files changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..aca3f68 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,6 +426,57 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata* +max8925_power_dt_init( struct platform_device *pdev) +{ + struct device_node *nproot = pdev-dev.parent-of_node, *np; + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev-dev.platform_data; + + np = of_find_node_by_name(nproot, charger); + if (!np) { + dev_err(pdev-dev, failed to find charger node\n); + return NULL; + } + + pdata = devm_kzalloc(pdev-dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, topoff-threshold, topoff_threshold); + of_property_read_u32(np, batt-detect, batt_detect); + of_property_read_u32(np, fast-charge, fast_charge); + of_property_read_u32(np, no-insert-detect, no_insert_detect); + of_property_read_u32(np, no-temp-support, no_temp_support); + + pdata-batt_detect = batt_detect; + pdata-fast_charge = fast_charge; + pdata-topoff_threshold = topoff_threshold; + pdata-no_insert_detect = no_insert_detect; + pdata-no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata* +max8925_power_dt_init( struct platform_device *pdev) +{ + return pdev-dev.platform_data; +} +#endif + +static char *power_supplicants[] = { + max8925-battery, +}; + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); @@ -433,7 +484,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) struct max8925_power_info *info; int ret; - pdata = pdev-dev.platform_data; + pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(pdev-dev, platform data isn't assigned to power supply\n); @@ -453,8 +504,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-ac.properties = max8925_ac_props; info-ac.num_properties = ARRAY_SIZE(max8925_ac_props); info-ac.get_property = max8925_ac_get_prop; - info-ac.supplied_to = pdata-supplied_to; - info-ac.num_supplicants = pdata-num_supplicants; + info-ac.supplied_to = power_supplicants; + info-ac.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(pdev-dev, info-ac); if (ret) goto out; @@ -465,8 +516,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-usb.properties = max8925_usb_props; info-usb.num_properties = ARRAY_SIZE(max8925_usb_props); info-usb.get_property = max8925_usb_get_prop; - info-usb.supplied_to = pdata-supplied_to; - info-usb.num_supplicants = pdata-num_supplicants; + info-usb.supplied_to = power_supplicants; + info-usb.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(pdev-dev, info-usb); if (ret) -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/7] mfd: max8925: support dt for power supply
On 11/19/2012 08:24 AM, Anton Vorontsov wrote: On Tue, Nov 06, 2012 at 03:42:44PM +0800, Qing Xu wrote: From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- W/ this patch I'm getting this warning: CC drivers/power/max8925_power.o drivers/power/max8925_power.c: In function ‘max8925_power_probe’: drivers/power/max8925_power.c:479:3: warning: statement with no effect [-Wunused-value] drivers/power/max8925_power.c | 57 1 files changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..dd2ac2d 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,14 +426,58 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static int max8925_power_dt_init(struct platform_device *pdev, + struct max8925_power_pdata *pdata) +{ + struct device_node *nproot = pdev-dev.parent-of_node, *np; + int batt_detect, topoff_threshold, fast_charge, + no_temp_support, no_insert_detect; One variable declaration per line please. + + if (!nproot) + return -ENODEV; Please add an empty line here. + np = of_find_node_by_name(nproot, charger); + if (!np) { + dev_err(pdev-dev, failed to find charger node\n); + return -ENODEV; + } ditto. + of_property_read_u32(np, topoff-threshold, topoff_threshold); + of_property_read_u32(np, batt-detect, batt_detect); + of_property_read_u32(np, fast-charge, fast_charge); + of_property_read_u32(np, no-insert-detect, no_insert_detect); + of_property_read_u32(np, no-temp-support, no_temp_support); + + pdata-batt_detect = batt_detect; + pdata-fast_charge = fast_charge; + pdata-topoff_threshold = topoff_threshold; + pdata-no_insert_detect = no_insert_detect; + pdata-no_temp_support = no_temp_support; ditto + pr_err(batt_detect%d, topoff_threshold%d, fast_charge%d,no_temp_support%d, no_insert_detect%d\n, + batt_detect, topoff_threshold, fast_charge, + no_temp_support, no_insert_detect); pr_err, are you sure? :) + return 0; +} +#else +#define max8925_power_dt_init(x, y)(-1) You should make it static inline function to get rid of the warning above. +#endif + +static char *power_supplicants[] = { + max8925-battery, +}; + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); - struct max8925_power_pdata *pdata = NULL; + struct max8925_power_pdata *pdata = pdev-dev.platform_data; struct max8925_power_info *info; int ret; - pdata = pdev-dev.platform_data; + if (pdev-dev.parent-of_node !pdata) { + pdata = devm_kzalloc(pdev-dev, +sizeof(struct max8925_power_pdata), +GFP_KERNEL); Please move this logic into max8925_power_dt_init(). So it will look like if (!pdata) pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(...); return ...; } + max8925_power_dt_init(pdev, pdata); + } if (!pdata) { dev_err(pdev-dev, platform data isn't assigned to power supply\n); @@ -453,8 +497,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-ac.properties = max8925_ac_props; info-ac.num_properties = ARRAY_SIZE(max8925_ac_props); info-ac.get_property = max8925_ac_get_prop; - info-ac.supplied_to = pdata-supplied_to; - info-ac.num_supplicants = pdata-num_supplicants; + info-ac.supplied_to = power_supplicants; + info-ac.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(pdev-dev, info-ac); if (ret) goto out; @@ -465,8 +509,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-usb.properties = max8925_usb_props; info-usb.num_properties = ARRAY_SIZE(max8925_usb_props); info-usb.get_property = max8925_usb_get_prop; - info-usb.supplied_to = pdata-supplied_to; - info-usb.num_supplicants = pdata-num_supplicants; + info-usb.supplied_to = power_supplicants; + info-usb.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(pdev-dev, info-usb); if (ret) @@ -491,6 +535,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-no_insert_detect = pdata-no_insert_detect; max8925_init_charger(chip, info); + This change is unrelated. return 0; out_battery: power_supply_unregister(info
Re: [PATCH v2 4/7] mfd: max8925: support dt for power supply
On 11/19/2012 03:06 PM, Anton Vorontsov wrote: On Mon, Nov 19, 2012 at 02:52:24PM +0800, Qing Xu wrote: From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/power/max8925_power.c | 61 +--- 1 files changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..aca3f68 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,6 +426,57 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata* Need a whitespace before *. +max8925_power_dt_init( struct platform_device *pdev) Unneeded tab. +{ + struct device_node *nproot = pdev-dev.parent-of_node, *np; Hmmm. No, this is cryptic. One variable declaration per line please. + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev-dev.platform_data; + + np = of_find_node_by_name(nproot, charger); + if (!np) { + dev_err(pdev-dev, failed to find charger node\n); + return NULL; + } + + pdata = devm_kzalloc(pdev-dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, topoff-threshold, topoff_threshold); + of_property_read_u32(np, batt-detect, batt_detect); + of_property_read_u32(np, fast-charge, fast_charge); + of_property_read_u32(np, no-insert-detect, no_insert_detect); + of_property_read_u32(np, no-temp-support, no_temp_support); + + pdata-batt_detect = batt_detect; + pdata-fast_charge = fast_charge; + pdata-topoff_threshold = topoff_threshold; + pdata-no_insert_detect = no_insert_detect; + pdata-no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata* +max8925_power_dt_init( struct platform_device *pdev) Unneeded tab. +{ + return pdev-dev.platform_data; +} +#endif + +static char *power_supplicants[] = { The rest of the driver uses max8925_ prefix. Also, should it be const char *? + max8925-battery, +}; + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); @@ -433,7 +484,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) struct max8925_power_info *info; int ret; - pdata = pdev-dev.platform_data; + pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(pdev-dev, platform data isn't assigned to power supply\n); @@ -453,8 +504,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-ac.properties = max8925_ac_props; info-ac.num_properties = ARRAY_SIZE(max8925_ac_props); info-ac.get_property = max8925_ac_get_prop; - info-ac.supplied_to = pdata-supplied_to; - info-ac.num_supplicants = pdata-num_supplicants; + info-ac.supplied_to = power_supplicants; So you no longer able to change supplied_to via platform data. This is a backwards-incompatible change. Commit message should at least explain why this is safe to do (no users in the kernel?). oh, I take test_power.c as example. I will remove this modification. + info-ac.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(pdev-dev, info-ac); if (ret) goto out; @@ -465,8 +516,8 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) info-usb.properties = max8925_usb_props; info-usb.num_properties = ARRAY_SIZE(max8925_usb_props); info-usb.get_property = max8925_usb_get_prop; - info-usb.supplied_to = pdata-supplied_to; - info-usb.num_supplicants = pdata-num_supplicants; + info-usb.supplied_to = power_supplicants; Ditto. + info-usb.num_supplicants = ARRAY_SIZE(power_supplicants); ret = power_supply_register(pdev-dev, info-usb); if (ret) -- 1.7.0.4 Thanks, Anton. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/7] mfd: max8925: support dt for power supply
From: Qing Xu qi...@marvell.com Signed-off-by: Qing Xu qi...@marvell.com --- drivers/power/max8925_power.c | 50 - 1 files changed, 49 insertions(+), 1 deletions(-) diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index daa333b..2d77107 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c @@ -426,6 +426,54 @@ static __devexit int max8925_deinit_charger(struct max8925_power_info *info) return 0; } +#ifdef CONFIG_OF +static struct max8925_power_pdata * +max8925_power_dt_init(struct platform_device *pdev) +{ + struct device_node *nproot = pdev-dev.parent-of_node; + struct device_node *np; + int batt_detect; + int topoff_threshold; + int fast_charge; + int no_temp_support; + int no_insert_detect; + struct max8925_power_pdata *pdata; + + if (!nproot) + return pdev-dev.platform_data; + + np = of_find_node_by_name(nproot, charger); + if (!np) { + dev_err(pdev-dev, failed to find charger node\n); + return NULL; + } + + pdata = devm_kzalloc(pdev-dev, + sizeof(struct max8925_power_pdata), + GFP_KERNEL); + + of_property_read_u32(np, topoff-threshold, topoff_threshold); + of_property_read_u32(np, batt-detect, batt_detect); + of_property_read_u32(np, fast-charge, fast_charge); + of_property_read_u32(np, no-insert-detect, no_insert_detect); + of_property_read_u32(np, no-temp-support, no_temp_support); + + pdata-batt_detect = batt_detect; + pdata-fast_charge = fast_charge; + pdata-topoff_threshold = topoff_threshold; + pdata-no_insert_detect = no_insert_detect; + pdata-no_temp_support = no_temp_support; + + return pdata; +} +#else +static struct max8925_power_pdata * +max8925_power_dt_init(struct platform_device *pdev) +{ + return pdev-dev.platform_data; +} +#endif + static __devinit int max8925_power_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev-dev.parent); @@ -433,7 +481,7 @@ static __devinit int max8925_power_probe(struct platform_device *pdev) struct max8925_power_info *info; int ret; - pdata = pdev-dev.platform_data; + pdata = max8925_power_dt_init(pdev); if (!pdata) { dev_err(pdev-dev, platform data isn't assigned to power supply\n); -- 1.7.0.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 5/7] mfd: max8925: support dt for regulator
On 11/07/2012 10:20 PM, Mark Brown wrote: On Wed, Nov 07, 2012 at 06:09:53PM +0800, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu Applied, thanks. +max8925 regulator device register is still handled by mfd_add_devices, not by +of_xxx, so, it is not necessary to add compatible name. Also, those reg +offset and id info is stored in mfd_cell(see max8925-core.c), as a result +there is not private properties in dts. +node's name should match with the definition in max8925_regulator_matches +(see max8925-regulator.c) Please submit a followup which removes all the Linux-specific references and just enumerates the supported regulators. Please do also use a subject line appropriate for the subsystem - this is for the regulator driver so it should be regulator: updated in another patch, please help me review it, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mfd: max8925: update dt regulator binding doc
From: Qing Xu remove linux specific references, enumerates all supported regulators Signed-off-by: Qing Xu --- .../bindings/regulator/max8925-regulator.txt | 51 1 files changed, 31 insertions(+), 20 deletions(-) diff --git a/Documentation/devicetree/bindings/regulator/max8925-regulator.txt b/Documentation/devicetree/bindings/regulator/max8925-regulator.txt index 073b41d..0057695 100644 --- a/Documentation/devicetree/bindings/regulator/max8925-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/max8925-regulator.txt @@ -1,29 +1,40 @@ Max8925 Voltage regulators -max8925 regulator device register is still handled by mfd_add_devices, not by -of_xxx, so, it is not necessary to add compatible name. Also, those reg -offset and id info is stored in mfd_cell(see max8925-core.c), as a result -there is not private properties in dts. - -node's name should match with the definition in max8925_regulator_matches -(see max8925-regulator.c) - +Required nodes: +-nodes: + - SDV1 for SDV SDV1 + - SDV2 for SDV SDV2 + - SDV3 for SDV SDV3 + - LDO1 for LDO LDO1 + - LDO2 for LDO LDO2 + - LDO3 for LDO LDO3 + - LDO4 for LDO LDO4 + - LDO5 for LDO LDO5 + - LDO6 for LDO LDO6 + - LDO7 for LDO LDO7 + - LDO8 for LDO LDO8 + - LDO9 for LDO LDO9 + - LDO10 for LDO LDO10 + - LDO11 for LDO LDO11 + - LDO12 for LDO LDO12 + - LDO13 for LDO LDO13 + - LDO14 for LDO LDO14 + - LDO15 for LDO LDO15 + - LDO16 for LDO LDO16 + - LDO17 for LDO LDO17 + - LDO18 for LDO LDO18 + - LDO19 for LDO LDO19 + - LDO20 for LDO LDO20 Optional properties: - Any optional property defined in bindings/regulator/regulator.txt - Example: + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; - regulators { - SDV1 { - regulator-min-microvolt = <637500>; - regulator-max-microvolt = <1425000>; - regulator-boot-on; - regulator-always-on; - }; - - ... - ... - } -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 5/7] mfd: max8925: support dt for regulator
From: Qing Xu Signed-off-by: Qing Xu --- .../bindings/regulator/max8925-regulator.txt | 29 drivers/regulator/max8925-regulator.c | 72 +++- 2 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/max8925-regulator.txt diff --git a/Documentation/devicetree/bindings/regulator/max8925-regulator.txt b/Documentation/devicetree/bindings/regulator/max8925-regulator.txt new file mode 100644 index 000..073b41d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/max8925-regulator.txt @@ -0,0 +1,29 @@ +Max8925 Voltage regulators + +max8925 regulator device register is still handled by mfd_add_devices, not by +of_xxx, so, it is not necessary to add compatible name. Also, those reg +offset and id info is stored in mfd_cell(see max8925-core.c), as a result +there is not private properties in dts. + +node's name should match with the definition in max8925_regulator_matches +(see max8925-regulator.c) + + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + + +Example: + + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + + ... + ... + } diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 9bb0be3..2b54979 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #define SD1_DVM_VMIN 85 #define SD1_DVM_VMAX 100 @@ -187,6 +189,34 @@ static struct regulator_ops max8925_regulator_ldo_ops = { .enable_reg = MAX8925_LDOCTL##_id, \ } +#ifdef CONFIG_OF +static struct of_regulator_match max8925_regulator_matches[] = { + { .name = "SDV1",}, + { .name = "SDV2",}, + { .name = "SDV3",}, + { .name = "LDO1",}, + { .name = "LDO2",}, + { .name = "LDO3",}, + { .name = "LDO4",}, + { .name = "LDO5",}, + { .name = "LDO6",}, + { .name = "LDO7",}, + { .name = "LDO8",}, + { .name = "LDO9",}, + { .name = "LDO10",}, + { .name = "LDO11",}, + { .name = "LDO12",}, + { .name = "LDO13",}, + { .name = "LDO14",}, + { .name = "LDO15",}, + { .name = "LDO16",}, + { .name = "LDO17",}, + { .name = "LDO18",}, + { .name = "LDO19",}, + { .name = "LDO20",}, +}; +#endif + static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_SDV(1, 637.5, 1425, 12.5), MAX8925_SDV(2, 650, 2225, 25), @@ -214,6 +244,36 @@ static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_LDO(20, 750, 3900, 50), }; +#ifdef CONFIG_OF +static int max8925_regulator_dt_init(struct platform_device *pdev, + struct max8925_regulator_info *info, + struct regulator_config *config, + int ridx) +{ + struct device_node *nproot, *np; + int rcount; + nproot = pdev->dev.parent->of_node; + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, "regulators"); + if (!np) { + dev_err(>dev, "failed to find regulators node\n"); + return -ENODEV; + } + + rcount = of_regulator_match(>dev, np, + _regulator_matches[ridx], 1); + if (rcount < 0) + return -ENODEV; + config->init_data = max8925_regulator_matches[ridx].init_data; + config->of_node = max8925_regulator_matches[ridx].of_node; + + return 0; +} +#else +#define max8925_regulator_dt_init(w, x, y, z) (-1) +#endif + static int __devinit max8925_regulator_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -222,7 +282,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) struct max8925_regulator_info *ri; struct resource *res; struct regulator_dev *rdev; - int i; + int i, regulator_idx; res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (!res) { @@ -231,9 +291,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) } for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) {
[PATCH v3 5/7] mfd: max8925: support dt for regulator
From: Qing Xu Signed-off-by: Qing Xu --- .../bindings/regulator/max8925-regulator.txt | 29 drivers/regulator/max8925-regulator.c | 72 +++- 2 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/max8925-regulator.txt diff --git a/Documentation/devicetree/bindings/regulator/max8925-regulator.txt b/Documentation/devicetree/bindings/regulator/max8925-regulator.txt new file mode 100644 index 000..073b41d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/max8925-regulator.txt @@ -0,0 +1,29 @@ +Max8925 Voltage regulators + +max8925 regulator device register is still handled by mfd_add_devices, not by +of_xxx, so, it is not necessary to add compatible name. Also, those reg +offset and id info is stored in mfd_cell(see max8925-core.c), as a result +there is not private properties in dts. + +node's name should match with the definition in max8925_regulator_matches +(see max8925-regulator.c) + + +Optional properties: +- Any optional property defined in bindings/regulator/regulator.txt + + +Example: + + + regulators { + SDV1 { + regulator-min-microvolt = <637500>; + regulator-max-microvolt = <1425000>; + regulator-boot-on; + regulator-always-on; + }; + + ... + ... + } diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 9bb0be3..5e84921 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #define SD1_DVM_VMIN 85 #define SD1_DVM_VMAX 100 @@ -187,6 +189,34 @@ static struct regulator_ops max8925_regulator_ldo_ops = { .enable_reg = MAX8925_LDOCTL##_id, \ } +#ifdef CONFIG_OF +static struct of_regulator_match max8925_regulator_matches[] = { + { .name = "SDV1",}, + { .name = "SDV2",}, + { .name = "SDV3",}, + { .name = "LDO1",}, + { .name = "LDO2",}, + { .name = "LDO3",}, + { .name = "LDO4",}, + { .name = "LDO5",}, + { .name = "LDO6",}, + { .name = "LDO7",}, + { .name = "LDO8",}, + { .name = "LDO9",}, + { .name = "LDO10",}, + { .name = "LDO11",}, + { .name = "LDO12",}, + { .name = "LDO13",}, + { .name = "LDO14",}, + { .name = "LDO15",}, + { .name = "LDO16",}, + { .name = "LDO17",}, + { .name = "LDO18",}, + { .name = "LDO19",}, + { .name = "LDO20",}, +}; +#endif + static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_SDV(1, 637.5, 1425, 12.5), MAX8925_SDV(2, 650, 2225, 25), @@ -214,6 +244,36 @@ static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_LDO(20, 750, 3900, 50), }; +#ifdef CONFIG_OF +static int max8925_regulator_dt_init(struct platform_device *pdev, + struct max8925_regulator_info *info, + struct regulator_config *config, + int ridx) +{ + struct device_node *nproot, *np; + int rcount; + nproot = pdev->dev.parent->of_node; + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, "regulators"); + if (!np) { + dev_err(>dev, "failed to find regulators node\n"); + return -ENODEV; + } + + rcount = of_regulator_match(>dev, np, + _regulator_matches[ridx], 1); + if (rcount < 0) + return -ENODEV; + config->init_data = max8925_regulator_matches[ridx].init_data; + config->of_node = max8925_regulator_matches[ridx].of_node; + + return 0; +} +#else +#define max8925_regulator_dt_init(x, y, z) (-1) +#endif + static int __devinit max8925_regulator_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -222,7 +282,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) struct max8925_regulator_info *ri; struct resource *res; struct regulator_dev *rdev; - int i; + int i, regulator_idx; res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (!res) { @@ -231,9 +291,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) } for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) {
Re: [PATCH 5/7] mfd: max8925: support dt for regulator
On 11/06/2012 05:01 PM, Mark Brown wrote: On Tue, Nov 06, 2012 at 03:44:52PM +0800, Qing Xu wrote: From: Qing Xu Signed-off-by: Qing Xu --- drivers/regulator/max8925-regulator.c | 35 - 1 files changed, 34 insertions(+), 1 deletions(-) There is no binding document here, documentation is required for all new bindings. + nproot = of_find_node_by_name(nproot, "regulators"); + if (!nproot) { + dev_err(>dev, "failed to find regulators node\n"); + return -ENODEV; + } + for_each_child_of_node(nproot, np) { + if (!of_node_cmp(np->name, info->desc.name)) { + config->init_data = + of_get_regulator_init_data(>dev, np); + config->of_node = np; + break; + } + } You appear to be open coding something like the standard helpers in of_regulator.h, you should use those helpers. Mark, thanks for your so quick response! I updated the patch in v2, please help me review it again. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 5/7] mfd: max8925: support dt for regulator
From: Qing Xu Signed-off-by: Qing Xu --- drivers/regulator/max8925-regulator.c | 72 +++- 1 files changed, 69 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index 9bb0be3..5e84921 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #define SD1_DVM_VMIN 85 #define SD1_DVM_VMAX 100 @@ -187,6 +189,34 @@ static struct regulator_ops max8925_regulator_ldo_ops = { .enable_reg = MAX8925_LDOCTL##_id, \ } +#ifdef CONFIG_OF +static struct of_regulator_match max8925_regulator_matches[] = { + { .name = "SDV1",}, + { .name = "SDV2",}, + { .name = "SDV3",}, + { .name = "LDO1",}, + { .name = "LDO2",}, + { .name = "LDO3",}, + { .name = "LDO4",}, + { .name = "LDO5",}, + { .name = "LDO6",}, + { .name = "LDO7",}, + { .name = "LDO8",}, + { .name = "LDO9",}, + { .name = "LDO10",}, + { .name = "LDO11",}, + { .name = "LDO12",}, + { .name = "LDO13",}, + { .name = "LDO14",}, + { .name = "LDO15",}, + { .name = "LDO16",}, + { .name = "LDO17",}, + { .name = "LDO18",}, + { .name = "LDO19",}, + { .name = "LDO20",}, +}; +#endif + static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_SDV(1, 637.5, 1425, 12.5), MAX8925_SDV(2, 650, 2225, 25), @@ -214,6 +244,36 @@ static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_LDO(20, 750, 3900, 50), }; +#ifdef CONFIG_OF +static int max8925_regulator_dt_init(struct platform_device *pdev, + struct max8925_regulator_info *info, + struct regulator_config *config, + int ridx) +{ + struct device_node *nproot, *np; + int rcount; + nproot = pdev->dev.parent->of_node; + if (!nproot) + return -ENODEV; + np = of_find_node_by_name(nproot, "regulators"); + if (!np) { + dev_err(>dev, "failed to find regulators node\n"); + return -ENODEV; + } + + rcount = of_regulator_match(>dev, np, + _regulator_matches[ridx], 1); + if (rcount < 0) + return -ENODEV; + config->init_data = max8925_regulator_matches[ridx].init_data; + config->of_node = max8925_regulator_matches[ridx].of_node; + + return 0; +} +#else +#define max8925_regulator_dt_init(x, y, z) (-1) +#endif + static int __devinit max8925_regulator_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -222,7 +282,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) struct max8925_regulator_info *ri; struct resource *res; struct regulator_dev *rdev; - int i; + int i, regulator_idx; res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (!res) { @@ -231,9 +291,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) } for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) { ri = _regulator_info[i]; - if (ri->vol_reg == res->start) + if (ri->vol_reg == res->start) { + regulator_idx = i; break; + } } + if (i == ARRAY_SIZE(max8925_regulator_info)) { dev_err(>dev, "Failed to find regulator %llu\n", (unsigned long long)res->start); @@ -243,9 +306,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ri->chip = chip; config.dev = >dev; - config.init_data = pdata; config.driver_data = ri; + if (max8925_regulator_dt_init(pdev, ri, , regulator_idx)) + if (pdata) + config.init_data = pdata; + rdev = regulator_register(>desc, ); if (IS_ERR(rdev)) { dev_err(>dev, "failed to register regulator %s\n", -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/