aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-09 14:57:13 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-03-15 01:39:24 -0400
commite48a7f1a719b258ee8bd2e809205d6d0f9d66aed (patch)
treef8978398bd827b59ede75dd0533e3bd8b0270b5d /drivers/hwmon
parent78aa4f72b30e4f2c631f6f550a911aad24769cfd (diff)
hwmon/f71882fg: Break out test for auto pwm's controlled by digital readings
Putting this check in its own switch case rather then in the switch case for adding pwm auto point sysfs attr is cleaner. This is a preparation patch for adding support for more different models. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/f71882fg.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 62352fd397df..4c17f12054a2 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -2075,6 +2075,27 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2075 } 2075 }
2076 2076
2077 switch (data->type) { 2077 switch (data->type) {
2078 case f71889fg:
2079 for (i = 0; i < nr_fans; i++) {
2080 data->pwm_auto_point_mapping[i] =
2081 f71882fg_read8(data,
2082 F71882FG_REG_POINT_MAPPING(i));
2083 if (data->pwm_auto_point_mapping[i] & 0x80)
2084 break;
2085 }
2086 if (i != nr_fans) {
2087 dev_warn(&pdev->dev,
2088 "Auto pwm controlled by raw digital "
2089 "data, disabling pwm auto_point "
2090 "sysfs attributes\n");
2091 goto no_pwm_auto_point;
2092 }
2093 break;
2094 default:
2095 break;
2096 }
2097
2098 switch (data->type) {
2078 case f71862fg: 2099 case f71862fg:
2079 err = f71882fg_create_sysfs_files(pdev, 2100 err = f71882fg_create_sysfs_files(pdev,
2080 f71862fg_auto_pwm_attr, 2101 f71862fg_auto_pwm_attr,
@@ -2090,23 +2111,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2090 f8000_auto_pwm_attr, 2111 f8000_auto_pwm_attr,
2091 ARRAY_SIZE(f8000_auto_pwm_attr)); 2112 ARRAY_SIZE(f8000_auto_pwm_attr));
2092 break; 2113 break;
2093 case f71889fg: 2114 default:
2094 for (i = 0; i < nr_fans; i++) {
2095 data->pwm_auto_point_mapping[i] =
2096 f71882fg_read8(data,
2097 F71882FG_REG_POINT_MAPPING(i));
2098 if (data->pwm_auto_point_mapping[i] & 0x80)
2099 break;
2100 }
2101 if (i != nr_fans) {
2102 dev_warn(&pdev->dev,
2103 "Auto pwm controlled by raw digital "
2104 "data, disabling pwm auto_point "
2105 "sysfs attributes\n");
2106 break;
2107 }
2108 /* fall through */
2109 default: /* f71858fg / f71882fg */
2110 err = f71882fg_create_sysfs_files(pdev, 2115 err = f71882fg_create_sysfs_files(pdev,
2111 &fxxxx_auto_pwm_attr[0][0], 2116 &fxxxx_auto_pwm_attr[0][0],
2112 ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); 2117 ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans);
@@ -2114,6 +2119,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2114 if (err) 2119 if (err)
2115 goto exit_unregister_sysfs; 2120 goto exit_unregister_sysfs;
2116 2121
2122no_pwm_auto_point:
2117 for (i = 0; i < nr_fans; i++) 2123 for (i = 0; i < nr_fans; i++)
2118 dev_info(&pdev->dev, "Fan: %d is in %s mode\n", i + 1, 2124 dev_info(&pdev->dev, "Fan: %d is in %s mode\n", i + 1,
2119 (data->pwm_enable & (1 << 2 * i)) ? 2125 (data->pwm_enable & (1 << 2 * i)) ?