blob: e86d9774414f92b450a000f8e5d7e82e70549f89 [file] [log] [blame]
Yi Lid5e9c892016-02-17 17:48:42 +08001README for adm1278 hwmon driver
2==================================
3Yi Li <shliyi@cn.ibm.com>
4
5
6This is a temporary kernel patch to enable hwmon driver for adm1278 chip on Barreleye.
7When this patch is merged into linux kernel, this patch will be removed from openbmc.
8
9The adm1278 driver is created according to datasheet:
10http://www.analog.com/media/en/technical-documentation/data-sheets/ADM1278.pdf
11
12The patch heavily re-used adm1278 enabling code from: https://github.com/facebook/openbmc/blob/master/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0000-linux-openbmc.patch.
13
14This patch has been tested on barreleye, by following these steps:
15
161) There are 3 adm1278 devices on Barreleye
17
18I2C5: P12v_a for CPU0
19I2C6: P12v_b for CPU1
20I2C7: P12v_c for HDD and IO Board
21
222) adm1278 driver is based on adm1275.c, which depends on pmbus. This patch builds
23adm1275 and pmbus into kernel.
24
253) When kernel booted, initialize the adm1278 devices:
26
27root@barreleye:~# echo adm1278 0x10 > /sys/class/i2c-adapter/i2c-4/new_device
28root@barreleye:~# echo adm1278 0x10 > /sys/class/i2c-adapter/i2c-5/new_device
29root@barreleye:~# echo adm1278 0x10 > /sys/class/i2c-adapter/i2c-6/new_device
30
31There will be three new hwmon sysfs entries created:
32
33root@barreleye:~# ls /sys/class/hwmon/hwmon3/
34curr1_highest in1_highest in1_reset_history in2_min_alarm power1_label temp1_input
35curr1_input in1_input in2_highest in2_reset_history power1_max temp1_max
36curr1_label in1_label in2_input name power1_reset_history temp1_max_alarm
37curr1_max in1_max in2_label power/ subsystem/ temp1_reset_history
38curr1_max_alarm in1_max_alarm in2_max power1_alarm temp1_crit uevent
39curr1_reset_history in1_min in2_max_alarm power1_input temp1_crit_alarm
40device/ in1_min_alarm in2_min power1_input_highest temp1_highest
41root@barreleye:~# ls /sys/class/hwmon/hwmon4/
42curr1_highest in1_highest in1_reset_history in2_min_alarm power1_label temp1_input
43curr1_input in1_input in2_highest in2_reset_history power1_max temp1_max
44curr1_label in1_label in2_input name power1_reset_history temp1_max_alarm
45curr1_max in1_max in2_label power/ subsystem/ temp1_reset_history
46curr1_max_alarm in1_max_alarm in2_max power1_alarm temp1_crit uevent
47curr1_reset_history in1_min in2_max_alarm power1_input temp1_crit_alarm
48device/ in1_min_alarm in2_min power1_input_highest temp1_highest
49root@barreleye:~# ls /sys/class/hwmon/hwmon5/
50curr1_highest in1_highest in1_reset_history in2_min_alarm power1_label temp1_input
51curr1_input in1_input in2_highest in2_reset_history power1_max temp1_max
52curr1_label in1_label in2_input name power1_reset_history temp1_max_alarm
53curr1_max in1_max in2_label power/ subsystem/ temp1_reset_history
54curr1_max_alarm in1_max_alarm in2_max power1_alarm temp1_crit uevent
55curr1_reset_history in1_min in2_max_alarm power1_input temp1_crit_alarm
56device/ in1_min_alarm in2_min power1_input_highest temp1_highest
57
584) For details of what each hwmon sysfs attributes mean, please refer to:
59https://www.kernel.org/doc/Documentation/hwmon/pmbus
60For short, 'curr1_*' refers to 'IOUT', 'in1_*' refers to 'vin', 'in2_*' refers to 'vout', 'power1_*' refers to 'input power',
61'temp1_*' for 'temperature'.
62
635) Remaining issue:
64
655.1) Currently, i2c_aspeed driver does not handle "i2c_smbus_read_block_data()" correctly. So this patch has to bypass some detection code.
66We need to fix this issue when the patch is merged to kernel.
675.2) According to adm1278 datasheet, there is a sense resistor used to measure power and current. The resistor will affect conversion between
68adm1278 register value to real-world value for current and power. I am not very sure about the resistor value. So using 1 mili-ohms (or 1000 micro-ohms) as default value. When build the adm1275 driver as kernel module, we can set this resistor value by:
69
70# insmod adm1275.ko r_sense=500
71
72This will set the 'sense resistor' to 500 micro-ohms.
735.3) Some of the sensor value, e.g, 'temp1_input' seems not reasonable, e.g:
74
75root@barreleye:~# cat /sys/class/hwmon/hwmon4/temp1_input
76-270952
77
78Need further check on that.