blob: 593e2b1737af2e72a6c232f502e7c56008145095 [file] [log] [blame]
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/init.h>
#include <linux/ioport.h>
#include <mach/board.h>
#include <mach/gpio.h>
#include <mach/gpiomux.h>
static struct gpiomux_setting gpio_i2c_config = {
.func = GPIOMUX_FUNC_3,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting gpio_cam_i2c_config = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting atmel_int_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting atmel_int_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting atmel_reset_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting atmel_reset_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting wcnss_5wire_active_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting lcd_en_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_HIGH,
};
static struct gpiomux_setting lcd_en_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting gpio_keys_active = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting gpio_keys_suspend = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
{
.gpio = 41,
.settings = {
[GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
},
},
{
.gpio = 7,
.settings = {
[GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
},
},
};
static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
{
.gpio = 2, /* BLSP1 QUP1 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 3, /* BLSP1 QUP1 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 10, /* BLSP1 QUP3 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 11, /* BLSP1 QUP3 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 16, /* BLSP1 QUP6 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
},
},
{
.gpio = 17, /* BLSP1 QUP6 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_cam_i2c_config,
},
},
};
static struct msm_gpiomux_config msm_atmel_configs[] __initdata = {
{
.gpio = 0, /* TOUCH RESET */
.settings = {
[GPIOMUX_ACTIVE] = &atmel_reset_act_cfg,
[GPIOMUX_SUSPENDED] = &atmel_reset_sus_cfg,
},
},
{
.gpio = 1, /* TOUCH INT */
.settings = {
[GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
[GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
},
},
};
static struct msm_gpiomux_config wcnss_5wire_interface[] = {
{
.gpio = 23,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 24,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 25,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 26,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 27,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
};
static struct msm_gpiomux_config msm_keypad_configs[] __initdata = {
{
.gpio = 72,
.settings = {
[GPIOMUX_ACTIVE] = &gpio_keys_active,
[GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
},
},
{
.gpio = 73,
.settings = {
[GPIOMUX_ACTIVE] = &gpio_keys_active,
[GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
},
},
{
.gpio = 74,
.settings = {
[GPIOMUX_ACTIVE] = &gpio_keys_active,
[GPIOMUX_SUSPENDED] = &gpio_keys_suspend,
},
},
};
static struct gpiomux_setting sd_card_det_active_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting sd_card_det_suspend_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
.dir = GPIOMUX_IN,
};
static struct msm_gpiomux_config sd_card_det[] __initdata = {
{
.gpio = 42,
.settings = {
[GPIOMUX_ACTIVE] = &sd_card_det_active_config,
[GPIOMUX_SUSPENDED] = &sd_card_det_suspend_config,
},
},
};
void __init msm8610_init_gpiomux(void)
{
int rc;
rc = msm_gpiomux_init_dt();
if (rc) {
pr_err("%s failed %d\n", __func__, rc);
return;
}
msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
msm_gpiomux_install(msm_atmel_configs,
ARRAY_SIZE(msm_atmel_configs));
msm_gpiomux_install(wcnss_5wire_interface,
ARRAY_SIZE(wcnss_5wire_interface));
msm_gpiomux_install(msm_lcd_configs, ARRAY_SIZE(msm_lcd_configs));
msm_gpiomux_install(msm_keypad_configs,
ARRAY_SIZE(msm_keypad_configs));
msm_gpiomux_install(sd_card_det, ARRAY_SIZE(sd_card_det));
}