~ubuntu-branches/ubuntu/precise/linux-ti-omap/precise

« back to all changes in this revision

Viewing changes to ubuntu/omnibook/dock.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Amit Kucheria
  • Date: 2010-03-23 18:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100323180512-iavj906ocnphdubp
Tags: 2.6.33-500.3
[ Amit Kucheria ]

* [Config] Fix the debug package name to end in -dbgsym
* SAUCE: Add the ubuntu/ drivers to omap
* SAUCE: Re-export the symbols for aufs
* [Config] Enable AUFS and COMPCACHE

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * dock.c -- docking station/port replicator support
 
3
 * 
 
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
 
7
 * later version.
 
8
 * 
 
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.
 
13
 *
 
14
 * Written by Soós Péter <sp@osb.hu>, 2002-2004
 
15
 * Modified by Mathieu Bérard <mathieu.berard@crans.org>, 2006
 
16
 */
 
17
 
 
18
#include "omnibook.h"
 
19
#include "hardware.h"
 
20
 
 
21
static int omnibook_dock_read(char *buffer, struct omnibook_operation *io_op)
 
22
{
 
23
        int len = 0;
 
24
        u8 dock;
 
25
        int retval;
 
26
 
 
27
        if ((retval = backend_byte_read(io_op, &dock)))
 
28
                return retval;
 
29
 
 
30
        len += sprintf(buffer + len, "Laptop is %s\n", (dock) ? "docked" : "undocked");
 
31
 
 
32
        return len;
 
33
}
 
34
 
 
35
static int omnibook_dock_write(char *buffer, struct omnibook_operation *io_op)
 
36
{
 
37
        int retval;
 
38
 
 
39
        switch (*buffer) {
 
40
        case '0':
 
41
                retval = backend_byte_write(io_op, 0);
 
42
                break;
 
43
        case '1':
 
44
                retval = backend_byte_write(io_op, 1);
 
45
                break;
 
46
        default:
 
47
                retval = -EINVAL;
 
48
        }
 
49
 
 
50
        return retval;
 
51
}
 
52
 
 
53
static struct omnibook_feature dock_driver;
 
54
 
 
55
static int __init omnibook_dock_init(struct omnibook_operation *io_op)
 
56
{
 
57
        /* writing is only supported on ectype 13 */
 
58
        if(!(omnibook_ectype & TSM40))
 
59
                dock_driver.write = NULL;
 
60
        
 
61
        return 0;
 
62
}
 
63
 
 
64
static struct omnibook_tbl dock_table[] __initdata = {
 
65
        {XE3GF, SIMPLE_BYTE(EC, XE3GF_CSPR, XE3GF_CSPR_MASK)},
 
66
        {OB500 | OB510 | OB6000 | OB6100, SIMPLE_BYTE(EC, OB500_STA1, OB500_DCKS_MASK)},
 
67
        {OB4150, SIMPLE_BYTE(EC, OB4150_DCID, 0)},
 
68
        {TSM40, {SMI, SMI_GET_DOCK, SMI_SET_DOCK, 0, 0, 0}},
 
69
        {0,}
 
70
};
 
71
 
 
72
static struct omnibook_feature __declared_feature dock_driver = {
 
73
        .name = "dock",
 
74
        .enabled = 0,
 
75
        .init = omnibook_dock_init,
 
76
        .read = omnibook_dock_read,
 
77
        .write = omnibook_dock_write,
 
78
        .ectypes = XE3GF | OB500 | OB510 | OB6000 | OB6100 | OB4150 | TSM40,
 
79
        .tbl = dock_table,
 
80
};
 
81
 
 
82
module_param_named(dock, dock_driver.enabled, int, S_IRUGO);
 
83
MODULE_PARM_DESC(dock, "Use 0 to disable, 1 to enable docking station support");
 
84
/* End of file */