aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-01 07:32:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-01 07:32:32 -0400
commit7a66ecfd319af8fe4f4c3eadf019b998c93d6687 (patch)
tree8348e0748e0f7e8c4cf16dd0d39f16fa617542cf /drivers/video
parentMerge tag 'mfd-for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd (diff)
parentbacklight: lp855x: Add enable regulator (diff)
downloadlinux-dev-7a66ecfd319af8fe4f4c3eadf019b998c93d6687.tar.xz
linux-dev-7a66ecfd319af8fe4f4c3eadf019b998c93d6687.zip
Merge tag 'backlight-for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight
Pull backlight updates from Lee Jones: "Add support for an enable regulator to lp855x_bl" * tag 'backlight-for-linus-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: lp855x: Add enable regulator
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/backlight/lp855x_bl.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index e5b14f52628f..939f057836e1 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/backlight.h>
+#include <linux/delay.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/platform_data/lp855x.h>
@@ -74,6 +75,7 @@ struct lp855x {
struct lp855x_platform_data *pdata;
struct pwm_device *pwm;
struct regulator *supply; /* regulator for VDD input */
+ struct regulator *enable; /* regulator for EN/VDDIO input */
};
static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
@@ -433,6 +435,19 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
lp->supply = NULL;
}
+ lp->enable = devm_regulator_get_optional(lp->dev, "enable");
+ if (IS_ERR(lp->enable)) {
+ ret = PTR_ERR(lp->enable);
+ if (ret == -ENODEV) {
+ lp->enable = NULL;
+ } else {
+ if (ret != -EPROBE_DEFER)
+ dev_err(lp->dev, "error getting enable regulator: %d\n",
+ ret);
+ return ret;
+ }
+ }
+
if (lp->supply) {
ret = regulator_enable(lp->supply);
if (ret < 0) {
@@ -441,6 +456,20 @@ static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
}
}
+ if (lp->enable) {
+ ret = regulator_enable(lp->enable);
+ if (ret < 0) {
+ dev_err(lp->dev, "failed to enable vddio: %d\n", ret);
+ return ret;
+ }
+
+ /*
+ * LP8555 datasheet says t_RESPONSE (time between VDDIO and
+ * I2C) is 1ms.
+ */
+ usleep_range(1000, 2000);
+ }
+
i2c_set_clientdata(cl, lp);
ret = lp855x_configure(lp);