Lines Matching +full:bus +full:- +full:range

3  * SPDX-License-Identifier: Apache-2.0
10 #include <zephyr/dt-bindings/regulator/max20335.h>
56 struct i2c_dt_spec bus; member
61 struct i2c_dt_spec bus; member
121 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_set_enable()
123 return i2c_reg_update_byte_dt(&config->bus, in regulator_max20335_set_enable()
124 config->desc->cfg_reg, in regulator_max20335_set_enable()
125 config->desc->enable_mask, in regulator_max20335_set_enable()
126 enable ? config->desc->enable_val : 0); in regulator_max20335_set_enable()
141 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_set_mode()
144 return -ENOTSUP; in regulator_max20335_set_mode()
147 switch (config->source) { in regulator_max20335_set_mode()
153 return i2c_reg_update_byte_dt(&config->bus, in regulator_max20335_set_mode()
154 config->desc->cfg_reg, in regulator_max20335_set_mode()
158 return -ENOTSUP; in regulator_max20335_set_mode()
164 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_count_voltages()
166 return linear_range_values_count(config->desc->uv_range); in regulator_max20335_count_voltages()
172 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_list_voltage()
174 return linear_range_get_value(config->desc->uv_range, idx, volt_uv); in regulator_max20335_list_voltage()
178 int32_t max_uv, const struct linear_range *range, in regulator_max20335_set_buck_ldo_voltage() argument
181 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_set_buck_ldo_voltage()
185 ret = linear_range_get_win_index(range, min_uv, max_uv, &idx); in regulator_max20335_set_buck_ldo_voltage()
186 if (ret == -EINVAL) { in regulator_max20335_set_buck_ldo_voltage()
190 return i2c_reg_write_byte_dt(&config->bus, vout_reg, (uint8_t)idx); in regulator_max20335_set_buck_ldo_voltage()
194 const struct linear_range *range, in regulator_max20335_buck12_ldo123_get_voltage() argument
197 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_buck12_ldo123_get_voltage()
201 ret = i2c_reg_read_byte_dt(&config->bus, vout_reg, &idx); in regulator_max20335_buck12_ldo123_get_voltage()
206 return linear_range_get_value(range, idx, volt_uv); in regulator_max20335_buck12_ldo123_get_voltage()
211 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_get_voltage()
214 config->desc->uv_range, in regulator_max20335_get_voltage()
215 config->desc->vsel_reg, in regulator_max20335_get_voltage()
221 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_set_voltage()
226 config->desc->uv_range, in regulator_max20335_set_voltage()
227 config->desc->vsel_reg); in regulator_max20335_set_voltage()
232 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_count_current_limits()
234 if (config->source != MAX20335_PMIC_SOURCE_BUCK1 && in regulator_max20335_count_current_limits()
235 config->source != MAX20335_PMIC_SOURCE_BUCK2) { in regulator_max20335_count_current_limits()
236 return -ENOTSUP; in regulator_max20335_count_current_limits()
239 return linear_range_values_count(config->desc->ua_range); in regulator_max20335_count_current_limits()
245 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_list_current_limit()
247 if (config->source != MAX20335_PMIC_SOURCE_BUCK1 && in regulator_max20335_list_current_limit()
248 config->source != MAX20335_PMIC_SOURCE_BUCK2) { in regulator_max20335_list_current_limit()
249 return -ENOTSUP; in regulator_max20335_list_current_limit()
252 return linear_range_get_value(config->desc->ua_range, idx, current_ua); in regulator_max20335_list_current_limit()
259 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_set_current_limit()
264 if (config->source != MAX20335_PMIC_SOURCE_BUCK1 && in regulator_max20335_set_current_limit()
265 config->source != MAX20335_PMIC_SOURCE_BUCK2) { in regulator_max20335_set_current_limit()
266 return -ENOTSUP; in regulator_max20335_set_current_limit()
269 ret = i2c_reg_read_byte_dt(&config->bus, MAX20335_BUCK12_CSET, &val); in regulator_max20335_set_current_limit()
274 ret = linear_range_get_win_index(config->desc->ua_range, min_ua, max_ua, &idx); in regulator_max20335_set_current_limit()
275 if (ret == -EINVAL) { in regulator_max20335_set_current_limit()
279 switch (config->source) { in regulator_max20335_set_current_limit()
287 return -ENOTSUP; in regulator_max20335_set_current_limit()
290 return i2c_reg_write_byte_dt(&config->bus, MAX20335_BUCK12_CSET, val); in regulator_max20335_set_current_limit()
295 const struct regulator_max20335_common_config *common_config = dev->config; in regulator_max20335_power_off()
297 return i2c_reg_write_byte_dt(&common_config->bus, MAX20335_PWR_CMD, MAX20335_OFF_MODE); in regulator_max20335_power_off()
302 const struct regulator_max20335_config *config = dev->config; in regulator_max20335_init()
304 if (!i2c_is_ready_dt(&config->bus)) { in regulator_max20335_init()
305 return -ENODEV; in regulator_max20335_init()
315 const struct regulator_max20335_common_config *common_config = dev->config; in regulator_max20335_common_init()
317 if (!i2c_is_ready_dt(&common_config->bus)) { in regulator_max20335_common_init()
318 return -ENODEV; in regulator_max20335_common_init()
344 .bus = I2C_DT_SPEC_GET(DT_GPARENT(node_id)), \
365 .bus = I2C_DT_SPEC_GET(DT_INST_PARENT(inst)), \