2
* colling.c -- cooling methods feature
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2, or (at your option) any
9
* This program is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* General Public License for more details.
14
* Written by Mathieu Bérard <mathieu.berard@crans.org>, 2007
20
static int omnibook_cooling_read(char *buffer, struct omnibook_operation *io_op)
24
if(mutex_lock_interruptible(&io_op->backend->mutex))
27
len += sprintf(buffer + len, "Cooling method : %s\n",
28
io_op->backend->cooling_state ? "Performance" : "Powersave" );
30
mutex_unlock(&io_op->backend->mutex);
34
static int omnibook_cooling_write(char *buffer, struct omnibook_operation *io_op)
38
if(mutex_lock_interruptible(&io_op->backend->mutex))
43
retval = __backend_byte_write(io_op,
44
TSM70_COOLING_OFFSET + TSM70_COOLING_POWERSAVE);
45
} else if (*buffer == '1') {
46
retval = __backend_byte_write(io_op,
47
TSM70_COOLING_OFFSET + TSM70_COOLING_PERF);
53
/* *buffer is either '0' or '1' here */
55
io_op->backend->cooling_state = *buffer - '0' ;
57
mutex_unlock(&io_op->backend->mutex);
63
static int __init omnibook_cooling_init(struct omnibook_operation *io_op)
65
mutex_lock(&io_op->backend->mutex);
66
/* XXX: Assumed default cooling method: performance */
67
io_op->backend->cooling_state = TSM70_COOLING_PERF;
68
mutex_unlock(&io_op->backend->mutex);
72
static void __exit omnibook_cooling_exit(struct omnibook_operation *io_op)
74
/* Set back cooling method to performance */
75
backend_byte_write(io_op, TSM70_COOLING_OFFSET + TSM70_COOLING_PERF);
78
static struct omnibook_tbl cooling_table[] __initdata = {
79
{TSM70 | TSX205, {CDI, 0, TSM70_FN_INDEX, 0, 0, 0 }},
83
struct omnibook_feature __declared_feature cooling_driver = {
86
.read = omnibook_cooling_read,
87
.write = omnibook_cooling_write,
88
.init = omnibook_cooling_init,
89
.exit = omnibook_cooling_exit,
90
.ectypes = TSM70 | TSX205,
94
module_param_named(cooling, cooling_driver.enabled, int, S_IRUGO);
95
MODULE_PARM_DESC(cooling, "Use 0 to disable, 1 to enable CPU cooling method control");