linux-laptop.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: akpm@linux-foundation.org, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>,
	zhangfx@lemote.com, linux-laptop@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH v10 5/8] Loongson: YeeLoong: add hardware monitoring driver
Date: Thu, 17 Dec 2009 09:16:10 +0800	[thread overview]
Message-ID: <1261012570.7239.13.camel@falcon.domain.org> (raw)
In-Reply-To: <d74dbb0ff251bc26556e27c21be3ce7c752776be.1260868626.git.wuzhangjin@gmail.com>

Hi,

On Tue, 2009-12-15 at 17:24 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@gmail.com>
> 
> This can be applied between v9 4/8 and v9 6/8.
> 
> Changes from v9 5/8:
> 
> 	o ensure the fan controlling interface is compatible with the
> 	one described in Documentation/hwmon/sysfs-interface
[...]
> +/* hwmon subdriver */
> +
> +#define MIN_FAN_SPEED 0
> +#define MAX_FAN_SPEED 3
> +
> +static int get_fan_pwm_enable(void)
> +{
> +	int level, mode;
> +
> +	level = ec_read(REG_FAN_SPEED_LEVEL);
> +	mode = ec_read(REG_FAN_AUTO_MAN_SWITCH);
> +
> +	if (level == MAX_FAN_SPEED && mode == BIT_FAN_MANUAL)
> +		mode = 0;
> +	else if (mode == BIT_FAN_MANUAL)
> +		mode = 1;
> +	else
> +		mode = 2;
> +
> +	return mode;
> +}
> +
> +static void set_fan_pwm_enable(int mode)
> +{
> +	switch (mode) {
> +	case 0:
> +		/* fullspeed */
> +		ec_write(REG_FAN_AUTO_MAN_SWITCH, BIT_FAN_MANUAL);
> +		ec_write(REG_FAN_SPEED_LEVEL, MAX_FAN_SPEED);
> +		break;
> +	case 1:
> +		ec_write(REG_FAN_AUTO_MAN_SWITCH, BIT_FAN_MANUAL);
> +		break;
> +	case 2:
> +		ec_write(REG_FAN_AUTO_MAN_SWITCH, BIT_FAN_AUTO);
> +		break;
> +	default:
> +		break;
> +	}
> +}
> +
[...]
> +
> +static int yeeloong_hwmon_init(void)
> +{
> +	int ret;
> +
> +	yeeloong_hwmon_dev = hwmon_device_register(NULL);
> +	if (IS_ERR(yeeloong_hwmon_dev)) {
> +		pr_err("Fail to register yeeloong hwmon device\n");
> +		yeeloong_hwmon_dev = NULL;
> +		return PTR_ERR(yeeloong_hwmon_dev);
> +	}
> +	ret = sysfs_create_group(&yeeloong_hwmon_dev->kobj,
> +				 &hwmon_attribute_group);
> +	if (ret) {
> +		hwmon_device_unregister(yeeloong_hwmon_dev);
> +		yeeloong_hwmon_dev = NULL;
> +		return ret;
> +	}
> +	/* ensure fan is set to auto mode */
> +	set_fan_pwm_enable(BIT_FAN_AUTO);
> +

We need to change the above line to:

set_fan_pwm_enable(2);

to ensure it is compatible to the hwmon interface too.

Best Regards,
	Wu Zhangjin


      reply	other threads:[~2009-12-17  1:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-15  9:24 [PATCH v10 5/8] Loongson: YeeLoong: add hardware monitoring driver Wu Zhangjin
2009-12-17  1:16 ` Wu Zhangjin [this message]

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=1261012570.7239.13.camel@falcon.domain.org \
    --to=wuzhangjin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-laptop@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=pavel@ucw.cz \
    --cc=ralf@linux-mips.org \
    --cc=rjw@sisk.pl \
    --cc=sfr@canb.auug.org.au \
    --cc=zhangfx@lemote.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).