Lines Matching +full:static +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0
23 static struct dm_regulator_mode s2mps11_buck_modes[] = {
29 static struct dm_regulator_mode s2mps11_ldo_modes[] = {
36 static const char s2mps11_buck_ctrl[] = {
40 static const char s2mps11_buck_out[] = {
44 static int s2mps11_buck_hex2volt(int buck, int hex) in s2mps11_buck_hex2volt()
78 return -EINVAL; in s2mps11_buck_hex2volt()
81 static int s2mps11_buck_volt2hex(int buck, int uV) in s2mps11_buck_volt2hex()
89 hex = (uV - S2MPS11_BUCK_UV_HMIN) / S2MPS11_BUCK_HSTEP; in s2mps11_buck_volt2hex()
95 hex = (uV - S2MPS11_BUCK9_UV_MIN) / S2MPS11_BUCK9_STEP; in s2mps11_buck_volt2hex()
100 hex = (uV - S2MPS11_BUCK_UV_MIN) / S2MPS11_BUCK_LSTEP; in s2mps11_buck_volt2hex()
113 return -EINVAL; in s2mps11_buck_volt2hex()
116 static int s2mps11_buck_val(struct udevice *dev, int op, int *uV) in s2mps11_buck_val()
122 buck = dev->driver_data; in s2mps11_buck_val()
125 return -EINVAL; in s2mps11_buck_val()
142 ret = pmic_read(dev->parent, addr, &val, 1); in s2mps11_buck_val()
161 ret = pmic_write(dev->parent, addr, &val, 1); in s2mps11_buck_val()
166 static int s2mps11_buck_mode(struct udevice *dev, int op, int *opmode) in s2mps11_buck_mode()
172 buck = dev->driver_data; in s2mps11_buck_mode()
175 return -EINVAL; in s2mps11_buck_mode()
180 ret = pmic_read(dev->parent, addr, &val, 1); in s2mps11_buck_mode()
197 return -EINVAL; in s2mps11_buck_mode()
214 return -EINVAL; in s2mps11_buck_mode()
219 ret = pmic_write(dev->parent, addr, &val, 1); in s2mps11_buck_mode()
224 static int s2mps11_buck_enable(struct udevice *dev, int op, bool *enable) in s2mps11_buck_enable() argument
234 *enable = false; in s2mps11_buck_enable()
237 *enable = true; in s2mps11_buck_enable()
240 return -EINVAL; in s2mps11_buck_enable()
243 if (*enable) in s2mps11_buck_enable()
256 static int buck_get_value(struct udevice *dev) in buck_get_value()
267 static int buck_set_value(struct udevice *dev, int uV) in buck_set_value()
272 static int buck_get_enable(struct udevice *dev) in buck_get_enable()
274 bool enable = false; in buck_get_enable() local
277 ret = s2mps11_buck_enable(dev, PMIC_OP_GET, &enable); in buck_get_enable()
280 return enable; in buck_get_enable()
283 static int buck_set_enable(struct udevice *dev, bool enable) in buck_set_enable() argument
285 return s2mps11_buck_enable(dev, PMIC_OP_SET, &enable); in buck_set_enable()
288 static int buck_get_mode(struct udevice *dev) in buck_get_mode()
300 static int buck_set_mode(struct udevice *dev, int mode) in buck_set_mode()
305 static int s2mps11_buck_probe(struct udevice *dev) in s2mps11_buck_probe()
311 uc_pdata->type = REGULATOR_TYPE_BUCK; in s2mps11_buck_probe()
312 uc_pdata->mode = s2mps11_buck_modes; in s2mps11_buck_probe()
313 uc_pdata->mode_count = ARRAY_SIZE(s2mps11_buck_modes); in s2mps11_buck_probe()
318 static const struct dm_regulator_ops s2mps11_buck_ops = {
334 static int s2mps11_ldo_hex2volt(int ldo, int hex) in s2mps11_ldo_hex2volt()
340 return -EINVAL; in s2mps11_ldo_hex2volt()
361 static int s2mps11_ldo_volt2hex(int ldo, int uV) in s2mps11_ldo_volt2hex()
373 hex = (uV - S2MPS11_LDO_UV_MIN) / S2MPS11_LDO_STEP; in s2mps11_ldo_volt2hex()
376 hex = (uV - S2MPS11_LDO_UV_MIN) / (S2MPS11_LDO_STEP * 2); in s2mps11_ldo_volt2hex()
384 return -EINVAL; in s2mps11_ldo_volt2hex()
389 static int s2mps11_ldo_val(struct udevice *dev, int op, int *uV) in s2mps11_ldo_val()
395 ldo = dev->driver_data; in s2mps11_ldo_val()
398 return -EINVAL; in s2mps11_ldo_val()
401 addr = S2MPS11_REG_L1CTRL + ldo - 1; in s2mps11_ldo_val()
403 ret = pmic_read(dev->parent, addr, &val, 1); in s2mps11_ldo_val()
424 ret = pmic_write(dev->parent, addr, &val, 1); in s2mps11_ldo_val()
429 static int s2mps11_ldo_mode(struct udevice *dev, int op, int *opmode) in s2mps11_ldo_mode()
435 ldo = dev->driver_data; in s2mps11_ldo_mode()
438 return -EINVAL; in s2mps11_ldo_mode()
440 addr = S2MPS11_REG_L1CTRL + ldo - 1; in s2mps11_ldo_mode()
442 ret = pmic_read(dev->parent, addr, &val, 1); in s2mps11_ldo_mode()
462 return -EINVAL; in s2mps11_ldo_mode()
482 return -EINVAL; in s2mps11_ldo_mode()
487 ret = pmic_write(dev->parent, addr, &val, 1); in s2mps11_ldo_mode()
492 static int s2mps11_ldo_enable(struct udevice *dev, int op, bool *enable) in s2mps11_ldo_enable() argument
502 *enable = false; in s2mps11_ldo_enable()
505 *enable = true; in s2mps11_ldo_enable()
508 return -EINVAL; in s2mps11_ldo_enable()
511 if (*enable) in s2mps11_ldo_enable()
524 static int ldo_get_value(struct udevice *dev) in ldo_get_value()
536 static int ldo_set_value(struct udevice *dev, int uV) in ldo_set_value()
541 static int ldo_get_enable(struct udevice *dev) in ldo_get_enable()
543 bool enable = false; in ldo_get_enable() local
546 ret = s2mps11_ldo_enable(dev, PMIC_OP_GET, &enable); in ldo_get_enable()
549 return enable; in ldo_get_enable()
552 static int ldo_set_enable(struct udevice *dev, bool enable) in ldo_set_enable() argument
556 ret = s2mps11_ldo_enable(dev, PMIC_OP_SET, &enable); in ldo_set_enable()
560 /* Wait the "enable delay" for voltage to start to rise */ in ldo_set_enable()
566 static int ldo_get_mode(struct udevice *dev) in ldo_get_mode()
576 static int ldo_set_mode(struct udevice *dev, int mode) in ldo_set_mode()
581 static int s2mps11_ldo_probe(struct udevice *dev) in s2mps11_ldo_probe()
586 uc_pdata->type = REGULATOR_TYPE_LDO; in s2mps11_ldo_probe()
587 uc_pdata->mode = s2mps11_ldo_modes; in s2mps11_ldo_probe()
588 uc_pdata->mode_count = ARRAY_SIZE(s2mps11_ldo_modes); in s2mps11_ldo_probe()
593 static const struct dm_regulator_ops s2mps11_ldo_ops = {