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:
Siddartha Mohanadoss 2012-12-06 14:17:30 -08:00 committed by Stephen Boyd
parent d4afc55092
commit 7efed8e6f4

View file

@ -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;