M7350/kernel/arch/arm/mach-msm/board-8974-gpiomux.c
2024-09-09 08:52:07 +00:00

1261 lines
27 KiB
C

/* 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>
#include <mach/socinfo.h>
#define KS8851_IRQ_GPIO 94
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 msm_gpiomux_config mdm_configs[] __initdata = {
/* AP2MDM_STATUS */
{
.gpio = 105,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
}
},
/* MDM2AP_STATUS */
{
.gpio = 46,
.settings = {
[GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
}
},
/* MDM2AP_ERRFATAL */
{
.gpio = 82,
.settings = {
[GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
}
},
/* AP2MDM_ERRFATAL */
{
.gpio = 106,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
}
},
/* AP2MDM_SOFT_RESET, aka AP2MDM_PON_RESET_N */
{
.gpio = 24,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_soft_reset_cfg,
}
},
/* AP2MDM_WAKEUP */
{
.gpio = 104,
.settings = {
[GPIOMUX_SUSPENDED] = &ap2mdm_wakeup,
}
},
/* MDM2AP_PBL_READY*/
{
.gpio = 80,
.settings = {
[GPIOMUX_SUSPENDED] = &mdm2ap_pblrdy,
}
},
};
static struct gpiomux_setting gpio_uart_config = {
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_16MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_HIGH,
};
static struct gpiomux_setting slimbus = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_KEEPER,
};
#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 gpiomux_setting gpio_spi_cs2_config = {
.func = GPIOMUX_FUNC_4,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting gpio_spi_config = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_12MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting gpio_spi_cs1_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_UP,
};
static struct msm_gpiomux_config msm_eth_configs[] = {
{
.gpio = KS8851_IRQ_GPIO,
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_eth_config,
}
},
};
#endif
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 gpio_epm_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.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 ath_gpio_active_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting ath_gpio_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting gpio_i2c_config = {
.func = GPIOMUX_FUNC_3,
/*
* Please keep I2C GPIOs drive-strength at minimum (2ma). It is a
* workaround for HW issue of glitches caused by rapid GPIO current-
* change.
*/
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
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 atmel_resout_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting atmel_resout_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_UP,
};
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 taiko_reset = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_6MA,
.pull = GPIOMUX_PULL_NONE,
.dir = GPIOMUX_OUT_LOW,
};
static struct gpiomux_setting taiko_int = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
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 hap_lvl_shft_active_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
{
.gpio = 86,
.settings = {
[GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
[GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
},
},
};
static struct msm_gpiomux_config msm_touch_configs[] __initdata = {
{
.gpio = 60, /* TOUCH RESET */
.settings = {
[GPIOMUX_ACTIVE] = &atmel_resout_act_cfg,
[GPIOMUX_SUSPENDED] = &atmel_resout_sus_cfg,
},
},
{
.gpio = 61, /* TOUCH IRQ */
.settings = {
[GPIOMUX_ACTIVE] = &atmel_int_act_cfg,
[GPIOMUX_SUSPENDED] = &atmel_int_sus_cfg,
},
},
};
static struct gpiomux_setting hsic_sus_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting hsic_act_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_12MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting hsic_hub_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
.dir = GPIOMUX_IN,
};
static struct gpiomux_setting hsic_resume_act_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
.dir = GPIOMUX_OUT_LOW,
};
static struct gpiomux_setting hsic_resume_susp_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct msm_gpiomux_config msm_hsic_configs[] = {
{
.gpio = 144, /*HSIC_STROBE */
.settings = {
[GPIOMUX_ACTIVE] = &hsic_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
},
},
{
.gpio = 145, /* HSIC_DATA */
.settings = {
[GPIOMUX_ACTIVE] = &hsic_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
},
},
{
.gpio = 80,
.settings = {
[GPIOMUX_ACTIVE] = &hsic_resume_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_resume_susp_cfg,
},
},
};
static struct msm_gpiomux_config msm_hsic_hub_configs[] = {
{
.gpio = 50, /* HSIC_HUB_INT_N */
.settings = {
[GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
[GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
},
},
};
static struct gpiomux_setting mhl_suspend_config = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting mhl_active_1_cfg = {
.func = GPIOMUX_FUNC_1,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_UP,
.dir = GPIOMUX_OUT_HIGH,
};
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 msm_gpiomux_config msm_mhl_configs[] __initdata = {
{
/* mhl-sii8334 pwr */
.gpio = 12,
.settings = {
[GPIOMUX_SUSPENDED] = &mhl_suspend_config,
[GPIOMUX_ACTIVE] = &mhl_active_1_cfg,
},
},
{
/* mhl-sii8334 intr */
.gpio = 82,
.settings = {
[GPIOMUX_SUSPENDED] = &mhl_suspend_config,
[GPIOMUX_ACTIVE] = &mhl_active_1_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,
},
},
};
static struct gpiomux_setting gpio_uart7_active_cfg = {
.func = GPIOMUX_FUNC_3,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting gpio_uart7_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct msm_gpiomux_config msm_blsp2_uart7_configs[] __initdata = {
{
.gpio = 41, /* BLSP2 UART7 TX */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
[GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
},
},
{
.gpio = 42, /* BLSP2 UART7 RX */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
[GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
},
},
{
.gpio = 43, /* BLSP2 UART7 CTS */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
[GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
},
},
{
.gpio = 44, /* BLSP2 UART7 RFR */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_uart7_active_cfg,
[GPIOMUX_SUSPENDED] = &gpio_uart7_suspend_cfg,
},
},
};
static struct msm_gpiomux_config msm_rumi_blsp_configs[] __initdata = {
{
.gpio = 45, /* BLSP2 UART8 TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 46, /* BLSP2 UART8 RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
};
static struct msm_gpiomux_config msm_lcd_configs[] __initdata = {
{
.gpio = 58,
.settings = {
[GPIOMUX_ACTIVE] = &lcd_en_act_cfg,
[GPIOMUX_SUSPENDED] = &lcd_en_sus_cfg,
},
},
};
static struct msm_gpiomux_config msm_blsp_configs[] __initdata = {
#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
{
.gpio = 0, /* BLSP1 QUP SPI_DATA_MOSI */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 1, /* BLSP1 QUP SPI_DATA_MISO */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 3, /* BLSP1 QUP SPI_CLK */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_config,
},
},
{
.gpio = 9, /* BLSP1 QUP SPI_CS2A_N */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_cs2_config,
},
},
{
.gpio = 8, /* BLSP1 QUP SPI_CS1_N */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_spi_cs1_config,
},
},
#endif
{
.gpio = 6, /* BLSP1 QUP2 I2C_DAT */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 7, /* BLSP1 QUP2 I2C_CLK */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 83, /* BLSP11 QUP I2C_DAT */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 84, /* BLSP11 QUP I2C_CLK */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
.gpio = 4, /* BLSP2 UART TX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 5, /* BLSP2 UART RX */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_uart_config,
},
},
{
.gpio = 53, /* BLSP2 QUP4 SPI_DATA_MOSI */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_spi_config,
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 54, /* BLSP2 QUP4 SPI_DATA_MISO */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_spi_config,
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 56, /* BLSP2 QUP4 SPI_CLK */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_spi_config,
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 55, /* BLSP2 QUP4 SPI_CS0_N */
.settings = {
[GPIOMUX_ACTIVE] = &gpio_spi_config,
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[0],
},
},
{
.gpio = 81, /* EPM enable */
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_epm_config,
},
},
};
static struct msm_gpiomux_config msm8974_slimbus_config[] __initdata = {
{
.gpio = 70, /* slimbus clk */
.settings = {
[GPIOMUX_SUSPENDED] = &slimbus,
},
},
{
.gpio = 71, /* slimbus data */
.settings = {
[GPIOMUX_SUSPENDED] = &slimbus,
},
},
};
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 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_sleep_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 = 62,
.settings = {
[GPIOMUX_ACTIVE] = &sd_card_det_active_config,
[GPIOMUX_SUSPENDED] = &sd_card_det_sleep_config,
},
};
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[0],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 24, /* FLASH_LED_NOW */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[0],
[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 = 28, /* WEBCAM1_STANDBY */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 89, /* CAM1_STANDBY_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 90, /* CAM1_RST_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 91, /* CAM2_STANDBY_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
{
.gpio = 92, /* CAM2_RST_N */
.settings = {
[GPIOMUX_ACTIVE] = &cam_settings[3],
[GPIOMUX_SUSPENDED] = &gpio_suspend_config[1],
},
},
};
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 Primary MI2S */
static struct msm_gpiomux_config msm8974_pri_pri_auxpcm_configs[] __initdata = {
{
.gpio = 65,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 66,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 67,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 68,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
};
/* Primary AUXPCM port sharing GPIO lines with Tertiary MI2S */
static struct msm_gpiomux_config msm8974_pri_ter_auxpcm_configs[] __initdata = {
{
.gpio = 74,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 75,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 76,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 77,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
};
static struct msm_gpiomux_config msm8974_sec_auxpcm_configs[] __initdata = {
{
.gpio = 79,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 80,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 81,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
{
.gpio = 82,
.settings = {
[GPIOMUX_SUSPENDED] = &auxpcm_sus_cfg,
[GPIOMUX_ACTIVE] = &auxpcm_act_cfg,
},
},
};
static struct msm_gpiomux_config wcnss_5wire_interface[] = {
{
.gpio = 36,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 37,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 38,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 39,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
{
.gpio = 40,
.settings = {
[GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
[GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
},
},
};
static struct msm_gpiomux_config ath_gpio_configs[] = {
{
.gpio = 51,
.settings = {
[GPIOMUX_ACTIVE] = &ath_gpio_active_cfg,
[GPIOMUX_SUSPENDED] = &ath_gpio_suspend_cfg,
},
},
{
.gpio = 79,
.settings = {
[GPIOMUX_ACTIVE] = &ath_gpio_active_cfg,
[GPIOMUX_SUSPENDED] = &ath_gpio_suspend_cfg,
},
},
};
static struct msm_gpiomux_config msm_taiko_config[] __initdata = {
{
.gpio = 63, /* SYS_RST_N */
.settings = {
[GPIOMUX_SUSPENDED] = &taiko_reset,
},
},
{
.gpio = 72, /* CDC_INT */
.settings = {
[GPIOMUX_SUSPENDED] = &taiko_int,
},
},
};
static struct gpiomux_setting sdc3_clk_actv_cfg = {
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting sdc3_cmd_data_0_3_actv_cfg = {
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting sdc3_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting sdc3_data_1_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct msm_gpiomux_config msm8974_sdc3_configs[] __initdata = {
{
/* DAT3 */
.gpio = 35,
.settings = {
[GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
},
},
{
/* DAT2 */
.gpio = 36,
.settings = {
[GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
},
},
{
/* DAT1 */
.gpio = 37,
.settings = {
[GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc3_data_1_suspend_cfg,
},
},
{
/* DAT0 */
.gpio = 38,
.settings = {
[GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
},
},
{
/* CMD */
.gpio = 39,
.settings = {
[GPIOMUX_ACTIVE] = &sdc3_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
},
},
{
/* CLK */
.gpio = 40,
.settings = {
[GPIOMUX_ACTIVE] = &sdc3_clk_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc3_suspend_cfg,
},
},
};
static void msm_gpiomux_sdc3_install(void)
{
msm_gpiomux_install(msm8974_sdc3_configs,
ARRAY_SIZE(msm8974_sdc3_configs));
}
#ifdef CONFIG_MMC_MSM_SDC4_SUPPORT
static struct gpiomux_setting sdc4_clk_actv_cfg = {
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_NONE,
};
static struct gpiomux_setting sdc4_cmd_data_0_3_actv_cfg = {
.func = GPIOMUX_FUNC_2,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct gpiomux_setting sdc4_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_2MA,
.pull = GPIOMUX_PULL_DOWN,
};
static struct gpiomux_setting sdc4_data_1_suspend_cfg = {
.func = GPIOMUX_FUNC_GPIO,
.drv = GPIOMUX_DRV_8MA,
.pull = GPIOMUX_PULL_UP,
};
static struct msm_gpiomux_config msm8974_sdc4_configs[] __initdata = {
{
/* DAT3 */
.gpio = 92,
.settings = {
[GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
},
},
{
/* DAT2 */
.gpio = 94,
.settings = {
[GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
},
},
{
/* DAT1 */
.gpio = 95,
.settings = {
[GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc4_data_1_suspend_cfg,
},
},
{
/* DAT0 */
.gpio = 96,
.settings = {
[GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
},
},
{
/* CMD */
.gpio = 91,
.settings = {
[GPIOMUX_ACTIVE] = &sdc4_cmd_data_0_3_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
},
},
{
/* CLK */
.gpio = 93,
.settings = {
[GPIOMUX_ACTIVE] = &sdc4_clk_actv_cfg,
[GPIOMUX_SUSPENDED] = &sdc4_suspend_cfg,
},
},
};
static void msm_gpiomux_sdc4_install(void)
{
msm_gpiomux_install(msm8974_sdc4_configs,
ARRAY_SIZE(msm8974_sdc4_configs));
}
#else
static void msm_gpiomux_sdc4_install(void) {}
#endif /* CONFIG_MMC_MSM_SDC4_SUPPORT */
static struct msm_gpiomux_config apq8074_dragonboard_ts_config[] __initdata = {
{
/* BLSP1 QUP I2C_DATA */
.gpio = 2,
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
{
/* BLSP1 QUP I2C_CLK */
.gpio = 3,
.settings = {
[GPIOMUX_SUSPENDED] = &gpio_i2c_config,
},
},
};
void __init msm_8974_init_gpiomux(void)
{
int rc;
rc = msm_gpiomux_init_dt();
if (rc) {
pr_err("%s failed %d\n", __func__, rc);
return;
}
#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
msm_gpiomux_install(msm_eth_configs, ARRAY_SIZE(msm_eth_configs));
#endif
msm_gpiomux_install(msm_blsp_configs, ARRAY_SIZE(msm_blsp_configs));
msm_gpiomux_install(msm_blsp2_uart7_configs,
ARRAY_SIZE(msm_blsp2_uart7_configs));
msm_gpiomux_install(wcnss_5wire_interface,
ARRAY_SIZE(wcnss_5wire_interface));
if (of_board_is_liquid())
msm_gpiomux_install_nowrite(ath_gpio_configs,
ARRAY_SIZE(ath_gpio_configs));
msm_gpiomux_install(msm8974_slimbus_config,
ARRAY_SIZE(msm8974_slimbus_config));
msm_gpiomux_install(msm_touch_configs, ARRAY_SIZE(msm_touch_configs));
msm_gpiomux_install(hap_lvl_shft_config,
ARRAY_SIZE(hap_lvl_shft_config));
msm_gpiomux_install(msm_sensor_configs, ARRAY_SIZE(msm_sensor_configs));
msm_gpiomux_install(&sd_card_det, 1);
if (machine_is_apq8074() && (of_board_is_liquid() || \
of_board_is_dragonboard()))
msm_gpiomux_sdc3_install();
msm_gpiomux_sdc4_install();
msm_gpiomux_install(msm_taiko_config, ARRAY_SIZE(msm_taiko_config));
msm_gpiomux_install(msm_hsic_configs, ARRAY_SIZE(msm_hsic_configs));
msm_gpiomux_install(msm_hsic_hub_configs,
ARRAY_SIZE(msm_hsic_hub_configs));
msm_gpiomux_install(msm_hdmi_configs, ARRAY_SIZE(msm_hdmi_configs));
if (of_board_is_fluid())
msm_gpiomux_install(msm_mhl_configs,
ARRAY_SIZE(msm_mhl_configs));
if (of_board_is_liquid())
msm_gpiomux_install(msm8974_pri_ter_auxpcm_configs,
ARRAY_SIZE(msm8974_pri_ter_auxpcm_configs));
else
msm_gpiomux_install(msm8974_pri_pri_auxpcm_configs,
ARRAY_SIZE(msm8974_pri_pri_auxpcm_configs));
msm_gpiomux_install(msm8974_sec_auxpcm_configs,
ARRAY_SIZE(msm8974_sec_auxpcm_configs));
msm_gpiomux_install_nowrite(msm_lcd_configs,
ARRAY_SIZE(msm_lcd_configs));
if (of_board_is_rumi())
msm_gpiomux_install(msm_rumi_blsp_configs,
ARRAY_SIZE(msm_rumi_blsp_configs));
if (socinfo_get_platform_subtype() == PLATFORM_SUBTYPE_MDM)
msm_gpiomux_install(mdm_configs,
ARRAY_SIZE(mdm_configs));
if (of_board_is_dragonboard() && machine_is_apq8074())
msm_gpiomux_install(apq8074_dragonboard_ts_config,
ARRAY_SIZE(apq8074_dragonboard_ts_config));
}