]> asedeno.scripts.mit.edu Git - linux.git/commit
iio: adc: meson-saradc: enable the temperature sensor two more SoCs
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Thu, 27 Dec 2018 21:50:20 +0000 (22:50 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 5 Jan 2019 16:42:05 +0000 (16:42 +0000)
commitb002bf5f8dbca8465b1dadb283154e844c61d73f
treecca055418a887545be1f929f837bbb6d63ab5001
parenta4b475b1abbb41b71d62e088a1ffd2b86e5e0aa0
iio: adc: meson-saradc: enable the temperature sensor two more SoCs

Meson8b and Meson8m2 use the same logic to convert the ADC register
value to celsius, which is different from Meson8:
- Meson8 has different multiplier and divider values
- Meson8 uses a 4-bit TSC (temperature sensor coefficient) which fits
  into the 4-bit field in the MESON_SAR_ADC_DELTA_10 register:
  MESON_SAR_ADC_DELTA_10_TS_C_MASK. Meson8b and Meson8m2 have a 5-bit
  TSC which requires writing the upper-most bit into the
  MESON_HHI_DPLL_TOP_0[9] register from the HHI register area.

This adds support for the temperature sensor on the Meson8b and Meson8m2
SoCs by implementing the logic to write the upper-most TSC bit into the
HHI register area. The SoC-specific values (temperature_trimming_bits,
temperature_multiplier, temperature_divider) are added - these simply
integrate into the existing infrastructure (which was implemented for
Meson8) and thus require no further changes to the existing temperature
calculation logic.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/meson_saradc.c