Lines Matching +full:buck +full:- +full:boost
3 * SPDX-License-Identifier: Apache-2.0
12 #include <zephyr/dt-bindings/regulator/adp5360.h>
22 /* Buck/boost configure register. */
35 /* Buck/boost output voltage setting register. */
91 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_count_voltages()
93 return linear_range_group_values_count(config->desc->ranges, config->desc->nranges); in regulator_adp5360_count_voltages()
99 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_list_voltage()
101 return linear_range_group_get_value(config->desc->ranges, config->desc->nranges, idx, in regulator_adp5360_list_voltage()
107 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_set_voltage()
111 ret = linear_range_group_get_win_index(config->desc->ranges, config->desc->nranges, min_uv, in regulator_adp5360_set_voltage()
113 if (ret == -EINVAL) { in regulator_adp5360_set_voltage()
117 return i2c_reg_update_byte_dt(&config->i2c, config->desc->out_reg, in regulator_adp5360_set_voltage()
124 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_get_voltage()
128 ret = i2c_reg_read_byte_dt(&config->i2c, config->desc->out_reg, &raw_reg); in regulator_adp5360_get_voltage()
135 return linear_range_group_get_value(config->desc->ranges, config->desc->nranges, raw_reg, in regulator_adp5360_get_voltage()
141 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_set_mode()
143 if (!config->desc->has_modes || (mode > ADP5360_MODE_PWM)) { in regulator_adp5360_set_mode()
144 return -ENOTSUP; in regulator_adp5360_set_mode()
147 return i2c_reg_update_byte_dt(&config->i2c, config->desc->cfg_reg, in regulator_adp5360_set_mode()
154 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_get_mode()
158 if (!config->desc->has_modes) { in regulator_adp5360_get_mode()
159 return -ENOTSUP; in regulator_adp5360_get_mode()
162 ret = i2c_reg_read_byte_dt(&config->i2c, config->desc->cfg_reg, &val); in regulator_adp5360_get_mode()
174 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_enable()
176 return i2c_reg_update_byte_dt(&config->i2c, config->desc->cfg_reg, ADP5360_BUCK_CFG_EN_MSK, in regulator_adp5360_enable()
182 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_disable()
184 return i2c_reg_update_byte_dt(&config->i2c, config->desc->cfg_reg, ADP5360_BUCK_CFG_EN_MSK, in regulator_adp5360_disable()
190 const struct regulator_adp5360_config *config = dev->config; in regulator_adp5360_init()
196 if (!i2c_is_ready_dt(&config->i2c)) { in regulator_adp5360_init()
197 return -ENODEV; in regulator_adp5360_init()
204 ret = i2c_reg_read_byte_dt(&config->i2c, config->desc->out_reg, &val); in regulator_adp5360_init()
209 if (config->dly_idx >= 0) { in regulator_adp5360_init()
211 nval |= ((uint8_t)config->dly_idx << ADP5360_BUCK_OUTPUT_DLY_POS) & in regulator_adp5360_init()
216 ret = i2c_reg_write_byte_dt(&config->i2c, config->desc->out_reg, in regulator_adp5360_init()
227 ret = i2c_reg_read_byte_dt(&config->i2c, config->desc->cfg_reg, &val); in regulator_adp5360_init()
232 if (config->ss_idx >= 0) { in regulator_adp5360_init()
234 nval |= ((uint8_t)config->ss_idx << ADP5360_BUCK_CFG_SS_POS) & in regulator_adp5360_init()
238 if (config->ilim_idx >= 0) { in regulator_adp5360_init()
239 if (config->desc->has_modes) { in regulator_adp5360_init()
241 nval |= ((uint8_t)config->ilim_idx << ADP5360_BUCK_CFG_BUCK_ILIM_POS) & in regulator_adp5360_init()
245 nval |= ((uint8_t)config->ilim_idx << ADP5360_BUCK_CFG_BST_ILIM_POS) & in regulator_adp5360_init()
250 if (config->stp_en) { in regulator_adp5360_init()
255 if (config->dis_en) { in regulator_adp5360_init()
261 ret = i2c_reg_write_byte_dt(&config->i2c, config->desc->cfg_reg, in regulator_adp5360_init()
289 .dly_idx = DT_ENUM_IDX_OR(node_id, adi_switch_delay_us, -1), \
290 .ss_idx = DT_ENUM_IDX_OR(node_id, adi_soft_start_ms, -1), \
291 .ilim_idx = DT_ENUM_IDX_OR(node_id, adi_ilim_milliamp, -1), \
305 REGULATOR_ADP5360_DEFINE_COND(inst, buck) \