Lines Matching +full:vsel1 +full:- +full:gpio
1 // SPDX-License-Identifier: GPL-2.0+
12 #include <asm/gpio.h>
17 * struct ic_types - definition of fan53555-family devices
27 * See http://www.onsemi.com/pub/Collateral/FAN53555-D.pdf for details.
47 /* I2C-accessible byte-sized registers */
92 uc_pdata->type = REGULATOR_TYPE_BUCK; in fan53555_regulator_ofdata_to_platdata()
94 sleep_vsel = dev_read_u32_default(dev, "fcs,suspend-voltage-selector", in fan53555_regulator_ofdata_to_platdata()
98 * Depending on the device-tree settings, the 'normal mode' in fan53555_regulator_ofdata_to_platdata()
99 * voltage is either controlled by VSEL0 or VSEL1. in fan53555_regulator_ofdata_to_platdata()
103 dev_pdata->sleep_reg = FAN53555_VSEL0; in fan53555_regulator_ofdata_to_platdata()
104 dev_pdata->vol_reg = FAN53555_VSEL1; in fan53555_regulator_ofdata_to_platdata()
107 dev_pdata->sleep_reg = FAN53555_VSEL1; in fan53555_regulator_ofdata_to_platdata()
108 dev_pdata->vol_reg = FAN53555_VSEL0; in fan53555_regulator_ofdata_to_platdata()
111 pr_err("%s: invalid vsel id %d\n", dev->name, sleep_vsel); in fan53555_regulator_ofdata_to_platdata()
112 return -EINVAL; in fan53555_regulator_ofdata_to_platdata()
126 reg = pmic_reg_read(dev->parent, pdata->vol_reg); in fan53555_regulator_get_value()
129 voltage = priv->vsel_min + (reg & 0x3f) * priv->vsel_step; in fan53555_regulator_get_value()
141 vol = (uV - priv->vsel_min) / priv->vsel_step; in fan53555_regulator_set_value()
143 __func__, uV, pdata->vol_reg, vol); in fan53555_regulator_set_value()
145 return pmic_clrsetbits(dev, pdata->vol_reg, GENMASK(6, 0), vol); in fan53555_regulator_set_value()
155 if (ic_types[i].die_id != priv->die_id) in fan53555_voltages_setup()
158 if (ic_types[i].die_rev != priv->die_rev) in fan53555_voltages_setup()
161 priv->vsel_min = ic_types[i].vsel_min; in fan53555_voltages_setup()
162 priv->vsel_step = ic_types[i].vsel_step; in fan53555_voltages_setup()
168 dev->name, __func__, priv->die_id, priv->die_rev); in fan53555_voltages_setup()
169 return -EINVAL; in fan53555_voltages_setup()
187 ID1 = pmic_reg_read(dev->parent, FAN53555_ID1); in fan53555_probe()
191 ID2 = pmic_reg_read(dev->parent, FAN53555_ID2); in fan53555_probe()
196 priv->vendor = bitfield_extract(ID1, 5, 3); in fan53555_probe()
197 priv->die_id = ID1 & GENMASK(3, 0); in fan53555_probe()
198 priv->die_rev = ID2 & GENMASK(3, 0); in fan53555_probe()
201 return -ENODATA; in fan53555_probe()
204 __func__, priv->die_id, priv->die_rev); in fan53555_probe()