1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/*
* ac.c -- AC adapter related functions
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* Written by Soós Péter <sp@osb.hu>, 2002-2004
* Modified by Mathieu Bérard <mathieu.berard@crans.org>, 2006
*/
#include "omnibook.h"
#include "hardware.h"
static int omnibook_ac_read(char *buffer, struct omnibook_operation *io_op)
{
int len = 0;
u8 ac;
int retval;
retval = backend_byte_read(io_op, &ac);
if (retval < 0)
return retval;
len += sprintf(buffer + len, "AC %s\n", (!!ac) ? "on-line" : "off-line");
return len;
}
static struct omnibook_tbl ac_table[] __initdata = {
{XE3GF | TSP10 | TSM30X | TSM70, SIMPLE_BYTE(EC, XE3GF_ADP, XE3GF_ADP_MASK)},
{XE3GC | AMILOD, SIMPLE_BYTE(EC, XE3GC_STA1, XE3GC_ADP_MASK)},
{OB500 | OB510 | OB6000 | OB6100 | XE4500, SIMPLE_BYTE(EC, OB500_STA2, OB500_ADP_MASK)},
{OB4150, SIMPLE_BYTE(EC, OB4150_ADP, OB4150_ADP_MASK)},
{XE2, SIMPLE_BYTE(EC, XE2_STA1, XE2_ADP_MASK)},
{0,}
};
struct omnibook_feature __declared_feature ac_driver = {
.name = "ac",
#ifdef CONFIG_OMNIBOOK_LEGACY
.enabled = 1,
#else
.enabled = 0,
#endif
.read = omnibook_ac_read,
.ectypes = XE3GF | XE3GC | OB500 | OB510 | OB6000 | OB6100 | XE4500 | OB4150 | XE2 | AMILOD | TSP10 | TSM70 | TSM30X,
.tbl = ac_table,
};
module_param_named(ac, ac_driver.enabled, int, S_IRUGO);
MODULE_PARM_DESC(ac, "Use 0 to disable, 1 to enable AC adapter status monitoring");
/* End of file */
|