msm: mpq8064: Boardfile configuration to enable vcap

This change is really doing 2 things. It is adding a vcap device
and it is fixing up compile errors.

All board related code about adding the msm_vcap is enclosed in
CONFIG_MSM_VCAP define. By default this define is not enabled.
When someone wants to enable the MSM_VCAP they need to enable
CONFIG_MSM_VCAP, but it is also recommend to disable
CONFIG_MMC_MSM_SDC3_SUPPORT when someone want so enable vcap.
When CONFIG_MMC_MSM_SDC3_SUPPORT is no longer defined there is
a compiler warning saying that a static table was declared but
no longer used.

Change-Id: I89c24bef9b40c2ab1aca28ab6784308da290de45
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064-gpiomux.c b/arch/arm/mach-msm/board-8064-gpiomux.c
index 8464752..de6e0d2 100644
--- a/arch/arm/mach-msm/board-8064-gpiomux.c
+++ b/arch/arm/mach-msm/board-8064-gpiomux.c
@@ -71,6 +71,265 @@
 };
 #endif
 
+#ifdef CONFIG_MSM_VCAP
+static struct gpiomux_setting gpio_vcap_config[] = {
+	{
+		.func = GPIOMUX_FUNC_GPIO,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_1,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_2,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_3,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_4,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_5,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_6,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_7,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_8,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_9,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+	{
+		.func = GPIOMUX_FUNC_A,
+		.drv = GPIOMUX_DRV_2MA,
+		.pull = GPIOMUX_PULL_DOWN,
+	},
+};
+
+struct msm_gpiomux_config vcap_configs[] = {
+	{
+		.gpio = 20,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[7],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[7],
+		}
+	},
+	{
+		.gpio = 25,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 24,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[1],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[1],
+		}
+	},
+	{
+		.gpio = 23,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 19,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[8],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[8],
+		}
+	},
+	{
+		.gpio = 22,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 21,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[7],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[7],
+		}
+	},
+	{
+		.gpio = 12,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[6],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[6],
+		}
+	},
+	{
+		.gpio = 18,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[9],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[9],
+		}
+	},
+	{
+		.gpio = 11,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[10],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[10],
+		}
+	},
+	{
+		.gpio = 10,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[9],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[9],
+		}
+	},
+	{
+		.gpio = 9,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 26,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[1],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[1],
+		}
+	},
+	{
+		.gpio = 8,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[3],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[3],
+		}
+	},
+	{
+		.gpio = 7,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[7],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[7],
+		}
+	},
+	{
+		.gpio = 6,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[7],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[7],
+		}
+	},
+	{
+		.gpio = 80,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 86,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[1],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[1],
+		}
+	},
+	{
+		.gpio = 85,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[4],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[4],
+		}
+	},
+	{
+		.gpio = 84,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[3],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[3],
+		}
+	},
+	{
+		.gpio = 5,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 4,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[3],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[3],
+		}
+	},
+	{
+		.gpio = 3,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[6],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[6],
+		}
+	},
+	{
+		.gpio = 2,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[5],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[5],
+		}
+	},
+	{
+		.gpio = 82,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[4],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[4],
+		}
+	},
+	{
+		.gpio = 83,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[4],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[4],
+		}
+	},
+	{
+		.gpio = 87,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[2],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[2],
+		}
+	},
+	{
+		.gpio = 13,
+		.settings = {
+			[GPIOMUX_SUSPENDED] =	&gpio_vcap_config[6],
+			[GPIOMUX_ACTIVE] =		&gpio_vcap_config[6],
+		}
+	},
+};
+#endif
+
 static struct gpiomux_setting gpio_i2c_config = {
 	.func = GPIOMUX_FUNC_1,
 	.drv = GPIOMUX_DRV_8MA,
@@ -658,6 +917,10 @@
 		 machine_is_mpq8064_dtv()) {
 		msm_gpiomux_install(mpq8064_gsbi5_i2c_configs,
 				ARRAY_SIZE(mpq8064_gsbi5_i2c_configs));
+#ifdef CONFIG_MSM_VCAP
+		msm_gpiomux_install(vcap_configs,
+				ARRAY_SIZE(vcap_configs));
+#endif
 	} else {
 		#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
 		msm_gpiomux_install(apq8064_ethernet_configs,
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 5cb44b8..b4a58e8 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -1068,6 +1068,7 @@
 	0,
 };
 
+#ifndef CONFIG_MSM_VCAP
 #define MXT_TS_GPIO_IRQ			6
 #define MXT_TS_PWR_EN_GPIO		PM8921_GPIO_PM_TO_SYS(23)
 #define MXT_TS_RESET_GPIO		33
@@ -1119,6 +1120,7 @@
 		.irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
 	},
 };
+#endif
 #define CYTTSP_TS_GPIO_IRQ		6
 #define CYTTSP_TS_GPIO_RESOUT		7
 #define CYTTSP_TS_GPIO_SLEEP		33
@@ -1854,9 +1856,11 @@
 
 static struct platform_device *common_devices[] __initdata = {
 	&apq8064_device_dmov,
+#ifndef CONFIG_MSM_VCAP
 	&apq8064_device_qup_i2c_gsbi1,
 	&apq8064_device_qup_i2c_gsbi3,
 	&apq8064_device_qup_i2c_gsbi4,
+#endif
 	&apq8064_device_qup_spi_gsbi5,
 	&apq8064_device_ext_5v_vreg,
 	&apq8064_device_ext_mpp8_vreg,
@@ -2054,6 +2058,9 @@
 	&mpq8064_device_ext_2p2_buck_vreg,
 	&mpq8064_device_ext_5v_buck_vreg,
 	&mpq8064_device_ext_3p3v_ldo_vreg,
+#ifdef CONFIG_MSM_VCAP
+	&msm8064_device_vcap,
+#endif
 };
 
 static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
@@ -2310,12 +2317,14 @@
 		smb349_charger_i2c_info,
 		ARRAY_SIZE(smb349_charger_i2c_info)
 	},
+#ifndef CONFIG_MSM_VCAP
 	{
 		I2C_SURF | I2C_LIQUID,
 		APQ_8064_GSBI3_QUP_I2C_BUS_ID,
 		mxt_device_info,
 		ARRAY_SIZE(mxt_device_info),
 	},
+#endif
 	{
 		I2C_FFA,
 		APQ_8064_GSBI3_QUP_I2C_BUS_ID,
diff --git a/arch/arm/mach-msm/board-8930-storage.c b/arch/arm/mach-msm/board-8930-storage.c
index 83fb5fd..679c2fc 100644
--- a/arch/arm/mach-msm/board-8930-storage.c
+++ b/arch/arm/mach-msm/board-8930-storage.c
@@ -211,9 +211,11 @@
 	400000, 24000000, 48000000,
 };
 
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
 static unsigned int sdc3_sup_clk_rates[] = {
 	400000, 24000000, 48000000, 96000000, 192000000,
 };
+#endif
 
 #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
 static struct mmc_platform_data msm8960_sdc1_data = {
diff --git a/arch/arm/mach-msm/board-8960-storage.c b/arch/arm/mach-msm/board-8960-storage.c
index b03da38..22f8fb5 100644
--- a/arch/arm/mach-msm/board-8960-storage.c
+++ b/arch/arm/mach-msm/board-8960-storage.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. 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
@@ -210,9 +210,11 @@
 	400000, 24000000, 48000000
 };
 
+#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
 static unsigned int sdc3_sup_clk_rates[] = {
 	400000, 24000000, 48000000, 96000000, 192000000
 };
+#endif
 
 #ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
 static struct mmc_platform_data msm8960_sdc1_data = {
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index ca5a63d..aa25103 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -5038,11 +5038,14 @@
 	CLK_LOOKUP("bus_clk",
 			    gfx3d_axi_clk_8064.c, "footswitch-8x60.2"),
 	CLK_LOOKUP("iface_clk",         vcap_p_clk.c,           ""),
+	CLK_LOOKUP("iface_clk",         vcap_p_clk.c,           "msm_vcap.0"),
 	CLK_LOOKUP("iface_clk",         vcap_p_clk.c,	"footswitch-8x60.10"),
 	CLK_LOOKUP("bus_clk",		vcap_axi_clk.c,	"footswitch-8x60.10"),
 	CLK_LOOKUP("core_clk",          vcap_clk.c,             ""),
+	CLK_LOOKUP("core_clk",          vcap_clk.c,             "msm_vcap.0"),
 	CLK_LOOKUP("core_clk",          vcap_clk.c,	"footswitch-8x60.10"),
 	CLK_LOOKUP("vcap_npl_clk",      vcap_npl_clk.c,         ""),
+	CLK_LOOKUP("vcap_npl_clk",      vcap_npl_clk.c,         "msm_vcap.0"),
 	CLK_LOOKUP("bus_clk",		ijpeg_axi_clk.c, "footswitch-8x60.3"),
 	CLK_LOOKUP("mem_clk",		imem_axi_clk.c,		""),
 	CLK_LOOKUP("ijpeg_clk",         ijpeg_clk.c,            ""),
diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c
index b760226..e729a63 100644
--- a/arch/arm/mach-msm/devices-8064.c
+++ b/arch/arm/mach-msm/devices-8064.c
@@ -2258,6 +2258,109 @@
 	},
 };
 
+#ifdef CONFIG_MSM_VCAP
+#define VCAP_HW_BASE         0x05900000
+
+static struct msm_bus_vectors vcap_init_vectors[]  = {
+	{
+		.src = MSM_BUS_MASTER_VIDEO_CAP,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 0,
+		.ib = 0,
+	},
+};
+
+
+static struct msm_bus_vectors vcap_480_vectors[]  = {
+	{
+		.src = MSM_BUS_MASTER_VIDEO_CAP,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 1280 * 720 * 3 * 60 / 16,
+		.ib = 1280 * 720 * 3 * 60 / 16 * 1.5,
+	},
+};
+
+static struct msm_bus_vectors vcap_720_vectors[]  = {
+	{
+		.src = MSM_BUS_MASTER_VIDEO_CAP,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 1280 * 720 * 3 * 60 / 16,
+		.ib = 1280 * 720 * 3 * 60 / 16 * 1.5,
+	},
+};
+
+static struct msm_bus_vectors vcap_1080_vectors[]  = {
+	{
+		.src = MSM_BUS_MASTER_VIDEO_CAP,
+		.dst = MSM_BUS_SLAVE_EBI_CH0,
+		.ab = 1920 * 1080 * 3 * 60 / 16,
+		.ib = 1920 * 1080 * 3 * 60 / 16 * 1.5,
+	},
+};
+
+static struct msm_bus_paths vcap_bus_usecases[]  = {
+	{
+		ARRAY_SIZE(vcap_init_vectors),
+		vcap_init_vectors,
+	},
+	{
+		ARRAY_SIZE(vcap_480_vectors),
+		vcap_480_vectors,
+	},
+	{
+		ARRAY_SIZE(vcap_720_vectors),
+		vcap_720_vectors,
+	},
+	{
+		ARRAY_SIZE(vcap_1080_vectors),
+		vcap_1080_vectors,
+	},
+};
+
+static struct msm_bus_scale_pdata vcap_axi_client_pdata = {
+	vcap_bus_usecases,
+	ARRAY_SIZE(vcap_bus_usecases),
+};
+
+static struct resource msm_vcap_resources[] = {
+	{
+		.name	= "vcap",
+		.start	= VCAP_HW_BASE,
+		.end	= VCAP_HW_BASE + SZ_1M - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.name	= "vcap",
+		.start	= VCAP_VC,
+		.end	= VCAP_VC,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static unsigned vcap_gpios[] = {
+	2, 3, 4, 5, 6, 7, 8, 9, 10,
+	11, 12, 13, 18, 19, 20, 21,
+	22, 23, 24, 25, 26, 80, 82,
+	83, 84, 85, 86, 87,
+};
+
+static struct vcap_platform_data vcap_pdata = {
+	.gpios = vcap_gpios,
+	.num_gpios = ARRAY_SIZE(vcap_gpios),
+	.bus_client_pdata = &vcap_axi_client_pdata
+};
+
+struct platform_device msm8064_device_vcap = {
+	.name           = "msm_vcap",
+	.id             = 0,
+	.resource       = msm_vcap_resources,
+	.num_resources  = ARRAY_SIZE(msm_vcap_resources),
+	.dev = {
+		.platform_data = &vcap_pdata,
+	},
+};
+#endif
+
 static struct resource msm_cache_erp_resources[] = {
 	{
 		.name = "l1_irq",
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index 0c25434..48a38f0 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -171,6 +171,9 @@
 extern struct platform_device msm_device_tssc;
 
 extern struct platform_device msm_rotator_device;
+#ifdef CONFIG_MSM_VCAP
+extern struct platform_device msm8064_device_vcap;
+#endif
 
 #ifdef CONFIG_MSM_BUS_SCALING
 extern struct msm_bus_scale_pdata rotator_bus_scale_pdata;