X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fadc.h;h=0d1a666908f28fa83f25bc4412ce6144b4a9a72d;hb=5fac11e6d5ab350429b8c8ddf47d3d3877ca89d1;hp=4b1401784983b5da17603657b1ad67c6b4c35353;hpb=5decbf53006c8e2aed8e5506b3961810c1544b3c;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/adc.h b/include/adc.h index 4b14017..0d1a666 100644 --- a/include/adc.h +++ b/include/adc.h @@ -1,8 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2015 Samsung Electronics * Przemyslaw Marczak - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _ADC_H_ @@ -41,7 +40,7 @@ struct adc_channel { }; /** - * struct adc_uclass_platdata - basic ADC info + * struct adc_uclass_plat - basic ADC info * * Note: The positive/negative reference Voltage is only a name and it doesn't * provide an information about the value polarity. It is possible, for both @@ -72,7 +71,7 @@ struct adc_channel { * @vdd_microvolts - positive reference Voltage value * @vss_microvolts - negative reference Voltage value */ -struct adc_uclass_platdata { +struct adc_uclass_plat { int data_format; unsigned int data_mask; unsigned int data_timeout_us; @@ -220,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. @@ -285,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