blob: 8f1b569c69e7b1c1d14b0c072a544fbfbd157798 [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Hans de Goedea98d5062011-03-21 17:59:36 +01002/***************************************************************************
Hans de Goede312869e2012-03-18 13:05:08 +01003 * Copyright (C) 2010-2012 Hans de Goede <hdegoede@redhat.com> *
Hans de Goedea98d5062011-03-21 17:59:36 +01004 * *
Hans de Goedea98d5062011-03-21 17:59:36 +01005 ***************************************************************************/
6
7#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
8
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/slab.h>
12#include <linux/jiffies.h>
13#include <linux/platform_device.h>
14#include <linux/hwmon.h>
Hans de Goedea98d5062011-03-21 17:59:36 +010015#include <linux/err.h>
16#include <linux/mutex.h>
Hans de Goede28ff2f72011-07-25 21:46:09 +020017#include "sch56xx-common.h"
Hans de Goedea98d5062011-03-21 17:59:36 +010018
19#define DRVNAME "sch5627"
20#define DEVNAME DRVNAME /* We only support one model */
21
Hans de Goedea98d5062011-03-21 17:59:36 +010022#define SCH5627_HWMON_ID 0xa5
23#define SCH5627_COMPANY_ID 0x5c
24#define SCH5627_PRIMARY_ID 0xa0
25
26#define SCH5627_REG_BUILD_CODE 0x39
27#define SCH5627_REG_BUILD_ID 0x3a
28#define SCH5627_REG_HWMON_ID 0x3c
29#define SCH5627_REG_HWMON_REV 0x3d
30#define SCH5627_REG_COMPANY_ID 0x3e
31#define SCH5627_REG_PRIMARY_ID 0x3f
32#define SCH5627_REG_CTRL 0x40
33
34#define SCH5627_NO_TEMPS 8
35#define SCH5627_NO_FANS 4
36#define SCH5627_NO_IN 5
37
38static const u16 SCH5627_REG_TEMP_MSB[SCH5627_NO_TEMPS] = {
39 0x2B, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x180, 0x181 };
40static const u16 SCH5627_REG_TEMP_LSN[SCH5627_NO_TEMPS] = {
41 0xE2, 0xE1, 0xE1, 0xE5, 0xE5, 0xE6, 0x182, 0x182 };
42static const u16 SCH5627_REG_TEMP_HIGH_NIBBLE[SCH5627_NO_TEMPS] = {
43 0, 0, 1, 1, 0, 0, 0, 1 };
44static const u16 SCH5627_REG_TEMP_HIGH[SCH5627_NO_TEMPS] = {
45 0x61, 0x57, 0x59, 0x5B, 0x5D, 0x5F, 0x184, 0x186 };
46static const u16 SCH5627_REG_TEMP_ABS[SCH5627_NO_TEMPS] = {
47 0x9B, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x1A8, 0x1A9 };
48
49static const u16 SCH5627_REG_FAN[SCH5627_NO_FANS] = {
50 0x2C, 0x2E, 0x30, 0x32 };
51static const u16 SCH5627_REG_FAN_MIN[SCH5627_NO_FANS] = {
52 0x62, 0x64, 0x66, 0x68 };
53
54static const u16 SCH5627_REG_IN_MSB[SCH5627_NO_IN] = {
55 0x22, 0x23, 0x24, 0x25, 0x189 };
56static const u16 SCH5627_REG_IN_LSN[SCH5627_NO_IN] = {
57 0xE4, 0xE4, 0xE3, 0xE3, 0x18A };
58static const u16 SCH5627_REG_IN_HIGH_NIBBLE[SCH5627_NO_IN] = {
59 1, 0, 1, 0, 1 };
60static const u16 SCH5627_REG_IN_FACTOR[SCH5627_NO_IN] = {
61 10745, 3660, 9765, 10745, 3660 };
62static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = {
63 "VCC", "VTT", "VBAT", "VTR", "V_IN" };
64
65struct sch5627_data {
66 unsigned short addr;
Hans de Goede357b9dc2011-05-25 20:43:33 +020067 u8 control;
Hans de Goedea98d5062011-03-21 17:59:36 +010068 u8 temp_max[SCH5627_NO_TEMPS];
69 u8 temp_crit[SCH5627_NO_TEMPS];
70 u16 fan_min[SCH5627_NO_FANS];
71
72 struct mutex update_lock;
Hans de Goede357b9dc2011-05-25 20:43:33 +020073 unsigned long last_battery; /* In jiffies */
Armin Wolf790ac8f2021-04-11 18:42:25 +020074 char temp_valid; /* !=0 if following fields are valid */
75 char fan_valid;
76 char in_valid;
77 unsigned long temp_last_updated; /* In jiffies */
78 unsigned long fan_last_updated;
79 unsigned long in_last_updated;
Hans de Goedea98d5062011-03-21 17:59:36 +010080 u16 temp[SCH5627_NO_TEMPS];
81 u16 fan[SCH5627_NO_FANS];
82 u16 in[SCH5627_NO_IN];
83};
84
Armin Wolf790ac8f2021-04-11 18:42:25 +020085static int sch5627_update_temp(struct sch5627_data *data)
Hans de Goedea98d5062011-03-21 17:59:36 +010086{
Armin Wolf790ac8f2021-04-11 18:42:25 +020087 int ret = 0;
88 int i, val;
89
90 mutex_lock(&data->update_lock);
91
92 /* Cache the values for 1 second */
93 if (time_after(jiffies, data->temp_last_updated + HZ) || !data->temp_valid) {
94 for (i = 0; i < SCH5627_NO_TEMPS; i++) {
95 val = sch56xx_read_virtual_reg12(data->addr, SCH5627_REG_TEMP_MSB[i],
96 SCH5627_REG_TEMP_LSN[i],
97 SCH5627_REG_TEMP_HIGH_NIBBLE[i]);
98 if (unlikely(val < 0)) {
99 ret = val;
100 goto abort;
101 }
102 data->temp[i] = val;
103 }
104 data->temp_last_updated = jiffies;
105 data->temp_valid = 1;
106 }
107abort:
108 mutex_unlock(&data->update_lock);
109 return ret;
110}
111
112static int sch5627_update_fan(struct sch5627_data *data)
113{
114 int ret = 0;
115 int i, val;
116
117 mutex_lock(&data->update_lock);
118
119 /* Cache the values for 1 second */
120 if (time_after(jiffies, data->fan_last_updated + HZ) || !data->fan_valid) {
121 for (i = 0; i < SCH5627_NO_FANS; i++) {
122 val = sch56xx_read_virtual_reg16(data->addr, SCH5627_REG_FAN[i]);
123 if (unlikely(val < 0)) {
124 ret = val;
125 goto abort;
126 }
127 data->fan[i] = val;
128 }
129 data->fan_last_updated = jiffies;
130 data->fan_valid = 1;
131 }
132abort:
133 mutex_unlock(&data->update_lock);
134 return ret;
135}
136
137static int sch5627_update_in(struct sch5627_data *data)
138{
139 int ret = 0;
Hans de Goedea98d5062011-03-21 17:59:36 +0100140 int i, val;
141
142 mutex_lock(&data->update_lock);
143
Hans de Goede357b9dc2011-05-25 20:43:33 +0200144 /* Trigger a Vbat voltage measurement every 5 minutes */
145 if (time_after(jiffies, data->last_battery + 300 * HZ)) {
Armin Wolf790ac8f2021-04-11 18:42:25 +0200146 sch56xx_write_virtual_reg(data->addr, SCH5627_REG_CTRL, data->control | 0x10);
Hans de Goede357b9dc2011-05-25 20:43:33 +0200147 data->last_battery = jiffies;
148 }
149
Hans de Goedea98d5062011-03-21 17:59:36 +0100150 /* Cache the values for 1 second */
Armin Wolf790ac8f2021-04-11 18:42:25 +0200151 if (time_after(jiffies, data->in_last_updated + HZ) || !data->in_valid) {
Hans de Goedea98d5062011-03-21 17:59:36 +0100152 for (i = 0; i < SCH5627_NO_IN; i++) {
Armin Wolf790ac8f2021-04-11 18:42:25 +0200153 val = sch56xx_read_virtual_reg12(data->addr, SCH5627_REG_IN_MSB[i],
154 SCH5627_REG_IN_LSN[i],
155 SCH5627_REG_IN_HIGH_NIBBLE[i]);
Hans de Goedea98d5062011-03-21 17:59:36 +0100156 if (unlikely(val < 0)) {
Armin Wolf790ac8f2021-04-11 18:42:25 +0200157 ret = val;
Hans de Goedea98d5062011-03-21 17:59:36 +0100158 goto abort;
159 }
160 data->in[i] = val;
161 }
Armin Wolf790ac8f2021-04-11 18:42:25 +0200162 data->in_last_updated = jiffies;
163 data->in_valid = 1;
Hans de Goedea98d5062011-03-21 17:59:36 +0100164 }
165abort:
166 mutex_unlock(&data->update_lock);
167 return ret;
168}
169
Bill Pemberton6c931ae2012-11-19 13:22:35 -0500170static int sch5627_read_limits(struct sch5627_data *data)
Hans de Goedea98d5062011-03-21 17:59:36 +0100171{
172 int i, val;
173
174 for (i = 0; i < SCH5627_NO_TEMPS; i++) {
175 /*
176 * Note what SMSC calls ABS, is what lm_sensors calls max
177 * (aka high), and HIGH is what lm_sensors calls crit.
178 */
Hans de Goede28ff2f72011-07-25 21:46:09 +0200179 val = sch56xx_read_virtual_reg(data->addr,
180 SCH5627_REG_TEMP_ABS[i]);
Hans de Goedea98d5062011-03-21 17:59:36 +0100181 if (val < 0)
182 return val;
183 data->temp_max[i] = val;
184
Hans de Goede28ff2f72011-07-25 21:46:09 +0200185 val = sch56xx_read_virtual_reg(data->addr,
186 SCH5627_REG_TEMP_HIGH[i]);
Hans de Goedea98d5062011-03-21 17:59:36 +0100187 if (val < 0)
188 return val;
189 data->temp_crit[i] = val;
190 }
191 for (i = 0; i < SCH5627_NO_FANS; i++) {
Hans de Goede28ff2f72011-07-25 21:46:09 +0200192 val = sch56xx_read_virtual_reg16(data->addr,
193 SCH5627_REG_FAN_MIN[i]);
Hans de Goedea98d5062011-03-21 17:59:36 +0100194 if (val < 0)
195 return val;
196 data->fan_min[i] = val;
197 }
198
199 return 0;
200}
201
202static int reg_to_temp(u16 reg)
203{
204 return (reg * 625) / 10 - 64000;
205}
206
207static int reg_to_temp_limit(u8 reg)
208{
209 return (reg - 64) * 1000;
210}
211
212static int reg_to_rpm(u16 reg)
213{
214 if (reg == 0)
215 return -EIO;
216 if (reg == 0xffff)
217 return 0;
218
219 return 5400540 / reg;
220}
221
Armin Wolfe7e0b462021-04-11 18:42:24 +0200222static umode_t sch5627_is_visible(const void *drvdata, enum hwmon_sensor_types type, u32 attr,
223 int channel)
Hans de Goedea98d5062011-03-21 17:59:36 +0100224{
Armin Wolfe7e0b462021-04-11 18:42:24 +0200225 return 0444;
Hans de Goedea98d5062011-03-21 17:59:36 +0100226}
227
Armin Wolfe7e0b462021-04-11 18:42:24 +0200228static int sch5627_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel,
229 long *val)
Hans de Goedea98d5062011-03-21 17:59:36 +0100230{
Armin Wolf790ac8f2021-04-11 18:42:25 +0200231 struct sch5627_data *data = dev_get_drvdata(dev);
Armin Wolfe7e0b462021-04-11 18:42:24 +0200232 int ret;
Hans de Goedea98d5062011-03-21 17:59:36 +0100233
Armin Wolfe7e0b462021-04-11 18:42:24 +0200234 switch (type) {
235 case hwmon_temp:
Armin Wolf790ac8f2021-04-11 18:42:25 +0200236 ret = sch5627_update_temp(data);
237 if (ret < 0)
238 return ret;
Armin Wolfe7e0b462021-04-11 18:42:24 +0200239 switch (attr) {
240 case hwmon_temp_input:
241 *val = reg_to_temp(data->temp[channel]);
242 return 0;
243 case hwmon_temp_max:
244 *val = reg_to_temp_limit(data->temp_max[channel]);
245 return 0;
246 case hwmon_temp_crit:
247 *val = reg_to_temp_limit(data->temp_crit[channel]);
248 return 0;
249 case hwmon_temp_fault:
250 *val = (data->temp[channel] == 0);
251 return 0;
252 default:
253 break;
254 }
255 break;
256 case hwmon_fan:
Armin Wolf790ac8f2021-04-11 18:42:25 +0200257 ret = sch5627_update_fan(data);
258 if (ret < 0)
259 return ret;
Armin Wolfe7e0b462021-04-11 18:42:24 +0200260 switch (attr) {
261 case hwmon_fan_input:
262 ret = reg_to_rpm(data->fan[channel]);
263 if (ret < 0)
264 return ret;
265 *val = ret;
266 return 0;
267 case hwmon_fan_min:
268 ret = reg_to_rpm(data->fan_min[channel]);
269 if (ret < 0)
270 return ret;
271 *val = ret;
272 return 0;
273 case hwmon_fan_fault:
274 *val = (data->fan[channel] == 0xffff);
275 return 0;
276 default:
277 break;
278 }
279 break;
280 case hwmon_in:
Armin Wolf790ac8f2021-04-11 18:42:25 +0200281 ret = sch5627_update_in(data);
282 if (ret < 0)
283 return ret;
Armin Wolfe7e0b462021-04-11 18:42:24 +0200284 switch (attr) {
285 case hwmon_in_input:
286 *val = DIV_ROUND_CLOSEST(data->in[channel] * SCH5627_REG_IN_FACTOR[channel],
287 10000);
288 return 0;
289 default:
290 break;
291 }
292 break;
293 default:
294 break;
295 }
296
297 return -EOPNOTSUPP;
Hans de Goedea98d5062011-03-21 17:59:36 +0100298}
299
Armin Wolfe7e0b462021-04-11 18:42:24 +0200300static int sch5627_read_string(struct device *dev, enum hwmon_sensor_types type, u32 attr,
301 int channel, const char **str)
Hans de Goedea98d5062011-03-21 17:59:36 +0100302{
Armin Wolfe7e0b462021-04-11 18:42:24 +0200303 switch (type) {
304 case hwmon_in:
305 switch (attr) {
306 case hwmon_in_label:
307 *str = SCH5627_IN_LABELS[channel];
308 return 0;
309 default:
310 break;
311 }
312 break;
313 default:
314 break;
315 }
Hans de Goedea98d5062011-03-21 17:59:36 +0100316
Armin Wolfe7e0b462021-04-11 18:42:24 +0200317 return -EOPNOTSUPP;
Hans de Goedea98d5062011-03-21 17:59:36 +0100318}
319
Armin Wolfe7e0b462021-04-11 18:42:24 +0200320static const struct hwmon_ops sch5627_ops = {
321 .is_visible = sch5627_is_visible,
322 .read = sch5627_read,
323 .read_string = sch5627_read_string,
324};
Hans de Goedea98d5062011-03-21 17:59:36 +0100325
Armin Wolfe7e0b462021-04-11 18:42:24 +0200326static const struct hwmon_channel_info *sch5627_info[] = {
327 HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
328 HWMON_CHANNEL_INFO(temp,
329 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
330 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
331 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
332 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
333 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
334 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
335 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT,
336 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_CRIT | HWMON_T_FAULT
337 ),
338 HWMON_CHANNEL_INFO(fan,
339 HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_FAULT,
340 HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_FAULT,
341 HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_FAULT,
342 HWMON_F_INPUT | HWMON_F_MIN | HWMON_F_FAULT
343 ),
344 HWMON_CHANNEL_INFO(in,
345 HWMON_I_INPUT | HWMON_I_LABEL,
346 HWMON_I_INPUT | HWMON_I_LABEL,
347 HWMON_I_INPUT | HWMON_I_LABEL,
348 HWMON_I_INPUT | HWMON_I_LABEL,
349 HWMON_I_INPUT
350 ),
Hans de Goedea98d5062011-03-21 17:59:36 +0100351 NULL
352};
353
Armin Wolfe7e0b462021-04-11 18:42:24 +0200354static const struct hwmon_chip_info sch5627_chip_info = {
355 .ops = &sch5627_ops,
356 .info = sch5627_info,
Hans de Goedea98d5062011-03-21 17:59:36 +0100357};
358
Bill Pemberton6c931ae2012-11-19 13:22:35 -0500359static int sch5627_probe(struct platform_device *pdev)
Hans de Goedea98d5062011-03-21 17:59:36 +0100360{
361 struct sch5627_data *data;
Armin Wolf93a6fb22021-04-17 23:09:19 +0200362 struct device *hwmon_dev;
Hans de Goedea98d5062011-03-21 17:59:36 +0100363 int err, build_code, build_id, hwmon_rev, val;
364
Guenter Roeckbd8d8e02012-06-02 11:20:21 -0700365 data = devm_kzalloc(&pdev->dev, sizeof(struct sch5627_data),
366 GFP_KERNEL);
Hans de Goedea98d5062011-03-21 17:59:36 +0100367 if (!data)
368 return -ENOMEM;
369
370 data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start;
371 mutex_init(&data->update_lock);
372 platform_set_drvdata(pdev, data);
373
Hans de Goede28ff2f72011-07-25 21:46:09 +0200374 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_HWMON_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200375 if (val < 0)
376 return val;
377
Hans de Goedea98d5062011-03-21 17:59:36 +0100378 if (val != SCH5627_HWMON_ID) {
379 pr_err("invalid %s id: 0x%02X (expected 0x%02X)\n", "hwmon",
380 val, SCH5627_HWMON_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200381 return -ENODEV;
Hans de Goedea98d5062011-03-21 17:59:36 +0100382 }
383
Hans de Goede28ff2f72011-07-25 21:46:09 +0200384 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_COMPANY_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200385 if (val < 0)
386 return val;
387
Hans de Goedea98d5062011-03-21 17:59:36 +0100388 if (val != SCH5627_COMPANY_ID) {
389 pr_err("invalid %s id: 0x%02X (expected 0x%02X)\n", "company",
390 val, SCH5627_COMPANY_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200391 return -ENODEV;
Hans de Goedea98d5062011-03-21 17:59:36 +0100392 }
393
Hans de Goede28ff2f72011-07-25 21:46:09 +0200394 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_PRIMARY_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200395 if (val < 0)
396 return val;
397
Hans de Goedea98d5062011-03-21 17:59:36 +0100398 if (val != SCH5627_PRIMARY_ID) {
399 pr_err("invalid %s id: 0x%02X (expected 0x%02X)\n", "primary",
400 val, SCH5627_PRIMARY_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200401 return -ENODEV;
Hans de Goedea98d5062011-03-21 17:59:36 +0100402 }
403
Hans de Goede28ff2f72011-07-25 21:46:09 +0200404 build_code = sch56xx_read_virtual_reg(data->addr,
405 SCH5627_REG_BUILD_CODE);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200406 if (build_code < 0)
407 return build_code;
Hans de Goedea98d5062011-03-21 17:59:36 +0100408
Hans de Goede28ff2f72011-07-25 21:46:09 +0200409 build_id = sch56xx_read_virtual_reg16(data->addr,
410 SCH5627_REG_BUILD_ID);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200411 if (build_id < 0)
412 return build_id;
Hans de Goedea98d5062011-03-21 17:59:36 +0100413
Hans de Goede28ff2f72011-07-25 21:46:09 +0200414 hwmon_rev = sch56xx_read_virtual_reg(data->addr,
415 SCH5627_REG_HWMON_REV);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200416 if (hwmon_rev < 0)
417 return hwmon_rev;
Hans de Goedea98d5062011-03-21 17:59:36 +0100418
Hans de Goede28ff2f72011-07-25 21:46:09 +0200419 val = sch56xx_read_virtual_reg(data->addr, SCH5627_REG_CTRL);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200420 if (val < 0)
421 return val;
422
Hans de Goede357b9dc2011-05-25 20:43:33 +0200423 data->control = val;
424 if (!(data->control & 0x01)) {
Hans de Goedea98d5062011-03-21 17:59:36 +0100425 pr_err("hardware monitoring not enabled\n");
Armin Wolfbab10bf2021-04-17 23:09:20 +0200426 return -ENODEV;
Hans de Goedea98d5062011-03-21 17:59:36 +0100427 }
Hans de Goede357b9dc2011-05-25 20:43:33 +0200428 /* Trigger a Vbat voltage measurement, so that we get a valid reading
429 the first time we read Vbat */
Hans de Goede28ff2f72011-07-25 21:46:09 +0200430 sch56xx_write_virtual_reg(data->addr, SCH5627_REG_CTRL,
Hans de Goede357b9dc2011-05-25 20:43:33 +0200431 data->control | 0x10);
432 data->last_battery = jiffies;
Hans de Goedea98d5062011-03-21 17:59:36 +0100433
434 /*
435 * Read limits, we do this only once as reading a register on
436 * the sch5627 is quite expensive (and they don't change).
437 */
438 err = sch5627_read_limits(data);
439 if (err)
Armin Wolfbab10bf2021-04-17 23:09:20 +0200440 return err;
Hans de Goedea98d5062011-03-21 17:59:36 +0100441
Hans de Goede28ff2f72011-07-25 21:46:09 +0200442 pr_info("found %s chip at %#hx\n", DEVNAME, data->addr);
Hans de Goedea98d5062011-03-21 17:59:36 +0100443 pr_info("firmware build: code 0x%02X, id 0x%04X, hwmon: rev 0x%02X\n",
444 build_code, build_id, hwmon_rev);
445
Armin Wolf93a6fb22021-04-17 23:09:19 +0200446 hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, DEVNAME, data,
447 &sch5627_chip_info, NULL);
Armin Wolfbab10bf2021-04-17 23:09:20 +0200448 if (IS_ERR(hwmon_dev))
449 return PTR_ERR(hwmon_dev);
Hans de Goedea98d5062011-03-21 17:59:36 +0100450
Hans de Goede312869e2012-03-18 13:05:08 +0100451 /* Note failing to register the watchdog is not a fatal error */
Armin Wolf2be5f0d2021-05-08 15:14:54 +0200452 sch56xx_watchdog_register(&pdev->dev, data->addr,
453 (build_code << 24) | (build_id << 8) | hwmon_rev,
454 &data->update_lock, 1);
Hans de Goede312869e2012-03-18 13:05:08 +0100455
Hans de Goedea98d5062011-03-21 17:59:36 +0100456 return 0;
Hans de Goedea98d5062011-03-21 17:59:36 +0100457}
458
Hans de Goedea98d5062011-03-21 17:59:36 +0100459static struct platform_driver sch5627_driver = {
460 .driver = {
Hans de Goedea98d5062011-03-21 17:59:36 +0100461 .name = DRVNAME,
462 },
463 .probe = sch5627_probe,
Hans de Goedea98d5062011-03-21 17:59:36 +0100464};
465
Axel Lin25a236a2011-11-25 02:31:00 -0500466module_platform_driver(sch5627_driver);
Hans de Goedea98d5062011-03-21 17:59:36 +0100467
468MODULE_DESCRIPTION("SMSC SCH5627 Hardware Monitoring Driver");
Hans de Goede7958e3b2011-07-03 13:32:53 +0200469MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
Hans de Goedea98d5062011-03-21 17:59:36 +0100470MODULE_LICENSE("GPL");