aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index eb324e604105..a65eac836174 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1735,19 +1735,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1735 goto exit_free; 1735 goto exit_free;
1736 } 1736 }
1737 1737
1738 data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1739 /* If it is a 71862 and the fan / pwm part is enabled sanity check
1740 the pwm settings */
1741 if (data->type == f71862fg && (start_reg & 0x02)) {
1742 if ((data->pwm_enable & 0x15) != 0x15) {
1743 dev_err(&pdev->dev,
1744 "Invalid (reserved) pwm settings: 0x%02x\n",
1745 (unsigned int)data->pwm_enable);
1746 err = -ENODEV;
1747 goto exit_free;
1748 }
1749 }
1750
1751 /* Register sysfs interface files */ 1738 /* Register sysfs interface files */
1752 err = device_create_file(&pdev->dev, &dev_attr_name); 1739 err = device_create_file(&pdev->dev, &dev_attr_name);
1753 if (err) 1740 if (err)
@@ -1778,6 +1765,29 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1778 } 1765 }
1779 1766
1780 if (start_reg & 0x02) { 1767 if (start_reg & 0x02) {
1768 data->pwm_enable =
1769 f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
1770
1771 /* Sanity check the pwm settings */
1772 switch (data->type) {
1773 case f71862fg:
1774 err = (data->pwm_enable & 0x15) != 0x15;
1775 break;
1776 case f71882fg:
1777 err = 0;
1778 break;
1779 case f8000:
1780 err = data->pwm_enable & 0x20;
1781 break;
1782 }
1783 if (err) {
1784 dev_err(&pdev->dev,
1785 "Invalid (reserved) pwm settings: 0x%02x\n",
1786 (unsigned int)data->pwm_enable);
1787 err = -ENODEV;
1788 goto exit_unregister_sysfs;
1789 }
1790
1781 err = f71882fg_create_sysfs_files(pdev, fxxxx_fan_attr, 1791 err = f71882fg_create_sysfs_files(pdev, fxxxx_fan_attr,
1782 ARRAY_SIZE(fxxxx_fan_attr)); 1792 ARRAY_SIZE(fxxxx_fan_attr));
1783 if (err) 1793 if (err)