/* Enable or disable micro sd card buffers on HREF */
static void control_level_shifter_for_microsd(int gpio_dir)
{
	int gpio[2];

	if (machine_is_u8540()) {
		static struct regulator *regu_sdio;

		if (gpio_dir) {
			regu_sdio = regulator_get(&ux500_stm_device.dev,
					"vmmc_io");
			if (IS_ERR(regu_sdio)) {
				regu_sdio = NULL;
				STM_ERR("Failed to get regulator vmmc_io\n");
				return;
			}

			regulator_disable(regu_sdio);
			prcmu_set_sdmmc_psw(gpio_dir);
			regulator_set_voltage(regu_sdio, 2750000, 3000000);
			regulator_enable(regu_sdio);
			usleep_range(3000, 4000);
		} else if (regu_sdio) {
			regulator_disable(regu_sdio);
			regulator_put(regu_sdio);
			regu_sdio = NULL;
		}
		return;
	}

	if (machine_is_hrefv60() || machine_is_u9540() || machine_is_a9500()) {
		gpio[0] = HREFV60_SDMMC_EN_GPIO;
		gpio[1] = HREFV60_SDMMC_1V8_3V_GPIO;
	} else if (machine_is_u8520()) {
		gpio[0] = U8520_SDMMC_EN_GPIO;
		gpio[1] = U8520_SDMMC_1V8_3V_GPIO;
	} else {
		gpio[0] = MOP500_EGPIO(17);
		gpio[1] = MOP500_EGPIO(18);
	}

	/* Select the default 2.9V and enable / disable level shifter */
	gpio_direction_output(gpio[1], 0);
	gpio_direction_output(gpio[0], gpio_dir);
}
/* Enable or disable micro sd card buffers on HREF */
static void control_level_shifter_for_microsd(int gpio_dir)
{
	int gpio[2];

	if (machine_is_hrefv60() || machine_is_u9540()) {
		gpio[0] = HREFV60_SDMMC_EN_GPIO;
		gpio[1] = HREFV60_SDMMC_1V8_3V_GPIO;
	} else if (machine_is_u8520()) {
		gpio[0] = U8520_SDMMC_EN_GPIO;
		gpio[1] = U8520_SDMMC_1V8_3V_GPIO;
	} else	{
		gpio[0] = MOP500_EGPIO(17);
		gpio[1] = MOP500_EGPIO(18);
	}

	/* Select the default 2.9V and enable / disable level shifter */
	gpio_direction_output(gpio[1], 0);
	gpio_direction_output(gpio[0], gpio_dir);
}
Example #3
0
/*
 * TC35892
 */

static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
{
	struct device *parent = NULL;
#if 0
	/* FIXME: Is the sdi actually part of tc3589x? */
	parent = tc3589x->dev;
#endif
	mop500_sdi_tc35892_init(parent);
}

static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
	.gpio_base	= MOP500_EGPIO(0),
	.setup		= mop500_tc35892_init,
};

static struct tc3589x_platform_data mop500_tc35892_data = {
	.block		= TC3589x_BLOCK_GPIO,
	.gpio		= &mop500_tc35892_gpio_data,
	.irq_base	= MOP500_EGPIO_IRQ_BASE,
};

static struct lp5521_led_config lp5521_pri_led[] = {
       [0] = {
	       .chan_nr = 0,
	       .led_current = 0x2f,
	       .max_current = 0x5f,
       },
/*
 * mmio_board_data_init() - Initialize board configuration.
 *
 * This function is customizable.
 * It allow to define and configure the different regulators,
 * gpios and clocks used to drive the camera.
 * Don't forget to update mmio_board_data structure accordingly.
 * It is called from mmio_platform_init function.
 */
static int mmio_board_data_init(struct mmio_platform_data *pdata)
{
	struct mmio_board_data *extra = pdata->extra;

	/* Power config */
	extra->reg_vana.name           = "vddcsi1v2";
	extra->reg_vmmiocamera.name    = "vaux12v5";

	/* Pin config */
	extra->gpio_i2c[0].name        = "IPI2C_SDA";
	extra->gpio_i2c[0].gpio        = 8;
	extra->gpio_i2c[0].cfg_ena     = GPIO8_IPI2C_SDA;
	extra->gpio_i2c[0].cfg_disa    = GPIO8_GPIO;

	extra->gpio_i2c[1].name        = "IPI2C_SCL";
	extra->gpio_i2c[1].gpio        = 9;
	extra->gpio_i2c[1].cfg_ena     = GPIO9_IPI2C_SCL;
	extra->gpio_i2c[1].cfg_disa    = GPIO9_GPIO;

	/* Update GPIO mappings according to board */
	if (machine_is_u9540()) {

		if (pdata->camera_slot == PRIMARY_CAMERA) {
			/* Primary sensor */
			extra->gpio_xshutdown.name     = "CAM0_RES";
			extra->gpio_xshutdown.gpio     = 141;
			extra->gpio_xshutdown.cfg_ena  = GPIO141_IP_GPIO2;
			extra->gpio_xshutdown.cfg_disa = GPIO141_GPIO;

			extra->gpio_power_en.name = "CAM0_EN";
			extra->gpio_power_en.gpio = MOP500_EGPIO(3);
		} else {
			/* Secondary sensor */
			extra->gpio_xshutdown.name     = "CAM1_RES";
			extra->gpio_xshutdown.gpio     = 142;
			extra->gpio_xshutdown.cfg_ena  = GPIO142_IP_GPIO3;
			extra->gpio_xshutdown.cfg_disa = GPIO142_GPIO;

			extra->gpio_power_en.name = "CAM1_EN";
			extra->gpio_power_en.gpio = MOP500_EGPIO(4);
		}

	} else if (machine_is_hrefv60()) {

		extra->gpio_xshutdown.name     = "XSHUTDOWN";
		extra->gpio_xshutdown.gpio     = 141;
		extra->gpio_xshutdown.cfg_ena  = GPIO141_IP_GPIO2;
		extra->gpio_xshutdown.cfg_disa = GPIO141_GPIO;

		extra->gpio_xenon.name = "XENON";
		extra->gpio_xenon.gpio = HREFV60_MMIO_XENON_CHARGE;

	} else {

		extra->gpio_xshutdown.name     = "XSHUTDOWN";
		extra->gpio_xshutdown.gpio     = 141;
		extra->gpio_xshutdown.cfg_ena  = GPIO141_IP_GPIO2;
		extra->gpio_xshutdown.cfg_disa = GPIO141_GPIO;

		extra->gpio_xenon.name = "XENON";
		extra->gpio_xenon.gpio = GPIO_MMIO_XENON_CHARGE;

	}

	/* Clock config */
	extra->clk_bml.name            = "bml";
	extra->clk_ipi2c.name          = "ipi2";

	if (pdata->camera_slot == PRIMARY_CAMERA) {
		extra->clk_ext.name    = "pri-cam";
		/* Don't forget to store logical IPGPIO for physical reset
		 * GPIOs used. GPIO 141 => IP GPIO 2 (cf. above traslation
		 * array). */
		pdata->reset_ipgpio[pdata->camera_slot] = 2;
	} else {
		extra->clk_ext.name    = "sec-cam";
		/* Don't forget to store logical IPGPIO for physical reset
		 * GPIOs used. GPIO 142 => IP GPIO 3 (cf. above traslation
		 * array). */
		pdata->reset_ipgpio[pdata->camera_slot] = 3;
	}

	return 0;
}