blob: f087cdfbc5bfa07d6b4a91d4d4816bc3cc753a30 [file] [log] [blame]
/* Copyright (c) 2013-2014, 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/gpio.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <mach/board.h>
#include <mach/gpiomux.h>
#include <soc/qcom/socinfo.h>
static struct gpiomux_setting ap2mdm_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting mdm2ap_status_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting mdm2ap_errfatal_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting mdm2ap_pblrdy = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting ap2mdm_soft_reset_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting ap2mdm_wakeup = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting hap_lvl_shft_active_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting hap_lvl_shft_suspended_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting gpio_epm_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_HIGH,
};
static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
{
.gpio = 48,
.settings = {
[GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
[GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
},
},
};
static struct msm_gpiomux_config mdm_configs[] __initdata = {
/* AP2MDM_STATUS */
{
.gpio = 110,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
}
},
/* MDM2AP_STATUS */
{
.gpio = 109,
.settings = {
[GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
}
},
/* MDM2AP_ERRFATAL */
{
.gpio = 111,
.settings = {
[GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
}
},
/* AP2MDM_ERRFATAL */
{
.gpio = 112,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
}
},
/* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
{
.gpio = 128,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
}
},
/* AP2MDM_WAKEUP */
{
.gpio = 108,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
}
},
/* MDM2AP_PBL_READY*/
{
.gpio = 113,
.settings = {
[GPIOMUX_SUSPENDED] = &mdm2ap_pblrdy,
}
},
};
static struct gpiomux_setting gpio_i2c_config = {
.func = GPIOMUX_FUNC_3,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting synaptics_reset_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting synaptics_reset_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting synaptics_int_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting synaptics_int_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting gpio_uart_config = {
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_16MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct msm_gpiomux_config msm_synaptics_configs[] __initdata = {
{
.gpio = 143,
.settings = {
[GPIOMUX_ACTIVE] = &synaptics_int_act_cfg,
[GPIOMUX_SUSPENDED] = &synaptics_int_sus_cfg,
},
},
{
.gpio = 145,
.settings = {
[GPIOMUX_ACTIVE] = &synaptics_reset_act_cfg,
[GPIOMUX_SUSPENDED] = &synaptics_reset_sus_cfg,
},
},
};
static struct gpiomux_setting gpio_spi_config = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting gpio_uart_gps_liquid_config = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_16MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting gpio_uart_gps_cdp_config = {
.func = GPIOMUX_FUNC_3,
.drv = GPIOMUX_DRV_16MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
{
.gpio = 0, /* BLSP1 QUP1 SPI_DATA_MOSI */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 1, /* BLSP1 QUP1 SPI_DATA_MISO */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 3, /* BLSP1 QUP1 SPI_CLK */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_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 = 29, /* BLSP1 QUP4 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 30, /* BLSP1 QUP4 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 41, /* BLSP1 QUP5 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 42, /* BLSP1 QUP5 ISC_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 51, /* BLSP2 UART1 TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 52, /* BLSP2 UART1 RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 61, /* BLSP1 QUP2 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 62, /* BLSP1 QUP2 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 116, /* BLSP1 QUP1 SPI_CS1 */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
}
};
static struct msm_gpiomux_config msm_sbc_blsp_configs[] __initdata = {
{
.gpio = 2, /* BLSP1 QUP0 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 3, /* BLSP1 QUP0 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 4, /* BLSP1 QUP1 SPI_DATA_MOSI */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 5, /* BLSP1 QUP1 SPI_DATA_MISO */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 6, /* BLSP1 QUP1 SPI_CS_N */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 7, /* BLSP1 QUP1 SPI_CLK */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 10, /* BLSP1 QUP2 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 11, /* BLSP1 QUP2 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 49, /* BLSP2 QUP5 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 50, /* BLSP2 QUP5 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 51, /* BLSP2 UART1 TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 52, /* BLSP2 UART1 RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 53, /* BLSP2 QUP1 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 54, /* BLSP2 QUP1 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 61, /* BLSP2 QUP3 I2C_SDA */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 62, /* BLSP2 QUP3 I2C_SCL */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
}
};
#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
static struct gpiomux_setting gpio_eth_config = {
.pull = GPIOMUX_PULL_UP,
.drv = GPIOMUX_DRV_2MA,
.func = GPIOMUX_FUNC_GPIO,
};
static struct msm_gpiomux_config msm_eth_configs[] __initdata = {
{
.gpio = 60, /* SPI IRQ */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_eth_config,
}
},
{
.gpio = 117, /* CS */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_eth_config,
}
},
};
#endif
static struct msm_gpiomux_config msm_blsp1_uart6_configs[] __initdata = {
{
.gpio = 43, /* BLSP1 UART6 TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 44, /* BLSP1 UART6 RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 45, /* BLSP1 UART6 CTS */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 46, /* BLSP1 UART6 RTS */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
};
/* QCA1530 uses differnt GPIOs based on platform, hence these settings */
static struct msm_gpiomux_config msm_blsp2_uart5_configs[] __initdata = {
{
.gpio = 112, /* BLSP2 UART5 TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_gps_liquid_config,
},
},
{
.gpio = 113, /* BLSP2 UART5 RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_gps_liquid_config,
},
},
};
static struct msm_gpiomux_config msm_blsp2_uart1_configs[] __initdata = {
{
.gpio = 130, /* BLSP2 UART1 TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_gps_cdp_config,
},
},
{
.gpio = 131, /* BLSP2 UART1 RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_gps_cdp_config,
},
},
};
static struct gpiomux_setting general_led_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_LOW,
};
static struct gpiomux_setting general_led_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
/*General led configuration for SBC 8084 platform*/
static struct msm_gpiomux_config apq8084_general_led_configs[] = {
{
.gpio = 83,
.settings = {
[GPIOMUX_ACTIVE] = &general_led_cfg,
[GPIOMUX_SUSPENDED] = &general_led_sus_cfg,
},
},
};
static struct gpiomux_setting hdmi_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting hdmi_active_1_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting hdmi_active_2_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_16MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting hdmi_active_mux_lpm_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
.dir = GPIOMUX_OUT_HIGH,
};
static struct gpiomux_setting hdmi_active_mux_en_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
.dir = GPIOMUX_OUT_HIGH,
};
static struct gpiomux_setting hdmi_active_mux_sel_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_OUT_LOW,
};
static struct msm_gpiomux_config msm_hdmi_nomux_configs[] __initdata = {
{
.gpio = 31,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 32,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 33,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 34,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
};
static struct msm_gpiomux_config msm_hdmi_configs[] __initdata = {
{
.gpio = 31,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 32,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 33,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 34,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 27,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_mux_lpm_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 83,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_mux_en_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
{
.gpio = 85,
.settings = {
[GPIOMUX_ACTIVE] = &hdmi_active_mux_sel_cfg,
[GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
},
},
};
static struct gpiomux_setting hsic_act_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting hsic_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_OUT_LOW,
};
static struct gpiomux_setting hsic_wakeup_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting hsic_wakeup_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting hsic_ap2mdm_chlrdy_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_LOW,
};
static struct gpiomux_setting hsic_ap2mdm_chlrdy_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_OUT_LOW,
};
static struct msm_gpiomux_config apq8084_hsic_configs[] = {
{
.gpio = 134, /*HSIC_STROBE */
.settings = {
[GPIOMUX_ACTIVE] = &hsic_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
},
},
{
.gpio = 135, /* HSIC_DATA */
.settings = {
[GPIOMUX_ACTIVE] = &hsic_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
},
},
{
.gpio = 107, /* wake up */
.settings = {
[GPIOMUX_ACTIVE] = &hsic_wakeup_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_wakeup_sus_cfg,
},
},
{
.gpio = 106,
.settings = {
[GPIOMUX_ACTIVE] = &hsic_ap2mdm_chlrdy_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_ap2mdm_chlrdy_sus_cfg,
}
},
{
.gpio = 108, /* ap2mdm_wakeup is used as resume gpio */
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
}
},
};
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 lcd_te_act_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting lcd_te_sus_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_IN,
};
static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
{
.gpio = 96, /* LCD RESET */
.settings = {
[GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
},
},
{
.gpio = 86, /* BKLT ENABLE */
.settings = {
[GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
},
},
{
.gpio = 137, /* DISPLAY ENABLE */
.settings = {
[GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
},
},
};
static struct msm_gpiomux_config msm_lcd_te_configs[] __initdata = {
{
.gpio = 12, /* TEAR ENABLE */
.settings = {
[GPIOMUX_ACTIVE] = &lcd_te_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_te_sus_cfg,
},
},
};
static struct gpiomux_setting auxpcm_act_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting auxpcm_sus_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
/* Primary AUXPCM port sharing GPIO lines with Tertiary MI2S */
static struct msm_gpiomux_config apq8084_pri_ter_auxpcm_configs[] __initdata = {
{
.gpio = 87,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 88,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 89,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 90,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
};
static struct gpiomux_setting eth_pwr_sleep_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
.dir = GPIOMUX_IN,
};
static struct msm_gpiomux_config eth_pwr[] = {
{
.gpio = 39,
.settings = {
[GPIOMUX_SUSPENDED] = &eth_pwr_sleep_config,
},
},
};
static struct gpiomux_setting gpio_suspend_config[] = {
{
.func = GPIOMUX_FUNC_GPIO, /* IN-NP */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
},
{
.func = GPIOMUX_FUNC_GPIO, /* O-LOW */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_LOW,
},
};
static struct gpiomux_setting cam_settings[] = {
{
.func = GPIOMUX_FUNC_1, /*active 1*/ /* 0 */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
},
{
.func = GPIOMUX_FUNC_1, /*suspend*/ /* 1 */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
},
{
.func = GPIOMUX_FUNC_1, /*i2c suspend*/ /* 2 */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_KEEPER,
},
{
.func = GPIOMUX_FUNC_GPIO, /*active 0*/ /* 3 */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
},
{
.func = GPIOMUX_FUNC_GPIO, /*suspend 0*/ /* 4 */
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
},
};
static struct msm_gpiomux_config msm_sensor_configs[] __initdata = {
{
.gpio = 15, /* CAM_MCLK0 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 16, /* CAM_MCLK1 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 17, /* CAM_MCLK2 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 18, /* WEBCAM1_RESET_N / CAM_MCLK3 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &cam_settings[4],
},
},
{
.gpio = 19, /* CCI_I2C_SDA0 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 20, /* CCI_I2C_SCL0 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 21, /* CCI_I2C_SDA1 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 22, /* CCI_I2C_SCL1 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 23, /* FLASH_LED_EN */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 24, /* FLASH_LED_NOW */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 25, /* WEBCAM2_RESET_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 26, /* CAM_IRQ */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 27, /* OIS_SYNC */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 120, /* WEBCAM1_STANDBY */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 35, /* CAM1_STANDBY_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 36, /* CAM1_RST_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 37, /* CAM2_STANDBY_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 38, /* CAM2_RST_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
};
static struct msm_gpiomux_config msm_sbc_sensor_configs[] __initdata = {
{
.gpio = 15, /* CSI0 (CAM1) CAM_MCLK0 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 16, /* CSI1 (CAM 3D L) CAM_MCLK1 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 17, /* CSI2 (CAM2) CAM_MCLK2 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 18, /* CSI1 (CAM 3D R) CAM_MCLK3 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &cam_settings[1],
},
},
{
.gpio = 19, /* (CAM1, CAM2 and CAM 3D L) CCI_I2C_SDA0 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 20, /* (CAM1, CAM2 and CAM 3D L) CCI_I2C_SCL0 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 21, /* (CAM 3D R) CCI_I2C_SDA1 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 22, /* (CAM 3D L) CCI_I2C_SCL1 */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 23, /* (CAM1 CCI_TIMER0) FLASH_LED_EN */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 24, /* (CAM1 CCI_TIMER1) FLASH_LED_NOW */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 25, /* CAM2_RESET_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 35, /* CAM1_STANDBY_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 36, /* CAM1_RST_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 78, /* CAM2_STANDBY */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 118, /* (CAM 3D L&R) CAM_3D_STANDBY */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 120, /* (CAM 3D L&R) CAM_3D_RESET */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
};
static struct gpiomux_setting gpio_qca1530_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting gpio_qca1530_config_mpp7 = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting gpio_pcie_clkreq_config[] = {
{
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
},
{
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
},
};
static struct msm_gpiomux_config msm_pcie_configs[] __initdata = {
{
.gpio = 68, /* PCIE0_CLKREQ_N */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_pcie_clkreq_config[0],
},
},
{
.gpio = 141, /* PCIE1_CLKREQ_N */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_pcie_clkreq_config[1],
},
},
};
static struct msm_gpiomux_config msm_qca1530_cdp_configs[] __initdata = {
{
.gpio = 133, /* qca1530 reset */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_qca1530_config,
},
},
};
static struct msm_gpiomux_config msm_qca1530_liquid_configs[] __initdata = {
{
.gpio = 128, /* qca1530 reset */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_qca1530_config,
},
},
{
.gpio = 66, /* qca1530 power extra */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_qca1530_config_mpp7,
},
},
};
static struct msm_gpiomux_config msm_epm_configs[] __initdata = {
{
.gpio = 92, /* EPM enable */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_epm_config,
},
},
};
void __init apq8084_init_gpiomux(void)
{
int rc;
rc = msm_gpiomux_init_dt();
if (rc) {
pr_err("%s failed %d\n", __func__, rc);
return;
}
if (of_board_is_sbc()) {
msm_gpiomux_install(msm_sbc_blsp_configs,
ARRAY_SIZE(msm_sbc_blsp_configs));
} else {
msm_gpiomux_install(msm_blsp_configs,
ARRAY_SIZE(msm_blsp_configs));
}
msm_gpiomux_install(msm_blsp1_uart6_configs,
ARRAY_SIZE(msm_blsp1_uart6_configs));
msm_gpiomux_install(msm_synaptics_configs,
ARRAY_SIZE(msm_synaptics_configs));
if (of_board_is_liquid() || of_board_is_sbc()) {
msm_gpiomux_install(msm_blsp2_uart5_configs,
ARRAY_SIZE(msm_blsp2_uart5_configs));
msm_gpiomux_install(msm_qca1530_liquid_configs,
ARRAY_SIZE(msm_qca1530_liquid_configs));
} else {
msm_gpiomux_install(mdm_configs, ARRAY_SIZE(mdm_configs));
msm_gpiomux_install(msm_blsp2_uart1_configs,
ARRAY_SIZE(msm_blsp2_uart1_configs));
if (of_board_is_cdp())
msm_gpiomux_install(msm_qca1530_cdp_configs,
ARRAY_SIZE(msm_qca1530_cdp_configs));
}
msm_gpiomux_install_nowrite(msm_lcd_configs,
ARRAY_SIZE(msm_lcd_configs));
msm_gpiomux_install(msm_lcd_te_configs,
ARRAY_SIZE(msm_lcd_te_configs));
msm_gpiomux_install(apq8084_pri_ter_auxpcm_configs,
ARRAY_SIZE(apq8084_pri_ter_auxpcm_configs));
if (of_board_is_sbc()) {
msm_gpiomux_install(msm_hdmi_nomux_configs,
ARRAY_SIZE(msm_hdmi_nomux_configs));
msm_gpiomux_install(apq8084_general_led_configs,
ARRAY_SIZE(apq8084_general_led_configs));
} else {
msm_gpiomux_install(apq8084_hsic_configs,
ARRAY_SIZE(apq8084_hsic_configs));
msm_gpiomux_install(msm_hdmi_configs,
ARRAY_SIZE(msm_hdmi_configs));
msm_gpiomux_install(hap_lvl_shft_config,
ARRAY_SIZE(hap_lvl_shft_config));
}
if (of_board_is_cdp() || of_board_is_sbc())
msm_gpiomux_install(eth_pwr, ARRAY_SIZE(eth_pwr));
if (of_board_is_sbc())
msm_gpiomux_install(msm_sbc_sensor_configs,
ARRAY_SIZE(msm_sbc_sensor_configs));
else
msm_gpiomux_install(msm_sensor_configs,
ARRAY_SIZE(msm_sensor_configs));
msm_gpiomux_install(msm_pcie_configs, ARRAY_SIZE(msm_pcie_configs));
if (of_board_is_liquid())
msm_gpiomux_install(msm_epm_configs,
ARRAY_SIZE(msm_epm_configs));
#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
if (of_board_is_cdp())
msm_gpiomux_install(msm_eth_configs,
ARRAY_SIZE(msm_eth_configs));
#endif
}