linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6/7] mfd: max8925: support dt for backlight
@ 2012-11-06  7:47 Qing Xu
  2012-11-23  7:23 ` Qing Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Qing Xu @ 2012-11-06  7:47 UTC (permalink / raw)
  To: qingx, rpurdie, FlorianSchandinat, sameo, grant.likely,
	rob.herring, haojian.zhuang, cxie4, linux-kernel,
	devicetree-discuss

From: Qing Xu <qingx@marvell.com>

Signed-off-by: Qing Xu <qingx@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:
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 6/7] mfd: max8925: support dt for backlight
  2012-11-06  7:47 [PATCH 6/7] mfd: max8925: support dt for backlight Qing Xu
@ 2012-11-23  7:23 ` Qing Xu
  2012-11-23  7:25 ` Qing Xu
  2012-11-23  9:08 ` Haojian Zhuang
  2 siblings, 0 replies; 5+ messages in thread
From: Qing Xu @ 2012-11-23  7:23 UTC (permalink / raw)
  To: Qing Xu
  Cc: rpurdie, FlorianSchandinat, sameo, grant.likely, rob.herring,
	haojian.zhuang, Chao Xie, linux-kernel, devicetree-discuss

On 11/06/2012 03:47 PM, Qing Xu wrote:
> From: Qing Xu <qingx@marvell.com>
>
> Signed-off-by: Qing Xu <qingx@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 6/7] mfd: max8925: support dt for backlight
  2012-11-06  7:47 [PATCH 6/7] mfd: max8925: support dt for backlight Qing Xu
  2012-11-23  7:23 ` Qing Xu
@ 2012-11-23  7:25 ` Qing Xu
  2012-11-23  9:08 ` Haojian Zhuang
  2 siblings, 0 replies; 5+ messages in thread
From: Qing Xu @ 2012-11-23  7:25 UTC (permalink / raw)
  To: Qing Xu
  Cc: rpurdie, FlorianSchandinat, sameo, grant.likely, rob.herring,
	haojian.zhuang, Chao Xie, linux-kernel, devicetree-discuss

On 11/06/2012 03:47 PM, Qing Xu wrote:
> From: Qing Xu <qingx@marvell.com>
>
> Signed-off-by: Qing Xu <qingx@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 6/7] mfd: max8925: support dt for backlight
  2012-11-06  7:47 [PATCH 6/7] mfd: max8925: support dt for backlight Qing Xu
  2012-11-23  7:23 ` Qing Xu
  2012-11-23  7:25 ` Qing Xu
@ 2012-11-23  9:08 ` Haojian Zhuang
  2012-11-28  2:11   ` Qing Xu
  2 siblings, 1 reply; 5+ messages in thread
From: Haojian Zhuang @ 2012-11-23  9:08 UTC (permalink / raw)
  To: Qing Xu
  Cc: rpurdie, FlorianSchandinat, Samuel Ortiz, Grant Likely,
	Rob Herring, cxie4, linux-kernel, devicetree-discuss

On Tue, Nov 6, 2012 at 3:47 PM, Qing Xu <qingx@marvell.com> wrote:
> From: Qing Xu <qingx@marvell.com>
>
> Signed-off-by: Qing Xu <qingx@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.

> +       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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 6/7] mfd: max8925: support dt for backlight
  2012-11-23  9:08 ` Haojian Zhuang
@ 2012-11-28  2:11   ` Qing Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Qing Xu @ 2012-11-28  2:11 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: rpurdie, FlorianSchandinat, Samuel Ortiz, Grant Likely,
	Rob Herring, Chao Xie, linux-kernel, devicetree-discuss

On 11/23/2012 05:08 PM, Haojian Zhuang wrote:
> On Tue, Nov 6, 2012 at 3:47 PM, Qing Xu <qingx@marvell.com> wrote:
>> From: Qing Xu <qingx@marvell.com>
>>
>> Signed-off-by: Qing Xu <qingx@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
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-11-28  2:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-06  7:47 [PATCH 6/7] mfd: max8925: support dt for backlight Qing Xu
2012-11-23  7:23 ` Qing Xu
2012-11-23  7:25 ` Qing Xu
2012-11-23  9:08 ` Haojian Zhuang
2012-11-28  2:11   ` Qing Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).