Skip to contentSkip to conversation

backlight: gpio_backlight: Use a default state enum.

PATCH Superseded Denis Carikli 1 participant 2 messages Nov 8, 2013

Subsystems (3)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

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.

Cc Richard Purdie <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Ian Campbell <[email protected]>
Cc devicetree at vger.kernel.org
Cc Sascha Hauer <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Lothar Wa?mann <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Eric B?nard <[email protected]>

---
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
index 81fb127..6ddeba9 100644
@@ -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
index 5ae0d9c..3b437b3 100644
@@ -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
#1 lore raw

PATCH v6 2/2 video: backlight: gpio-backlight: Add DT support.

Cc Richard Purdie <[email protected]>
Cc Jingoo Han <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Rob Herring <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Ian Campbell <[email protected]>
Cc devicetree at vger.kernel.org
Cc Sascha Hauer <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc Lothar Wa?mann <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Thierry Reding <[email protected]>
Cc Eric B?nard <[email protected]>

---
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
new file mode 100644
index 0000000..f36f6e3
@@ -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