aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Brown <davidb@codeaurora.org>2011-05-16 16:32:15 -0400
committerDavid Brown <davidb@codeaurora.org>2011-08-01 07:58:00 -0400
commit030a77fc9b805a38a2ffaea42728557282b81275 (patch)
treecfa523bf81db0c49e88c7ef4b5fef3c50d775b8d
parent10eb5f6bcbdc5e460e5500e1dbc39b2e7713ebfd (diff)
msm: gpiomux: Move public API to public header
The gpiomux.h header contains some SOC ifdefs. However, the API that is actually used by the GPIO driver only uses two functions that are general. Move these general definitions into a public header file. Change-Id: Ia5df8af87dba268225598d56908e523bcfc24ef6 Signed-off-by: David Brown <davidb@codeaurora.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
-rw-r--r--arch/arm/mach-msm/gpio.c2
-rw-r--r--arch/arm/mach-msm/gpiomux.h17
-rw-r--r--arch/arm/mach-msm/include/mach/msm_gpiomux.h38
3 files changed, 40 insertions, 17 deletions
diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c
index e96199dd14d0..6767deb79cd0 100644
--- a/arch/arm/mach-msm/gpio.c
+++ b/arch/arm/mach-msm/gpio.c
@@ -21,8 +21,8 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <mach/cpu.h> 23#include <mach/cpu.h>
24#include <mach/msm_gpiomux.h>
24#include "gpio_hw.h" 25#include "gpio_hw.h"
25#include "gpiomux.h"
26 26
27#define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0) 27#define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0)
28 28
diff --git a/arch/arm/mach-msm/gpiomux.h b/arch/arm/mach-msm/gpiomux.h
index b178d9cb742f..00459f6ee13c 100644
--- a/arch/arm/mach-msm/gpiomux.h
+++ b/arch/arm/mach-msm/gpiomux.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <mach/msm_gpiomux.h>
22 23
23#if defined(CONFIG_MSM_V2_TLMM) 24#if defined(CONFIG_MSM_V2_TLMM)
24#include "gpiomux-v2.h" 25#include "gpiomux-v2.h"
@@ -71,12 +72,6 @@ enum {
71 */ 72 */
72extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS]; 73extern struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS];
73 74
74/* Increment a gpio's reference count, possibly activating the line. */
75int __must_check msm_gpiomux_get(unsigned gpio);
76
77/* Decrement a gpio's reference count, possibly suspending the line. */
78int msm_gpiomux_put(unsigned gpio);
79
80/* Install a new configuration to the gpio line. To avoid overwriting 75/* Install a new configuration to the gpio line. To avoid overwriting
81 * a configuration, leave the VALID bit out. 76 * a configuration, leave the VALID bit out.
82 */ 77 */
@@ -94,16 +89,6 @@ int msm_gpiomux_write(unsigned gpio,
94 */ 89 */
95void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val); 90void __msm_gpiomux_write(unsigned gpio, gpiomux_config_t val);
96#else 91#else
97static inline int __must_check msm_gpiomux_get(unsigned gpio)
98{
99 return -ENOSYS;
100}
101
102static inline int msm_gpiomux_put(unsigned gpio)
103{
104 return -ENOSYS;
105}
106
107static inline int msm_gpiomux_write(unsigned gpio, 92static inline int msm_gpiomux_write(unsigned gpio,
108 gpiomux_config_t active, 93 gpiomux_config_t active,
109 gpiomux_config_t suspended) 94 gpiomux_config_t suspended)
diff --git a/arch/arm/mach-msm/include/mach/msm_gpiomux.h b/arch/arm/mach-msm/include/mach/msm_gpiomux.h
new file mode 100644
index 000000000000..0c7d3936e02f
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/msm_gpiomux.h
@@ -0,0 +1,38 @@
1/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _LINUX_MSM_GPIOMUX_H
14#define _LINUX_MSM_GPIOMUX_H
15
16#ifdef CONFIG_MSM_GPIOMUX
17
18/* Increment a gpio's reference count, possibly activating the line. */
19int __must_check msm_gpiomux_get(unsigned gpio);
20
21/* Decrement a gpio's reference count, possibly suspending the line. */
22int msm_gpiomux_put(unsigned gpio);
23
24#else
25
26static inline int __must_check msm_gpiomux_get(unsigned gpio)
27{
28 return -ENOSYS;
29}
30
31static inline int msm_gpiomux_put(unsigned gpio)
32{
33 return -ENOSYS;
34}
35
36#endif
37
38#endif /* _LINUX_MSM_GPIOMUX_H */