Lines Matching refs:regul

220 	const struct regul_struct *regul = &regul_table[id];  in stpmic2_regulator_set_state()  local
223 return stpmic2_register_update(pmic, regul->en_cr, 1U, 1U); in stpmic2_regulator_set_state()
225 return stpmic2_register_update(pmic, regul->en_cr, 0, 1U); in stpmic2_regulator_set_state()
232 const struct regul_struct *regul = &regul_table[id]; in stpmic2_regulator_get_state() local
235 if (stpmic2_register_read(pmic, regul->en_cr, &val) != 0) { in stpmic2_regulator_get_state()
248 const struct regul_struct *regul = &regul_table[id]; in stpmic2_regulator_levels_mv() local
251 *levels_count = regul->volt_table_size; in stpmic2_regulator_levels_mv()
254 *levels = regul->volt_table; in stpmic2_regulator_levels_mv()
263 const struct regul_struct *regul = &regul_table[id]; in stpmic2_regulator_get_voltage() local
267 if (regul->volt_table_size == 0U) { in stpmic2_regulator_get_voltage()
271 mask = regul->volt_table_size - 1U; in stpmic2_regulator_get_voltage()
273 if (stpmic2_register_read(pmic, regul->volt_cr, &value) != 0) { in stpmic2_regulator_get_voltage()
277 value = (value >> regul->volt_shift) & mask; in stpmic2_regulator_get_voltage()
280 if (value > regul->volt_table_size) { in stpmic2_regulator_get_voltage()
284 *val = regul->volt_table[value]; in stpmic2_regulator_get_voltage()
289 static size_t voltage_to_index(const struct regul_struct *regul, in voltage_to_index() argument
294 assert(regul->volt_table); in voltage_to_index()
295 for (i = 0U; i < regul->volt_table_size; i++) { in voltage_to_index()
296 if (regul->volt_table[i] == millivolts) { in voltage_to_index()
307 const struct regul_struct *regul = &regul_table[id]; in stpmic2_regulator_set_voltage() local
311 if (!regul->volt_table_size) { in stpmic2_regulator_set_voltage()
315 mask = regul->volt_table_size - 1U; in stpmic2_regulator_set_voltage()
317 index = voltage_to_index(regul, millivolts); in stpmic2_regulator_set_voltage()
322 return stpmic2_register_update(pmic, regul->volt_cr, in stpmic2_regulator_set_voltage()
323 index << regul->volt_shift, in stpmic2_regulator_set_voltage()
324 mask << regul->volt_shift); in stpmic2_regulator_set_voltage()
331 const struct regul_struct *regul = &regul_table[id]; in stpmic2_update_en_crs() local
333 if (stpmic2_register_update(pmic, regul->en_cr, value, mask) != 0) { in stpmic2_update_en_crs()
337 if (stpmic2_register_update(pmic, regul->alt_en_cr, value, mask) != 0) { in stpmic2_update_en_crs()
347 const struct regul_struct *regul = &regul_table[id]; in stpmic2_regulator_get_prop() local
350 VERBOSE("%s: get prop 0x%x\n", regul->name, prop); in stpmic2_regulator_get_prop()
359 if (stpmic2_register_read(pmic, regul->en_cr, &val) != 0) { in stpmic2_regulator_get_prop()
379 const struct regul_struct *regul = &regul_table[id]; in stpmic2_regulator_set_prop() local
381 VERBOSE("%s: set prop 0x%x arg=%u\n", regul->name, prop, arg); in stpmic2_regulator_set_prop()
385 return stpmic2_register_update(pmic, regul->pd_reg, in stpmic2_regulator_set_prop()
386 regul->pd_val, in stpmic2_regulator_set_prop()
387 regul->pd_val); in stpmic2_regulator_set_prop()
389 if (!regul->msrt_mask) { in stpmic2_regulator_set_prop()
393 return stpmic2_register_update(pmic, regul->msrt_reg, in stpmic2_regulator_set_prop()
394 regul->msrt_mask, in stpmic2_regulator_set_prop()
395 regul->msrt_mask); in stpmic2_regulator_set_prop()
426 return stpmic2_register_update(pmic, regul->ocp_reg, in stpmic2_regulator_set_prop()
427 regul->ocp_mask, in stpmic2_regulator_set_prop()
428 regul->ocp_mask); in stpmic2_regulator_set_prop()