Lines Matching refs:sreg
55 struct scmi_regulator *sreg = rdev_get_drvdata(rdev); in scmi_reg_enable() local
57 return voltage_ops->config_set(sreg->ph, sreg->id, in scmi_reg_enable()
63 struct scmi_regulator *sreg = rdev_get_drvdata(rdev); in scmi_reg_disable() local
65 return voltage_ops->config_set(sreg->ph, sreg->id, in scmi_reg_disable()
73 struct scmi_regulator *sreg = rdev_get_drvdata(rdev); in scmi_reg_is_enabled() local
75 ret = voltage_ops->config_get(sreg->ph, sreg->id, &config); in scmi_reg_is_enabled()
77 dev_err(&sreg->sdev->dev, in scmi_reg_is_enabled()
79 ret, sreg->desc.name); in scmi_reg_is_enabled()
90 struct scmi_regulator *sreg = rdev_get_drvdata(rdev); in scmi_reg_get_voltage_sel() local
92 ret = voltage_ops->level_get(sreg->ph, sreg->id, &volt_uV); in scmi_reg_get_voltage_sel()
96 return sreg->desc.ops->map_voltage(rdev, volt_uV, volt_uV); in scmi_reg_get_voltage_sel()
103 struct scmi_regulator *sreg = rdev_get_drvdata(rdev); in scmi_reg_set_voltage_sel() local
105 volt_uV = sreg->desc.ops->list_voltage(rdev, selector); in scmi_reg_set_voltage_sel()
109 return voltage_ops->level_set(sreg->ph, sreg->id, 0x0, volt_uV); in scmi_reg_set_voltage_sel()
139 scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg, in scmi_config_linear_regulator_mappings() argument
155 dev_err(&sreg->sdev->dev, in scmi_config_linear_regulator_mappings()
159 sreg->id); in scmi_config_linear_regulator_mappings()
165 sreg->desc.fixed_uV = in scmi_config_linear_regulator_mappings()
167 sreg->desc.n_voltages = 1; in scmi_config_linear_regulator_mappings()
168 sreg->desc.ops = &scmi_reg_fixed_ops; in scmi_config_linear_regulator_mappings()
171 sreg->desc.min_uV = in scmi_config_linear_regulator_mappings()
173 sreg->desc.uV_step = in scmi_config_linear_regulator_mappings()
175 sreg->desc.linear_min_sel = 0; in scmi_config_linear_regulator_mappings()
176 sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1; in scmi_config_linear_regulator_mappings()
177 sreg->desc.ops = &scmi_reg_linear_ops; in scmi_config_linear_regulator_mappings()
184 scmi_config_discrete_regulator_mappings(struct scmi_regulator *sreg, in scmi_config_discrete_regulator_mappings() argument
188 sreg->desc.n_voltages = vinfo->num_levels; in scmi_config_discrete_regulator_mappings()
190 if (sreg->desc.n_voltages > 1) { in scmi_config_discrete_regulator_mappings()
191 sreg->desc.volt_table = (const unsigned int *)vinfo->levels_uv; in scmi_config_discrete_regulator_mappings()
192 sreg->desc.ops = &scmi_reg_discrete_ops; in scmi_config_discrete_regulator_mappings()
194 sreg->desc.fixed_uV = vinfo->levels_uv[0]; in scmi_config_discrete_regulator_mappings()
195 sreg->desc.ops = &scmi_reg_fixed_ops; in scmi_config_discrete_regulator_mappings()
201 static int scmi_regulator_common_init(struct scmi_regulator *sreg) in scmi_regulator_common_init() argument
204 struct device *dev = &sreg->sdev->dev; in scmi_regulator_common_init()
207 vinfo = voltage_ops->info_get(sreg->ph, sreg->id); in scmi_regulator_common_init()
210 sreg->id); in scmi_regulator_common_init()
222 sreg->of_node->full_name); in scmi_regulator_common_init()
226 sreg->desc.name = devm_kasprintf(dev, GFP_KERNEL, "%s", vinfo->name); in scmi_regulator_common_init()
227 if (!sreg->desc.name) in scmi_regulator_common_init()
230 sreg->desc.id = sreg->id; in scmi_regulator_common_init()
231 sreg->desc.type = REGULATOR_VOLTAGE; in scmi_regulator_common_init()
232 sreg->desc.owner = THIS_MODULE; in scmi_regulator_common_init()
233 sreg->desc.of_match_full_name = true; in scmi_regulator_common_init()
234 sreg->desc.of_match = sreg->of_node->full_name; in scmi_regulator_common_init()
235 sreg->desc.regulators_node = "regulators"; in scmi_regulator_common_init()
237 ret = scmi_config_linear_regulator_mappings(sreg, vinfo); in scmi_regulator_common_init()
239 ret = scmi_config_discrete_regulator_mappings(sreg, vinfo); in scmi_regulator_common_init()
247 sreg->conf.dev = dev; in scmi_regulator_common_init()
250 sreg->conf.driver_data = sreg; in scmi_regulator_common_init()
362 struct scmi_regulator *sreg = rinfo->sregv[d]; in scmi_regulator_probe() local
365 if (!sreg) in scmi_regulator_probe()
368 ret = scmi_regulator_common_init(sreg); in scmi_regulator_probe()
373 sreg->rdev = devm_regulator_register(&sdev->dev, &sreg->desc, in scmi_regulator_probe()
374 &sreg->conf); in scmi_regulator_probe()
375 if (IS_ERR(sreg->rdev)) { in scmi_regulator_probe()
376 sreg->rdev = NULL; in scmi_regulator_probe()
382 sreg->desc.name, sreg->id); in scmi_regulator_probe()