summaryrefslogtreecommitdiff
path: root/drivers/hwmon/w83795.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2010-11-15 23:38:56 +0300
committerJean Delvare <khali@endymion.delvare>2010-11-15 23:38:56 +0300
commitd5ab845a13de7ff2d195917dad8879acfb6d8ff9 (patch)
tree63f66db0cadf410ea084ecade80ea970da92969a /drivers/hwmon/w83795.c
parentae51cd9bcd9ca841bf45c0ba33823c56ac1ce81e (diff)
downloadlinux-d5ab845a13de7ff2d195917dad8879acfb6d8ff9.tar.xz
hwmon: (w83795) Expose fan control method
Expose fan control method (DC vs. PWM) using the standard sysfs attributes. I've made it read-only as the board should be wired for a given mode, the BIOS should have set up the chip for this mode, and you shouldn't have to change it. But it would be easy enough to make it changeable if someone comes up with a use case. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/w83795.c')
-rw-r--r--drivers/hwmon/w83795.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/hwmon/w83795.c b/drivers/hwmon/w83795.c
index fd96e72adde0..95b1f860c14e 100644
--- a/drivers/hwmon/w83795.c
+++ b/drivers/hwmon/w83795.c
@@ -916,6 +916,21 @@ store_pwm_enable(struct device *dev, struct device_attribute *attr,
}
static ssize_t
+show_pwm_mode(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct w83795_data *data = w83795_update_pwm_config(dev);
+ int index = to_sensor_dev_attr_2(attr)->index;
+ unsigned int mode;
+
+ if (data->pwm_fomc & (1 << index))
+ mode = 0; /* DC */
+ else
+ mode = 1; /* PWM */
+
+ return sprintf(buf, "%u\n", mode);
+}
+
+static ssize_t
show_temp_src(struct device *dev, struct device_attribute *attr, char *buf)
{
struct sensor_device_attribute_2 *sensor_attr =
@@ -1551,6 +1566,8 @@ store_sf_setup(struct device *dev, struct device_attribute *attr,
show_pwm, store_pwm, PWM_FREQ, index - 1), \
SENSOR_ATTR_2(pwm##index##_enable, S_IWUSR | S_IRUGO, \
show_pwm_enable, store_pwm_enable, NOT_USED, index - 1), \
+ SENSOR_ATTR_2(pwm##index##_mode, S_IRUGO, \
+ show_pwm_mode, NULL, NOT_USED, index - 1), \
SENSOR_ATTR_2(fan##index##_target, S_IWUSR | S_IRUGO, \
show_fanin, store_fanin, FANIN_TARGET, index - 1) }
@@ -1698,7 +1715,7 @@ static const struct sensor_device_attribute_2 w83795_dts[][8] = {
SENSOR_ATTR_DTS(14),
};
-static const struct sensor_device_attribute_2 w83795_pwm[][7] = {
+static const struct sensor_device_attribute_2 w83795_pwm[][8] = {
SENSOR_ATTR_PWM(1),
SENSOR_ATTR_PWM(2),
SENSOR_ATTR_PWM(3),