Lines Matching +full:output +full:- +full:enable
1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2014-2015 Samsung Electronics
11 * U-Boot Voltage/Current Regulator
18 * The regulator uclass - is based on uclass platform data which is allocated,
19 * automatically for each regulator device on bind and 'dev->uclass_platdata'
21 * The uclass file: 'drivers/power/regulator/regulator-uclass.c'
23 * The regulator device - is based on driver's model 'struct udevice'.
25 * - devname - the regulator device's name: 'dev->name'
26 * - platname - the device's platdata's name. So in the code it looks like:
27 * 'uc_pdata = dev->uclass_platdata'; 'name = uc_pdata->name'.
29 * The regulator device driver - provide an implementation of uclass operations
30 * pointed by 'dev->driver->ops' as a struct of type 'struct dm_regulator_ops'.
36 * regulator-name = "VDD_MMC_1.8V"; (must be unique for proper bind)
37 * regulator-min-microvolt = <1000000>; (optional)
38 * regulator-max-microvolt = <1000000>; (optional)
39 * regulator-min-microamp = <1000>; (optional)
40 * regulator-max-microamp = <1000>; (optional)
41 * regulator-always-on; (optional)
42 * regulator-boot-on; (optional)
48 * If regulator-name property is not provided, node name will be chosen.
53 * which does the scan on the device node, for the 'regulator-name' constraint.
56 * dm_scan_fdt_dev() - this is usually done automatically for bus devices,
68 * Please do not use the device_bind_by_name() function, since it pass '-1' as
69 * device node offset - and the bind will fail on uclass .post_bind method,
70 * because of missing 'regulator-name' constraint.
76 * When fixed voltage regulator is needed, then enable the config:
77 * - CONFIG_DM_REGULATOR_FIXED
82 * To bind the fixed voltage regulator device, we usually use a 'simple-bus'
83 * node as a parent. And 'regulator-fixed' for the driver compatible. This is
86 * simple-bus {
87 * compatible = "simple-bus";
88 * #address-cells = <1>;
89 * #size-cells = <0>;
92 * compatible = "regulator-fixed";
93 * regulator-name = "VDD_LED_3.3V";
94 * regulator-min-microvolt = <3300000>;
95 * regulator-max-microvolt = <3300000>;
104 /* enum regulator_type - used for regulator_*() variant calls */
115 * struct dm_regulator_mode - this structure holds an information about
116 * each regulator operation mode. Probably in most cases - an array.
117 * This will be probably a driver-static data, since it is device-specific.
119 * @id - a driver-specific mode id
120 * @register_value - a driver-specific value for its mode id
121 * @name - the name of mode - used for regulator command
138 * struct dm_regulator_uclass_platdata - pointed by dev->uclass_platdata, and
141 * There is no "step" voltage value - so driver should take care of this.
143 * @type - one of 'enum regulator_type'
144 * @mode - pointer to the regulator mode (array if more than one)
145 * @mode_count - number of '.mode' entries
146 * @min_uV* - minimum voltage (micro Volts)
147 * @max_uV* - maximum voltage (micro Volts)
148 * @min_uA* - minimum amperage (micro Amps)
149 * @max_uA* - maximum amperage (micro Amps)
150 * @always_on* - bool type, true or false
151 * @boot_on* - bool type, true or false
153 * @ramp_delay - Time to settle down after voltage change (unit: uV/us)
154 * @flags: - flags value (see REGULATOR_FLAG_...)
155 * @name** - fdt regulator name - should be taken from the device tree
156 * ctrl_reg: - Control register offset used to enable/disable regulator
157 * volt_reg: - register offset for writing voltage vsel values
160 * * - set automatically on device probe by the uclass's '.pre_probe' method.
161 * ** - set automatically on device bind by the uclass's '.post_bind' method.
185 * The regulator output value function calls operates on a micro Volts.
187 * get/set_value - get/set output value of the given output number
188 * @dev - regulator device
190 * @uV - set the output value [micro Volts]
191 * @return output value [uV] on success or negative errno if fail.
197 * The regulator output current function calls operates on a micro Amps.
199 * get/set_current - get/set output current of the given output number
200 * @dev - regulator device
202 * @uA - set the output current [micro Amps]
203 * @return output value [uA] on success or negative errno if fail.
209 * The most basic feature of the regulator output is its enable state.
211 * get/set_enable - get/set enable state of the given output number
212 * @dev - regulator device
214 * @enable - set true - enable or false - disable
215 * @return true/false for get or -errno if fail; 0 / -errno for set.
218 int (*set_enable)(struct udevice *dev, bool enable);
221 * The 'get/set_mode()' function calls should operate on a driver-
225 * get/set_mode - get/set operation mode of the given output number
226 * @dev - regulator device
228 * @mode_id - set output mode id (struct dm_regulator_mode->id)
241 * @dev - pointer to the regulator device
242 * @modep - pointer to the returned mode info array
243 * @return - count of modep entries on success or negative errno if fail.
250 * @dev - pointer to the regulator device
251 * @return - positive output value [uV] on success or negative errno if fail.
258 * @dev - pointer to the regulator device
259 * @uV - the output value to set [micro Volts]
260 * @return - 0 on success or -errno val if fails
266 * without any min-,max condition check
268 * @dev - pointer to the regulator device
269 * @uV - the output value to set [micro Volts]
270 * @return - 0 on success or -errno val if fails
277 * @dev - pointer to the regulator device
278 * @return - positive output current [uA] on success or negative errno if fail.
285 * @dev - pointer to the regulator device
286 * @uA - set the output current [micro Amps]
287 * @return - 0 on success or -errno val if fails
292 * regulator_get_enable: get regulator device enable state.
294 * @dev - pointer to the regulator device
295 * @return - true/false of enable state or -errno val if fails
300 * regulator_set_enable: set regulator enable state
302 * @dev - pointer to the regulator device
303 * @enable - set true or false
304 * @return - 0 on success or -errno val if fails
306 int regulator_set_enable(struct udevice *dev, bool enable);
309 * regulator_set_enable_if_allowed: set regulator enable state if allowed by
312 * @dev - pointer to the regulator device
313 * @enable - set true or false
314 * @return - 0 on success or if enabling is not supported
315 * -errno val if fails.
317 int regulator_set_enable_if_allowed(struct udevice *dev, bool enable);
322 * @dev - pointer to the regulator device
323 * @return - positive mode 'id' number on success or -errno val if fails
335 * @dev - pointer to the regulator device
336 * @mode_id - mode id to set ('id' field of struct type dm_regulator_mode)
337 * @return - 0 on success or -errno value if fails
347 * regulators_enable_boot_on() - enable regulators needed for boot
363 * - Enable - will set - if any of: 'always_on' or 'boot_on' is set to true,
365 * - Voltage value - will set - if '.min_uV' and '.max_uV' values are equal
366 * - Current limit - will set - if '.min_uA' and '.max_uA' values are equal
368 * The function returns on the first-encountered error.
370 * @platname - expected string for dm_regulator_uclass_platdata .name field
371 * @devp - returned pointer to the regulator device - if non-NULL passed
380 * - Enable - will set - if any of: 'always_on' or 'boot_on' is set to true,
382 * - Voltage value - will set - if '.min_uV' and '.max_uV' values are equal
383 * - Current limit - will set - if '.min_uA' and '.max_uA' values are equal
387 * @platname - expected string for dm_regulator_uclass_platdata .name field
388 * @devp - returned pointer to the regulator device - if non-NULL passed
392 * - regulator_get/set_*
402 * @list_platname - an array of expected strings for .name field of each
404 * @list_devp - an array of returned pointers to the successfully setup
405 * regulator devices if non-NULL passed
406 * @verbose - (true/false) print each regulator setup info, or be quiet
410 * - regulator_get/set_*
427 * @devname - expected string for 'dev->name' of regulator device
428 * @devp - returned pointer to the regulator device
432 * - regulator_get/set_*
440 * @platname - expected string for uc_pdata->name of regulator uclass platdata
441 * @devp - returns pointer to the regulator device or NULL on error
445 * - regulator_get/set_*
457 * @dev - device with supply phandle
458 * @supply_name - phandle name of regulator
459 * @devp - returned pointer to the supply device