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