From: Guenter Roeck <guenter.roeck@ericsson.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 5/6] hwmon: (f75375s) Properly map the F75387 automatic modes to pwm_enable
Date: Thu, 23 Feb 2012 01:32:34 +0000 [thread overview]
Message-ID: <20120223013234.GD4930@ericsson.com> (raw)
In-Reply-To: <1329949129-4265-6-git-send-email-mail@microschulz.de>
On Wed, Feb 22, 2012 at 05:18:48PM -0500, Nikolaus Schulz wrote:
> From: Nikolaus Schulz <schulz@macnetix.de>
>
> The F75387 supports automatic fan control using either PWM duty cycle or
> RPM speed values. Make the driver detect the latter mode, and expose the
> different modes in sysfs as per pwm_enable, so that the user can switch
> between them.
>
> The interpretation of the pwm_enable attribute for the F75387 is adjusted
> to be a superset of those values used for similar Fintek chips which do
> not support automatic duty mode, with 2 mapping to automatic speed mode,
> and moving automatic duty mode to the new value 4.
>
> Toggling the duty mode via pwm_enable is currently denied for the F75387,
> as the chip then simply reinterprets the fan configuration register values
> according to the new mode, switching between RPM and PWM units, which
> makes this a dangerous operation.
>
> Signed-off-by: Nikolaus Schulz <mail@microschulz.de>
> ---
[ ... ]
> @@ -363,12 +382,14 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
> fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
> fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
> break;
> - case 2: /* AUTOMATIC*/
> - fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
> + case 2: /* Automatic, speed mode */
> break;
> case 3: /* fan speed */
> fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
> break;
> + case 4: /* Automatic, pwm */
> + fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
Might be time to get rid of those extra spaces.
> + break;
> }
> } else {
> /* clear each fanX_mode bit before setting them properly */
> @@ -386,6 +407,8 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
> break;
> case 3: /* fan speed */
> break;
> + case 4: /* Automatic pwm */
> + return -EOPNOTSUPP;
Should be -EINVAL.
Thanks,
Guenter
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2012-02-23 1:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 22:18 [lm-sensors] [PATCH 5/6] hwmon: (f75375s) Properly map the F75387 automatic modes to pwm_enable Nikolaus Schulz
2012-02-23 1:32 ` Guenter Roeck [this message]
2012-02-23 2:26 ` Guenter Roeck
2012-02-23 19:12 ` Nikolaus Schulz
2012-02-23 19:21 ` Guenter Roeck
2012-02-23 19:50 ` Nikolaus Schulz
2012-02-23 19:58 ` Nikolaus Schulz
2012-02-23 20:00 ` Guenter Roeck
2012-02-23 20:16 ` Nikolaus Schulz
2012-02-23 21:26 ` Guenter Roeck
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=20120223013234.GD4930@ericsson.com \
--to=guenter.roeck@ericsson.com \
--cc=lm-sensors@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.