diff options
author | Fabrice Gasnier | 2018-11-12 14:03:58 +0100 |
---|---|---|
committer | Tom Rini | 2018-11-20 12:35:25 -0500 |
commit | 63f004e7aae17a6b6048c88ce7e39d64e58c08c1 (patch) | |
tree | d24d457dd1dfedb302da045a978782508556dcc1 /include/adc.h | |
parent | d73d81fd85e4a030ade42c4b2d13466d45090aa3 (diff) |
dm: adc: add uclass's mask and conversion helpers
Add two functions to ADC uclass's:
- adc_raw_to_uV() to ease ADC raw value conversion to microvolts
- adc_channel_mask() to get channels on consumer side
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/adc.h')
-rw-r--r-- | include/adc.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/adc.h b/include/adc.h index d04c9c49262..5841dfb54b9 100644 --- a/include/adc.h +++ b/include/adc.h @@ -219,6 +219,17 @@ int adc_channels_data(struct udevice *dev, unsigned int channel_mask, int adc_data_mask(struct udevice *dev, unsigned int *data_mask); /** + * adc_channel_mask() - get channel mask for given ADC device + * + * This can be used if adc uclass platform data is filled. + * + * @dev: ADC device to check + * @channel_mask: pointer to the returned channel bitmask + * @return: 0 if OK, -ve on error + */ +int adc_channel_mask(struct udevice *dev, unsigned int *channel_mask); + +/** * adc_channel_single_shot() - get output data of conversion for the ADC * device's channel. This function searches for the device with the given name, * starts the given channel conversion and returns the output data. @@ -284,4 +295,14 @@ int adc_vss_value(struct udevice *dev, int *uV); */ int adc_stop(struct udevice *dev); +/** + * adc_raw_to_uV() - converts raw value to microvolts for given ADC device. + * + * @dev: ADC device used from conversion + * @raw: raw value to convert + * @uV: converted value in microvolts + * @return: 0 on success or -ve on error + */ +int adc_raw_to_uV(struct udevice *dev, unsigned int raw, int *uV); + #endif |