xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/regulator/pwm-regulator.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunBindings for the Generic PWM Regulator
2*4882a593Smuzhiyun======================================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunCurrently supports 2 modes of operation:
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunVoltage Table:		When in this mode, a voltage table (See below) of
7*4882a593Smuzhiyun			predefined voltage <=> duty-cycle values must be
8*4882a593Smuzhiyun			provided via DT. Limitations are that the regulator can
9*4882a593Smuzhiyun			only operate at the voltages supplied in the table.
10*4882a593Smuzhiyun			Intermediary duty-cycle values which would normally
11*4882a593Smuzhiyun			allow finer grained voltage selection are ignored and
12*4882a593Smuzhiyun			rendered useless.  Although more control is given to
13*4882a593Smuzhiyun			the user if the assumptions made in continuous-voltage
14*4882a593Smuzhiyun			mode do not reign true.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunContinuous Voltage:	This mode uses the regulator's maximum and minimum
17*4882a593Smuzhiyun			supplied voltages specified in the
18*4882a593Smuzhiyun			regulator-{min,max}-microvolt properties to calculate
19*4882a593Smuzhiyun			appropriate duty-cycle values.  This allows for a much
20*4882a593Smuzhiyun			more fine grained solution when compared with
21*4882a593Smuzhiyun			voltage-table mode above.  This solution does make an
22*4882a593Smuzhiyun			assumption that a %50 duty-cycle value will cause the
23*4882a593Smuzhiyun			regulator voltage to run at half way between the
24*4882a593Smuzhiyun			supplied max_uV and min_uV values.
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunRequired properties:
27*4882a593Smuzhiyun--------------------
28*4882a593Smuzhiyun- compatible:		Should be "pwm-regulator"
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun- pwms:			PWM specification (See: ../pwm/pwm.txt)
31*4882a593Smuzhiyun
32*4882a593SmuzhiyunOnly required for Voltage Table Mode:
33*4882a593Smuzhiyun- voltage-table: 	Voltage and Duty-Cycle table consisting of 2 cells
34*4882a593Smuzhiyun			    First cell is voltage in microvolts (uV)
35*4882a593Smuzhiyun			    Second cell is duty-cycle in percent (%)
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunOptional properties for Continuous mode:
38*4882a593Smuzhiyun- pwm-dutycycle-unit:	Integer value encoding the duty cycle unit. If not
39*4882a593Smuzhiyun			defined, <100> is assumed, meaning that
40*4882a593Smuzhiyun			pwm-dutycycle-range contains values expressed in
41*4882a593Smuzhiyun			percent.
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun- pwm-dutycycle-range:	Should contain 2 entries. The first entry is encoding
44*4882a593Smuzhiyun			the dutycycle for regulator-min-microvolt and the
45*4882a593Smuzhiyun			second one the dutycycle for regulator-max-microvolt.
46*4882a593Smuzhiyun			Duty cycle values are expressed in pwm-dutycycle-unit.
47*4882a593Smuzhiyun			If not defined, <0 100> is assumed.
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunNB: To be clear, if voltage-table is provided, then the device will be used
50*4882a593Smuzhiyunin Voltage Table Mode.  If no voltage-table is provided, then the device will
51*4882a593Smuzhiyunbe used in Continuous Voltage Mode.
52*4882a593Smuzhiyun
53*4882a593SmuzhiyunOptional properties:
54*4882a593Smuzhiyun--------------------
55*4882a593Smuzhiyun- enable-gpios:		GPIO to use to enable/disable the regulator
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunAny property defined as part of the core regulator binding can also be used.
58*4882a593Smuzhiyun(See: ../regulator/regulator.txt)
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunContinuous Voltage With Enable GPIO Example:
61*4882a593Smuzhiyun	pwm_regulator {
62*4882a593Smuzhiyun		compatible = "pwm-regulator";
63*4882a593Smuzhiyun		pwms = <&pwm1 0 8448 0>;
64*4882a593Smuzhiyun		enable-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
65*4882a593Smuzhiyun		regulator-min-microvolt = <1016000>;
66*4882a593Smuzhiyun		regulator-max-microvolt = <1114000>;
67*4882a593Smuzhiyun		regulator-name = "vdd_logic";
68*4882a593Smuzhiyun		/* unit == per-mille */
69*4882a593Smuzhiyun		pwm-dutycycle-unit = <1000>;
70*4882a593Smuzhiyun		/*
71*4882a593Smuzhiyun		 * Inverted PWM logic, and the duty cycle range is limited
72*4882a593Smuzhiyun		 * to 30%-70%.
73*4882a593Smuzhiyun		 */
74*4882a593Smuzhiyun		pwm-dutycycle-range = <700 300>; /* */
75*4882a593Smuzhiyun	};
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunVoltage Table Example:
78*4882a593Smuzhiyun	pwm_regulator {
79*4882a593Smuzhiyun		compatible = "pwm-regulator";
80*4882a593Smuzhiyun		pwms = <&pwm1 0 8448 0>;
81*4882a593Smuzhiyun		regulator-min-microvolt = <1016000>;
82*4882a593Smuzhiyun		regulator-max-microvolt = <1114000>;
83*4882a593Smuzhiyun		regulator-name = "vdd_logic";
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun			      /* Voltage Duty-Cycle */
86*4882a593Smuzhiyun		voltage-table = <1114000 0>,
87*4882a593Smuzhiyun				<1095000 10>,
88*4882a593Smuzhiyun				<1076000 20>,
89*4882a593Smuzhiyun				<1056000 30>,
90*4882a593Smuzhiyun				<1036000 40>,
91*4882a593Smuzhiyun				<1016000 50>;
92*4882a593Smuzhiyun	};
93