mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-09-21 03:43:03 +00:00
hwmon: epm_adc: Scale single measurement result
EPM driver can scale the result returned to the user instead of returning raw ADC code that is obtained through the PSOC. The range of the code is from 0-0x7fff with the corresponding voltage range from 0 to 2.048V. The voltage units are in mV. The current is computed using the corresponding channel's rsense value with the units in mA. Change-Id: I6fc4b264fa170e412800f4ef77b4c3dacb90186c Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
This commit is contained in:
parent
d4afc55092
commit
7efed8e6f4
|
@ -1324,6 +1324,10 @@ static long epm_adc_ioctl(struct file *file, unsigned int cmd,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
psoc_get_data.reading_value = epm_psoc_scale_result(
|
||||
psoc_get_data.reading_value,
|
||||
psoc_get_data.chan_num);
|
||||
|
||||
if (copy_to_user((void __user *)arg, &psoc_get_data,
|
||||
sizeof(struct epm_psoc_get_data)))
|
||||
return -EFAULT;
|
||||
|
|
Loading…
Reference in a new issue