Blame view

drivers/hwmon/ntc_thermistor.c 19.8 KB
1a59d1b8e   Thomas Gleixner   treewide: Replace...
1
  // SPDX-License-Identifier: GPL-2.0-or-later
f22aaaa70   Donggeun Kim   hwmon: Driver for...
2
3
4
5
6
  /*
   * ntc_thermistor.c - NTC Thermistors
   *
   *  Copyright (C) 2010 Samsung Electronics
   *  MyungJoo Ham <myungjoo.ham@samsung.com>
f22aaaa70   Donggeun Kim   hwmon: Driver for...
7
8
9
10
11
12
13
14
   */
  
  #include <linux/slab.h>
  #include <linux/module.h>
  #include <linux/pm_runtime.h>
  #include <linux/math64.h>
  #include <linux/platform_device.h>
  #include <linux/err.h>
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
15
16
  #include <linux/of.h>
  #include <linux/of_device.h>
f22aaaa70   Donggeun Kim   hwmon: Driver for...
17
18
  
  #include <linux/platform_data/ntc_thermistor.h>
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
19
20
21
22
  #include <linux/iio/iio.h>
  #include <linux/iio/machine.h>
  #include <linux/iio/driver.h>
  #include <linux/iio/consumer.h>
f22aaaa70   Donggeun Kim   hwmon: Driver for...
23
  #include <linux/hwmon.h>
f22aaaa70   Donggeun Kim   hwmon: Driver for...
24
25
  
  struct ntc_compensation {
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
26
  	int		temp_c;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
27
28
  	unsigned int	ohm;
  };
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  /*
   * Used as index in a zero-terminated array, holes not allowed so
   * that NTC_LAST is the first empty array entry.
   */
  enum {
  	NTC_B57330V2103,
  	NTC_B57891S0103,
  	NTC_NCP03WB473,
  	NTC_NCP03WF104,
  	NTC_NCP15WB473,
  	NTC_NCP15WL333,
  	NTC_NCP15XH103,
  	NTC_NCP18WB473,
  	NTC_NCP21WB473,
  	NTC_LAST,
  };
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
45
  static const struct platform_device_id ntc_thermistor_id[] = {
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
46
47
48
49
50
51
52
53
54
55
  	[NTC_B57330V2103]     = { "b57330v2103",     TYPE_B57330V2103 },
  	[NTC_B57891S0103]     = { "b57891s0103",     TYPE_B57891S0103 },
  	[NTC_NCP03WB473]      = { "ncp03wb473",      TYPE_NCPXXWB473 },
  	[NTC_NCP03WF104]      = { "ncp03wf104",      TYPE_NCPXXWF104 },
  	[NTC_NCP15WB473]      = { "ncp15wb473",      TYPE_NCPXXWB473 },
  	[NTC_NCP15WL333]      = { "ncp15wl333",      TYPE_NCPXXWL333 },
  	[NTC_NCP15XH103]      = { "ncp15xh103",      TYPE_NCPXXXH103 },
  	[NTC_NCP18WB473]      = { "ncp18wb473",      TYPE_NCPXXWB473 },
  	[NTC_NCP21WB473]      = { "ncp21wb473",      TYPE_NCPXXWB473 },
  	[NTC_LAST]            = { },
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
56
  };
f22aaaa70   Donggeun Kim   hwmon: Driver for...
57
58
59
60
61
62
  /*
   * A compensation table should be sorted by the values of .ohm
   * in descending order.
   * The following compensation tables are from the specification of Murata NTC
   * Thermistors Datasheet
   */
4626dcff7   Sachin Kamat   hwmon: (ntc_therm...
63
  static const struct ntc_compensation ncpXXwb473[] = {
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
  	{ .temp_c	= -40, .ohm	= 1747920 },
  	{ .temp_c	= -35, .ohm	= 1245428 },
  	{ .temp_c	= -30, .ohm	= 898485 },
  	{ .temp_c	= -25, .ohm	= 655802 },
  	{ .temp_c	= -20, .ohm	= 483954 },
  	{ .temp_c	= -15, .ohm	= 360850 },
  	{ .temp_c	= -10, .ohm	= 271697 },
  	{ .temp_c	= -5, .ohm	= 206463 },
  	{ .temp_c	= 0, .ohm	= 158214 },
  	{ .temp_c	= 5, .ohm	= 122259 },
  	{ .temp_c	= 10, .ohm	= 95227 },
  	{ .temp_c	= 15, .ohm	= 74730 },
  	{ .temp_c	= 20, .ohm	= 59065 },
  	{ .temp_c	= 25, .ohm	= 47000 },
  	{ .temp_c	= 30, .ohm	= 37643 },
  	{ .temp_c	= 35, .ohm	= 30334 },
  	{ .temp_c	= 40, .ohm	= 24591 },
  	{ .temp_c	= 45, .ohm	= 20048 },
  	{ .temp_c	= 50, .ohm	= 16433 },
  	{ .temp_c	= 55, .ohm	= 13539 },
  	{ .temp_c	= 60, .ohm	= 11209 },
  	{ .temp_c	= 65, .ohm	= 9328 },
  	{ .temp_c	= 70, .ohm	= 7798 },
  	{ .temp_c	= 75, .ohm	= 6544 },
  	{ .temp_c	= 80, .ohm	= 5518 },
  	{ .temp_c	= 85, .ohm	= 4674 },
  	{ .temp_c	= 90, .ohm	= 3972 },
  	{ .temp_c	= 95, .ohm	= 3388 },
  	{ .temp_c	= 100, .ohm	= 2902 },
  	{ .temp_c	= 105, .ohm	= 2494 },
  	{ .temp_c	= 110, .ohm	= 2150 },
  	{ .temp_c	= 115, .ohm	= 1860 },
  	{ .temp_c	= 120, .ohm	= 1615 },
  	{ .temp_c	= 125, .ohm	= 1406 },
f22aaaa70   Donggeun Kim   hwmon: Driver for...
98
  };
4626dcff7   Sachin Kamat   hwmon: (ntc_therm...
99
  static const struct ntc_compensation ncpXXwl333[] = {
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  	{ .temp_c	= -40, .ohm	= 1610154 },
  	{ .temp_c	= -35, .ohm	= 1130850 },
  	{ .temp_c	= -30, .ohm	= 802609 },
  	{ .temp_c	= -25, .ohm	= 575385 },
  	{ .temp_c	= -20, .ohm	= 416464 },
  	{ .temp_c	= -15, .ohm	= 304219 },
  	{ .temp_c	= -10, .ohm	= 224193 },
  	{ .temp_c	= -5, .ohm	= 166623 },
  	{ .temp_c	= 0, .ohm	= 124850 },
  	{ .temp_c	= 5, .ohm	= 94287 },
  	{ .temp_c	= 10, .ohm	= 71747 },
  	{ .temp_c	= 15, .ohm	= 54996 },
  	{ .temp_c	= 20, .ohm	= 42455 },
  	{ .temp_c	= 25, .ohm	= 33000 },
  	{ .temp_c	= 30, .ohm	= 25822 },
  	{ .temp_c	= 35, .ohm	= 20335 },
  	{ .temp_c	= 40, .ohm	= 16115 },
  	{ .temp_c	= 45, .ohm	= 12849 },
  	{ .temp_c	= 50, .ohm	= 10306 },
  	{ .temp_c	= 55, .ohm	= 8314 },
  	{ .temp_c	= 60, .ohm	= 6746 },
  	{ .temp_c	= 65, .ohm	= 5503 },
  	{ .temp_c	= 70, .ohm	= 4513 },
  	{ .temp_c	= 75, .ohm	= 3721 },
  	{ .temp_c	= 80, .ohm	= 3084 },
  	{ .temp_c	= 85, .ohm	= 2569 },
  	{ .temp_c	= 90, .ohm	= 2151 },
  	{ .temp_c	= 95, .ohm	= 1809 },
  	{ .temp_c	= 100, .ohm	= 1529 },
  	{ .temp_c	= 105, .ohm	= 1299 },
  	{ .temp_c	= 110, .ohm	= 1108 },
  	{ .temp_c	= 115, .ohm	= 949 },
  	{ .temp_c	= 120, .ohm	= 817 },
  	{ .temp_c	= 125, .ohm	= 707 },
f22aaaa70   Donggeun Kim   hwmon: Driver for...
134
  };
887ee4347   Beomho Seo   hwmon: (ntc_therm...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  static const struct ntc_compensation ncpXXwf104[] = {
  	{ .temp_c	= -40, .ohm	= 4397119 },
  	{ .temp_c	= -35, .ohm	= 3088599 },
  	{ .temp_c	= -30, .ohm	= 2197225 },
  	{ .temp_c	= -25, .ohm	= 1581881 },
  	{ .temp_c	= -20, .ohm	= 1151037 },
  	{ .temp_c	= -15, .ohm	= 846579 },
  	{ .temp_c	= -10, .ohm	= 628988 },
  	{ .temp_c	= -5, .ohm	= 471632 },
  	{ .temp_c	= 0, .ohm	= 357012 },
  	{ .temp_c	= 5, .ohm	= 272500 },
  	{ .temp_c	= 10, .ohm	= 209710 },
  	{ .temp_c	= 15, .ohm	= 162651 },
  	{ .temp_c	= 20, .ohm	= 127080 },
  	{ .temp_c	= 25, .ohm	= 100000 },
  	{ .temp_c	= 30, .ohm	= 79222 },
  	{ .temp_c	= 35, .ohm	= 63167 },
  	{ .temp_c	= 40, .ohm	= 50677 },
  	{ .temp_c	= 45, .ohm	= 40904 },
  	{ .temp_c	= 50, .ohm	= 33195 },
  	{ .temp_c	= 55, .ohm	= 27091 },
  	{ .temp_c	= 60, .ohm	= 22224 },
  	{ .temp_c	= 65, .ohm	= 18323 },
  	{ .temp_c	= 70, .ohm	= 15184 },
  	{ .temp_c	= 75, .ohm	= 12635 },
  	{ .temp_c	= 80, .ohm	= 10566 },
  	{ .temp_c	= 85, .ohm	= 8873 },
  	{ .temp_c	= 90, .ohm	= 7481 },
  	{ .temp_c	= 95, .ohm	= 6337 },
  	{ .temp_c	= 100, .ohm	= 5384 },
  	{ .temp_c	= 105, .ohm	= 4594 },
  	{ .temp_c	= 110, .ohm	= 3934 },
  	{ .temp_c	= 115, .ohm	= 3380 },
  	{ .temp_c	= 120, .ohm	= 2916 },
  	{ .temp_c	= 125, .ohm	= 2522 },
  };
54ce3a0d8   Joseph McNally   hwmon: (ntc_therm...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
  static const struct ntc_compensation ncpXXxh103[] = {
  	{ .temp_c	= -40, .ohm	= 247565 },
  	{ .temp_c	= -35, .ohm	= 181742 },
  	{ .temp_c	= -30, .ohm	= 135128 },
  	{ .temp_c	= -25, .ohm	= 101678 },
  	{ .temp_c	= -20, .ohm	= 77373 },
  	{ .temp_c	= -15, .ohm	= 59504 },
  	{ .temp_c	= -10, .ohm	= 46222 },
  	{ .temp_c	= -5, .ohm	= 36244 },
  	{ .temp_c	= 0, .ohm	= 28674 },
  	{ .temp_c	= 5, .ohm	= 22878 },
  	{ .temp_c	= 10, .ohm	= 18399 },
  	{ .temp_c	= 15, .ohm	= 14910 },
  	{ .temp_c	= 20, .ohm	= 12169 },
  	{ .temp_c	= 25, .ohm	= 10000 },
  	{ .temp_c	= 30, .ohm	= 8271 },
  	{ .temp_c	= 35, .ohm	= 6883 },
  	{ .temp_c	= 40, .ohm	= 5762 },
  	{ .temp_c	= 45, .ohm	= 4851 },
  	{ .temp_c	= 50, .ohm	= 4105 },
  	{ .temp_c	= 55, .ohm	= 3492 },
  	{ .temp_c	= 60, .ohm	= 2985 },
  	{ .temp_c	= 65, .ohm	= 2563 },
  	{ .temp_c	= 70, .ohm	= 2211 },
  	{ .temp_c	= 75, .ohm	= 1915 },
  	{ .temp_c	= 80, .ohm	= 1666 },
  	{ .temp_c	= 85, .ohm	= 1454 },
  	{ .temp_c	= 90, .ohm	= 1275 },
  	{ .temp_c	= 95, .ohm	= 1121 },
  	{ .temp_c	= 100, .ohm	= 990 },
  	{ .temp_c	= 105, .ohm	= 876 },
  	{ .temp_c	= 110, .ohm	= 779 },
  	{ .temp_c	= 115, .ohm	= 694 },
  	{ .temp_c	= 120, .ohm	= 620 },
  	{ .temp_c	= 125, .ohm	= 556 },
  };
ed67f0872   Johannes Pointner   hwmon: (ntc_therm...
207
  /*
e8fda2c86   Peter Rosin   hwmon: (ntc_therm...
208
209
   * The following compensation tables are from the specifications in EPCOS NTC
   * Thermistors Datasheets
ed67f0872   Johannes Pointner   hwmon: (ntc_therm...
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
   */
  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 },
  };
e8fda2c86   Peter Rosin   hwmon: (ntc_therm...
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
  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 },
  };
737c086ed   Peter Rosin   hwmon: (ntc_therm...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
  struct ntc_type {
  	const struct ntc_compensation *comp;
  	int n_comp;
  };
  
  #define NTC_TYPE(ntc, compensation) \
  [(ntc)] = { .comp = (compensation), .n_comp = ARRAY_SIZE(compensation) }
  
  static const struct ntc_type ntc_type[] = {
  	NTC_TYPE(TYPE_B57330V2103, b57330v2103),
  	NTC_TYPE(TYPE_B57891S0103, b57891s0103),
  	NTC_TYPE(TYPE_NCPXXWB473,  ncpXXwb473),
  	NTC_TYPE(TYPE_NCPXXWF104,  ncpXXwf104),
  	NTC_TYPE(TYPE_NCPXXWL333,  ncpXXwl333),
  	NTC_TYPE(TYPE_NCPXXXH103,  ncpXXxh103),
  };
f22aaaa70   Donggeun Kim   hwmon: Driver for...
308
  struct ntc_data {
f22aaaa70   Donggeun Kim   hwmon: Driver for...
309
310
  	struct ntc_thermistor_platform_data *pdata;
  	const struct ntc_compensation *comp;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
311
  	int n_comp;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
312
  };
59cf4243e   Jean Delvare   hwmon: (ntc_therm...
313
  #if defined(CONFIG_OF) && IS_ENABLED(CONFIG_IIO)
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
314
315
316
  static int ntc_adc_iio_read(struct ntc_thermistor_platform_data *pdata)
  {
  	struct iio_channel *channel = pdata->chan;
0315253b1   Chris Lesiak   hwmon: (ntc_therm...
317
  	int raw, uv, ret;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
318

0315253b1   Chris Lesiak   hwmon: (ntc_therm...
319
  	ret = iio_read_channel_raw(channel, &raw);
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
320
321
322
323
324
  	if (ret < 0) {
  		pr_err("read channel() error: %d
  ", ret);
  		return ret;
  	}
0315253b1   Chris Lesiak   hwmon: (ntc_therm...
325
326
327
328
329
  	ret = iio_convert_raw_to_processed(channel, raw, &uv, 1000);
  	if (ret < 0) {
  		/* Assume 12 bit ADC with vref at pullup_uv */
  		uv = (pdata->pullup_uv * (s64)raw) >> 12;
  	}
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
330

0315253b1   Chris Lesiak   hwmon: (ntc_therm...
331
  	return uv;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
332
333
334
  }
  
  static const struct of_device_id ntc_match[] = {
ed67f0872   Johannes Pointner   hwmon: (ntc_therm...
335
  	{ .compatible = "epcos,b57330v2103",
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
336
337
338
339
340
  		.data = &ntc_thermistor_id[NTC_B57330V2103]},
  	{ .compatible = "epcos,b57891s0103",
  		.data = &ntc_thermistor_id[NTC_B57891S0103] },
  	{ .compatible = "murata,ncp03wb473",
  		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
887ee4347   Beomho Seo   hwmon: (ntc_therm...
341
  	{ .compatible = "murata,ncp03wf104",
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
342
343
344
345
346
  		.data = &ntc_thermistor_id[NTC_NCP03WF104] },
  	{ .compatible = "murata,ncp15wb473",
  		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
  	{ .compatible = "murata,ncp15wl333",
  		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
54ce3a0d8   Joseph McNally   hwmon: (ntc_therm...
347
  	{ .compatible = "murata,ncp15xh103",
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
348
349
350
351
352
  		.data = &ntc_thermistor_id[NTC_NCP15XH103] },
  	{ .compatible = "murata,ncp18wb473",
  		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
  	{ .compatible = "murata,ncp21wb473",
  		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
8b6f5e0f1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
353
354
  
  	/* Usage of vendor name "ntc" is deprecated */
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
355
356
  	{ .compatible = "ntc,ncp03wb473",
  		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
357
  	{ .compatible = "ntc,ncp15wb473",
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
358
359
360
  		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
  	{ .compatible = "ntc,ncp15wl333",
  		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
361
  	{ .compatible = "ntc,ncp18wb473",
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
362
  		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
363
  	{ .compatible = "ntc,ncp21wb473",
e056fe25d   Peter Rosin   hwmon: (ntc_therm...
364
  		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
365
366
367
368
369
  	{ },
  };
  MODULE_DEVICE_TABLE(of, ntc_match);
  
  static struct ntc_thermistor_platform_data *
48001525c   Guenter Roeck   hwmon: (ntc_therm...
370
  ntc_thermistor_parse_dt(struct device *dev)
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
371
372
  {
  	struct iio_channel *chan;
adba65753   Chris Lesiak   hwmon: (ntc_therm...
373
  	enum iio_chan_type type;
48001525c   Guenter Roeck   hwmon: (ntc_therm...
374
  	struct device_node *np = dev->of_node;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
375
  	struct ntc_thermistor_platform_data *pdata;
adba65753   Chris Lesiak   hwmon: (ntc_therm...
376
  	int ret;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
377
378
379
  
  	if (!np)
  		return NULL;
48001525c   Guenter Roeck   hwmon: (ntc_therm...
380
  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
381
382
  	if (!pdata)
  		return ERR_PTR(-ENOMEM);
48001525c   Guenter Roeck   hwmon: (ntc_therm...
383
  	chan = devm_iio_channel_get(dev, NULL);
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
384
385
  	if (IS_ERR(chan))
  		return ERR_CAST(chan);
adba65753   Chris Lesiak   hwmon: (ntc_therm...
386
387
388
389
390
391
  	ret = iio_get_channel_type(chan, &type);
  	if (ret < 0)
  		return ERR_PTR(ret);
  
  	if (type != IIO_VOLTAGE)
  		return ERR_PTR(-EINVAL);
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
392
  	if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv))
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
393
394
395
396
397
398
399
400
401
402
403
404
  		return ERR_PTR(-ENODEV);
  	if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm))
  		return ERR_PTR(-ENODEV);
  	if (of_property_read_u32(np, "pulldown-ohm", &pdata->pulldown_ohm))
  		return ERR_PTR(-ENODEV);
  
  	if (of_find_property(np, "connected-positive", NULL))
  		pdata->connect = NTC_CONNECTED_POSITIVE;
  	else /* status change should be possible if not always on. */
  		pdata->connect = NTC_CONNECTED_GROUND;
  
  	pdata->chan = chan;
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
405
  	pdata->read_uv = ntc_adc_iio_read;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
406
407
408
  
  	return pdata;
  }
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
409
410
  #else
  static struct ntc_thermistor_platform_data *
48001525c   Guenter Roeck   hwmon: (ntc_therm...
411
  ntc_thermistor_parse_dt(struct device *dev)
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
412
413
414
  {
  	return NULL;
  }
59cf4243e   Jean Delvare   hwmon: (ntc_therm...
415
  #define ntc_match	NULL
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
416
  #endif
f22aaaa70   Donggeun Kim   hwmon: Driver for...
417
418
419
420
421
422
423
424
  static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
  {
  	if (divisor == 0 && dividend == 0)
  		return 0;
  	if (divisor == 0)
  		return UINT_MAX;
  	return div64_u64(dividend, divisor);
  }
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
425
  static int get_ohm_of_thermistor(struct ntc_data *data, unsigned int uv)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
426
427
  {
  	struct ntc_thermistor_platform_data *pdata = data->pdata;
f6725ae2f   Chris Lesiak   hwmon: (ntc_therm...
428
  	u32 puv = pdata->pullup_uv;
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
429
430
431
  	u64 n, puo, pdo;
  	puo = pdata->pullup_ohm;
  	pdo = pdata->pulldown_ohm;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
432

f6725ae2f   Chris Lesiak   hwmon: (ntc_therm...
433
434
435
436
  	if (uv == 0)
  		return (pdata->connect == NTC_CONNECTED_POSITIVE) ?
  			INT_MAX : 0;
  	if (uv >= puv)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
437
  		return (pdata->connect == NTC_CONNECTED_POSITIVE) ?
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
438
  			0 : INT_MAX;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
439

088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
440
  	if (pdata->connect == NTC_CONNECTED_POSITIVE && puo == 0)
f6725ae2f   Chris Lesiak   hwmon: (ntc_therm...
441
  		n = div_u64(pdo * (puv - uv), uv);
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
442
  	else if (pdata->connect == NTC_CONNECTED_GROUND && pdo == 0)
f6725ae2f   Chris Lesiak   hwmon: (ntc_therm...
443
  		n = div_u64(puo * uv, puv - uv);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
444
  	else if (pdata->connect == NTC_CONNECTED_POSITIVE)
f6725ae2f   Chris Lesiak   hwmon: (ntc_therm...
445
446
  		n = div64_u64_safe(pdo * puo * (puv - uv),
  				puo * uv - pdo * (puv - uv));
f22aaaa70   Donggeun Kim   hwmon: Driver for...
447
  	else
f6725ae2f   Chris Lesiak   hwmon: (ntc_therm...
448
  		n = div64_u64_safe(pdo * puo * uv, pdo * (puv - uv) - puo * uv);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
449

088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
450
451
452
  	if (n > INT_MAX)
  		n = INT_MAX;
  	return n;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
453
  }
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
454
455
  static void lookup_comp(struct ntc_data *data, unsigned int ohm,
  			int *i_low, int *i_high)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
456
  {
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
  	int start, end, mid;
  
  	/*
  	 * Handle special cases: Resistance is higher than or equal to
  	 * resistance in first table entry, or resistance is lower or equal
  	 * to resistance in last table entry.
  	 * In these cases, return i_low == i_high, either pointing to the
  	 * beginning or to the end of the table depending on the condition.
  	 */
  	if (ohm >= data->comp[0].ohm) {
  		*i_low = 0;
  		*i_high = 0;
  		return;
  	}
  	if (ohm <= data->comp[data->n_comp - 1].ohm) {
  		*i_low = data->n_comp - 1;
  		*i_high = data->n_comp - 1;
  		return;
  	}
f22aaaa70   Donggeun Kim   hwmon: Driver for...
476
477
478
479
  
  	/* Do a binary search on compensation table */
  	start = 0;
  	end = data->n_comp;
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
480
  	while (start < end) {
f22aaaa70   Donggeun Kim   hwmon: Driver for...
481
  		mid = start + (end - start) / 2;
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
482
483
484
485
486
487
488
489
490
491
  		/*
  		 * start <= mid < end
  		 * data->comp[start].ohm > ohm >= data->comp[end].ohm
  		 *
  		 * We could check for "ohm == data->comp[mid].ohm" here, but
  		 * that is a quite unlikely condition, and we would have to
  		 * check again after updating start. Check it at the end instead
  		 * for simplicity.
  		 */
  		if (ohm >= data->comp[mid].ohm) {
f22aaaa70   Donggeun Kim   hwmon: Driver for...
492
  			end = mid;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
493
  		} else {
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
494
495
496
497
498
499
500
501
502
  			start = mid + 1;
  			/*
  			 * ohm >= data->comp[start].ohm might be true here,
  			 * since we set start to mid + 1. In that case, we are
  			 * done. We could keep going, but the condition is quite
  			 * likely to occur, so it is worth checking for it.
  			 */
  			if (ohm >= data->comp[start].ohm)
  				end = start;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
503
  		}
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
504
505
506
507
  		/*
  		 * start <= end
  		 * data->comp[start].ohm >= ohm >= data->comp[end].ohm
  		 */
f22aaaa70   Donggeun Kim   hwmon: Driver for...
508
  	}
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
509
510
511
512
513
514
515
516
517
  	/*
  	 * start == end
  	 * ohm >= data->comp[end].ohm
  	 */
  	*i_low = end;
  	if (ohm == data->comp[end].ohm)
  		*i_high = end;
  	else
  		*i_high = end - 1;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
518
  }
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
519
  static int get_temp_mc(struct ntc_data *data, unsigned int ohm)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
520
521
  {
  	int low, high;
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
522
  	int temp;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
523

dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
524
525
  	lookup_comp(data, ohm, &low, &high);
  	if (low == high) {
f22aaaa70   Donggeun Kim   hwmon: Driver for...
526
  		/* Unable to use linear approximation */
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
527
  		temp = data->comp[low].temp_c * 1000;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
528
  	} else {
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
529
530
  		temp = data->comp[low].temp_c * 1000 +
  			((data->comp[high].temp_c - data->comp[low].temp_c) *
f22aaaa70   Donggeun Kim   hwmon: Driver for...
531
532
533
  			 1000 * ((int)ohm - (int)data->comp[low].ohm)) /
  			((int)data->comp[high].ohm - (int)data->comp[low].ohm);
  	}
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
534
  	return temp;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
535
  }
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
536
  static int ntc_thermistor_get_ohm(struct ntc_data *data)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
537
  {
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
538
  	int read_uv;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
539

dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
540
541
  	if (data->pdata->read_ohm)
  		return data->pdata->read_ohm();
f22aaaa70   Donggeun Kim   hwmon: Driver for...
542

088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
543
544
545
546
547
  	if (data->pdata->read_uv) {
  		read_uv = data->pdata->read_uv(data->pdata);
  		if (read_uv < 0)
  			return read_uv;
  		return get_ohm_of_thermistor(data, read_uv);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
548
  	}
dbe43a627   Guenter Roeck   hwmon: (ntc_therm...
549
  	return -EINVAL;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
550
  }
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
551
552
  static int ntc_read(struct device *dev, enum hwmon_sensor_types type,
  		    u32 attr, int channel, long *val)
c08860ffe   Jonghwa Lee   hwmon: (ntc_therm...
553
  {
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
554
  	struct ntc_data *data = dev_get_drvdata(dev);
c08860ffe   Jonghwa Lee   hwmon: (ntc_therm...
555
  	int ohm;
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
  	switch (type) {
  	case hwmon_temp:
  		switch (attr) {
  		case hwmon_temp_input:
  			ohm = ntc_thermistor_get_ohm(data);
  			if (ohm < 0)
  				return ohm;
  			*val = get_temp_mc(data, ohm);
  			return 0;
  		case hwmon_temp_type:
  			*val = 4;
  			return 0;
  		default:
  			break;
  		}
  		break;
  	default:
  		break;
  	}
  	return -EINVAL;
c08860ffe   Jonghwa Lee   hwmon: (ntc_therm...
576
  }
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
577
578
  static umode_t ntc_is_visible(const void *data, enum hwmon_sensor_types type,
  			      u32 attr, int channel)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
579
  {
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
580
581
582
583
584
585
586
587
588
589
  	if (type == hwmon_temp) {
  		switch (attr) {
  		case hwmon_temp_input:
  		case hwmon_temp_type:
  			return 0444;
  		default:
  			break;
  		}
  	}
  	return 0;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
590
  }
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
591
  static const struct hwmon_channel_info *ntc_info[] = {
0ddca5773   Guenter Roeck   hwmon: (ntc_therm...
592
593
  	HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
  	HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_TYPE),
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
594
  	NULL
f22aaaa70   Donggeun Kim   hwmon: Driver for...
595
  };
f22aaaa70   Donggeun Kim   hwmon: Driver for...
596

7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
597
598
599
600
601
602
603
604
  static const struct hwmon_ops ntc_hwmon_ops = {
  	.is_visible = ntc_is_visible,
  	.read = ntc_read,
  };
  
  static const struct hwmon_chip_info ntc_chip_info = {
  	.ops = &ntc_hwmon_ops,
  	.info = ntc_info,
2251aef64   Eduardo Valentin   thermal: of: impr...
605
  };
6c931ae1c   Bill Pemberton   hwmon: remove use...
606
  static int ntc_thermistor_probe(struct platform_device *pdev)
f22aaaa70   Donggeun Kim   hwmon: Driver for...
607
  {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
608
  	struct device *dev = &pdev->dev;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
609
  	const struct of_device_id *of_id =
48001525c   Guenter Roeck   hwmon: (ntc_therm...
610
  			of_match_device(of_match_ptr(ntc_match), dev);
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
611
612
  	const struct platform_device_id *pdev_id;
  	struct ntc_thermistor_platform_data *pdata;
5e7f5994b   Guenter Roeck   hwmon: (ntc_therm...
613
  	struct device *hwmon_dev;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
614
  	struct ntc_data *data;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
615

48001525c   Guenter Roeck   hwmon: (ntc_therm...
616
  	pdata = ntc_thermistor_parse_dt(dev);
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
617
618
619
  	if (IS_ERR(pdata))
  		return PTR_ERR(pdata);
  	else if (pdata == NULL)
48001525c   Guenter Roeck   hwmon: (ntc_therm...
620
  		pdata = dev_get_platdata(dev);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
621
622
  
  	if (!pdata) {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
623
624
  		dev_err(dev, "No platform init data supplied.
  ");
f22aaaa70   Donggeun Kim   hwmon: Driver for...
625
626
627
628
  		return -ENODEV;
  	}
  
  	/* Either one of the two is required. */
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
629
  	if (!pdata->read_uv && !pdata->read_ohm) {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
630
  		dev_err(dev,
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
631
632
  			"Both read_uv and read_ohm missing. Need either one of the two.
  ");
f22aaaa70   Donggeun Kim   hwmon: Driver for...
633
634
  		return -EINVAL;
  	}
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
635
  	if (pdata->read_uv && pdata->read_ohm) {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
636
  		dev_warn(dev,
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
637
638
639
  			 "Only one of read_uv and read_ohm is needed; ignoring read_uv.
  ");
  		pdata->read_uv = NULL;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
640
  	}
088ce2ac9   Guenter Roeck   hwmon: Fix CamelC...
641
  	if (pdata->read_uv && (pdata->pullup_uv == 0 ||
f22aaaa70   Donggeun Kim   hwmon: Driver for...
642
643
644
645
646
647
  				(pdata->pullup_ohm == 0 && pdata->connect ==
  				 NTC_CONNECTED_GROUND) ||
  				(pdata->pulldown_ohm == 0 && pdata->connect ==
  				 NTC_CONNECTED_POSITIVE) ||
  				(pdata->connect != NTC_CONNECTED_POSITIVE &&
  				 pdata->connect != NTC_CONNECTED_GROUND))) {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
648
649
  		dev_err(dev, "Required data to use read_uv not supplied.
  ");
f22aaaa70   Donggeun Kim   hwmon: Driver for...
650
651
  		return -EINVAL;
  	}
48001525c   Guenter Roeck   hwmon: (ntc_therm...
652
  	data = devm_kzalloc(dev, sizeof(struct ntc_data), GFP_KERNEL);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
653
654
  	if (!data)
  		return -ENOMEM;
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
655
  	pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
656
  	data->pdata = pdata;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
657

737c086ed   Peter Rosin   hwmon: (ntc_therm...
658
  	if (pdev_id->driver_data >= ARRAY_SIZE(ntc_type)) {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
659
660
  		dev_err(dev, "Unknown device type: %lu(%s)
  ",
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
661
  				pdev_id->driver_data, pdev_id->name);
41141e64e   Guenter Roeck   hwmon: (ntc_therm...
662
  		return -EINVAL;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
663
  	}
737c086ed   Peter Rosin   hwmon: (ntc_therm...
664
665
  	data->comp   = ntc_type[pdev_id->driver_data].comp;
  	data->n_comp = ntc_type[pdev_id->driver_data].n_comp;
7cc7de93f   Guenter Roeck   hwmon: (ntc_therm...
666
667
668
  	hwmon_dev = devm_hwmon_device_register_with_info(dev, pdev_id->name,
  							 data, &ntc_chip_info,
  							 NULL);
5e7f5994b   Guenter Roeck   hwmon: (ntc_therm...
669
  	if (IS_ERR(hwmon_dev)) {
48001525c   Guenter Roeck   hwmon: (ntc_therm...
670
671
  		dev_err(dev, "unable to register as hwmon device.
  ");
5e7f5994b   Guenter Roeck   hwmon: (ntc_therm...
672
  		return PTR_ERR(hwmon_dev);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
673
  	}
48001525c   Guenter Roeck   hwmon: (ntc_therm...
674
675
676
  	dev_info(dev, "Thermistor type: %s successfully probed.
  ",
  		 pdev_id->name);
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
677

f22aaaa70   Donggeun Kim   hwmon: Driver for...
678
  	return 0;
f22aaaa70   Donggeun Kim   hwmon: Driver for...
679
  }
f22aaaa70   Donggeun Kim   hwmon: Driver for...
680
681
682
  static struct platform_driver ntc_thermistor_driver = {
  	.driver = {
  		.name = "ntc-thermistor",
9e8269de1   Naveen Krishna Chatradhi   hwmon: (ntc_therm...
683
  		.of_match_table = of_match_ptr(ntc_match),
f22aaaa70   Donggeun Kim   hwmon: Driver for...
684
685
  	},
  	.probe = ntc_thermistor_probe,
f22aaaa70   Donggeun Kim   hwmon: Driver for...
686
687
  	.id_table = ntc_thermistor_id,
  };
25a236a5d   Axel Lin   hwmon: convert dr...
688
  module_platform_driver(ntc_thermistor_driver);
f22aaaa70   Donggeun Kim   hwmon: Driver for...
689

ed67f0872   Johannes Pointner   hwmon: (ntc_therm...
690
  MODULE_DESCRIPTION("NTC Thermistor Driver");
f22aaaa70   Donggeun Kim   hwmon: Driver for...
691
692
693
  MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
  MODULE_LICENSE("GPL");
  MODULE_ALIAS("platform:ntc-thermistor");