1
0
Fork 0

- New Functionality

- Add support for an enable regulator to lp855x_bl
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXnxc3AAoJEFGvii+H/HdhWqMP+wV7w4p8lfO7sjA3Bbb4IQCv
 A0Rh2Xog1xVr/abFo4WE43oILZ5EiqWd/89vJJkidgtGBknUTxxICS5bh8Eloy8A
 0LOWdpjHnbrYKHFrmsdXM9nwOdO4GCaUXO3TaKUuuRsiMqpHQ7h5t/+beTdFCpx9
 6eOxeCvcLI3Qt3Fzn//Y6Nhe2TZKg3POc5b8Ces9LbsBkFs4XUwrhkvD1i14UM+E
 dPHNn7faCf0rxvvyzqtNtorMj6vg2SyxHyC3eSGGZ4gZUeu/bjSWIUrrZLN53/2D
 Jk0ay1Db5AOIrWyFUZeJT9x0GwX35RwtDHpy+AN/kvafXRCB/eMfkXmzkTmX10FZ
 Z/oBjyn8Sepqf0OaAINoj3ClXe3MeoVJk5TVHKoAuquVSL2f+E8PocOY98d8Qf6Q
 K/8+TSH9CyD93Ad1NQ6vqHz75RAsOwM4Ntir8d8ppSn795JlxvHT/isxwxDR8Lp9
 sRn8a17MG6RgWv7iPddUib8X4xtjsiv9cLwUBt5u4CNNrWTAeUc4vI81DFWK5H07
 DUaL6YofNqAhusSkdYtQfYrkpAywJsOjhFABghVCMnXbr0Gqwq0bV0vNRL5zMxZm
 kLk49eD2Zu6F3Huyr1v/6jmljVz+WvsAyTUIbvWMoW5SRDMsBoHg1gwAUKG1wKk0
 dzQhy/t3Z3RiLi2C7gLa
 =rUNA
 -----END PGP SIGNATURE-----

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
hifive-unleashed-5.1
Linus Torvalds 2016-08-01 07:32:32 -04:00
commit 7a66ecfd31
2 changed files with 31 additions and 0 deletions

View File

@ -13,6 +13,7 @@ Optional properties:
- rom-addr: Register address of ROM area to be updated (u8)
- rom-val: Register value to be updated (u8)
- power-supply: Regulator which controls the 3V rail
- enable-supply: Regulator which controls the EN/VDDIO input
Example:
@ -57,6 +58,7 @@ Example:
backlight@2c {
compatible = "ti,lp8557";
reg = <0x2c>;
enable-supply = <&backlight_vddio>;
power-supply = <&backlight_vdd>;
dev-ctrl = /bits/ 8 <0x41>;

View File

@ -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);