Skip to content

Commit

Permalink
hwmon: (ntc_thermistor): add support for B57891S0103 from Epcos
Browse files Browse the repository at this point in the history
More of the same...

Signed-off-by: Peter Rosin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
peda-r authored and groeck committed Dec 16, 2018
1 parent e1fd3be commit e8fda2c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,8 @@ config SENSORS_NTC_THERMISTOR

Currently, this driver supports
NCP15WB473, NCP18WB473, NCP21WB473, NCP03WB473, NCP15WL333,
NCP03WF104 and NCP15XH103 from Murata and B57330V2103 from EPCOS.
NCP03WF104 and NCP15XH103 from Murata and B57330V2103 and
B57891S0103 from EPCOS.

This driver can also be built as a module. If so, the module
will be called ntc-thermistor.
Expand Down
57 changes: 55 additions & 2 deletions drivers/hwmon/ntc_thermistor.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static const struct platform_device_id ntc_thermistor_id[] = {
{ "b57330v2103", TYPE_B57330V2103},
{ "ncp03wf104", TYPE_NCPXXWF104 },
{ "ncp15xh103", TYPE_NCPXXXH103 },
{ "b57891s0103", TYPE_B57891S0103 },
{ },
};

Expand Down Expand Up @@ -212,8 +213,8 @@ static const struct ntc_compensation ncpXXxh103[] = {
};

/*
* The following compensation table is from the specification of EPCOS NTC
* Thermistors Datasheet
* The following compensation tables are from the specifications in EPCOS NTC
* Thermistors Datasheets
*/
static const struct ntc_compensation b57330v2103[] = {
{ .temp_c = -40, .ohm = 190030 },
Expand Down Expand Up @@ -252,6 +253,52 @@ static const struct ntc_compensation b57330v2103[] = {
{ .temp_c = 125, .ohm = 531 },
};

static const struct ntc_compensation b57891s0103[] = {
{ .temp_c = -55.0, .ohm = 878900 },
{ .temp_c = -50.0, .ohm = 617590 },
{ .temp_c = -45.0, .ohm = 439340 },
{ .temp_c = -40.0, .ohm = 316180 },
{ .temp_c = -35.0, .ohm = 230060 },
{ .temp_c = -30.0, .ohm = 169150 },
{ .temp_c = -25.0, .ohm = 125550 },
{ .temp_c = -20.0, .ohm = 94143 },
{ .temp_c = -15.0, .ohm = 71172 },
{ .temp_c = -10.0, .ohm = 54308 },
{ .temp_c = -5.0, .ohm = 41505 },
{ .temp_c = 0.0, .ohm = 32014 },
{ .temp_c = 5.0, .ohm = 25011 },
{ .temp_c = 10.0, .ohm = 19691 },
{ .temp_c = 15.0, .ohm = 15618 },
{ .temp_c = 20.0, .ohm = 12474 },
{ .temp_c = 25.0, .ohm = 10000 },
{ .temp_c = 30.0, .ohm = 8080 },
{ .temp_c = 35.0, .ohm = 6569 },
{ .temp_c = 40.0, .ohm = 5372 },
{ .temp_c = 45.0, .ohm = 4424 },
{ .temp_c = 50.0, .ohm = 3661 },
{ .temp_c = 55.0, .ohm = 3039 },
{ .temp_c = 60.0, .ohm = 2536 },
{ .temp_c = 65.0, .ohm = 2128 },
{ .temp_c = 70.0, .ohm = 1794 },
{ .temp_c = 75.0, .ohm = 1518 },
{ .temp_c = 80.0, .ohm = 1290 },
{ .temp_c = 85.0, .ohm = 1100 },
{ .temp_c = 90.0, .ohm = 942 },
{ .temp_c = 95.0, .ohm = 809 },
{ .temp_c = 100.0, .ohm = 697 },
{ .temp_c = 105.0, .ohm = 604 },
{ .temp_c = 110.0, .ohm = 525 },
{ .temp_c = 115.0, .ohm = 457 },
{ .temp_c = 120.0, .ohm = 400 },
{ .temp_c = 125.0, .ohm = 351 },
{ .temp_c = 130.0, .ohm = 308 },
{ .temp_c = 135.0, .ohm = 272 },
{ .temp_c = 140.0, .ohm = 240 },
{ .temp_c = 145.0, .ohm = 213 },
{ .temp_c = 150.0, .ohm = 189 },
{ .temp_c = 155.0, .ohm = 168 },
};

struct ntc_data {
struct ntc_thermistor_platform_data *pdata;
const struct ntc_compensation *comp;
Expand Down Expand Up @@ -296,6 +343,8 @@ static const struct of_device_id ntc_match[] = {
.data = &ntc_thermistor_id[6] },
{ .compatible = "murata,ncp15xh103",
.data = &ntc_thermistor_id[7] },
{ .compatible = "epcos,b57891s0103",
.data = &ntc_thermistor_id[8] },

/* Usage of vendor name "ntc" is deprecated */
{ .compatible = "ntc,ncp15wb473",
Expand Down Expand Up @@ -627,6 +676,10 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
data->comp = ncpXXxh103;
data->n_comp = ARRAY_SIZE(ncpXXxh103);
break;
case TYPE_B57891S0103:
data->comp = b57891s0103;
data->n_comp = ARRAY_SIZE(b57891s0103);
break;
default:
dev_err(dev, "Unknown device type: %lu(%s)\n",
pdev_id->driver_data, pdev_id->name);
Expand Down
1 change: 1 addition & 0 deletions include/linux/platform_data/ntc_thermistor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ enum ntc_thermistor_type {
TYPE_B57330V2103,
TYPE_NCPXXWF104,
TYPE_NCPXXXH103,
TYPE_B57891S0103,
};

struct ntc_thermistor_platform_data {
Expand Down

0 comments on commit e8fda2c

Please sign in to comment.