summaryrefslogtreecommitdiff
path: root/drivers/leds
diff options
context:
space:
mode:
authorKim, Milo <Milo.Kim@ti.com>2013-05-07 00:14:49 -0700
committerBryan Wu <cooloney@gmail.com>2013-06-20 16:21:32 -0700
commite015050cc5ea01e4beba3862dcafef9360c77522 (patch)
treebd63a78d9df9ce2986585fac10384f52d5ae569b /drivers/leds
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>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lp5562.c19
1 files changed, 14 insertions, 5 deletions
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,
int ret;
struct lp55xx_chip *chip;
struct lp55xx_led *led;
- struct lp55xx_platform_data *pdata = client->dev.platform_data;
-
- if (!pdata) {
- dev_err(&client->dev, "no platform data\n");
- return -EINVAL;
+ struct lp55xx_platform_data *pdata;
+ struct device_node *np = client->dev.of_node;
+
+ if (!client->dev.platform_data) {
+ if (np) {
+ ret = lp55xx_of_populate_pdata(&client->dev, np);
+ if (ret < 0)
+ return ret;
+ } else {
+ dev_err(&client->dev, "no platform data\n");
+ return -EINVAL;
+ }
}
+ pdata = client->dev.platform_data;
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
@@ -579,6 +587,7 @@ static int lp5562_remove(struct i2c_client *client)
static const struct i2c_device_id lp5562_id[] = {
{ "lp5562", 0 },
+ { "ti,lp5562", 0 }, /* OF compatible */
{ }
};
MODULE_DEVICE_TABLE(i2c, lp5562_id);