[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1261012570.7239.13.camel@falcon.domain.org>
Date: Thu, 17 Dec 2009 09:16:10 +0800
From: Wu Zhangjin <wuzhangjin@...il.com>
To: Ralf Baechle <ralf@...ux-mips.org>
Cc: akpm@...ux-foundation.org, linux-mips@...ux-mips.org,
linux-kernel@...r.kernel.org,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
"Rafael J . Wysocki" <rjw@...k.pl>, zhangfx@...ote.com,
linux-laptop@...r.kernel.org,
Stephen Rothwell <sfr@...b.auug.org.au>,
Pavel Machek <pavel@....cz>
Subject: Re: [PATCH v10 5/8] Loongson: YeeLoong: add hardware monitoring
driver
Hi,
On Tue, 2009-12-15 at 17:24 +0800, Wu Zhangjin wrote:
> From: Wu Zhangjin <wuzhangjin@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists