diff options
author | Marek Vasut <marex@denx.de> | 2023-05-10 12:22:49 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-05-23 22:20:16 +0200 |
commit | 8a0377bf671da3a4737d5bff2a974c3049cedbfe (patch) | |
tree | c25e7b0f251b0efaa51f8106ea8c914a235d6e42 /drivers/iio/temperature | |
parent | iio: mlx90614: Drop unused register macros (diff) | |
download | linux-8a0377bf671da3a4737d5bff2a974c3049cedbfe.tar.xz linux-8a0377bf671da3a4737d5bff2a974c3049cedbfe.zip |
iio: mlx90614: Drop MLX90614_CONST_EMISSIVITY_RESOLUTION
The MLX90614_CONST_EMISSIVITY_RESOLUTION can be calculated from
MLX90614_CONST_RAW_EMISSIVITY_MAX, perform the calculation inline
and drio the MLX90614_CONST_EMISSIVITY_RESOLUTION.
Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Crt Mori <cmo@melexis.com>
Link: https://lore.kernel.org/r/20230510102251.10118-4-marex@denx.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/temperature')
-rw-r--r-- | drivers/iio/temperature/mlx90614.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c index 840621f454ab..4f4cefc848c4 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c @@ -63,7 +63,6 @@ #define MLX90614_CONST_OFFSET_REM 500000 /* remainder of offset (273.15*50) */ #define MLX90614_CONST_SCALE 20 /* Scale in milliKelvin (0.02 * 1000) */ #define MLX90614_CONST_RAW_EMISSIVITY_MAX 65535 /* max value for emissivity */ -#define MLX90614_CONST_EMISSIVITY_RESOLUTION 15259 /* 1/65535 ~ 0.000015259 */ #define MLX90614_CONST_FIR 0x7 /* Fixed value for FIR part of low pass filter */ struct mlx90614_data { @@ -283,7 +282,8 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev, *val2 = 0; } else { *val = 0; - *val2 = ret * MLX90614_CONST_EMISSIVITY_RESOLUTION; + *val2 = ret * NSEC_PER_SEC / + MLX90614_CONST_RAW_EMISSIVITY_MAX; } return IIO_VAL_INT_PLUS_NANO; case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: /* IIR setting with @@ -321,7 +321,7 @@ static int mlx90614_write_raw(struct iio_dev *indio_dev, if (val < 0 || val2 < 0 || val > 1 || (val == 1 && val2 != 0)) return -EINVAL; val = val * MLX90614_CONST_RAW_EMISSIVITY_MAX + - val2 / MLX90614_CONST_EMISSIVITY_RESOLUTION; + val2 * MLX90614_CONST_RAW_EMISSIVITY_MAX / NSEC_PER_SEC; ret = mlx90614_power_get(data, false); if (ret < 0) |