Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751865AbbGHWtm (ORCPT ); Wed, 8 Jul 2015 18:49:42 -0400 Received: from gproxy10-pub.mail.unifiedlayer.com ([69.89.20.226]:60769 "HELO gproxy10-pub.mail.unifiedlayer.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751041AbbGHWte (ORCPT ); Wed, 8 Jul 2015 18:49:34 -0400 X-Authority-Analysis: v=2.1 cv=RppWckWK c=1 sm=1 tr=0 a=J7Q474dc+DFtUK1fo70nSg==:117 a=J7Q474dc+DFtUK1fo70nSg==:17 a=cNaOj0WVAAAA:8 a=f5113yIGAAAA:8 a=dSbym95GAAAA:8 a=ZhRHZX3j7ZUA:10 a=BVO03KwuqkIA:10 a=zOBTXjUuO1YA:10 a=pv3OlonVRiGcs5UaSHQA:9 From: Constantine Shulyupin To: Jean Delvare , Guenter Roeck , lm-sensors@lm-sensors.org (open list:HARDWARE MONITORING), linux-kernel@vger.kernel.org (open list) Cc: Constantine Shulyupin Subject: [PATCH] hwmon: (nct7802) Add autopoint attributes Date: Thu, 9 Jul 2015 01:49:08 +0300 Message-Id: <1436395749-4101-1-git-send-email-const@MakeLinux.com> X-Mailer: git-send-email 1.9.1 X-Identified-User: {1470:box668.bluehost.com:makelinu:makelinux.net} {sentby:smtp auth 84.229.173.55 authed with poster@makelinux.net} Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2856 Lines: 87 Introduced PWM_REG, TEMP_REG, auto_pointX_temp, auto_pointX_pwm, nct7802_auto_point_attrs, nct7802_auto_point_group. Signed-off-by: Constantine Shulyupin --- drivers/hwmon/nct7802.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c index 2f6bbe5..a3f3063 100644 --- a/drivers/hwmon/nct7802.c +++ b/drivers/hwmon/nct7802.c @@ -153,6 +153,10 @@ static ssize_t store_pwm(struct device *dev, struct device_attribute *devattr, return err ? : count; } +#define PWM_REG(_name, _reg) \ + SENSOR_DEVICE_ATTR(_name, S_IRUGO | S_IWUSR, \ + show_pwm, store_pwm, _reg) + static ssize_t show_pwm_enable(struct device *dev, struct device_attribute *attr, char *buf) { @@ -404,6 +408,10 @@ static ssize_t store_temp(struct device *dev, struct device_attribute *attr, return err ? : count; } +#define TEMP_REG(_name, _high, _low) \ + SENSOR_DEVICE_ATTR_2(_name, S_IRUGO | S_IWUSR, \ + show_temp, store_temp, _high, _low) + static ssize_t show_fan(struct device *dev, struct device_attribute *attr, char *buf) { @@ -890,11 +898,44 @@ static struct attribute_group nct7802_pwm_group = { .attrs = nct7802_pwm_attrs, }; +/* 7.2.115... 0x80-0x83, 0x84 Temperature (X-axis) transition */ +static TEMP_REG(auto_point1_temp, 0x80, 0); +static TEMP_REG(auto_point2_temp, 0x81, 0); +static TEMP_REG(auto_point3_temp, 0x82, 0); +static TEMP_REG(auto_point4_temp, 0x83, 0); +static TEMP_REG(auto_point_crit_temp, 0x84, 0); + +/* 7.2.120... 0x85-0x88 PWM (Y-axis) transition */ +static PWM_REG(auto_point1_pwm, 0x85); +static PWM_REG(auto_point2_pwm, 0x86); +static PWM_REG(auto_point3_pwm, 0x87); +static PWM_REG(auto_point4_pwm, 0x88); + +static struct attribute *nct7802_auto_point_attrs[] = { + &sensor_dev_attr_auto_point1_temp.dev_attr.attr, + &sensor_dev_attr_auto_point2_temp.dev_attr.attr, + &sensor_dev_attr_auto_point3_temp.dev_attr.attr, + &sensor_dev_attr_auto_point4_temp.dev_attr.attr, + &sensor_dev_attr_auto_point_crit_temp.dev_attr.attr, + + &sensor_dev_attr_auto_point1_pwm.dev_attr.attr, + &sensor_dev_attr_auto_point2_pwm.dev_attr.attr, + &sensor_dev_attr_auto_point3_pwm.dev_attr.attr, + &sensor_dev_attr_auto_point4_pwm.dev_attr.attr, + + NULL +}; + +static struct attribute_group nct7802_auto_point_group = { + .attrs = nct7802_auto_point_attrs, +}; + static const struct attribute_group *nct7802_groups[] = { &nct7802_temp_group, &nct7802_in_group, &nct7802_fan_group, &nct7802_pwm_group, + &nct7802_auto_point_group, NULL }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/