From 6648bb685a25c6caa87b7b8ebcb7c147af805c39 Mon Sep 17 00:00:00 2001 From: xiongzuan_w Date: Tue, 23 Oct 2018 20:13:50 +0800 Subject: [PATCH] (CR):[kane]:thermal:Add thermal io-channels config Add thermal io-channels config,such as batt_therm/board_therm... Change-Id: I96e4b9576c66c035d99be4cc2a710f1100c66b0b Signed-off-by: xiongzuan_w --- .../dts/exynos/exynos9609-robusta2_evb.dts | 50 +++++++++++++++++++ .../arm64/boot/dts/exynos/exynos9609-wing.dts | 49 ++++++++++++++++++ arch/arm64/configs/robusta2_evb_defconfig | 4 +- arch/arm64/configs/wing_defconfig | 4 +- drivers/hwmon/ntc_thermistor.c | 3 ++ include/linux/platform_data/ntc_thermistor.h | 1 + 6 files changed, 109 insertions(+), 2 deletions(-) mode change 100644 => 100755 drivers/hwmon/ntc_thermistor.c mode change 100644 => 100755 include/linux/platform_data/ntc_thermistor.h diff --git a/arch/arm64/boot/dts/exynos/exynos9609-robusta2_evb.dts b/arch/arm64/boot/dts/exynos/exynos9609-robusta2_evb.dts index d131682943b0..6ea8804e9704 100755 --- a/arch/arm64/boot/dts/exynos/exynos9609-robusta2_evb.dts +++ b/arch/arm64/boot/dts/exynos/exynos9609-robusta2_evb.dts @@ -1283,6 +1283,56 @@ }; }; +&exynos_adc { + status = "okay"; + cpu_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 0>; + io-channel-names = "cpu_therm"; + }; + battery_thermistor { + compatible = "murata,ncp15xh103"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 1>; + io-channel-names = "bat_therm"; + }; + pa_thermistor { + compatible = "murata,ncp15xh103"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <0>; + pulldown-ohm = <10000>; + io-channels = <&exynos_adc 4>; + io-channel-names = "pa_therm"; + connected-positive; + }; + board_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 7>; + io-channel-names = "board_therm"; + }; + usb_con_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 8>; + io-channel-names = "usb_con_therm"; + }; +}; + &i2c_2 { #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm64/boot/dts/exynos/exynos9609-wing.dts b/arch/arm64/boot/dts/exynos/exynos9609-wing.dts index 9ba2198a31fe..1c451f12a9ec 100755 --- a/arch/arm64/boot/dts/exynos/exynos9609-wing.dts +++ b/arch/arm64/boot/dts/exynos/exynos9609-wing.dts @@ -1782,6 +1782,55 @@ }; }; +&exynos_adc { + status = "okay"; + cpu_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 0>; + io-channel-names = "cpu_therm"; + }; + chg_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 1>; + io-channel-names = "chg_therm"; + }; + pa_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 4>; + io-channel-names = "pa_therm"; + }; + board_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 7>; + io-channel-names = "board_therm"; + }; + battery_thermistor { + compatible = "murata,ncp03wf104"; + status = "okay"; + pullup-uv = <1800000>; + pullup-ohm = <100000>; + pulldown-ohm = <0>; + io-channels = <&exynos_adc 8>; + io-channel-names = "batt_therm"; + }; +}; + &i2c_2 { #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm64/configs/robusta2_evb_defconfig b/arch/arm64/configs/robusta2_evb_defconfig index b83e85d3c299..3af79f68af41 100755 --- a/arch/arm64/configs/robusta2_evb_defconfig +++ b/arch/arm64/configs/robusta2_evb_defconfig @@ -555,4 +555,6 @@ CONFIG_SEC_NFC_CLK_REQ=y CONFIG_SENSORS_CLASS=y CONFIG_INPUT_EGISTEC_320=y CONFIG_AW8695_HAPTIC=y -CONFIG_MOT_UTAG=y \ No newline at end of file +CONFIG_MOT_UTAG=y +CONFIG_HWMON=y +CONFIG_SENSORS_NTC_THERMISTOR=y \ No newline at end of file diff --git a/arch/arm64/configs/wing_defconfig b/arch/arm64/configs/wing_defconfig index c1dd3f17de78..982865698311 100755 --- a/arch/arm64/configs/wing_defconfig +++ b/arch/arm64/configs/wing_defconfig @@ -540,4 +540,6 @@ CONFIG_SEC_NFC_CLK_REQ=y CONFIG_SENSORS_CLASS=y CONFIG_INPUT_EGISTEC_320=y CONFIG_AW8695_HAPTIC=y -CONFIG_MOT_UTAG=y \ No newline at end of file +CONFIG_MOT_UTAG=y +CONFIG_HWMON=y +CONFIG_SENSORS_NTC_THERMISTOR=y \ No newline at end of file diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c old mode 100644 new mode 100755 index b2b1d23aaaea..b19a2e6e9347 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c @@ -278,6 +278,9 @@ static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata) } } else { /* Assume 12 bit ADC with vref at pullup_uv */ + uv = (pdata->pullup_uv * (s64)raw) >> 12; + } + } else { uv = (pdata->pullup_uv * (s64)raw) >> 12; } diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h old mode 100644 new mode 100755 index 962d582a4803..de9fe9a04bab --- a/include/linux/platform_data/ntc_thermistor.h +++ b/include/linux/platform_data/ntc_thermistor.h @@ -57,6 +57,7 @@ struct ntc_thermistor_platform_data { struct iio_channel *chan; bool iio_convert_support; + bool iio_convert_support; int (*read_ohm)(void); }; -- 2.20.1