aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/w83792d.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/w83792d.c')
-rw-r--r--drivers/hwmon/w83792d.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index 4be59dbb78c4..1ba072630361 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -193,6 +193,7 @@ static const u8 W83792D_REG_LEVELS[3][4] = {
193 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */ 193 0xE2 } /* (bit3-0) SmartFanII: Fan3 Level 3 */
194}; 194};
195 195
196#define W83792D_REG_GPIO_EN 0x1A
196#define W83792D_REG_CONFIG 0x40 197#define W83792D_REG_CONFIG 0x40
197#define W83792D_REG_VID_FANDIV 0x47 198#define W83792D_REG_VID_FANDIV 0x47
198#define W83792D_REG_CHIPID 0x49 199#define W83792D_REG_CHIPID 0x49
@@ -257,7 +258,7 @@ DIV_TO_REG(long val)
257{ 258{
258 int i; 259 int i;
259 val = SENSORS_LIMIT(val, 1, 128) >> 1; 260 val = SENSORS_LIMIT(val, 1, 128) >> 1;
260 for (i = 0; i < 6; i++) { 261 for (i = 0; i < 7; i++) {
261 if (val == 0) 262 if (val == 0)
262 break; 263 break;
263 val >>= 1; 264 val >>= 1;
@@ -1282,8 +1283,8 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1282 w83792d_init_client(new_client); 1283 w83792d_init_client(new_client);
1283 1284
1284 /* A few vars need to be filled upon startup */ 1285 /* A few vars need to be filled upon startup */
1285 for (i = 1; i <= 7; i++) { 1286 for (i = 0; i < 7; i++) {
1286 data->fan_min[i - 1] = w83792d_read_value(new_client, 1287 data->fan_min[i] = w83792d_read_value(new_client,
1287 W83792D_REG_FAN_MIN[i]); 1288 W83792D_REG_FAN_MIN[i]);
1288 } 1289 }
1289 1290
@@ -1306,10 +1307,20 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1306 device_create_file_fan(new_client, 1); 1307 device_create_file_fan(new_client, 1);
1307 device_create_file_fan(new_client, 2); 1308 device_create_file_fan(new_client, 2);
1308 device_create_file_fan(new_client, 3); 1309 device_create_file_fan(new_client, 3);
1309 device_create_file_fan(new_client, 4); 1310
1310 device_create_file_fan(new_client, 5); 1311 /* Read GPIO enable register to check if pins for fan 4,5 are used as
1311 device_create_file_fan(new_client, 6); 1312 GPIO */
1312 device_create_file_fan(new_client, 7); 1313 val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN);
1314 if (!(val1 & 0x40))
1315 device_create_file_fan(new_client, 4);
1316 if (!(val1 & 0x20))
1317 device_create_file_fan(new_client, 5);
1318
1319 val1 = w83792d_read_value(new_client, W83792D_REG_PIN);
1320 if (val1 & 0x40)
1321 device_create_file_fan(new_client, 6);
1322 if (val1 & 0x04)
1323 device_create_file_fan(new_client, 7);
1313 1324
1314 device_create_file_temp1(new_client); /* Temp1 */ 1325 device_create_file_temp1(new_client); /* Temp1 */
1315 device_create_file_temp_add(new_client, 2); /* Temp2 */ 1326 device_create_file_temp_add(new_client, 2); /* Temp2 */