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 / gpio.c
blobbc32c845c7b0e4f777e3366fd4f418daa44c700e
1 /* linux/arch/arm/mach-msm/gpio.c
3 * Copyright (C) 2007 Google, Inc.
4 * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
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.
17 #include <linux/module.h>
18 #include <mach/gpio.h>
19 #include "proc_comm.h"
21 int gpio_tlmm_config(unsigned config, unsigned disable)
23 return msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, &disable);
25 EXPORT_SYMBOL(gpio_tlmm_config);
27 int msm_gpios_enable(const struct msm_gpio *table, int size)
29 int rc;
30 int i;
31 const struct msm_gpio *g;
32 for (i = 0; i < size; i++) {
33 g = table + i;
34 rc = gpio_tlmm_config(g->gpio_cfg, GPIO_ENABLE);
35 if (rc) {
36 pr_err("gpio_tlmm_config(0x%08x, GPIO_ENABLE)"
37 " <%s> failed: %d\n",
38 g->gpio_cfg, g->label ?: "?", rc);
39 pr_err("pin %d func %d dir %d pull %d drvstr %d\n",
40 GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg),
41 GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg),
42 GPIO_DRVSTR(g->gpio_cfg));
43 goto err;
46 return 0;
47 err:
48 msm_gpios_disable(table, i);
49 return rc;
51 EXPORT_SYMBOL(msm_gpios_enable);
53 void msm_gpios_disable(const struct msm_gpio *table, int size)
55 int rc;
56 int i;
57 const struct msm_gpio *g;
58 for (i = size-1; i >= 0; i--) {
59 g = table + i;
60 rc = gpio_tlmm_config(g->gpio_cfg, GPIO_DISABLE);
61 if (rc) {
62 pr_err("gpio_tlmm_config(0x%08x, GPIO_DISABLE)"
63 " <%s> failed: %d\n",
64 g->gpio_cfg, g->label ?: "?", rc);
65 pr_err("pin %d func %d dir %d pull %d drvstr %d\n",
66 GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg),
67 GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg),
68 GPIO_DRVSTR(g->gpio_cfg));
72 EXPORT_SYMBOL(msm_gpios_disable);
74 int msm_gpios_request_enable(const struct msm_gpio *table, int size)
76 int rc = msm_gpios_enable(table, size);
77 return rc;
79 EXPORT_SYMBOL(msm_gpios_request_enable);
81 void msm_gpios_disable_free(const struct msm_gpio *table, int size)
83 msm_gpios_disable(table, size);
85 EXPORT_SYMBOL(msm_gpios_disable_free);