2
* display.c -- External display (LCD,VGA,TV-OUT) 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 Soós Péter <sp@osb.hu>, 2002-2004
15
* Modified by Mathieu Bérard <mathieu.berard@crans.org>, 2006
21
static const char display_name[][16] = {
28
static int omnibook_display_read(char *buffer, struct omnibook_operation *io_op)
32
unsigned int sta, en_mask, det_mask;
34
retval = backend_display_get(io_op, &sta);
38
for (en_mask = DISPLAY_LCD_ON; en_mask <= DISPLAY_DVI_ON; en_mask = en_mask << 1) {
39
det_mask = en_mask << 4; /* see display masks in omnibook.h */
40
if (!(retval & en_mask) && !(retval & det_mask))
41
continue; /* not supported */
42
len += sprintf(buffer + len, "%s:", display_name[ffs(en_mask) - 1]);
43
if (retval & det_mask)
45
sprintf(buffer + len, " display %s",
46
(sta & det_mask) ? "present" : "absent");
49
sprintf(buffer + len, " port %s",
50
(sta & en_mask) ? "enabled" : "disabled");
51
len += sprintf(buffer + len, "\n");
57
static int omnibook_display_write(char *buffer, struct omnibook_operation *io_op)
63
state = simple_strtoul(buffer, &endp, 16);
67
retval = backend_display_set(io_op, state);
72
static struct omnibook_feature display_driver;
74
static int __init omnibook_display_init(struct omnibook_operation *io_op)
79
/* Disable file writing if unsuported by backend */
80
if (!io_op->backend->display_set)
81
display_driver.write = NULL;
83
retval = backend_display_get(io_op, &state);
90
static struct omnibook_tbl display_table[] __initdata = {
91
{TSM70 | TSX205, {ACPI,}},
92
{TSM40, {SMI, SMI_GET_DISPLAY_STATE, SMI_SET_DISPLAY_STATE, 0, 0, 0}},
93
{XE3GF | TSP10 | TSM70 | TSM30X | TSM40, SIMPLE_BYTE(EC, XE3GF_STA1, XE3GF_SHDD_MASK)},
94
{XE3GC, SIMPLE_BYTE(EC, XE3GC_STA1, XE3GC_CRTI_MASK)},
95
{OB500 | OB510 | OB6000 | OB6100 | XE4500, SIMPLE_BYTE(EC, OB500_STA1, OB500_CRTS_MASK)},
96
{OB4150, SIMPLE_BYTE(EC, OB4150_STA2, OB4150_CRST_MASK)},
100
static struct omnibook_feature __declared_feature display_driver = {
103
.init = omnibook_display_init,
104
.read = omnibook_display_read,
105
.write = omnibook_display_write,
107
XE3GF | XE3GC | OB500 | OB510 | OB6000 | OB6100 | XE4500 | OB4150 | TSP10 | TSM70 | TSM30X |
109
.tbl = display_table,
112
module_param_named(display, display_driver.enabled, int, S_IRUGO);
113
MODULE_PARM_DESC(display, "Use 0 to disable, 1 to enable display status handling");