aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2014-12-02 20:39:12 -0500
committerLee Jones <lee.jones@linaro.org>2014-12-09 04:24:45 -0500
commit829b030e58f8349a63909c0fff2fa1913d79314c (patch)
tree7fc2c2e84bd396b8299ab2635ec41472d18e652b /drivers/video/backlight
parent47726656dd67a2487bd7fafec1a73472da1db956 (diff)
backlight: lp855x: Add supply regulator to lp855x
This patch adds a supply regulator to the lp855x platform data to facilitate powering on/off the 3V rail attached to the controller. Cc: Stéphane Marchesin <marcheu@chromium.org> Cc: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> Acked-by: Milo Kim <milo.kim@ti.com> Acked-by: Bryan Wu <cooloney@gmail.com> Acked-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/lp855x_bl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 257b3badd8e4..a26d3bb25650 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -17,6 +17,7 @@
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/platform_data/lp855x.h> 18#include <linux/platform_data/lp855x.h>
19#include <linux/pwm.h> 19#include <linux/pwm.h>
20#include <linux/regulator/consumer.h>
20 21
21/* LP8550/1/2/3/6 Registers */ 22/* LP8550/1/2/3/6 Registers */
22#define LP855X_BRIGHTNESS_CTRL 0x00 23#define LP855X_BRIGHTNESS_CTRL 0x00
@@ -383,6 +384,13 @@ static int lp855x_parse_dt(struct lp855x *lp)
383 pdata->rom_data = &rom[0]; 384 pdata->rom_data = &rom[0];
384 } 385 }
385 386
387 pdata->supply = devm_regulator_get(dev, "power");
388 if (IS_ERR(pdata->supply)) {
389 if (PTR_ERR(pdata->supply) == -EPROBE_DEFER)
390 return -EPROBE_DEFER;
391 pdata->supply = NULL;
392 }
393
386 lp->pdata = pdata; 394 lp->pdata = pdata;
387 395
388 return 0; 396 return 0;
@@ -423,6 +431,14 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
423 else 431 else
424 lp->mode = REGISTER_BASED; 432 lp->mode = REGISTER_BASED;
425 433
434 if (lp->pdata->supply) {
435 ret = regulator_enable(lp->pdata->supply);
436 if (ret < 0) {
437 dev_err(&cl->dev, "failed to enable supply: %d\n", ret);
438 return ret;
439 }
440 }
441
426 i2c_set_clientdata(cl, lp); 442 i2c_set_clientdata(cl, lp);
427 443
428 ret = lp855x_configure(lp); 444 ret = lp855x_configure(lp);
@@ -454,6 +470,8 @@ static int lp855x_remove(struct i2c_client *cl)
454 470
455 lp->bl->props.brightness = 0; 471 lp->bl->props.brightness = 0;
456 backlight_update_status(lp->bl); 472 backlight_update_status(lp->bl);
473 if (lp->pdata->supply)
474 regulator_disable(lp->pdata->supply);
457 sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group); 475 sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
458 476
459 return 0; 477 return 0;