diff options
Diffstat (limited to 'drivers/hwmon/nct6775.c')
-rw-r--r-- | drivers/hwmon/nct6775.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 3f4ef21010d5..cf811c1a1475 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -510,6 +510,13 @@ static const u16 NCT6779_REG_TEMP_CRIT[ARRAY_SIZE(nct6779_temp_label) - 1] | |||
510 | 510 | ||
511 | #define NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE 0x28 | 511 | #define NCT6791_REG_HM_IO_SPACE_LOCK_ENABLE 0x28 |
512 | 512 | ||
513 | static const u16 NCT6791_REG_WEIGHT_TEMP_SEL[6] = { 0, 0x239 }; | ||
514 | static const u16 NCT6791_REG_WEIGHT_TEMP_STEP[6] = { 0, 0x23a }; | ||
515 | static const u16 NCT6791_REG_WEIGHT_TEMP_STEP_TOL[6] = { 0, 0x23b }; | ||
516 | static const u16 NCT6791_REG_WEIGHT_DUTY_STEP[6] = { 0, 0x23c }; | ||
517 | static const u16 NCT6791_REG_WEIGHT_TEMP_BASE[6] = { 0, 0x23d }; | ||
518 | static const u16 NCT6791_REG_WEIGHT_DUTY_BASE[6] = { 0, 0x23e }; | ||
519 | |||
513 | static const u16 NCT6791_REG_ALARM[NUM_REG_ALARM] = { | 520 | static const u16 NCT6791_REG_ALARM[NUM_REG_ALARM] = { |
514 | 0x459, 0x45A, 0x45B, 0x568, 0x45D }; | 521 | 0x459, 0x45A, 0x45B, 0x568, 0x45D }; |
515 | 522 | ||
@@ -1311,6 +1318,9 @@ static void nct6775_update_pwm(struct device *dev) | |||
1311 | if (reg & 0x80) | 1318 | if (reg & 0x80) |
1312 | data->pwm[2][i] = 0; | 1319 | data->pwm[2][i] = 0; |
1313 | 1320 | ||
1321 | if (!data->REG_WEIGHT_TEMP_SEL[i]) | ||
1322 | continue; | ||
1323 | |||
1314 | reg = nct6775_read_value(data, data->REG_WEIGHT_TEMP_SEL[i]); | 1324 | reg = nct6775_read_value(data, data->REG_WEIGHT_TEMP_SEL[i]); |
1315 | data->pwm_weight_temp_sel[i] = reg & 0x1f; | 1325 | data->pwm_weight_temp_sel[i] = reg & 0x1f; |
1316 | /* If weight is disabled, report weight source as 0 */ | 1326 | /* If weight is disabled, report weight source as 0 */ |
@@ -2856,6 +2866,9 @@ static umode_t nct6775_pwm_is_visible(struct kobject *kobj, | |||
2856 | if (!(data->has_pwm & (1 << pwm))) | 2866 | if (!(data->has_pwm & (1 << pwm))) |
2857 | return 0; | 2867 | return 0; |
2858 | 2868 | ||
2869 | if ((nr >= 14 && nr <= 18) || nr == 21) /* weight */ | ||
2870 | if (!data->REG_WEIGHT_TEMP_SEL[pwm]) | ||
2871 | return 0; | ||
2859 | if (nr == 19 && data->REG_PWM[3] == NULL) /* pwm_max */ | 2872 | if (nr == 19 && data->REG_PWM[3] == NULL) /* pwm_max */ |
2860 | return 0; | 2873 | return 0; |
2861 | if (nr == 20 && data->REG_PWM[4] == NULL) /* pwm_step */ | 2874 | if (nr == 20 && data->REG_PWM[4] == NULL) /* pwm_step */ |
@@ -2949,11 +2962,11 @@ static struct sensor_device_template *nct6775_attributes_pwm_template[] = { | |||
2949 | &sensor_dev_template_pwm_step_down_time, | 2962 | &sensor_dev_template_pwm_step_down_time, |
2950 | &sensor_dev_template_pwm_start, | 2963 | &sensor_dev_template_pwm_start, |
2951 | &sensor_dev_template_pwm_floor, | 2964 | &sensor_dev_template_pwm_floor, |
2952 | &sensor_dev_template_pwm_weight_temp_sel, | 2965 | &sensor_dev_template_pwm_weight_temp_sel, /* 14 */ |
2953 | &sensor_dev_template_pwm_weight_temp_step, | 2966 | &sensor_dev_template_pwm_weight_temp_step, |
2954 | &sensor_dev_template_pwm_weight_temp_step_tol, | 2967 | &sensor_dev_template_pwm_weight_temp_step_tol, |
2955 | &sensor_dev_template_pwm_weight_temp_step_base, | 2968 | &sensor_dev_template_pwm_weight_temp_step_base, |
2956 | &sensor_dev_template_pwm_weight_duty_step, | 2969 | &sensor_dev_template_pwm_weight_duty_step, /* 18 */ |
2957 | &sensor_dev_template_pwm_max, /* 19 */ | 2970 | &sensor_dev_template_pwm_max, /* 19 */ |
2958 | &sensor_dev_template_pwm_step, /* 20 */ | 2971 | &sensor_dev_template_pwm_step, /* 20 */ |
2959 | &sensor_dev_template_pwm_weight_duty_base, /* 21 */ | 2972 | &sensor_dev_template_pwm_weight_duty_base, /* 21 */ |
@@ -3615,8 +3628,8 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3615 | data->REG_PWM[0] = NCT6775_REG_PWM; | 3628 | data->REG_PWM[0] = NCT6775_REG_PWM; |
3616 | data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; | 3629 | data->REG_PWM[1] = NCT6775_REG_FAN_START_OUTPUT; |
3617 | data->REG_PWM[2] = NCT6775_REG_FAN_STOP_OUTPUT; | 3630 | data->REG_PWM[2] = NCT6775_REG_FAN_STOP_OUTPUT; |
3618 | data->REG_PWM[5] = NCT6775_REG_WEIGHT_DUTY_STEP; | 3631 | data->REG_PWM[5] = NCT6791_REG_WEIGHT_DUTY_STEP; |
3619 | data->REG_PWM[6] = NCT6776_REG_WEIGHT_DUTY_BASE; | 3632 | data->REG_PWM[6] = NCT6791_REG_WEIGHT_DUTY_BASE; |
3620 | data->REG_PWM_READ = NCT6775_REG_PWM_READ; | 3633 | data->REG_PWM_READ = NCT6775_REG_PWM_READ; |
3621 | data->REG_PWM_MODE = NCT6776_REG_PWM_MODE; | 3634 | data->REG_PWM_MODE = NCT6776_REG_PWM_MODE; |
3622 | data->PWM_MODE_MASK = NCT6776_PWM_MODE_MASK; | 3635 | data->PWM_MODE_MASK = NCT6776_PWM_MODE_MASK; |
@@ -3632,10 +3645,10 @@ static int nct6775_probe(struct platform_device *pdev) | |||
3632 | data->REG_TEMP_OFFSET = NCT6779_REG_TEMP_OFFSET; | 3645 | data->REG_TEMP_OFFSET = NCT6779_REG_TEMP_OFFSET; |
3633 | data->REG_TEMP_SOURCE = NCT6775_REG_TEMP_SOURCE; | 3646 | data->REG_TEMP_SOURCE = NCT6775_REG_TEMP_SOURCE; |
3634 | data->REG_TEMP_SEL = NCT6775_REG_TEMP_SEL; | 3647 | data->REG_TEMP_SEL = NCT6775_REG_TEMP_SEL; |
3635 | data->REG_WEIGHT_TEMP_SEL = NCT6775_REG_WEIGHT_TEMP_SEL; | 3648 | data->REG_WEIGHT_TEMP_SEL = NCT6791_REG_WEIGHT_TEMP_SEL; |
3636 | data->REG_WEIGHT_TEMP[0] = NCT6775_REG_WEIGHT_TEMP_STEP; | 3649 | data->REG_WEIGHT_TEMP[0] = NCT6791_REG_WEIGHT_TEMP_STEP; |
3637 | data->REG_WEIGHT_TEMP[1] = NCT6775_REG_WEIGHT_TEMP_STEP_TOL; | 3650 | data->REG_WEIGHT_TEMP[1] = NCT6791_REG_WEIGHT_TEMP_STEP_TOL; |
3638 | data->REG_WEIGHT_TEMP[2] = NCT6775_REG_WEIGHT_TEMP_BASE; | 3651 | data->REG_WEIGHT_TEMP[2] = NCT6791_REG_WEIGHT_TEMP_BASE; |
3639 | data->REG_ALARM = NCT6791_REG_ALARM; | 3652 | data->REG_ALARM = NCT6791_REG_ALARM; |
3640 | data->REG_BEEP = NCT6776_REG_BEEP; | 3653 | data->REG_BEEP = NCT6776_REG_BEEP; |
3641 | 3654 | ||