Lines Matching full:buck

3  * TI LP8788 MFD - buck regulator driver
96 /* BUCK 1 ~ 4 voltage ranges */
102 static void lp8788_buck1_set_dvs(struct lp8788_buck *buck) in lp8788_buck1_set_dvs() argument
104 struct lp8788_buck1_dvs *dvs = (struct lp8788_buck1_dvs *)buck->dvs; in lp8788_buck1_set_dvs()
111 gpiod_set_value(buck->gpio1, pinstate); in lp8788_buck1_set_dvs()
114 static void lp8788_buck2_set_dvs(struct lp8788_buck *buck) in lp8788_buck2_set_dvs() argument
116 struct lp8788_buck2_dvs *dvs = (struct lp8788_buck2_dvs *)buck->dvs; in lp8788_buck2_set_dvs()
143 gpiod_set_value(buck->gpio1, pin1); in lp8788_buck2_set_dvs()
144 gpiod_set_value(buck->gpio2, pin2); in lp8788_buck2_set_dvs()
147 static void lp8788_set_dvs(struct lp8788_buck *buck, enum lp8788_buck_id id) in lp8788_set_dvs() argument
151 lp8788_buck1_set_dvs(buck); in lp8788_set_dvs()
154 lp8788_buck2_set_dvs(buck); in lp8788_set_dvs()
162 lp8788_get_buck_dvs_ctrl_mode(struct lp8788_buck *buck, enum lp8788_buck_id id) in lp8788_get_buck_dvs_ctrl_mode() argument
177 lp8788_read_byte(buck->lp, LP8788_BUCK_DVS_SEL, &val); in lp8788_get_buck_dvs_ctrl_mode()
199 static u8 lp8788_select_buck_vout_addr(struct lp8788_buck *buck, in lp8788_select_buck_vout_addr() argument
202 enum lp8788_dvs_mode mode = lp8788_get_buck_dvs_ctrl_mode(buck, id); in lp8788_select_buck_vout_addr()
209 idx = gpiod_get_value(buck->gpio1); in lp8788_select_buck_vout_addr()
211 lp8788_read_byte(buck->lp, LP8788_BUCK_DVS_SEL, &val); in lp8788_select_buck_vout_addr()
218 pin1 = gpiod_get_value(buck->gpio1); in lp8788_select_buck_vout_addr()
219 pin2 = gpiod_get_value(buck->gpio2); in lp8788_select_buck_vout_addr()
230 lp8788_read_byte(buck->lp, LP8788_BUCK_DVS_SEL, &val); in lp8788_select_buck_vout_addr()
247 struct lp8788_buck *buck = rdev_get_drvdata(rdev); in lp8788_buck12_set_voltage_sel() local
251 if (buck->dvs) in lp8788_buck12_set_voltage_sel()
252 lp8788_set_dvs(buck, id); in lp8788_buck12_set_voltage_sel()
254 addr = lp8788_select_buck_vout_addr(buck, id); in lp8788_buck12_set_voltage_sel()
258 return lp8788_update_bits(buck->lp, addr, LP8788_VOUT_M, selector); in lp8788_buck12_set_voltage_sel()
263 struct lp8788_buck *buck = rdev_get_drvdata(rdev); in lp8788_buck12_get_voltage_sel() local
268 addr = lp8788_select_buck_vout_addr(buck, id); in lp8788_buck12_get_voltage_sel()
272 ret = lp8788_read_byte(buck->lp, addr, &val); in lp8788_buck12_get_voltage_sel()
281 struct lp8788_buck *buck = rdev_get_drvdata(rdev); in lp8788_buck_enable_time() local
285 if (lp8788_read_byte(buck->lp, addr, &val)) in lp8788_buck_enable_time()
295 struct lp8788_buck *buck = rdev_get_drvdata(rdev); in lp8788_buck_set_mode() local
311 return lp8788_update_bits(buck->lp, LP8788_BUCK_PWM, mask, val); in lp8788_buck_set_mode()
316 struct lp8788_buck *buck = rdev_get_drvdata(rdev); in lp8788_buck_get_mode() local
321 ret = lp8788_read_byte(buck->lp, LP8788_BUCK_PWM, &val); in lp8788_buck_get_mode()
411 struct lp8788_buck *buck, in lp8788_dvs_gpio_request() argument
414 struct lp8788_platform_data *pdata = buck->lp->pdata; in lp8788_dvs_gpio_request()
419 buck->gpio1 = devm_gpiod_get(dev, "dvs", GPIOD_OUT_LOW); in lp8788_dvs_gpio_request()
420 if (IS_ERR(buck->gpio1)) in lp8788_dvs_gpio_request()
421 return PTR_ERR(buck->gpio1); in lp8788_dvs_gpio_request()
422 gpiod_set_consumer_name(buck->gpio1, "LP8788_B1_DVS"); in lp8788_dvs_gpio_request()
424 buck->dvs = pdata->buck1_dvs; in lp8788_dvs_gpio_request()
427 buck->gpio1 = devm_gpiod_get_index(dev, "dvs", 0, GPIOD_OUT_LOW); in lp8788_dvs_gpio_request()
428 if (IS_ERR(buck->gpio1)) in lp8788_dvs_gpio_request()
429 return PTR_ERR(buck->gpio1); in lp8788_dvs_gpio_request()
430 gpiod_set_consumer_name(buck->gpio1, "LP8788_B2_DVS1"); in lp8788_dvs_gpio_request()
432 buck->gpio2 = devm_gpiod_get_index(dev, "dvs", 1, GPIOD_OUT_LOW); in lp8788_dvs_gpio_request()
433 if (IS_ERR(buck->gpio2)) in lp8788_dvs_gpio_request()
434 return PTR_ERR(buck->gpio2); in lp8788_dvs_gpio_request()
435 gpiod_set_consumer_name(buck->gpio2, "LP8788_B2_DVS2"); in lp8788_dvs_gpio_request()
437 buck->dvs = pdata->buck2_dvs; in lp8788_dvs_gpio_request()
447 struct lp8788_buck *buck, enum lp8788_buck_id id) in lp8788_init_dvs() argument
449 struct lp8788_platform_data *pdata = buck->lp->pdata; in lp8788_init_dvs()
466 if (lp8788_dvs_gpio_request(pdev, buck, id)) in lp8788_init_dvs()
469 return lp8788_update_bits(buck->lp, LP8788_BUCK_DVS_SEL, mask[id], in lp8788_init_dvs()
473 return lp8788_update_bits(buck->lp, LP8788_BUCK_DVS_SEL, mask[id], in lp8788_init_dvs()
481 struct lp8788_buck *buck; in lp8788_buck_probe() local
489 buck = devm_kzalloc(&pdev->dev, sizeof(struct lp8788_buck), GFP_KERNEL); in lp8788_buck_probe()
490 if (!buck) in lp8788_buck_probe()
493 buck->lp = lp; in lp8788_buck_probe()
495 ret = lp8788_init_dvs(pdev, buck, id); in lp8788_buck_probe()
501 cfg.driver_data = buck; in lp8788_buck_probe()
507 dev_err(&pdev->dev, "BUCK%d regulator register err = %d\n", in lp8788_buck_probe()
512 buck->regulator = rdev; in lp8788_buck_probe()
513 platform_set_drvdata(pdev, buck); in lp8788_buck_probe()
538 MODULE_DESCRIPTION("TI LP8788 BUCK Driver");
541 MODULE_ALIAS("platform:lp8788-buck");