blob: 4b435ded65eef5cd2a051d49182fb73be280b184 [file] [log] [blame]
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Hanumant Singh55a1bb02012-11-06 10:01:15 -08002 *
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
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <mach/board.h>
17#include <mach/gpio.h>
18#include <mach/gpiomux.h>
19
Gilad Avidovf84f2792013-01-31 13:26:39 -070020static struct gpiomux_setting gpio_i2c_config = {
21 .func = GPIOMUX_FUNC_3,
22 .drv = GPIOMUX_DRV_2MA,
23 .pull = GPIOMUX_PULL_NONE,
24};
25
Gilad Avidovf58f1832013-01-09 17:31:28 -070026static struct gpiomux_setting gpio_spi_config = {
27 .func = GPIOMUX_FUNC_1,
28 .drv = GPIOMUX_DRV_6MA,
29 .pull = GPIOMUX_PULL_NONE,
30};
31
32static struct gpiomux_setting gpio_spi_cs_config = {
33 .func = GPIOMUX_FUNC_1,
34 .drv = GPIOMUX_DRV_6MA,
35 .pull = GPIOMUX_PULL_DOWN,
36};
37
Sameer Thalappil1fafd672013-04-03 12:31:04 -070038static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
39 .func = GPIOMUX_FUNC_GPIO,
40 .drv = GPIOMUX_DRV_2MA,
41 .pull = GPIOMUX_PULL_UP,
42};
43
44static struct gpiomux_setting wcnss_5wire_active_cfg = {
45 .func = GPIOMUX_FUNC_1,
46 .drv = GPIOMUX_DRV_6MA,
47 .pull = GPIOMUX_PULL_DOWN,
48};
49
Xiaoming Zhou17972262013-04-10 17:50:35 -040050static struct gpiomux_setting lcd_en_act_cfg = {
51 .func = GPIOMUX_FUNC_GPIO,
52 .drv = GPIOMUX_DRV_8MA,
53 .pull = GPIOMUX_PULL_NONE,
54 .dir = GPIOMUX_OUT_HIGH,
55};
56
57static struct gpiomux_setting lcd_en_sus_cfg = {
58 .func = GPIOMUX_FUNC_GPIO,
59 .drv = GPIOMUX_DRV_2MA,
60 .pull = GPIOMUX_PULL_DOWN,
61};
62
63static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
64 {
65 .gpio = 41,
66 .settings = {
67 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
68 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
69 },
70 },
71 {
72 .gpio = 7,
73 .settings = {
74 [GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
75 [GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
76 },
77 },
78};
79
Gilad Avidovf84f2792013-01-31 13:26:39 -070080static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
81 {
Gilad Avidovf58f1832013-01-09 17:31:28 -070082 .gpio = 10, /* BLSP1 QUP3 I2C_SDA */
Gilad Avidovf84f2792013-01-31 13:26:39 -070083 .settings = {
84 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
85 },
86 },
87 {
Gilad Avidovf58f1832013-01-09 17:31:28 -070088 .gpio = 11, /* BLSP1 QUP3 I2C_SCL */
Gilad Avidovf84f2792013-01-31 13:26:39 -070089 .settings = {
90 [GPIOMUX_SUSPENDED] = &gpio_i2c_config,
91 },
92 },
Gilad Avidovf58f1832013-01-09 17:31:28 -070093 {
94 .gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
95 .settings = {
96 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
97 },
98 },
99 {
100 .gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
101 .settings = {
102 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
103 },
104 },
105 {
106 .gpio = 3, /* BLSP1 QUP1 SPI_CLK */
107 .settings = {
108 [GPIOMUX_SUSPENDED] = &gpio_spi_config,
109 },
110 },
111 {
112 .gpio = 2, /* BLSP1 QUP1 SPI_CS1 */
113 .settings = {
114 [GPIOMUX_SUSPENDED] = &gpio_spi_cs_config,
115 },
116 },
Gilad Avidovf84f2792013-01-31 13:26:39 -0700117};
118
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700119static struct msm_gpiomux_config wcnss_5wire_interface[] = {
120 {
121 .gpio = 23,
122 .settings = {
123 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
124 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
125 },
126 },
127 {
128 .gpio = 24,
129 .settings = {
130 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
131 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
132 },
133 },
134 {
135 .gpio = 25,
136 .settings = {
137 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
138 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
139 },
140 },
141 {
142 .gpio = 26,
143 .settings = {
144 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
145 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
146 },
147 },
148 {
149 .gpio = 27,
150 .settings = {
151 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
152 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
153 },
154 },
155};
156
Syed Rameez Mustafa3971c142013-01-09 19:04:53 -0800157void __init msm8610_init_gpiomux(void)
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800158{
159 int rc;
160
Rohit Vaswani341c2032012-11-08 18:49:29 -0800161 rc = msm_gpiomux_init_dt();
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800162 if (rc) {
Rohit Vaswani341c2032012-11-08 18:49:29 -0800163 pr_err("%s failed %d\n", __func__, rc);
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800164 return;
165 }
Gilad Avidovf84f2792013-01-31 13:26:39 -0700166
167 msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
Sameer Thalappil1fafd672013-04-03 12:31:04 -0700168 msm_gpiomux_install(wcnss_5wire_interface,
169 ARRAY_SIZE(wcnss_5wire_interface));
Xiaoming Zhou17972262013-04-10 17:50:35 -0400170 msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs));
Hanumant Singh55a1bb02012-11-06 10:01:15 -0800171}