aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/wm8350-regulator.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index e7b89e704af6..94227dd6ba7b 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -290,6 +290,51 @@ static int wm8350_isink_is_enabled(struct regulator_dev *rdev)
290 return -EINVAL; 290 return -EINVAL;
291} 291}
292 292
293static int wm8350_isink_enable_time(struct regulator_dev *rdev)
294{
295 struct wm8350 *wm8350 = rdev_get_drvdata(rdev);
296 int isink = rdev_get_id(rdev);
297 int reg;
298
299 switch (isink) {
300 case WM8350_ISINK_A:
301 reg = wm8350_reg_read(wm8350, WM8350_CSA_FLASH_CONTROL);
302 break;
303 case WM8350_ISINK_B:
304 reg = wm8350_reg_read(wm8350, WM8350_CSB_FLASH_CONTROL);
305 break;
306 default:
307 return -EINVAL;
308 }
309
310 if (reg & WM8350_CS1_FLASH_MODE) {
311 switch (reg & WM8350_CS1_ON_RAMP_MASK) {
312 case 0:
313 return 0;
314 case 1:
315 return 1950;
316 case 2:
317 return 3910;
318 case 3:
319 return 7800;
320 }
321 } else {
322 switch (reg & WM8350_CS1_ON_RAMP_MASK) {
323 case 0:
324 return 0;
325 case 1:
326 return 250000;
327 case 2:
328 return 500000;
329 case 3:
330 return 1000000;
331 }
332 }
333
334 return -EINVAL;
335}
336
337
293int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode, 338int wm8350_isink_set_flash(struct wm8350 *wm8350, int isink, u16 mode,
294 u16 trigger, u16 duration, u16 on_ramp, u16 off_ramp, 339 u16 trigger, u16 duration, u16 on_ramp, u16 off_ramp,
295 u16 drive) 340 u16 drive)
@@ -1221,6 +1266,7 @@ static struct regulator_ops wm8350_isink_ops = {
1221 .enable = wm8350_isink_enable, 1266 .enable = wm8350_isink_enable,
1222 .disable = wm8350_isink_disable, 1267 .disable = wm8350_isink_disable,
1223 .is_enabled = wm8350_isink_is_enabled, 1268 .is_enabled = wm8350_isink_is_enabled,
1269 .enable_time = wm8350_isink_enable_time,
1224}; 1270};
1225 1271
1226static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = { 1272static struct regulator_desc wm8350_reg[NUM_WM8350_REGULATORS] = {