mirror of
https://xff.cz/git/u-boot/
synced 2025-10-17 16:02:33 +02:00
dm: adc: add simple ADC uclass implementation
This commit adds: - new uclass id: UCLASS_ADC - new uclass driver: drivers/adc/adc-uclass.c The new uclass's API allows for ADC operation on: * single-channel with channel selection by a number * multti-channel with channel selection by bit mask ADC uclass's functions: * single-channel: - adc_start_channel() - start channel conversion - adc_channel_data() - get conversion data - adc_channel_single_shot() - start/get conversion data * multi-channel: - adc_start_channels() - start selected channels conversion - adc_channels_data() - get conversion data - adc_channels_single_shot() - start/get conversion data for channels selected by bit mask * general: - adc_stop() - stop the conversion - adc_vdd_value() - positive reference Voltage value with polarity [uV] - adc_vss_value() - negative reference Voltage value with polarity [uV] - adc_data_mask() - conversion data bit mask The device tree can provide below constraints/properties: - vdd-polarity-negative: if true: Vdd = vdd-microvolts * (-1) - vss-polarity-negative: if true: Vss = vss-microvolts * (-1) - vdd-supply: phandle to Vdd regulator's node - vss-supply: phandle to Vss regulator's node And optional, checked only if the above corresponding, doesn't exist: - vdd-microvolts: positive reference Voltage [uV] - vss-microvolts: negative reference Voltage [uV] Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
committed by
Minkyu Kang
parent
7c816e24a4
commit
5decbf5300
62
doc/device-tree-bindings/adc/adc.txt
Normal file
62
doc/device-tree-bindings/adc/adc.txt
Normal file
@@ -0,0 +1,62 @@
|
||||
ADC device binding
|
||||
|
||||
There are no mandatory properties for ADC. However, if Voltage info is required,
|
||||
then there are two options:
|
||||
- use microvolts constraint or
|
||||
- use regulator phandle to enable/read supply's Voltage
|
||||
|
||||
Properties and constraints:
|
||||
*optional and always checked, Voltage polarity info:
|
||||
- vdd-polarity-negative: positive reference Voltage has a negative polarity
|
||||
- vss-polarity-negative: negative reference Voltage has a negative polarity
|
||||
|
||||
Chose one option, for each supply (Vdd/Vss):
|
||||
|
||||
*optional and always checked, supply Voltage constants:
|
||||
- vdd-supply: phandle to Vdd regulator's node
|
||||
- vss-supply: phandle to Vss regulator's node
|
||||
|
||||
*optional and checked only if the above corresponding, doesn't exist:
|
||||
- vdd-microvolts: positive reference Voltage value [uV]
|
||||
- vss-microvolts: negative reference Voltage value [uV]
|
||||
|
||||
Example with constant 'Vdd' value:
|
||||
adc@1000000 {
|
||||
compatible = "some-adc";
|
||||
reg = <0xaabb000 0x100>;
|
||||
status = "enabled";
|
||||
vdd-microvolts = <1800000>;
|
||||
};
|
||||
|
||||
Example of supply phandle usage, for the ADC's VDD/VSS references as below:
|
||||
_______ _______
|
||||
|Sandbox| |Sandbox|
|
||||
: PMIC : : ADC :
|
||||
. . . .
|
||||
| | (Vdd) | AIN0|-->
|
||||
| BUCK2|-------|VDDref |
|
||||
| (3.3V)| _|VSSref |
|
||||
|_______| | |_______|
|
||||
_|_
|
||||
|
||||
For the above PMIC, the node can be defined as follows:
|
||||
sandbox_pmic {
|
||||
compatible = "sandbox,pmic";
|
||||
...
|
||||
buck2: buck2 {
|
||||
regulator-name = "SUPPLY_3.3V";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
};
|
||||
...
|
||||
};
|
||||
|
||||
For the above ADC, the node can be defined as follows:
|
||||
adc@0 {
|
||||
compatible = "sandbox,adc";
|
||||
vdd-supply = <&buck2>;
|
||||
vss-microvolts = <0>;
|
||||
};
|
||||
|
||||
The ADC uclass code, will enable the supply before start of the conversion,
|
||||
but it will not configure the regulator settings.
|
Reference in New Issue
Block a user