backlight: gpio_backlight: Use a default state enum.
Subsystems (3)
PATCH v6 1/2 backlight: gpio_backlight: Use a default state enum.
That enum adds a "keep" state which permits to tell the
driver trough its platform data not to touch the hardware during the probe.
---
ChangeLog v5->v6:
- New patch.
--- drivers/video/backlight/gpio_backlight.c | 7 +++++-- include/linux/platform_data/gpio_backlight.h | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/video/backlight/gpio_backlight.c +5 -2
@@ -23,6 +23,7 @@ struct gpio_backlight {int gpio;int active; +enum gpio_backlight_default_state def_value; };static int gpio_backlight_update_status (struct backlight_device *bl)
@@ -103,8 +104,10 @@ static int gpio_backlight_probe(struct platform_device *pdev)return PTR_ERR (bl); } - bl->props.brightness = pdata->def_value; -backlight_update_status (bl); +if (pdata->def_value !=BACKLIGHT_GPIO_DEFSTATE_KEEP ) { + bl->props.brightness = pdata->def_value; +backlight_update_status (bl); + }platform_set_drvdata (pdev, bl);return 0 ;
include/linux/platform_data/gpio_backlight.h +6 -0
@@ -10,6 +10,12 @@struct device ; +enum gpio_backlight_default_state { +BACKLIGHT_GPIO_DEFSTATE_OFF , +BACKLIGHT_GPIO_DEFSTATE_ON , +BACKLIGHT_GPIO_DEFSTATE_KEEP , +}; +struct gpio_backlight_platform_data {struct device *fbdev;int gpio;
Signature · 1 line
1.7.9.5
PATCH v6 2/2 video: backlight: gpio-backlight: Add DT support.
---
ChangeLog v5->v6:
- The default state handling was reworked:
- it's now called default-state, and looks like the gpio-leds default-state.
- it now has a "keep" option, like for the gpio-leds.
- that "keep" option is the default when the default-state property is not set.
- The documentation was updated accordingly.
ChangeLog v4->v5:
- The default-brightness property now defaults to 0 in the driver.
- def_value int becomes a bool.
- The check for the gpio validity has been reworked.
--- .../bindings/video/backlight/gpio-backlight.txt | 23 +++++++ drivers/video/backlight/gpio_backlight.c | 72 +++++++++++++++++--- 2 files changed, 87 insertions(+), 8 deletions(-) create mode 100644 Documentation/devicetree/bindings/video/backlight/gpio-backlight.txt
Documentation/devicetree/bindings/video/backlight/gpio-backlight.txt new file +23 -0
@@ -0,0 +1,23 @@ +gpio-backlight bindings + +Required properties: + - compatible: "gpio-backlight" + - gpios: describes the gpio that is used for enabling/disabling the backlight + (see GPIO binding[0] for more details). + +Optional properties: + - default-state: The initial state of the backlight. + Valid values are "on", "off", and "keep". + The "keep" setting will keep the backlight at whatever its current + state is, without producing a glitch. The default is keep if this + property is not present. + +[0]: Documentation/devicetree/bindings/gpio/gpio.txt + +Example: + + backlight { + compatible = "gpio-backlight"; + gpios = <&gpio3 4 0>; + default-state = "on"; + };
drivers/video/backlight/gpio_backlight.c +64 -8
118 lines not on this page · raw message
Signature · 1 line
1.7.9.5