diff options
| -rw-r--r-- | drivers/hwmon/abituguru.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index 59122cc0a50..cc15c4f2e9e 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c | |||
| @@ -142,6 +142,14 @@ static const u8 abituguru_pwm_max[5] = { 0, 255, 255, 75, 75 }; | |||
| 142 | static int force; | 142 | static int force; |
| 143 | module_param(force, bool, 0); | 143 | module_param(force, bool, 0); |
| 144 | MODULE_PARM_DESC(force, "Set to one to force detection."); | 144 | MODULE_PARM_DESC(force, "Set to one to force detection."); |
| 145 | static int bank1_types[ABIT_UGURU_MAX_BANK1_SENSORS] = { -1, -1, -1, -1, -1, | ||
| 146 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; | ||
| 147 | module_param_array(bank1_types, int, NULL, 0); | ||
| 148 | MODULE_PARM_DESC(bank1_types, "Bank1 sensortype autodetection override:\n" | ||
| 149 | " -1 autodetect\n" | ||
| 150 | " 0 volt sensor\n" | ||
| 151 | " 1 temp sensor\n" | ||
| 152 | " 2 not connected"); | ||
| 145 | static int fan_sensors; | 153 | static int fan_sensors; |
| 146 | module_param(fan_sensors, int, 0); | 154 | module_param(fan_sensors, int, 0); |
| 147 | MODULE_PARM_DESC(fan_sensors, "Number of fan sensors on the uGuru " | 155 | MODULE_PARM_DESC(fan_sensors, "Number of fan sensors on the uGuru " |
| @@ -397,6 +405,15 @@ abituguru_detect_bank1_sensor_type(struct abituguru_data *data, | |||
| 397 | u8 val, buf[3]; | 405 | u8 val, buf[3]; |
| 398 | int ret = ABIT_UGURU_NC; | 406 | int ret = ABIT_UGURU_NC; |
| 399 | 407 | ||
| 408 | /* If overriden by the user return the user selected type */ | ||
| 409 | if (bank1_types[sensor_addr] >= ABIT_UGURU_IN_SENSOR && | ||
| 410 | bank1_types[sensor_addr] <= ABIT_UGURU_NC) { | ||
| 411 | ABIT_UGURU_DEBUG(2, "assuming sensor type %d for bank1 sensor " | ||
| 412 | "%d because of \"bank1_types\" module param\n", | ||
| 413 | bank1_types[sensor_addr], (int)sensor_addr); | ||
| 414 | return bank1_types[sensor_addr]; | ||
| 415 | } | ||
| 416 | |||
| 400 | /* First read the sensor and the current settings */ | 417 | /* First read the sensor and the current settings */ |
| 401 | if (abituguru_read(data, ABIT_UGURU_SENSOR_BANK1, sensor_addr, &val, | 418 | if (abituguru_read(data, ABIT_UGURU_SENSOR_BANK1, sensor_addr, &val, |
| 402 | 1, ABIT_UGURU_MAX_RETRIES) != 1) | 419 | 1, ABIT_UGURU_MAX_RETRIES) != 1) |
| @@ -514,7 +531,7 @@ abituguru_detect_no_bank2_sensors(struct abituguru_data *data) | |||
| 514 | { | 531 | { |
| 515 | int i; | 532 | int i; |
| 516 | 533 | ||
| 517 | if (fan_sensors) { | 534 | if (fan_sensors > 0 && fan_sensors <= ABIT_UGURU_MAX_BANK2_SENSORS) { |
| 518 | data->bank2_sensors = fan_sensors; | 535 | data->bank2_sensors = fan_sensors; |
| 519 | ABIT_UGURU_DEBUG(2, "assuming %d fan sensors because of " | 536 | ABIT_UGURU_DEBUG(2, "assuming %d fan sensors because of " |
| 520 | "\"fan_sensors\" module param\n", | 537 | "\"fan_sensors\" module param\n", |
| @@ -568,7 +585,7 @@ abituguru_detect_no_pwms(struct abituguru_data *data) | |||
| 568 | { | 585 | { |
| 569 | int i, j; | 586 | int i, j; |
| 570 | 587 | ||
| 571 | if (pwms) { | 588 | if (pwms > 0 && pwms <= ABIT_UGURU_MAX_PWMS) { |
| 572 | data->pwms = pwms; | 589 | data->pwms = pwms; |
| 573 | ABIT_UGURU_DEBUG(2, "assuming %d PWM outputs because of " | 590 | ABIT_UGURU_DEBUG(2, "assuming %d PWM outputs because of " |
| 574 | "\"pwms\" module param\n", (int)data->pwms); | 591 | "\"pwms\" module param\n", (int)data->pwms); |
