Skip to contentSkip to conversation

leds: leds-mc13783: Add devicetree support

PATCH Superseded Alexander Shiyan 2 participants 4 messages Dec 7, 2013

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 leds: leds-mc13783: Add devicetree support

This patch adds devicetree support for the MC13XXX LED driver.

---
 Documentation/devicetree/bindings/mfd/mc13xxx.txt |  38 +++++
 drivers/leds/leds-mc13783.c                       | 161 ++++++++++++++--------
 2 files changed, 143 insertions(+), 56 deletions(-)
Documentation/devicetree/bindings/mfd/mc13xxx.txt +38 -0
index abd9e3c..bdf31e8 100644
@@ -10,9 +10,37 @@ Optional properties:
 - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
 
 Sub-nodes:
+- leds : Contain the led nodes and initial register values in property
+  "led_control". Number of register depends of used IC, for MC13783 is 6,
+  for MC13892 is 4. See datasheet for bits definitions of these register.
+  Each led node should contain "reg", which used as LED ID (described below).
+  Optional properties "label" and "linux,default-trigger" is described in
+  Documentation/devicetree/bindings/leds/common.txt.
 - regulators : Contain the regulator nodes. The regulators are bound using
   their names as listed below with their registers and bits for enabling.
 
+MC13783 LED IDs:
+    0  : Main display
+    1  : AUX display
+    2  : Keypad
+    3  : Red 1
+    4  : Green 1
+    5  : Blue 1
+    6  : Red 2
+    7  : Green 2
+    8  : Blue 2
+    9  : Red 3
+    10 : Green 3
+    11 : Blue 3
+
+MC13892 LED IDs:
+    12 : Main display
+    13 : AUX display
+    14 : Keypad
+    15 : Red
+    16 : Green
+    17 : Blue
+
 MC13783 regulators:
     sw1a      : regulator SW1A      (register 24, bit 0)
     sw1b      : regulator SW1B      (register 25, bit 0)
@@ -89,6 +117,16 @@ ecspi@70010000 { /* ECSPI1 */
 		interrupt-parent = <&gpio0>;
 		interrupts = <8>;
 
+		leds {
+			led_control = <0x000 0x000 0x0e0 0x000>;
+
+			system_led {
+				reg = <15>;
+				label = "system:red:live";
+				linux,default-trigger = "heartbeat";
+			};
+		};
+
 		regulators {
 			sw1_reg: mc13892__sw1 {
 				regulator-min-microvolt = <600000>;
drivers/leds/leds-mc13783.c +105 -56

305 lines not on this page · raw message

Signature · 6 lines
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

Hi Alexander,

Please see my comments inline.

Quoted 13 lines · On Saturday 07 of December 2013 10:24:24 Alexander Shiyan wrote:

This patch adds devicetree support for the MC13XXX LED driver.

---
 Documentation/devicetree/bindings/mfd/mc13xxx.txt |  38 +++++
 drivers/leds/leds-mc13783.c                       | 161 ++++++++++++++--------
 2 files changed, 143 insertions(+), 56 deletions(-)
Documentation/devicetree/bindings/mfd/mc13xxx.txt +0 -0
index abd9e3c..bdf31e8 100644

Documentation/devicetree/bindings/mfd/mc13xxx.txt Optional properties: · line 15

Quoted 6 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +3 -0
@@ -10,9 +10,37 @@ Optional properties:
 - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
 
 Sub-nodes:
+- leds : Contain the led nodes and initial register values in property
+  "led_control". Number of register depends of used IC, for MC13783 is 6,
+  for MC13892 is 4. See datasheet for bits definitions of these register.

Can't the driver somehow derive correct register values from LEDs listed as subnodes of this node? If not, I'd say that more fine grained properties should be used instead. What kind of configuration do these register control?

Also s/_/-/ in property names.

Quoted 17 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +14 -0
+  Each led node should contain "reg", which used as LED ID (described below).
+  Optional properties "label" and "linux,default-trigger" is described in
+  Documentation/devicetree/bindings/leds/common.txt.
 - regulators : Contain the regulator nodes. The regulators are bound using
   their names as listed below with their registers and bits for enabling.
 
+MC13783 LED IDs:
+    0  : Main display
+    1  : AUX display
+    2  : Keypad
+    3  : Red 1
+    4  : Green 1
+    5  : Blue 1
+    6  : Red 2
+    7  : Green 2
+    8  : Blue 2
+    9  : Red 3

Documentation/devicetree/bindings/mfd/mc13xxx.txt Optional properties: · line 42

Quoted 10 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +10 -0
+    10 : Green 3
+    11 : Blue 3
+
+MC13892 LED IDs:
+    12 : Main display
+    13 : AUX display
+    14 : Keypad
+    15 : Red
+    16 : Green
+    17 : Blue

This looks a bit strange. Does the numbering relate to hardware design in any way? From what I can see, those are just enums values from Linux driver, which doesn't seem the right namespace to export to DT.

Documentation/devicetree/bindings/mfd/mc13xxx.txt ecspi@70010000 { /* ECSPI1 */ · line 123

Quoted 12 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +5 -0
+
 MC13783 regulators:
     sw1a      : regulator SW1A      (register 24, bit 0)
     sw1b      : regulator SW1B      (register 25, bit 0)
@@ -89,6 +117,16 @@ ecspi@70010000 { /* ECSPI1 */
 		interrupt-parent = <&gpio0>;
 		interrupts = <8>;
 
+		leds {
+			led_control = <0x000 0x000 0x0e0 0x000>;
+
+			system_led {

s/_/-/ in node name and also whenever reg property is present, node name should be followed by @unit-address suffix where unit-address is the value of first address in reg property.

Quoted 14 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +6 -0
+				reg = <15>;
+				label = "system:red:live";
+				linux,default-trigger = "heartbeat";
+			};
+		};
+
 		regulators {
 			sw1_reg: mc13892__sw1 {
 				regulator-min-microvolt = <600000>;
drivers/leds/leds-mc13783.c +0 -0
index ca87a1b..bc3ea2b 100644

drivers/leds/leds-mc13783.c line 27

Quoted 9 lines
drivers/leds/leds-mc13783.c +1 -2
@@ -20,26 +20,27 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/leds.h>
+#include <linux/of.h>
 #include <linux/workqueue.h>
 #include <linux/mfd/mc13xxx.h>
 
-#define MC13XXX_REG_LED_CONTROL(x)	(51 + (x))
-

This and related changes qualify for a separate patch that would be a simple refactoring.

Quoted 115 lines
drivers/leds/leds-mc13783.c +27 -11
 struct mc13xxx_led_devtype {
 	int	led_min;
 	int	led_max;
 	int	num_regs;
+	u32	ledctrl_base;
 };
 
 struct mc13xxx_led {
 	struct led_classdev	cdev;
 	struct work_struct	work;
-	struct mc13xxx		*master;
 	enum led_brightness	new_brightness;
 	int			id;
+	struct mc13xxx_leds	*leds;
 };
 
 struct mc13xxx_leds {
+	struct mc13xxx			*master;
 	struct mc13xxx_led_devtype	*devtype;
 	int				num_leds;
 	struct mc13xxx_led		led[0];
@@ -48,23 +49,24 @@ struct mc13xxx_leds {
 static void mc13xxx_led_work(struct work_struct *work)
 {
 	struct mc13xxx_led *led = container_of(work, struct mc13xxx_led, work);
-	int reg, mask, value, bank, off, shift;
+	struct mc13xxx_leds *leds = led->leds;
+	unsigned int reg, mask, value, bank, off, shift;
 
 	switch (led->id) {
 	case MC13783_LED_MD:
-		reg = MC13XXX_REG_LED_CONTROL(2);
+		reg = 2;
 		shift = 9;
 		mask = 0x0f;
 		value = led->new_brightness >> 4;
 		break;
 	case MC13783_LED_AD:
-		reg = MC13XXX_REG_LED_CONTROL(2);
+		reg = 2;
 		shift = 13;
 		mask = 0x0f;
 		value = led->new_brightness >> 4;
 		break;
 	case MC13783_LED_KP:
-		reg = MC13XXX_REG_LED_CONTROL(2);
+		reg = 2;
 		shift = 17;
 		mask = 0x0f;
 		value = led->new_brightness >> 4;
@@ -80,25 +82,25 @@ static void mc13xxx_led_work(struct work_struct *work)
 	case MC13783_LED_B3:
 		off = led->id - MC13783_LED_R1;
 		bank = off / 3;
-		reg = MC13XXX_REG_LED_CONTROL(3) + bank;
+		reg = 3 + bank;
 		shift = (off - bank * 3) * 5 + 6;
 		value = led->new_brightness >> 3;
 		mask = 0x1f;
 		break;
 	case MC13892_LED_MD:
-		reg = MC13XXX_REG_LED_CONTROL(0);
+		reg = 0;
 		shift = 3;
 		mask = 0x3f;
 		value = led->new_brightness >> 2;
 		break;
 	case MC13892_LED_AD:
-		reg = MC13XXX_REG_LED_CONTROL(0);
+		reg = 0;
 		shift = 15;
 		mask = 0x3f;
 		value = led->new_brightness >> 2;
 		break;
 	case MC13892_LED_KP:
-		reg = MC13XXX_REG_LED_CONTROL(1);
+		reg = 1;
 		shift = 3;
 		mask = 0x3f;
 		value = led->new_brightness >> 2;
@@ -108,7 +110,7 @@ static void mc13xxx_led_work(struct work_struct *work)
 	case MC13892_LED_B:
 		off = led->id - MC13892_LED_R;
 		bank = off / 2;
-		reg = MC13XXX_REG_LED_CONTROL(2) + bank;
+		reg = 2 + bank;
 		shift = (off - bank * 2) * 12 + 3;
 		value = led->new_brightness >> 2;
 		mask = 0x3f;
@@ -117,7 +119,8 @@ static void mc13xxx_led_work(struct work_struct *work)
 		BUG();
 	}
 
-	mc13xxx_reg_rmw(led->master, reg, mask << shift, value << shift);
+	mc13xxx_reg_rmw(leds->master, leds->devtype->ledctrl_base + reg,
+			mask << shift, value << shift);
 }
 
 static void mc13xxx_led_set(struct led_classdev *led_cdev,
@@ -130,80 +133,121 @@ static void mc13xxx_led_set(struct led_classdev *led_cdev,
 	schedule_work(&led->work);
 }
 
+static int __init mc13xxx_led_setup_of(struct mc13xxx_leds *leds,
+				       struct device_node *parent)
+{
+#ifdef CONFIG_OF
+	struct device_node *child;
+	int ret, i = 0;
+
+	for_each_child_of_node(parent, child) {
+		ret = of_property_read_u32(child, "reg", &leds->led[i].id);
+		if (ret)
+			return ret;
+		leds->led[i].cdev.name = of_get_property(child, "label", NULL);

drivers/leds/leds-mc13783.c static void mc13xxx_led_set(struct led_classdev *led_cdev, · line 157

Quoted 10 lines
drivers/leds/leds-mc13783.c +10 -0
+		leds->led[i].cdev.default_trigger =
+			of_get_property(child, "linux,default-trigger", NULL);
+		i++;
+	}
+
+	return 0;
+#else
+	return -ENOTSUPP;
+#endif
+}

I believe the preferred way to use conditional compilation is:

#ifdef CONFIG_OF
static int __init mc13xxx_led_setup_of(struct mc13xxx_leds *leds,
struct device_node *parent)

{
	/* enabled variant */
}
#else
static inline int mc13xxx_led_setup_of(struct mc13xxx_leds *leds,
				       struct device_node *parent)
{
	return -ENOTSUPP;
}

#endif

This doesn't pollute function body with #ifdefs and allows explicitly marking the disabled variant inline.

Quoted 13 lines
drivers/leds/leds-mc13783.c +6 -2
+
 static int __init mc13xxx_led_probe(struct platform_device *pdev)
 {
-	struct mc13xxx_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
-	struct mc13xxx *mcdev = dev_get_drvdata(pdev->dev.parent);
+	struct device *dev = &pdev->dev;
+	struct mc13xxx_leds_platform_data *pdata = dev_get_platdata(dev);
+	struct mc13xxx *mcdev = dev_get_drvdata(dev->parent);
 	struct mc13xxx_led_devtype *devtype =
 		(struct mc13xxx_led_devtype *)pdev->id_entry->driver_data;
+	int i, num_leds = 0, ret = 0;
+	struct device_node *parent;
 	struct mc13xxx_leds *leds;

drivers/leds/leds-mc13783.c static void mc13xxx_led_set(struct led_classdev *led_cdev, · line 172

Quoted 10 lines
drivers/leds/leds-mc13783.c +4 -6
-	int i, id, num_leds, ret = -ENODATA;
-	u32 reg, init_led = 0;
-
-	if (!pdata) {
-		dev_err(&pdev->dev, "Missing platform data\n");
-		return -ENODEV;
+	u32 *ctrls = NULL, init_led = 0;
+
+	of_node_get(dev->parent->of_node);
+	parent = of_find_node_by_name(dev->parent->of_node, "leds");

Both lines above should be executed only if the device has been instantiated using DT.

Also of_find_node_by_name() is not the correct function to use. Please refer to its documentation to learn why. The function that should be used here is of_get_child_by_name().

drivers/leds/leds-mc13783.c static void mc13xxx_led_set(struct led_classdev *led_cdev, · line 180

Quoted 8 lines
drivers/leds/leds-mc13783.c +8 -0
+
+	if (pdata) {
+		num_leds = pdata->num_leds;
+		ctrls = pdata->led_control;
+	} else if (parent) {
+		num_leds = of_get_child_count(parent);
+		ret = of_property_read_u32_array(parent, "led_control", ctrls,
+						 devtype->num_regs);

Huh? Does this even work? The argument in place of ctrls is supposed to be the destination memory for read array. Your code sets ctrls to NULL above and then passes it to this function.

drivers/leds/leds-mc13783.c static void mc13xxx_led_set(struct led_classdev *led_cdev, · line 185

Quoted 5 lines
drivers/leds/leds-mc13783.c +4 -0
+		if (ret)
+			goto out_node_put;
+	} else {
+		return -ENODATA;
 	}

In general, I would rather adopt a completely different approach to DT enablement in this driver. Instead of splitting the probe into two almost completely different code paths in large if blocks, what about making mc13xxx_led_setup_of() allocate a platform data structure and fill it in with data parsed from DT, so the driver would then proceed normally as if the platform data were available? IMHO this should make the code much simpler and more readable.

Best regards,
Tomasz

#2 lore raw

PiBIaSBBbGV4YW5kZXIsCj4gCj4gUGxlYXNlIHNlZSBteSBjb21tZW50cyBpbmxpbmUuCj4gCj4g T24gU2F0dXJkYXkgMDcgb2YgRGVjZW1iZXIgMjAxMyAxMDoyNDoyNCBBbGV4YW5kZXIgU2hpeWFu IHdyb3RlOgo+ID4gVGhpcyBwYXRjaCBhZGRzIGRldmljZXRyZWUgc3VwcG9ydCBmb3IgdGhlIE1D MTNYWFggTEVEIGRyaXZlci4KPiA+IAo+ID4gU2lnbmVkLW9mZi1ieTogQWxleGFuZGVyIFNoaXlh biA8c2hjX3dvcmtAbWFpbC5ydT4KPiA+IC0tLQo+ID4gIERvY3VtZW50YXRpb24vZGV2aWNldHJl ZS9iaW5kaW5ncy9tZmQvbWMxM3h4eC50eHQgfCAgMzggKysrKysKPiA+ICBkcml2ZXJzL2xlZHMv bGVkcy1tYzEzNzgzLmMgICAgICAgICAgICAgICAgICAgICAgIHwgMTYxICsrKysrKysrKysrKysr LS0tLS0tLS0KPiA+ICAyIGZpbGVzIGNoYW5nZWQsIDE0MyBpbnNlcnRpb25zKCspLCA1NiBkZWxl dGlvbnMoLSkKPiA+IAo+ID4gZGlmZiAtLWdpdCBhL0RvY3VtZW50YXRpb24vZGV2aWNldHJlZS9i aW5kaW5ncy9tZmQvbWMxM3h4eC50eHQgYi9Eb2N1bWVudGF0aW9uL2RldmljZXRyZWUvYmluZGlu Z3MvbWZkL21jMTN4eHgudHh0Cj4gPiBpbmRleCBhYmQ5ZTNjLi5iZGYzMWU4IDEwMDY0NAo+ID4g LS0tIGEvRG9jdW1lbnRhdGlvbi9kZXZpY2V0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AgOCAgOiBCbHVlIDIKPiA+ICsgICAgOSAgOiBSZWQgMwo+ID4gKyAgICAxMCA6 IEdyZWVuIDMKPiA+ICsgICAgMTEgOiBCbHVlIDMKPiA+ICsKPiA+ICtNQzEzODkyIExFRCBJRHM6 Cj4gPiArICAgIDEyIDogTWFpbiBkaXNwbGF5Cj4gPiArICAgIDEzIDogQVVYIGRpc3BsYXkKPiA+ ICsgICAgMTQgOiBLZXlwYWQKPiA+ICsgICAgMTUgOiBSZWQKPiA+ICsgICAgMTYgOiBHcmVlbgo+ ID4gKyAgICAxNyA6IEJsdWUKPiAKPiBUaGlzIGxvb2tzIGEgYml0IHN0cmFuZ2UuIERvZXMgdGhl IG51bWJlcmluZyByZWxhdGUgdG8gaGFyZHdhcmUgZGVzaWduCj4gaW4gYW55IHdheT8gRnJvbSB3 aGF0IEkgY2FuIHNlZSwgdGhvc2UgYXJlIGp1c3QgZW51bXMgdmFsdWVzIGZyb20gTGludXgKPiBk cml2ZXIsIHdoaWNoIGRvZXNuJ3Qgc2VlbSB0aGUgcmlnaHQgbmFtZXNwYWNlIHRvIGV4cG9ydCB0 byBEVC4KCldoaWNoIGEgYmV0dGVyIHNvbHV0aW9uIGhlcmU/IE1ha2UgbmFtZXMgYXMgd2VsbCBh cyBmb3IgcmVndWxhdG9ycz8KVGhhbmtzLgoKLS0tCg==
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 67 lines · On Saturday 07 of December 2013 16:08:41 Alexander Shiyan wrote:
Quoted 20 lines

Hi Alexander,

Please see my comments inline.

Quoted 15 lines · On Saturday 07 of December 2013 10:24:24 Alexander Shiyan wrote:

This patch adds devicetree support for the MC13XXX LED driver.

---
 Documentation/devicetree/bindings/mfd/mc13xxx.txt |  38 +++++
 drivers/leds/leds-mc13783.c                       | 161 ++++++++++++++--------
 2 files changed, 143 insertions(+), 56 deletions(-)
Documentation/devicetree/bindings/mfd/mc13xxx.txt +0 -0
index abd9e3c..bdf31e8 100644
@@ -10,9 +10,37 @@ Optional properties:
 - fsl,mc13xxx-uses-touch : Indicate the touchscreen controller is being used
 
Quoted 9 lines

Documentation/devicetree/bindings/mfd/mc13xxx.txt Optional properties: · line 15

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +3 -0
 Sub-nodes:
+- leds : Contain the led nodes and initial register values in property
+  "led_control". Number of register depends of used IC, for MC13783 is 6,
+  for MC13892 is 4. See datasheet for bits definitions of these register.

Can't the driver somehow derive correct register values from LEDs listed as subnodes of this node? If not, I'd say that more fine grained properties should be used instead. What kind of configuration do these register control?

Registers contain the basic state for LED (high current mode, current, duty cycle, ramp etc.). Presence and bit position for each LED is individually. So I decided that the use of a simple initial setup is better, especially since these will not be changed during operation.

Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +20 -0
+  Each led node should contain "reg", which used as LED ID (described below).
+  Optional properties "label" and "linux,default-trigger" is described in
+  Documentation/devicetree/bindings/leds/common.txt.
 - regulators : Contain the regulator nodes. The regulators are bound using
   their names as listed below with their registers and bits for enabling.
 
+MC13783 LED IDs:
+    0  : Main display
+    1  : AUX display
+    2  : Keypad
+    3  : Red 1
+    4  : Green 1
+    5  : Blue 1
+    6  : Red 2
+    7  : Green 2
+    8  : Blue 2
+    9  : Red 3
+    10 : Green 3
+    11 : Blue 3
+
+MC13892 LED IDs:
+    12 : Main display
+    13 : AUX display
Quoted 8 lines

Documentation/devicetree/bindings/mfd/mc13xxx.txt Optional properties: · line 42

Quoted 4 lines
Documentation/devicetree/bindings/mfd/mc13xxx.txt +4 -0
+    14 : Keypad
+    15 : Red
+    16 : Green
+    17 : Blue

This looks a bit strange. Does the numbering relate to hardware design in any way? From what I can see, those are just enums values from Linux driver, which doesn't seem the right namespace to export to DT.

Quoted 2 lines

Which a better solution here? Make names as well as for regulators? Thanks.

I don't have anything against using simple numbers, but they should be somehow related to hardware layout. If such relation does not exist, then using the <0, number_of_leds_in_the_chip - 1> namespace should be fine.

Best regards,
Tomasz