From ebdfb6b5e24202b2d7e54318f1fc2742ba42c9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Anikiel?= Date: Fri, 4 Aug 2023 10:36:54 +0000 Subject: [PATCH] drivers: sensor: ntc-thermistor: Add Murata NCP15WB473 thermistor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add murata,ncp15wb473 property together with a compensation table. The table can be found on the vendor's website (Resistance VS. Temperature tab): https://www.murata.com/en-us/products/productdetail?partno=NCP15WB473F03RC Signed-off-by: Paweł Anikiel --- drivers/sensor/ntc_thermistor/Kconfig | 3 ++- .../sensor/ntc_thermistor/ntc_thermistor.c | 26 +++++++++++++++++++ dts/bindings/sensor/murata,ncp15wb473.yaml | 8 ++++++ tests/drivers/build_all/sensor/adc.dtsi | 9 +++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 dts/bindings/sensor/murata,ncp15wb473.yaml diff --git a/drivers/sensor/ntc_thermistor/Kconfig b/drivers/sensor/ntc_thermistor/Kconfig index 3b73aebd205..8ab04aaf184 100644 --- a/drivers/sensor/ntc_thermistor/Kconfig +++ b/drivers/sensor/ntc_thermistor/Kconfig @@ -6,7 +6,8 @@ config NTC_THERMISTOR bool "NTC Thermistor" default y depends on DT_HAS_NTC_THERMISTOR_GENERIC_ENABLED || \ - DT_HAS_EPCOS_B57861S0103A039_ENABLED + DT_HAS_EPCOS_B57861S0103A039_ENABLED || \ + DT_HAS_MURATA_NCP15WB473_ENABLED select ADC help Enable driver for Zephyr NTC Thermistor. diff --git a/drivers/sensor/ntc_thermistor/ntc_thermistor.c b/drivers/sensor/ntc_thermistor/ntc_thermistor.c index c07742f3b3f..00757a49f0c 100644 --- a/drivers/sensor/ntc_thermistor/ntc_thermistor.c +++ b/drivers/sensor/ntc_thermistor/ntc_thermistor.c @@ -156,3 +156,29 @@ static __unused const struct ntc_compensation comp_epcos_b57861s0103a039[] = { DT_INST_FOREACH_STATUS_OKAY_VARGS(NTC_THERMISTOR_DEFINE, DT_DRV_COMPAT, comp_epcos_b57861s0103a039) + +/* murata,ncp15wb473 */ +#undef DT_DRV_COMPAT +#define DT_DRV_COMPAT murata_ncp15wb473 + +static __unused const struct ntc_compensation comp_murata_ncp15wb473[] = { + { -25, 655802 }, + { -15, 360850 }, + { -5, 206463 }, + { 5, 122259 }, + { 15, 74730 }, + { 25, 47000 }, + { 35, 30334 }, + { 45, 20048 }, + { 55, 13539 }, + { 65, 9328 }, + { 75, 6544 }, + { 85, 4674 }, + { 95, 3388 }, + { 105, 2494 }, + { 115, 1860 }, + { 125, 1406 }, +}; + +DT_INST_FOREACH_STATUS_OKAY_VARGS(NTC_THERMISTOR_DEFINE, DT_DRV_COMPAT, + comp_murata_ncp15wb473) diff --git a/dts/bindings/sensor/murata,ncp15wb473.yaml b/dts/bindings/sensor/murata,ncp15wb473.yaml new file mode 100644 index 00000000000..2ea851719dd --- /dev/null +++ b/dts/bindings/sensor/murata,ncp15wb473.yaml @@ -0,0 +1,8 @@ +# Copyright (c) 2023 Google LLC +# SPDX-License-Identifier: Apache-2.0 + +description: MURATA NCP15WB473 thermistor + +compatible: "murata,ncp15wb473" + +include: ntc-thermistor.yaml diff --git a/tests/drivers/build_all/sensor/adc.dtsi b/tests/drivers/build_all/sensor/adc.dtsi index c5a1223576e..fb004abaf37 100644 --- a/tests/drivers/build_all/sensor/adc.dtsi +++ b/tests/drivers/build_all/sensor/adc.dtsi @@ -51,3 +51,12 @@ test_epcos_b57861s0103a039: epcos-b57861s0103a039 { pulldown-ohm = <10000>; connected-positive; }; + +test_murata_ncp15wb473: murata-ncp15wb473 { + compatible = "murata,ncp15wb473"; + io-channels = <&adc0 0>; + pullup-uv = <3300000>; + pullup-ohm = <0>; + pulldown-ohm = <10000>; + connected-positive; +};