GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / mach-msm / include / mach / gpio.h
blob83e47c0d5c2e451de5f459653053684beb786ee8
1 /*
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
4 * Author: Mike Lockwood <lockwood@android.com>
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef __ASM_ARCH_MSM_GPIO_H
17 #define __ASM_ARCH_MSM_GPIO_H
19 #include <asm-generic/gpio.h>
21 #define gpio_get_value __gpio_get_value
22 #define gpio_set_value __gpio_set_value
23 #define gpio_cansleep __gpio_cansleep
24 #define gpio_to_irq __gpio_to_irq
26 /**
27 * struct msm_gpio - GPIO pin description
28 * @gpio_cfg - configuration bitmap, as per gpio_tlmm_config()
29 * @label - textual label
31 * Usually, GPIO's are operated by sets.
32 * This struct accumulate all GPIO information in single source
33 * and facilitete group operations provided by msm_gpios_xxx()
35 struct msm_gpio {
36 u32 gpio_cfg;
37 const char *label;
40 /**
41 * msm_gpios_request_enable() - request and enable set of GPIOs
43 * Request and configure set of GPIO's
44 * In case of error, all operations rolled back.
45 * Return error code.
47 * @table: GPIO table
48 * @size: number of entries in @table
50 int msm_gpios_request_enable(const struct msm_gpio *table, int size);
52 /**
53 * msm_gpios_disable_free() - disable and free set of GPIOs
55 * @table: GPIO table
56 * @size: number of entries in @table
58 void msm_gpios_disable_free(const struct msm_gpio *table, int size);
60 /**
61 * msm_gpios_request() - request set of GPIOs
62 * In case of error, all operations rolled back.
63 * Return error code.
65 * @table: GPIO table
66 * @size: number of entries in @table
68 int msm_gpios_request(const struct msm_gpio *table, int size);
70 /**
71 * msm_gpios_free() - free set of GPIOs
73 * @table: GPIO table
74 * @size: number of entries in @table
76 void msm_gpios_free(const struct msm_gpio *table, int size);
78 /**
79 * msm_gpios_enable() - enable set of GPIOs
80 * In case of error, all operations rolled back.
81 * Return error code.
83 * @table: GPIO table
84 * @size: number of entries in @table
86 int msm_gpios_enable(const struct msm_gpio *table, int size);
88 /**
89 * msm_gpios_disable() - disable set of GPIOs
91 * @table: GPIO table
92 * @size: number of entries in @table
94 void msm_gpios_disable(const struct msm_gpio *table, int size);
96 /* GPIO TLMM (Top Level Multiplexing) Definitions */
98 /* GPIO TLMM: Function -- GPIO specific */
100 /* GPIO TLMM: Direction */
101 enum {
102 GPIO_INPUT,
103 GPIO_OUTPUT,
106 /* GPIO TLMM: Pullup/Pulldown */
107 enum {
108 GPIO_NO_PULL,
109 GPIO_PULL_DOWN,
110 GPIO_KEEPER,
111 GPIO_PULL_UP,
114 /* GPIO TLMM: Drive Strength */
115 enum {
116 GPIO_2MA,
117 GPIO_4MA,
118 GPIO_6MA,
119 GPIO_8MA,
120 GPIO_10MA,
121 GPIO_12MA,
122 GPIO_14MA,
123 GPIO_16MA,
126 enum {
127 GPIO_ENABLE,
128 GPIO_DISABLE,
131 #define GPIO_CFG(gpio, func, dir, pull, drvstr) \
132 ((((gpio) & 0x3FF) << 4) | \
133 ((func) & 0xf) | \
134 (((dir) & 0x1) << 14) | \
135 (((pull) & 0x3) << 15) | \
136 (((drvstr) & 0xF) << 17))
139 * extract GPIO pin from bit-field used for gpio_tlmm_config
141 #define GPIO_PIN(gpio_cfg) (((gpio_cfg) >> 4) & 0x3ff)
142 #define GPIO_FUNC(gpio_cfg) (((gpio_cfg) >> 0) & 0xf)
143 #define GPIO_DIR(gpio_cfg) (((gpio_cfg) >> 14) & 0x1)
144 #define GPIO_PULL(gpio_cfg) (((gpio_cfg) >> 15) & 0x3)
145 #define GPIO_DRVSTR(gpio_cfg) (((gpio_cfg) >> 17) & 0xf)
147 int gpio_tlmm_config(unsigned config, unsigned disable);
149 #endif /* __ASM_ARCH_MSM_GPIO_H */