From: jaap aarts <jaap.aarts1@gmail.com>
To: Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, linux-usb@vger.kernel.org
Cc: jaap aarts <jaap.aarts1@gmail.com>, Jaap Aarts <jaap.aarts1@example.com>
Subject: [PATCH 5/6] allow setting enable instead of mode, and support enable 2/3/4
Date: Mon, 13 Jul 2020 21:32:26 +0200 [thread overview]
Message-ID: <20200713193227.189751-5-jaap.aarts1@gmail.com> (raw)
In-Reply-To: <20200713193227.189751-1-jaap.aarts1@gmail.com>
Signed-off-by: Jaap Aarts <jaap.aarts1@example.com>
---
drivers/hwmon/asetek_gen6.c | 110 ++++++++++++++++++++++++++++++------
1 file changed, 93 insertions(+), 17 deletions(-)
diff --git a/drivers/hwmon/asetek_gen6.c b/drivers/hwmon/asetek_gen6.c
index d657ecc78908..19f50d5cd179 100644
--- a/drivers/hwmon/asetek_gen6.c
+++ b/drivers/hwmon/asetek_gen6.c
@@ -64,38 +64,100 @@ struct hwmon_data {
void **channel_data;
};
-struct curve_point default_curve[] = {
+struct curve_point quiet_curve[] = {
{
- .temp = 0x10,
- .pwm = 0x19,
+ .temp = 0x1F,
+ .pwm = 0x15,
},
{
- .temp = 0x14,
- .pwm = 0x19,
+ .temp = 0x21,
+ .pwm = 0x1E,
+ },
+ {
+ .temp = 0x24,
+ .pwm = 0x25,
+ },
+ {
+ .temp = 0x27,
+ .pwm = 0x2D,
+ },
+ {
+ .temp = 0x29,
+ .pwm = 0x38,
+ },
+ {
+ .temp = 0x2C,
+ .pwm = 0x4A,
+ },
+ {
+ .temp = 0x2F,
+ .pwm = 0x64,
+ },
+};
+
+struct curve_point balanced_curve[] = {
+ {
+ .temp = 0x1C,
+ .pwm = 0x15,
+ },
+ {
+ .temp = 0x1E,
+ .pwm = 0x1B,
},
{
.temp = 0x20,
- .pwm = 0x27,
+ .pwm = 0x23,
},
{
- .temp = 0x28,
- .pwm = 0x32,
+ .temp = 0x22,
+ .pwm = 0x28,
},
{
- .temp = 0x32,
- .pwm = 0x4b,
+ .temp = 0x24,
+ .pwm = 0x32,
},
{
- .temp = 0x37,
- .pwm = 0x5a,
+ .temp = 0x27,
+ .pwm = 0x48,
},
{
- .temp = 0x3c,
+ .temp = 0x29,
.pwm = 0x64,
},
+};
+struct curve_point extreme_curve[] = {
+ {
+ .temp = 0x19,
+ .pwm = 0x28,
+ },
+ {
+ .temp = 0x1B,
+ .pwm = 0x2E,
+ },
+ {
+ .temp = 0x1D,
+ .pwm = 0x37,
+ },
+ {
+ .temp = 0x1E,
+ .pwm = 0x41,
+ },
+ {
+ .temp = 0x1F,
+ .pwm = 0x4C,
+ },
+ {
+ .temp = 0x20,
+ .pwm = 0x56,
+ },
+ {
+ .temp = 0x21,
+ .pwm = 0x64,
+ },
};
+#define default_curve quiet_curve
static const char SUCCESS[2] = { 0x12, 0x34 };
#define SUCCES_LENGTH 3
@@ -347,7 +409,7 @@ static int write_func(struct device *dev, enum hwmon_sensor_types type,
return retval;
goto cleanup;
- case hwmon_pwm_mode:
+ case hwmon_pwm_enable:
fan_data = data->channel_data[channel];
retval = usb_autopm_get_interface(cdev->interface);
@@ -360,10 +422,12 @@ static int write_func(struct device *dev, enum hwmon_sensor_types type,
}
fan_data->mode = val;
- if (val == 0) {
+ switch (val) {
+ case 0:
set_fan_rpm_curve(cdev, fan_data,
default_curve);
- } else if (val == 1) {
+ break;
+ case 1:
if (fan_data->fan_target != 0) {
retval = set_fan_target_rpm(
cdev, fan_data,
@@ -377,6 +441,18 @@ static int write_func(struct device *dev, enum hwmon_sensor_types type,
if (retval)
goto cleanup;
}
+ break;
+ case 2:
+ set_fan_rpm_curve(cdev, fan_data, quiet_curve);
+ break;
+ case 3:
+ set_fan_rpm_curve(cdev, fan_data,
+ balanced_curve);
+ break;
+ case 4:
+ set_fan_rpm_curve(cdev, fan_data,
+ extreme_curve);
+ break;
}
goto cleanup;
default:
@@ -465,7 +541,7 @@ int read_func(struct device *dev, enum hwmon_sensor_types type, u32 attr,
return retval;
}
#define fan_config HWMON_F_INPUT | HWMON_F_TARGET | HWMON_F_MIN
-#define pwm_config HWMON_PWM_INPUT | HWMON_PWM_MODE
+#define pwm_config HWMON_PWM_INPUT | HWMON_PWM_ENABLE
static const struct hwmon_ops asetek_6_ops = {
.is_visible = is_visible_func,
--
2.27.0
next prev parent reply other threads:[~2020-07-13 19:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 19:32 [PATCH 1/6] skeleton for asetek gen 6 driver jaap aarts
2020-07-13 19:32 ` [PATCH 2/6] fan support " jaap aarts
2020-07-13 19:32 ` [PATCH 3/6] rpm " jaap aarts
2020-07-13 19:32 ` [PATCH 4/6] automatic fan count detection jaap aarts
2020-07-13 19:32 ` jaap aarts [this message]
2020-07-13 19:32 ` [PATCH 6/6] added some comments and fixed some styling jaap aarts
2020-07-14 4:59 ` [PATCH 1/6] skeleton for asetek gen 6 driver Guenter Roeck
2020-07-14 10:03 ` jaap aarts
2020-07-14 17:30 ` Guenter Roeck
2020-07-14 17:43 ` jaap aarts
2020-07-14 5:19 ` Guenter Roeck
2020-07-14 5:54 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200713193227.189751-5-jaap.aarts1@gmail.com \
--to=jaap.aarts1@gmail.com \
--cc=jaap.aarts1@example.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).