Skip to content

Commit

Permalink
iio: adc: qcom-vadc-common: use <linux/units.h> helpers
Browse files Browse the repository at this point in the history
This switches the qcom-vadc-common to use milli_kelvin_to_millicelsius()
in <linux/units.h>.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Akinobu Mita <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Cc: Hartmut Knaack <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Cc: Peter Meerwald-Stadler <[email protected]>
Cc: Amit Kucheria <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Daniel Lezcano <[email protected]>
Cc: Darren Hart <[email protected]>
Cc: Emmanuel Grumbach <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Jean Delvare <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Keith Busch <[email protected]>
Cc: Luca Coelho <[email protected]>
Cc: Sagi Grimberg <[email protected]>
Cc: Stanislaw Gruszka <[email protected]>
Cc: Sujith Thomas <[email protected]>
Cc: Zhang Rui <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
  • Loading branch information
mita authored and sfrothwell committed Jan 10, 2020
1 parent 6f84a54 commit 60a99a0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions drivers/iio/adc/qcom-vadc-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/log2.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/units.h>

#include "qcom-vadc-common.h"

Expand Down Expand Up @@ -236,8 +237,7 @@ static int qcom_vadc_scale_die_temp(const struct vadc_linear_graph *calib_graph,
voltage = 0;
}

voltage -= KELVINMIL_CELSIUSMIL;
*result_mdec = voltage;
*result_mdec = milli_kelvin_to_millicelsius(voltage);

return 0;
}
Expand Down Expand Up @@ -325,7 +325,7 @@ static int qcom_vadc_scale_hw_calib_die_temp(
{
*result_mdec = qcom_vadc_scale_code_voltage_factor(adc_code,
prescale, data, 2);
*result_mdec -= KELVINMIL_CELSIUSMIL;
*result_mdec = milli_kelvin_to_millicelsius(*result_mdec);

return 0;
}
Expand Down
1 change: 0 additions & 1 deletion drivers/iio/adc/qcom-vadc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#define VADC_AVG_SAMPLES_MAX 512
#define ADC5_AVG_SAMPLES_MAX 16

#define KELVINMIL_CELSIUSMIL 273150
#define PMIC5_CHG_TEMP_SCALE_FACTOR 377500
#define PMIC5_SMB_TEMP_CONSTANT 419400
#define PMIC5_SMB_TEMP_SCALE_FACTOR 356
Expand Down

0 comments on commit 60a99a0

Please sign in to comment.