20 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22 #include <linux/module.h>
24 #include <linux/slab.h>
33 #define DRVNAME "sch5636"
34 #define DEVNAME "theseus"
36 #define SCH5636_REG_FUJITSU_ID 0x780
37 #define SCH5636_REG_FUJITSU_REV 0x783
39 #define SCH5636_NO_INS 5
40 #define SCH5636_NO_TEMPS 16
41 #define SCH5636_NO_FANS 8
44 0x22, 0x23, 0x24, 0x25, 0x189 };
46 4400, 1500, 4000, 4400, 16000 };
48 "3.3V",
"VREF",
"VBAT",
"3.3AUX",
"12V" };
51 0x2B, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x180, 0x181,
52 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C };
53 #define SCH5636_REG_TEMP_CTRL(i) (0x790 + (i))
54 #define SCH5636_TEMP_WORKING 0x01
55 #define SCH5636_TEMP_ALARM 0x02
56 #define SCH5636_TEMP_DEACTIVATED 0x80
59 0x2C, 0x2E, 0x30, 0x32, 0x62, 0x64, 0x66, 0x68 };
60 #define SCH5636_REG_FAN_CTRL(i) (0x880 + (i))
62 #define SCH5636_FAN_ALARM 0x04
63 #define SCH5636_FAN_NOT_PRESENT 0x08
64 #define SCH5636_FAN_DEACTIVATED 0x80
96 SCH5636_REG_IN_VAL[i]);
109 SCH5636_REG_TEMP_VAL[i]);
135 SCH5636_REG_FAN_VAL[i]);
163 static int reg_to_rpm(
u16 reg)
170 return 5400540 /
reg;
187 return PTR_ERR(data);
190 data->
in[attr->
index] * SCH5636_REG_IN_FACTORS[attr->
index],
201 SCH5636_IN_LABELS[attr->
index]);
212 return PTR_ERR(data);
226 return PTR_ERR(data);
240 return PTR_ERR(data);
254 return PTR_ERR(data);
271 return PTR_ERR(data);
285 return PTR_ERR(data);
394 for (i = 0; i <
ARRAY_SIZE(sch5636_attr); i++)
397 for (i = 0; i < SCH5636_NO_TEMPS * 3; i++)
401 for (i = 0; i < SCH5636_NO_FANS * 3; i++)
421 platform_set_drvdata(pdev, data);
423 for (i = 0; i < 3; i++) {
427 pr_err(
"Could not read Fujitsu id byte at %#x\n",
437 pr_err(
"Unknown Fujitsu id: %02x%02x%02x\n",
438 id[0],
id[1],
id[2]);
443 for (i = 0; i < 2; i++) {
453 data->
addr, revision[0], revision[1]);
476 for (i = 0; i <
ARRAY_SIZE(sch5636_attr); i++) {
483 for (i = 0; i < (SCH5636_NO_TEMPS * 3); i++) {
484 if (data->
temp_ctrl[i/3] & SCH5636_TEMP_DEACTIVATED)
493 for (i = 0; i < (SCH5636_NO_FANS * 3); i++) {
494 if (data->
fan_ctrl[i/3] & SCH5636_FAN_DEACTIVATED)
512 (revision[0] << 8) | revision[1],
518 sch5636_remove(pdev);
527 .probe = sch5636_probe,
528 .remove = sch5636_remove,