aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Pointner <johannes.pointner@gmail.com>2014-07-01 02:05:52 -0400
committerGuenter Roeck <linux@roeck-us.net>2014-08-04 10:01:35 -0400
commited67f0872be1aa516831332c732752022d4edc7c (patch)
tree3c1ad73c7b1735ae78c85cfbfd9add48459339b3
parent3ef0bb6f769bc61af0ec073cbf49db6598bdefc0 (diff)
hwmon: (ntc_thermistor) Support B57330V2103 from EPCOS
This patch adds support for the ntc thermistor B57330V2103 from EPCOS. Signed-off-by: Johannes Pointner <johannes.pointner@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt1
-rw-r--r--Documentation/hwmon/ntc_thermistor5
-rw-r--r--drivers/hwmon/Kconfig2
-rw-r--r--drivers/hwmon/ntc_thermistor.c50
-rw-r--r--include/linux/platform_data/ntc_thermistor.h1
5 files changed, 57 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
index b117b2e9e1a7..2391e5c41999 100644
--- a/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
+++ b/Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
@@ -3,6 +3,7 @@ NTC Thermistor hwmon sensors
3 3
4Requires node properties: 4Requires node properties:
5- "compatible" value : one of 5- "compatible" value : one of
6 "epcos,b57330v2103"
6 "murata,ncp15wb473" 7 "murata,ncp15wb473"
7 "murata,ncp18wb473" 8 "murata,ncp18wb473"
8 "murata,ncp21wb473" 9 "murata,ncp21wb473"
diff --git a/Documentation/hwmon/ntc_thermistor b/Documentation/hwmon/ntc_thermistor
index 057b77029f26..c5e05e2900a3 100644
--- a/Documentation/hwmon/ntc_thermistor
+++ b/Documentation/hwmon/ntc_thermistor
@@ -6,6 +6,11 @@ Supported thermistors from Murata:
6 Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333' 6 Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333'
7 Datasheet: Publicly available at Murata 7 Datasheet: Publicly available at Murata
8 8
9Supported thermistors from EPCOS:
10* EPCOS NTC Thermistors B57330V2103
11 Prefixes: b57330v2103
12 Datasheet: Publicly available at EPCOS
13
9Other NTC thermistors can be supported simply by adding compensation 14Other NTC thermistors can be supported simply by adding compensation
10tables; e.g., NCP15WL333 support is added by the table ncpXXwl333. 15tables; e.g., NCP15WL333 support is added by the table ncpXXwl333.
11 16
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 0c7359c5c317..ae1e2160c1b5 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1073,7 +1073,7 @@ config SENSORS_NTC_THERMISTOR
1073 1073
1074 Currently, this driver supports 1074 Currently, this driver supports
1075 NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333 1075 NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333
1076 from Murata. 1076 from Murata and B57330V2103 from EPCOS.
1077 1077
1078 This driver can also be built as a module. If so, the module 1078 This driver can also be built as a module. If so, the module
1079 will be called ntc-thermistor. 1079 will be called ntc-thermistor.
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index ae66f42c4d6d..bd410722cd4b 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -51,6 +51,7 @@ static const struct platform_device_id ntc_thermistor_id[] = {
51 { "ncp21wb473", TYPE_NCPXXWB473 }, 51 { "ncp21wb473", TYPE_NCPXXWB473 },
52 { "ncp03wb473", TYPE_NCPXXWB473 }, 52 { "ncp03wb473", TYPE_NCPXXWB473 },
53 { "ncp15wl333", TYPE_NCPXXWL333 }, 53 { "ncp15wl333", TYPE_NCPXXWL333 },
54 { "b57330v2103", TYPE_B57330V2103},
54 { }, 55 { },
55}; 56};
56 57
@@ -133,6 +134,47 @@ static const struct ntc_compensation ncpXXwl333[] = {
133 { .temp_c = 125, .ohm = 707 }, 134 { .temp_c = 125, .ohm = 707 },
134}; 135};
135 136
137/*
138 * The following compensation table is from the specification of EPCOS NTC
139 * Thermistors Datasheet
140 */
141static const struct ntc_compensation b57330v2103[] = {
142 { .temp_c = -40, .ohm = 190030 },
143 { .temp_c = -35, .ohm = 145360 },
144 { .temp_c = -30, .ohm = 112060 },
145 { .temp_c = -25, .ohm = 87041 },
146 { .temp_c = -20, .ohm = 68104 },
147 { .temp_c = -15, .ohm = 53665 },
148 { .temp_c = -10, .ohm = 42576 },
149 { .temp_c = -5, .ohm = 34001 },
150 { .temp_c = 0, .ohm = 27326 },
151 { .temp_c = 5, .ohm = 22096 },
152 { .temp_c = 10, .ohm = 17973 },
153 { .temp_c = 15, .ohm = 14703 },
154 { .temp_c = 20, .ohm = 12090 },
155 { .temp_c = 25, .ohm = 10000 },
156 { .temp_c = 30, .ohm = 8311 },
157 { .temp_c = 35, .ohm = 6941 },
158 { .temp_c = 40, .ohm = 5825 },
159 { .temp_c = 45, .ohm = 4911 },
160 { .temp_c = 50, .ohm = 4158 },
161 { .temp_c = 55, .ohm = 3536 },
162 { .temp_c = 60, .ohm = 3019 },
163 { .temp_c = 65, .ohm = 2588 },
164 { .temp_c = 70, .ohm = 2227 },
165 { .temp_c = 75, .ohm = 1924 },
166 { .temp_c = 80, .ohm = 1668 },
167 { .temp_c = 85, .ohm = 1451 },
168 { .temp_c = 90, .ohm = 1266 },
169 { .temp_c = 95, .ohm = 1108 },
170 { .temp_c = 100, .ohm = 973 },
171 { .temp_c = 105, .ohm = 857 },
172 { .temp_c = 110, .ohm = 757 },
173 { .temp_c = 115, .ohm = 671 },
174 { .temp_c = 120, .ohm = 596 },
175 { .temp_c = 125, .ohm = 531 },
176};
177
136struct ntc_data { 178struct ntc_data {
137 struct device *hwmon_dev; 179 struct device *hwmon_dev;
138 struct ntc_thermistor_platform_data *pdata; 180 struct ntc_thermistor_platform_data *pdata;
@@ -173,6 +215,8 @@ static const struct of_device_id ntc_match[] = {
173 .data = &ntc_thermistor_id[3] }, 215 .data = &ntc_thermistor_id[3] },
174 { .compatible = "murata,ncp15wl333", 216 { .compatible = "murata,ncp15wl333",
175 .data = &ntc_thermistor_id[4] }, 217 .data = &ntc_thermistor_id[4] },
218 { .compatible = "epcos,b57330v2103",
219 .data = &ntc_thermistor_id[5]},
176 220
177 /* Usage of vendor name "ntc" is deprecated */ 221 /* Usage of vendor name "ntc" is deprecated */
178 { .compatible = "ntc,ncp15wb473", 222 { .compatible = "ntc,ncp15wb473",
@@ -490,6 +534,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
490 data->comp = ncpXXwl333; 534 data->comp = ncpXXwl333;
491 data->n_comp = ARRAY_SIZE(ncpXXwl333); 535 data->n_comp = ARRAY_SIZE(ncpXXwl333);
492 break; 536 break;
537 case TYPE_B57330V2103:
538 data->comp = b57330v2103;
539 data->n_comp = ARRAY_SIZE(b57330v2103);
540 break;
493 default: 541 default:
494 dev_err(&pdev->dev, "Unknown device type: %lu(%s)\n", 542 dev_err(&pdev->dev, "Unknown device type: %lu(%s)\n",
495 pdev_id->driver_data, pdev_id->name); 543 pdev_id->driver_data, pdev_id->name);
@@ -546,7 +594,7 @@ static struct platform_driver ntc_thermistor_driver = {
546 594
547module_platform_driver(ntc_thermistor_driver); 595module_platform_driver(ntc_thermistor_driver);
548 596
549MODULE_DESCRIPTION("NTC Thermistor Driver from Murata"); 597MODULE_DESCRIPTION("NTC Thermistor Driver");
550MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); 598MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
551MODULE_LICENSE("GPL"); 599MODULE_LICENSE("GPL");
552MODULE_ALIAS("platform:ntc-thermistor"); 600MODULE_ALIAS("platform:ntc-thermistor");
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
index c7285b575462..0a6de4ca4930 100644
--- a/include/linux/platform_data/ntc_thermistor.h
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -26,6 +26,7 @@ struct iio_channel;
26enum ntc_thermistor_type { 26enum ntc_thermistor_type {
27 TYPE_NCPXXWB473, 27 TYPE_NCPXXWB473,
28 TYPE_NCPXXWL333, 28 TYPE_NCPXXWL333,
29 TYPE_B57330V2103,
29}; 30};
30 31
31struct ntc_thermistor_platform_data { 32struct ntc_thermistor_platform_data {