Commit f88b4265 authored by Akinobu Mita's avatar Akinobu Mita Committed by Linus Torvalds

iio: adc: qcom-vadc-common: use <linux/units.h> helpers

This switches the qcom-vadc-common to use milli_kelvin_to_millicelsius()
in <linux/units.h>.

Link: http://lkml.kernel.org/r/1576386975-7941-13-git-send-email-akinobu.mita@gmail.comSigned-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Amit Kucheria <amit.kucheria@verdurent.com>
Cc: Andy Shevchenko <andy@infradead.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Sujith Thomas <sujith.thomas@intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b741ffb4
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/units.h>
#include "qcom-vadc-common.h" #include "qcom-vadc-common.h"
...@@ -236,8 +237,7 @@ static int qcom_vadc_scale_die_temp(const struct vadc_linear_graph *calib_graph, ...@@ -236,8 +237,7 @@ static int qcom_vadc_scale_die_temp(const struct vadc_linear_graph *calib_graph,
voltage = 0; voltage = 0;
} }
voltage -= KELVINMIL_CELSIUSMIL; *result_mdec = milli_kelvin_to_millicelsius(voltage);
*result_mdec = voltage;
return 0; return 0;
} }
...@@ -325,7 +325,7 @@ static int qcom_vadc_scale_hw_calib_die_temp( ...@@ -325,7 +325,7 @@ static int qcom_vadc_scale_hw_calib_die_temp(
{ {
*result_mdec = qcom_vadc_scale_code_voltage_factor(adc_code, *result_mdec = qcom_vadc_scale_code_voltage_factor(adc_code,
prescale, data, 2); prescale, data, 2);
*result_mdec -= KELVINMIL_CELSIUSMIL; *result_mdec = milli_kelvin_to_millicelsius(*result_mdec);
return 0; return 0;
} }
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#define VADC_AVG_SAMPLES_MAX 512 #define VADC_AVG_SAMPLES_MAX 512
#define ADC5_AVG_SAMPLES_MAX 16 #define ADC5_AVG_SAMPLES_MAX 16
#define KELVINMIL_CELSIUSMIL 273150
#define PMIC5_CHG_TEMP_SCALE_FACTOR 377500 #define PMIC5_CHG_TEMP_SCALE_FACTOR 377500
#define PMIC5_SMB_TEMP_CONSTANT 419400 #define PMIC5_SMB_TEMP_CONSTANT 419400
#define PMIC5_SMB_TEMP_SCALE_FACTOR 356 #define PMIC5_SMB_TEMP_SCALE_FACTOR 356
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment