hwmon: (ntc_thermistor) Support B57330V2103 from EPCOS
authorJohannes Pointner <johannes.pointner@gmail.com>
Tue, 1 Jul 2014 06:05:52 +0000 (08:05 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 4 Aug 2014 14:01:35 +0000 (07:01 -0700)
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>
Documentation/devicetree/bindings/hwmon/ntc_thermistor.txt
Documentation/hwmon/ntc_thermistor
drivers/hwmon/Kconfig
drivers/hwmon/ntc_thermistor.c
include/linux/platform_data/ntc_thermistor.h

index b117b2e9e1a7fa51c814e9ea6e85ed2e8b50e8fe..2391e5c41999afd69df9feafc1f70b15accfefe0 100644 (file)
@@ -3,6 +3,7 @@ NTC Thermistor hwmon sensors
 
 Requires node properties:
 - "compatible" value : one of
+       "epcos,b57330v2103"
        "murata,ncp15wb473"
        "murata,ncp18wb473"
        "murata,ncp21wb473"
index 057b77029f2674c6bf6561fe9698e63ef9ee3e01..c5e05e2900a3250ed7f0884c15a82d72154bf65e 100644 (file)
@@ -6,6 +6,11 @@ Supported thermistors from Murata:
   Prefixes: 'ncp15wb473', 'ncp18wb473', 'ncp21wb473', 'ncp03wb473', 'ncp15wl333'
   Datasheet: Publicly available at Murata
 
+Supported thermistors from EPCOS:
+* EPCOS NTC Thermistors B57330V2103
+  Prefixes: b57330v2103
+  Datasheet: Publicly available at EPCOS
+
 Other NTC thermistors can be supported simply by adding compensation
 tables; e.g., NCP15WL333 support is added by the table ncpXXwl333.
 
index 0c7359c5c3172327aaf0cde641a58898c3cdd759..ae1e2160c1b5ca7b28a1ad241d4fa2e79065d502 100644 (file)
@@ -1073,7 +1073,7 @@ config SENSORS_NTC_THERMISTOR
 
          Currently, this driver supports
          NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, and NCP15WL333
-         from Murata.
+         from Murata and B57330V2103 from EPCOS.
 
          This driver can also be built as a module.  If so, the module
          will be called ntc-thermistor.
index ae66f42c4d6d7c8599f4008e318c4f3d5d5095d6..bd410722cd4bacef0eae6401e5c12f044dd94102 100644 (file)
@@ -51,6 +51,7 @@ static const struct platform_device_id ntc_thermistor_id[] = {
        { "ncp21wb473", TYPE_NCPXXWB473 },
        { "ncp03wb473", TYPE_NCPXXWB473 },
        { "ncp15wl333", TYPE_NCPXXWL333 },
+       { "b57330v2103", TYPE_B57330V2103},
        { },
 };
 
@@ -133,6 +134,47 @@ static const struct ntc_compensation ncpXXwl333[] = {
        { .temp_c       = 125, .ohm     = 707 },
 };
 
+/*
+ * The following compensation table is from the specification of EPCOS NTC
+ * Thermistors Datasheet
+ */
+static const struct ntc_compensation b57330v2103[] = {
+       { .temp_c       = -40, .ohm     = 190030 },
+       { .temp_c       = -35, .ohm     = 145360 },
+       { .temp_c       = -30, .ohm     = 112060 },
+       { .temp_c       = -25, .ohm     = 87041 },
+       { .temp_c       = -20, .ohm     = 68104 },
+       { .temp_c       = -15, .ohm     = 53665 },
+       { .temp_c       = -10, .ohm     = 42576 },
+       { .temp_c       = -5, .ohm      = 34001 },
+       { .temp_c       = 0, .ohm       = 27326 },
+       { .temp_c       = 5, .ohm       = 22096 },
+       { .temp_c       = 10, .ohm      = 17973 },
+       { .temp_c       = 15, .ohm      = 14703 },
+       { .temp_c       = 20, .ohm      = 12090 },
+       { .temp_c       = 25, .ohm      = 10000 },
+       { .temp_c       = 30, .ohm      = 8311 },
+       { .temp_c       = 35, .ohm      = 6941 },
+       { .temp_c       = 40, .ohm      = 5825 },
+       { .temp_c       = 45, .ohm      = 4911 },
+       { .temp_c       = 50, .ohm      = 4158 },
+       { .temp_c       = 55, .ohm      = 3536 },
+       { .temp_c       = 60, .ohm      = 3019 },
+       { .temp_c       = 65, .ohm      = 2588 },
+       { .temp_c       = 70, .ohm      = 2227 },
+       { .temp_c       = 75, .ohm      = 1924 },
+       { .temp_c       = 80, .ohm      = 1668 },
+       { .temp_c       = 85, .ohm      = 1451 },
+       { .temp_c       = 90, .ohm      = 1266 },
+       { .temp_c       = 95, .ohm      = 1108 },
+       { .temp_c       = 100, .ohm     = 973 },
+       { .temp_c       = 105, .ohm     = 857 },
+       { .temp_c       = 110, .ohm     = 757 },
+       { .temp_c       = 115, .ohm     = 671 },
+       { .temp_c       = 120, .ohm     = 596 },
+       { .temp_c       = 125, .ohm     = 531 },
+};
+
 struct ntc_data {
        struct device *hwmon_dev;
        struct ntc_thermistor_platform_data *pdata;
@@ -173,6 +215,8 @@ static const struct of_device_id ntc_match[] = {
                .data = &ntc_thermistor_id[3] },
        { .compatible = "murata,ncp15wl333",
                .data = &ntc_thermistor_id[4] },
+       { .compatible = "epcos,b57330v2103",
+               .data = &ntc_thermistor_id[5]},
 
        /* Usage of vendor name "ntc" is deprecated */
        { .compatible = "ntc,ncp15wb473",
@@ -490,6 +534,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
                data->comp = ncpXXwl333;
                data->n_comp = ARRAY_SIZE(ncpXXwl333);
                break;
+       case TYPE_B57330V2103:
+               data->comp = b57330v2103;
+               data->n_comp = ARRAY_SIZE(b57330v2103);
+               break;
        default:
                dev_err(&pdev->dev, "Unknown device type: %lu(%s)\n",
                                pdev_id->driver_data, pdev_id->name);
@@ -546,7 +594,7 @@ static struct platform_driver ntc_thermistor_driver = {
 
 module_platform_driver(ntc_thermistor_driver);
 
-MODULE_DESCRIPTION("NTC Thermistor Driver from Murata");
+MODULE_DESCRIPTION("NTC Thermistor Driver");
 MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:ntc-thermistor");
index c7285b57546268e028d859b00328cacb018b637d..0a6de4ca4930bdded25056c7d4cc36bbf0a172d0 100644 (file)
@@ -26,6 +26,7 @@ struct iio_channel;
 enum ntc_thermistor_type {
        TYPE_NCPXXWB473,
        TYPE_NCPXXWL333,
+       TYPE_B57330V2103,
 };
 
 struct ntc_thermistor_platform_data {