Lines Matching +full:addr +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0
16 #define MODE(_id, _val, _name) { \ macro
24 MODE(OP_OFF, S2MPS11_BUCK_MODE_OFF, "OFF"),
25 MODE(OP_STANDBY, S2MPS11_BUCK_MODE_STANDBY, "ON/OFF"),
26 MODE(OP_ON, S2MPS11_BUCK_MODE_STANDBY, "ON"),
30 MODE(OP_OFF, S2MPS11_LDO_MODE_OFF, "OFF"),
31 MODE(OP_STANDBY, S2MPS11_LDO_MODE_STANDBY, "ON/OFF"),
32 MODE(OP_STANDBY_LPM, S2MPS11_LDO_MODE_STANDBY_LPM, "ON/LPM"),
33 MODE(OP_ON, S2MPS11_LDO_MODE_ON, "ON"),
78 return -EINVAL; in s2mps11_buck_hex2volt()
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()
119 u32 mask, addr; in s2mps11_buck_val() local
122 buck = dev->driver_data; in s2mps11_buck_val()
125 return -EINVAL; in s2mps11_buck_val()
131 addr = s2mps11_buck_out[buck]; 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()
168 unsigned int addr, mode; in s2mps11_buck_mode() local
172 buck = dev->driver_data; in s2mps11_buck_mode()
175 return -EINVAL; in s2mps11_buck_mode()
178 addr = s2mps11_buck_ctrl[buck]; in s2mps11_buck_mode()
180 ret = pmic_read(dev->parent, addr, &val, 1); in s2mps11_buck_mode()
197 return -EINVAL; in s2mps11_buck_mode()
204 mode = S2MPS11_BUCK_MODE_OFF; in s2mps11_buck_mode()
207 mode = S2MPS11_BUCK_MODE_STANDBY; in s2mps11_buck_mode()
210 mode = S2MPS11_BUCK_MODE_ON; in s2mps11_buck_mode()
213 pr_err("Wrong mode: %d for buck: %d\n", *opmode, buck); in s2mps11_buck_mode()
214 return -EINVAL; in s2mps11_buck_mode()
218 val |= mode; in s2mps11_buck_mode()
219 ret = pmic_write(dev->parent, addr, &val, 1); in s2mps11_buck_mode()
240 return -EINVAL; in s2mps11_buck_enable()
290 int mode; in buck_get_mode() local
293 ret = s2mps11_buck_mode(dev, PMIC_OP_GET, &mode); in buck_get_mode()
297 return mode; in buck_get_mode()
300 static int buck_set_mode(struct udevice *dev, int mode) in buck_set_mode() argument
302 return s2mps11_buck_mode(dev, PMIC_OP_SET, &mode); in buck_set_mode()
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()
340 return -EINVAL; in s2mps11_ldo_hex2volt()
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()
391 unsigned int addr; in s2mps11_ldo_val() local
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()
431 unsigned int addr, mode; in s2mps11_ldo_mode() local
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()
469 mode = S2MPS11_LDO_MODE_OFF; in s2mps11_ldo_mode()
472 mode = S2MPS11_LDO_MODE_STANDBY; in s2mps11_ldo_mode()
475 mode = S2MPS11_LDO_MODE_STANDBY_LPM; in s2mps11_ldo_mode()
478 mode = S2MPS11_LDO_MODE_ON; in s2mps11_ldo_mode()
481 pr_err("Wrong mode: %d for ldo: %d\n", *opmode, ldo); in s2mps11_ldo_mode()
482 return -EINVAL; in s2mps11_ldo_mode()
486 val |= mode; in s2mps11_ldo_mode()
487 ret = pmic_write(dev->parent, addr, &val, 1); in s2mps11_ldo_mode()
508 return -EINVAL; in s2mps11_ldo_enable()
568 int mode, ret; in ldo_get_mode() local
570 ret = s2mps11_ldo_mode(dev, PMIC_OP_GET, &mode); in ldo_get_mode()
573 return mode; in ldo_get_mode()
576 static int ldo_set_mode(struct udevice *dev, int mode) in ldo_set_mode() argument
578 return s2mps11_ldo_mode(dev, PMIC_OP_SET, &mode); in ldo_set_mode()
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()