Re: [PATCH 1/1 v2] pwm_bl: Add support for backlight enable GPIO

2013-03-04 Thread Thierry Reding
On Mon, Mar 04, 2013 at 08:43:50PM -0800, Andrew Chew wrote:
> The backlight enable GPIO is specified in the device tree node for
> backlight.
> 
> Signed-off-by: Andrew Chew 
> ---
> I decided to go ahead with disabling/enabling the backlight via GPIO as
> needed.  Note that I named the new functions pwm_backlight_enable() and
> pwm_backlight_disable() (instead of something more gpio-specific) because
> I thought it would be convenient to have a generic hook for when someone
> wants to add yet more stuff to be done on enable/disable.
> 
> I tested this by going into /sys/class/backlight/backlight.n and manually
> adjusting the brightness, and checked the gpio state to see that it had
> the appropriate value.
> 
>  .../bindings/video/backlight/pwm-backlight.txt |2 +
>  drivers/video/backlight/pwm_bl.c   |   50 
> ++--
>  include/linux/pwm_backlight.h  |2 +
>  3 files changed, 50 insertions(+), 4 deletions(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
> b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
> index 1e4fc72..1ed4f0f 100644
> --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
> +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
> @@ -14,6 +14,8 @@ Required properties:
>  Optional properties:
>- pwm-names: a list of names for the PWM devices specified in the
> "pwms" property (see PWM binding[0])
> +  - enable-gpio: a GPIO that needs to be used to enable the backlight

According to Documentation/devicetree/bindings/gpio/gpio.txt this should
be called "enable-gpios".

> +  - enable-gpio-active-high: polarity of GPIO is active high (default is low)

There is OF_GPIO_ACTIVE_LOW, which is automatically parsed from the
second cell of a GPIO specifier. It will only work if you request the
GPIO using of_get_named_gpio_flags(), though, so it will only work in
the non-DT case.

I think using a regulator would be more appropriate, since it gives you
more flexibility than a plain GPIO. Does anybody see a problem with
using a regulator instead?

Thierry


pgpOelTVTf4Oe.pgp
Description: PGP signature


Re: [PATCH 1/1 v2] pwm_bl: Add support for backlight enable GPIO

2013-03-04 Thread Alex Courbot

On 03/05/2013 01:43 PM, Andrew Chew wrote:

The backlight enable GPIO is specified in the device tree node for
backlight.

Signed-off-by: Andrew Chew 
---
I decided to go ahead with disabling/enabling the backlight via GPIO as
needed.  Note that I named the new functions pwm_backlight_enable() and
pwm_backlight_disable() (instead of something more gpio-specific) because
I thought it would be convenient to have a generic hook for when someone
wants to add yet more stuff to be done on enable/disable.

I tested this by going into /sys/class/backlight/backlight.n and manually
adjusting the brightness, and checked the gpio state to see that it had
the appropriate value.

  .../bindings/video/backlight/pwm-backlight.txt |2 +
  drivers/video/backlight/pwm_bl.c   |   50 ++--
  include/linux/pwm_backlight.h  |2 +
  3 files changed, 50 insertions(+), 4 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
index 1e4fc72..1ed4f0f 100644
--- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
+++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
@@ -14,6 +14,8 @@ Required properties:
  Optional properties:
- pwm-names: a list of names for the PWM devices specified in the
 "pwms" property (see PWM binding[0])
+  - enable-gpio: a GPIO that needs to be used to enable the backlight
+  - enable-gpio-active-high: polarity of GPIO is active high (default is low)

  [0]: Documentation/devicetree/bindings/pwm/pwm.txt

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 069983c..7dd426e 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -20,10 +20,13 @@
  #include 
  #include 
  #include 
+#include 

  struct pwm_bl_data {
struct pwm_device   *pwm;
struct device   *dev;
+   int enable_gpio;
+   unsigned intenable_gpio_flags;
unsigned intperiod;
unsigned intlth_brightness;
unsigned int*levels;
@@ -35,6 +38,20 @@ struct pwm_bl_data {
void(*exit)(struct device *);
  };

+static void pwm_backlight_enable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb->enable_gpio))
+   gpio_set_value(pb->enable_gpio,
+  pb->enable_gpio_flags & GPIOF_INIT_HIGH ? 1 : 0);
+}
+
+static void pwm_backlight_disable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb->enable_gpio))
+   gpio_set_value(pb->enable_gpio,
+  pb->enable_gpio_flags & GPIOF_INIT_HIGH ? 0 : 1);
+}
+
  static int pwm_backlight_update_status(struct backlight_device *bl)
  {
struct pwm_bl_data *pb = dev_get_drvdata(>dev);
@@ -53,6 +70,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
+   pwm_backlight_disable(pb);


Maybe move the call to pwm_backlight_disable() before pwm_disable() to 
have a correctly nested power sequence?


Actually every call to pwm_disable/enable is near 
pwm_backlight_disable/enable, so you might as well want to call 
pwm_disable/enable within pwm_backlight_enable/disable to make the code 
more bullet-proof.



} else {
int duty_cycle;

@@ -67,6 +85,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
 (duty_cycle * (pb->period - pb->lth_brightness) / max);
pwm_config(pb->pwm, duty_cycle, pb->period);
pwm_enable(pb->pwm);
+   pwm_backlight_enable(pb);
}

if (pb->notify_after)
@@ -146,10 +165,15 @@ static int pwm_backlight_parse_dt(struct device *dev,
}

/*
-* TODO: Most users of this driver use a number of GPIOs to control
-*   backlight power. Support for specifying these needs to be
-*   added.
+* If "enable-gpio" is present, use that GPIO to enable the backlight.
+* The presence (or not) of "enable-gpio-active-high" will determine
+* the value of the GPIO.
 */
+   data->enable_gpio = of_get_named_gpio(node, "enable-gpio", 0);
+   if (of_property_read_bool(node, "enable-gpio-active-high"))
+   data->enable_gpio_flags = GPIOF_OUT_INIT_HIGH;
+   else
+   data->enable_gpio_flags = GPIOF_OUT_INIT_LOW;

return 0;
  }
@@ -207,12 +231,23 @@ static int pwm_backlight_probe(struct platform_device 
*pdev)
} else
max = data->max_brightness;

+   pb->enable_gpio = data->enable_gpio;
+   pb->enable_gpio_flags = data->enable_gpio_flags;
pb->notify = data->notify;

[PATCH 1/1 v2] pwm_bl: Add support for backlight enable GPIO

2013-03-04 Thread Andrew Chew
The backlight enable GPIO is specified in the device tree node for
backlight.

Signed-off-by: Andrew Chew 
---
I decided to go ahead with disabling/enabling the backlight via GPIO as
needed.  Note that I named the new functions pwm_backlight_enable() and
pwm_backlight_disable() (instead of something more gpio-specific) because
I thought it would be convenient to have a generic hook for when someone
wants to add yet more stuff to be done on enable/disable.

I tested this by going into /sys/class/backlight/backlight.n and manually
adjusting the brightness, and checked the gpio state to see that it had
the appropriate value.

 .../bindings/video/backlight/pwm-backlight.txt |2 +
 drivers/video/backlight/pwm_bl.c   |   50 ++--
 include/linux/pwm_backlight.h  |2 +
 3 files changed, 50 insertions(+), 4 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
index 1e4fc72..1ed4f0f 100644
--- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
+++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
@@ -14,6 +14,8 @@ Required properties:
 Optional properties:
   - pwm-names: a list of names for the PWM devices specified in the
"pwms" property (see PWM binding[0])
+  - enable-gpio: a GPIO that needs to be used to enable the backlight
+  - enable-gpio-active-high: polarity of GPIO is active high (default is low)
 
 [0]: Documentation/devicetree/bindings/pwm/pwm.txt
 
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 069983c..7dd426e 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -20,10 +20,13 @@
 #include 
 #include 
 #include 
+#include 
 
 struct pwm_bl_data {
struct pwm_device   *pwm;
struct device   *dev;
+   int enable_gpio;
+   unsigned intenable_gpio_flags;
unsigned intperiod;
unsigned intlth_brightness;
unsigned int*levels;
@@ -35,6 +38,20 @@ struct pwm_bl_data {
void(*exit)(struct device *);
 };
 
+static void pwm_backlight_enable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb->enable_gpio))
+   gpio_set_value(pb->enable_gpio,
+  pb->enable_gpio_flags & GPIOF_INIT_HIGH ? 1 : 0);
+}
+
+static void pwm_backlight_disable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb->enable_gpio))
+   gpio_set_value(pb->enable_gpio,
+  pb->enable_gpio_flags & GPIOF_INIT_HIGH ? 0 : 1);
+}
+
 static int pwm_backlight_update_status(struct backlight_device *bl)
 {
struct pwm_bl_data *pb = dev_get_drvdata(>dev);
@@ -53,6 +70,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
+   pwm_backlight_disable(pb);
} else {
int duty_cycle;
 
@@ -67,6 +85,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
 (duty_cycle * (pb->period - pb->lth_brightness) / max);
pwm_config(pb->pwm, duty_cycle, pb->period);
pwm_enable(pb->pwm);
+   pwm_backlight_enable(pb);
}
 
if (pb->notify_after)
@@ -146,10 +165,15 @@ static int pwm_backlight_parse_dt(struct device *dev,
}
 
/*
-* TODO: Most users of this driver use a number of GPIOs to control
-*   backlight power. Support for specifying these needs to be
-*   added.
+* If "enable-gpio" is present, use that GPIO to enable the backlight.
+* The presence (or not) of "enable-gpio-active-high" will determine
+* the value of the GPIO.
 */
+   data->enable_gpio = of_get_named_gpio(node, "enable-gpio", 0);
+   if (of_property_read_bool(node, "enable-gpio-active-high"))
+   data->enable_gpio_flags = GPIOF_OUT_INIT_HIGH;
+   else
+   data->enable_gpio_flags = GPIOF_OUT_INIT_LOW;
 
return 0;
 }
@@ -207,12 +231,23 @@ static int pwm_backlight_probe(struct platform_device 
*pdev)
} else
max = data->max_brightness;
 
+   pb->enable_gpio = data->enable_gpio;
+   pb->enable_gpio_flags = data->enable_gpio_flags;
pb->notify = data->notify;
pb->notify_after = data->notify_after;
pb->check_fb = data->check_fb;
pb->exit = data->exit;
pb->dev = >dev;
 
+   if (gpio_is_valid(pb->enable_gpio)) {
+   ret = gpio_request_one(pb->enable_gpio,
+   GPIOF_DIR_OUT | pb->enable_gpio_flags, "bl_en");
+   if (ret) {
+   dev_err(>dev, "failed to 

[PATCH 1/1 v2] pwm_bl: Add support for backlight enable GPIO

2013-03-04 Thread Andrew Chew
The backlight enable GPIO is specified in the device tree node for
backlight.

Signed-off-by: Andrew Chew ac...@nvidia.com
---
I decided to go ahead with disabling/enabling the backlight via GPIO as
needed.  Note that I named the new functions pwm_backlight_enable() and
pwm_backlight_disable() (instead of something more gpio-specific) because
I thought it would be convenient to have a generic hook for when someone
wants to add yet more stuff to be done on enable/disable.

I tested this by going into /sys/class/backlight/backlight.n and manually
adjusting the brightness, and checked the gpio state to see that it had
the appropriate value.

 .../bindings/video/backlight/pwm-backlight.txt |2 +
 drivers/video/backlight/pwm_bl.c   |   50 ++--
 include/linux/pwm_backlight.h  |2 +
 3 files changed, 50 insertions(+), 4 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
index 1e4fc72..1ed4f0f 100644
--- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
+++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
@@ -14,6 +14,8 @@ Required properties:
 Optional properties:
   - pwm-names: a list of names for the PWM devices specified in the
pwms property (see PWM binding[0])
+  - enable-gpio: a GPIO that needs to be used to enable the backlight
+  - enable-gpio-active-high: polarity of GPIO is active high (default is low)
 
 [0]: Documentation/devicetree/bindings/pwm/pwm.txt
 
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 069983c..7dd426e 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -20,10 +20,13 @@
 #include linux/pwm.h
 #include linux/pwm_backlight.h
 #include linux/slab.h
+#include linux/of_gpio.h
 
 struct pwm_bl_data {
struct pwm_device   *pwm;
struct device   *dev;
+   int enable_gpio;
+   unsigned intenable_gpio_flags;
unsigned intperiod;
unsigned intlth_brightness;
unsigned int*levels;
@@ -35,6 +38,20 @@ struct pwm_bl_data {
void(*exit)(struct device *);
 };
 
+static void pwm_backlight_enable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb-enable_gpio))
+   gpio_set_value(pb-enable_gpio,
+  pb-enable_gpio_flags  GPIOF_INIT_HIGH ? 1 : 0);
+}
+
+static void pwm_backlight_disable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb-enable_gpio))
+   gpio_set_value(pb-enable_gpio,
+  pb-enable_gpio_flags  GPIOF_INIT_HIGH ? 0 : 1);
+}
+
 static int pwm_backlight_update_status(struct backlight_device *bl)
 {
struct pwm_bl_data *pb = dev_get_drvdata(bl-dev);
@@ -53,6 +70,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
if (brightness == 0) {
pwm_config(pb-pwm, 0, pb-period);
pwm_disable(pb-pwm);
+   pwm_backlight_disable(pb);
} else {
int duty_cycle;
 
@@ -67,6 +85,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
 (duty_cycle * (pb-period - pb-lth_brightness) / max);
pwm_config(pb-pwm, duty_cycle, pb-period);
pwm_enable(pb-pwm);
+   pwm_backlight_enable(pb);
}
 
if (pb-notify_after)
@@ -146,10 +165,15 @@ static int pwm_backlight_parse_dt(struct device *dev,
}
 
/*
-* TODO: Most users of this driver use a number of GPIOs to control
-*   backlight power. Support for specifying these needs to be
-*   added.
+* If enable-gpio is present, use that GPIO to enable the backlight.
+* The presence (or not) of enable-gpio-active-high will determine
+* the value of the GPIO.
 */
+   data-enable_gpio = of_get_named_gpio(node, enable-gpio, 0);
+   if (of_property_read_bool(node, enable-gpio-active-high))
+   data-enable_gpio_flags = GPIOF_OUT_INIT_HIGH;
+   else
+   data-enable_gpio_flags = GPIOF_OUT_INIT_LOW;
 
return 0;
 }
@@ -207,12 +231,23 @@ static int pwm_backlight_probe(struct platform_device 
*pdev)
} else
max = data-max_brightness;
 
+   pb-enable_gpio = data-enable_gpio;
+   pb-enable_gpio_flags = data-enable_gpio_flags;
pb-notify = data-notify;
pb-notify_after = data-notify_after;
pb-check_fb = data-check_fb;
pb-exit = data-exit;
pb-dev = pdev-dev;
 
+   if (gpio_is_valid(pb-enable_gpio)) {
+   ret = gpio_request_one(pb-enable_gpio,
+   GPIOF_DIR_OUT | pb-enable_gpio_flags, bl_en);
+   if (ret) {
+ 

Re: [PATCH 1/1 v2] pwm_bl: Add support for backlight enable GPIO

2013-03-04 Thread Alex Courbot

On 03/05/2013 01:43 PM, Andrew Chew wrote:

The backlight enable GPIO is specified in the device tree node for
backlight.

Signed-off-by: Andrew Chew ac...@nvidia.com
---
I decided to go ahead with disabling/enabling the backlight via GPIO as
needed.  Note that I named the new functions pwm_backlight_enable() and
pwm_backlight_disable() (instead of something more gpio-specific) because
I thought it would be convenient to have a generic hook for when someone
wants to add yet more stuff to be done on enable/disable.

I tested this by going into /sys/class/backlight/backlight.n and manually
adjusting the brightness, and checked the gpio state to see that it had
the appropriate value.

  .../bindings/video/backlight/pwm-backlight.txt |2 +
  drivers/video/backlight/pwm_bl.c   |   50 ++--
  include/linux/pwm_backlight.h  |2 +
  3 files changed, 50 insertions(+), 4 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
index 1e4fc72..1ed4f0f 100644
--- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
+++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
@@ -14,6 +14,8 @@ Required properties:
  Optional properties:
- pwm-names: a list of names for the PWM devices specified in the
 pwms property (see PWM binding[0])
+  - enable-gpio: a GPIO that needs to be used to enable the backlight
+  - enable-gpio-active-high: polarity of GPIO is active high (default is low)

  [0]: Documentation/devicetree/bindings/pwm/pwm.txt

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 069983c..7dd426e 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -20,10 +20,13 @@
  #include linux/pwm.h
  #include linux/pwm_backlight.h
  #include linux/slab.h
+#include linux/of_gpio.h

  struct pwm_bl_data {
struct pwm_device   *pwm;
struct device   *dev;
+   int enable_gpio;
+   unsigned intenable_gpio_flags;
unsigned intperiod;
unsigned intlth_brightness;
unsigned int*levels;
@@ -35,6 +38,20 @@ struct pwm_bl_data {
void(*exit)(struct device *);
  };

+static void pwm_backlight_enable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb-enable_gpio))
+   gpio_set_value(pb-enable_gpio,
+  pb-enable_gpio_flags  GPIOF_INIT_HIGH ? 1 : 0);
+}
+
+static void pwm_backlight_disable(struct pwm_bl_data *pb)
+{
+   if (gpio_is_valid(pb-enable_gpio))
+   gpio_set_value(pb-enable_gpio,
+  pb-enable_gpio_flags  GPIOF_INIT_HIGH ? 0 : 1);
+}
+
  static int pwm_backlight_update_status(struct backlight_device *bl)
  {
struct pwm_bl_data *pb = dev_get_drvdata(bl-dev);
@@ -53,6 +70,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
if (brightness == 0) {
pwm_config(pb-pwm, 0, pb-period);
pwm_disable(pb-pwm);
+   pwm_backlight_disable(pb);


Maybe move the call to pwm_backlight_disable() before pwm_disable() to 
have a correctly nested power sequence?


Actually every call to pwm_disable/enable is near 
pwm_backlight_disable/enable, so you might as well want to call 
pwm_disable/enable within pwm_backlight_enable/disable to make the code 
more bullet-proof.



} else {
int duty_cycle;

@@ -67,6 +85,7 @@ static int pwm_backlight_update_status(struct 
backlight_device *bl)
 (duty_cycle * (pb-period - pb-lth_brightness) / max);
pwm_config(pb-pwm, duty_cycle, pb-period);
pwm_enable(pb-pwm);
+   pwm_backlight_enable(pb);
}

if (pb-notify_after)
@@ -146,10 +165,15 @@ static int pwm_backlight_parse_dt(struct device *dev,
}

/*
-* TODO: Most users of this driver use a number of GPIOs to control
-*   backlight power. Support for specifying these needs to be
-*   added.
+* If enable-gpio is present, use that GPIO to enable the backlight.
+* The presence (or not) of enable-gpio-active-high will determine
+* the value of the GPIO.
 */
+   data-enable_gpio = of_get_named_gpio(node, enable-gpio, 0);
+   if (of_property_read_bool(node, enable-gpio-active-high))
+   data-enable_gpio_flags = GPIOF_OUT_INIT_HIGH;
+   else
+   data-enable_gpio_flags = GPIOF_OUT_INIT_LOW;

return 0;
  }
@@ -207,12 +231,23 @@ static int pwm_backlight_probe(struct platform_device 
*pdev)
} else
max = data-max_brightness;

+   pb-enable_gpio = data-enable_gpio;
+   pb-enable_gpio_flags = data-enable_gpio_flags;

Re: [PATCH 1/1 v2] pwm_bl: Add support for backlight enable GPIO

2013-03-04 Thread Thierry Reding
On Mon, Mar 04, 2013 at 08:43:50PM -0800, Andrew Chew wrote:
 The backlight enable GPIO is specified in the device tree node for
 backlight.
 
 Signed-off-by: Andrew Chew ac...@nvidia.com
 ---
 I decided to go ahead with disabling/enabling the backlight via GPIO as
 needed.  Note that I named the new functions pwm_backlight_enable() and
 pwm_backlight_disable() (instead of something more gpio-specific) because
 I thought it would be convenient to have a generic hook for when someone
 wants to add yet more stuff to be done on enable/disable.
 
 I tested this by going into /sys/class/backlight/backlight.n and manually
 adjusting the brightness, and checked the gpio state to see that it had
 the appropriate value.
 
  .../bindings/video/backlight/pwm-backlight.txt |2 +
  drivers/video/backlight/pwm_bl.c   |   50 
 ++--
  include/linux/pwm_backlight.h  |2 +
  3 files changed, 50 insertions(+), 4 deletions(-)
 
 diff --git 
 a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt 
 b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
 index 1e4fc72..1ed4f0f 100644
 --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
 +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt
 @@ -14,6 +14,8 @@ Required properties:
  Optional properties:
- pwm-names: a list of names for the PWM devices specified in the
 pwms property (see PWM binding[0])
 +  - enable-gpio: a GPIO that needs to be used to enable the backlight

According to Documentation/devicetree/bindings/gpio/gpio.txt this should
be called enable-gpios.

 +  - enable-gpio-active-high: polarity of GPIO is active high (default is low)

There is OF_GPIO_ACTIVE_LOW, which is automatically parsed from the
second cell of a GPIO specifier. It will only work if you request the
GPIO using of_get_named_gpio_flags(), though, so it will only work in
the non-DT case.

I think using a regulator would be more appropriate, since it gives you
more flexibility than a plain GPIO. Does anybody see a problem with
using a regulator instead?

Thierry


pgpOelTVTf4Oe.pgp
Description: PGP signature