aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2013-05-07 03:14:49 -0400
committerBryan Wu <cooloney@gmail.com>2013-06-20 19:21:32 -0400
commite015050cc5ea01e4beba3862dcafef9360c77522 (patch)
treebd63a78d9df9ce2986585fac10384f52d5ae569b
parent2dac912809490ea3a6e5c16b83b54a08f36fc3d9 (diff)
leds: lp5562: support the device tree feature
The LP55xx DT structure is applicable to the LP5562 device. The driver and documentation are updated. Compatible property of the DT : LP5521 and LP5223 were manufactured by National Semiconductor. LP5562 is a new device from Texas Instruments. Cc: Gabriel Fernandez <gabriel.fernandez@stericsson.com> Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r--Documentation/devicetree/bindings/leds/leds-lp55xx.txt37
-rw-r--r--drivers/leds/leds-lp5562.c19
2 files changed, 49 insertions, 7 deletions
diff --git a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt
index 1ed6bb0ce777..d5176882d8b9 100644
--- a/Documentation/devicetree/bindings/leds/leds-lp55xx.txt
+++ b/Documentation/devicetree/bindings/leds/leds-lp55xx.txt
@@ -1,7 +1,7 @@
1Binding for National Semiconductor LP55xx Led Drivers 1Binding for TI/National Semiconductor LP55xx Led Drivers
2 2
3Required properties: 3Required properties:
4- compatible: "national,lp5521" or "national,lp5523" 4- compatible: "national,lp5521" or "national,lp5523" or "ti,lp5562"
5- reg: I2C slave address 5- reg: I2C slave address
6- clock-mode: Input clock mode, (0: automode, 1: internal, 2: external) 6- clock-mode: Input clock mode, (0: automode, 1: internal, 2: external)
7 7
@@ -112,3 +112,36 @@ lp5523@32 {
112 max-cur = /bits/ 8 <0x20>; 112 max-cur = /bits/ 8 <0x20>;
113 }; 113 };
114}; 114};
115
116example 3) LP5562
1174 channels are defined.
118
119lp5562@30 {
120 compatible = "ti,lp5562";
121 reg = <0x30>;
122 clock-mode = /bits/8 <2>;
123
124 chan0 {
125 chan-name = "R";
126 led-cur = /bits/ 8 <0x20>;
127 max-cur = /bits/ 8 <0x60>;
128 };
129
130 chan1 {
131 chan-name = "G";
132 led-cur = /bits/ 8 <0x20>;
133 max-cur = /bits/ 8 <0x60>;
134 };
135
136 chan2 {
137 chan-name = "B";
138 led-cur = /bits/ 8 <0x20>;
139 max-cur = /bits/ 8 <0x60>;
140 };
141
142 chan3 {
143 chan-name = "W";
144 led-cur = /bits/ 8 <0x20>;
145 max-cur = /bits/ 8 <0x60>;
146 };
147};
diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c
index 513f2390ca2d..e53bcb89a978 100644
--- a/drivers/leds/leds-lp5562.c
+++ b/drivers/leds/leds-lp5562.c
@@ -515,12 +515,20 @@ static int lp5562_probe(struct i2c_client *client,
515 int ret; 515 int ret;
516 struct lp55xx_chip *chip; 516 struct lp55xx_chip *chip;
517 struct lp55xx_led *led; 517 struct lp55xx_led *led;
518 struct lp55xx_platform_data *pdata = client->dev.platform_data; 518 struct lp55xx_platform_data *pdata;
519 519 struct device_node *np = client->dev.of_node;
520 if (!pdata) { 520
521 dev_err(&client->dev, "no platform data\n"); 521 if (!client->dev.platform_data) {
522 return -EINVAL; 522 if (np) {
523 ret = lp55xx_of_populate_pdata(&client->dev, np);
524 if (ret < 0)
525 return ret;
526 } else {
527 dev_err(&client->dev, "no platform data\n");
528 return -EINVAL;
529 }
523 } 530 }
531 pdata = client->dev.platform_data;
524 532
525 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); 533 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
526 if (!chip) 534 if (!chip)
@@ -579,6 +587,7 @@ static int lp5562_remove(struct i2c_client *client)
579 587
580static const struct i2c_device_id lp5562_id[] = { 588static const struct i2c_device_id lp5562_id[] = {
581 { "lp5562", 0 }, 589 { "lp5562", 0 },
590 { "ti,lp5562", 0 }, /* OF compatible */
582 { } 591 { }
583}; 592};
584MODULE_DEVICE_TABLE(i2c, lp5562_id); 593MODULE_DEVICE_TABLE(i2c, lp5562_id);