aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp5562.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/leds-lp5562.c')
-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,
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);