]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/plat-omap/include/mach/gpio-switch.h
Merge branch 'omap-fixes'
[linux-2.6-omap-h63xx.git] / arch / arm / plat-omap / include / mach / gpio-switch.h
1 /*
2  * GPIO switch definitions
3  *
4  * Copyright (C) 2006 Nokia Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H
12 #define __ASM_ARCH_OMAP_GPIO_SWITCH_H
13
14 #include <linux/types.h>
15
16 /* Cover:
17  *      high -> closed
18  *      low  -> open
19  * Connection:
20  *      high -> connected
21  *      low  -> disconnected
22  * Activity:
23  *      high -> active
24  *      low  -> inactive
25  *
26  */
27 #define OMAP_GPIO_SWITCH_TYPE_COVER                     0x0000
28 #define OMAP_GPIO_SWITCH_TYPE_CONNECTION                0x0001
29 #define OMAP_GPIO_SWITCH_TYPE_ACTIVITY                  0x0002
30 #define OMAP_GPIO_SWITCH_FLAG_INVERTED                  0x0001
31 #define OMAP_GPIO_SWITCH_FLAG_OUTPUT                    0x0002
32 #define OMAP_GPIO_SWITCH_FLAG_OUTPUT_INIT_ACTIVE        0x0004
33
34 struct omap_gpio_switch {
35         const char *name;
36         s16 gpio;
37         unsigned flags:4;
38         unsigned type:4;
39
40         /* Time in ms to debounce when transitioning from
41          * inactive state to active state. */
42         u16 debounce_rising;
43         /* Same for transition from active to inactive state. */
44         u16 debounce_falling;
45
46         /* notify board-specific code about state changes */
47         void (* notify)(void *data, int state);
48         void *notify_data;
49 };
50
51 /* Call at init time only */
52 #ifdef CONFIG_OMAP_GPIO_SWITCH
53 extern void omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
54                                         int count);
55 #else
56 #define omap_register_gpio_switches(tbl, count) do { } while (0)
57 #endif
58
59 #endif