Exemplo n.º 1
0
static void __init mop500_init_machine(void)
{
	int i2c0_devs;

	/*
	 * The HREFv60 board removed a GPIO expander and routed
	 * all these GPIO pins to the internal GPIO controller
	 * instead.
	 */
	if (machine_is_hrefv60())
		mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
	else
		mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;

	u8500_init_devices();

	mop500_pins_init();

	platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));

	mop500_i2c_init();
	mop500_sdi_init();
	mop500_spi_init();
	mop500_uart_init();

	platform_device_register(&ab8500_device);

	i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
	if (machine_is_hrefv60())
		i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;

	i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
	i2c_register_board_info(2, mop500_i2c2_devices,
				ARRAY_SIZE(mop500_i2c2_devices));
}
static int __init mop500_offchip_gpio_init(void)
{
	if (machine_is_hrefv60() || machine_is_u8520() || machine_is_u9540())
		ux500_offchip_gpio_init(&mop500_offchip_gpio_cfg);

	return 0;
}
/*
 *  On boards hrefpv60 and later, the accessory insertion/removal,
 *  button press/release are inverted.
*/
static void accessory_detect_config(void)
{
	if (machine_is_hrefv60())
		ab8500_accdet_pdata.is_detection_inverted = true;
	else
		ab8500_accdet_pdata.is_detection_inverted = false;
}
void __init mop500_u8500uib_init(void)
{
	int ret;

	mop500_uib_i2c_add(3, mop500_i2c3_devices_u8500,
			ARRAY_SIZE(mop500_i2c3_devices_u8500));

	mop500_uib_i2c_add(0, mop500_i2c0_devices_u8500,
			ARRAY_SIZE(mop500_i2c0_devices_u8500));

	if (machine_is_hrefv60() || machine_is_u8520()) {
		lsm303dlh_pdata_u8500.irq_a1 = HREFV60_ACCEL_INT1_GPIO;
		lsm303dlh_pdata_u8500.irq_a2 = HREFV60_ACCEL_INT2_GPIO;
		lsm303dlh_pdata_u8500.irq_m = HREFV60_MAGNET_DRDY_GPIO;
		adp1653_pdata_u8500_uib.enable_gpio =
					HREFV60_CAMERA_FLASH_ENABLE;
	} else {
		lsm303dlh_pdata_u8500.irq_a1 = GPIO_ACCEL_INT1;
		lsm303dlh_pdata_u8500.irq_a2 = GPIO_ACCEL_INT2;
		lsm303dlh_pdata_u8500.irq_m = GPIO_MAGNET_DRDY;
		adp1653_pdata_u8500_uib.enable_gpio =
					GPIO_CAMERA_FLASH_ENABLE;
	}
	ret = mop500_get_acc_id();
	if (ret < 0)
		printk(KERN_ERR " Failed to get Accelerometr chip ID\n");
	else
		lsm303dlh_pdata_u8500.chip_id = ret;
	mop500_uib_i2c_add(2, mop500_i2c2_devices_u8500,
			ARRAY_SIZE(mop500_i2c2_devices_u8500));
}
void __init mop500_stuib_init(void)
{
	int ret;
	if (machine_is_hrefv60() || machine_is_u8520() || machine_is_a9500()) {
		tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
#ifdef CONFIG_U8500_FLASH
		adp1653_pdata_u8500_uib.enable_gpio =
					HREFV60_CAMERA_FLASH_ENABLE;
#endif
	} else {
		tsc_plat_device.cs_pin = GPIO_BU21013_CS;
#ifdef CONFIG_U8500_FLASH
		adp1653_pdata_u8500_uib.enable_gpio =
					GPIO_CAMERA_FLASH_ENABLE;
#endif
	}

	mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib,
			ARRAY_SIZE(mop500_i2c0_devices_stuib));

	mop500_uib_i2c_add(3, u8500_i2c3_devices_stuib,
			ARRAY_SIZE(u8500_i2c3_devices_stuib));

	if (machine_is_hrefv60() || machine_is_u8520() || machine_is_a9500()) {
		lsm303dlh_pdata.irq_a1 = HREFV60_ACCEL_INT1_GPIO;
		lsm303dlh_pdata.irq_a2 = HREFV60_ACCEL_INT2_GPIO;
		lsm303dlh_pdata.irq_m = HREFV60_MAGNET_DRDY_GPIO;
	} else if (machine_is_snowball()) {
		lsm303dlh_pdata.irq_a1 = SNOWBALL_ACCEL_INT1_GPIO;
		lsm303dlh_pdata.irq_a2 = SNOWBALL_ACCEL_INT2_GPIO;
		lsm303dlh_pdata.irq_m = SNOWBALL_MAGNET_DRDY_GPIO;
	} else {
		lsm303dlh_pdata.irq_a1 = GPIO_ACCEL_INT1;
		lsm303dlh_pdata.irq_a2 = GPIO_ACCEL_INT2;
		lsm303dlh_pdata.irq_m = GPIO_MAGNET_DRDY;
	}
	ret = mop500_get_acc_id();
	if (ret < 0)
		printk(KERN_ERR " Failed to get Accelerometr chip ID\n");
	else
		lsm303dlh_pdata.chip_id = ret;
	mop500_uib_i2c_add(2, mop500_i2c2_devices,
			ARRAY_SIZE(mop500_i2c2_devices));
}
Exemplo n.º 6
0
static void __init mop500_init_machine(void)
{
	int i2c0_devs;

	/*
	 * The HREFv60 board removed a GPIO expander and routed
	 * all these GPIO pins to the internal GPIO controller
	 * instead.
	 */
	if (!machine_is_snowball()) {
		if (machine_is_hrefv60())
			mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
		else
			mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
	}

	u8500_init_devices();

	mop500_pins_init();

	if (machine_is_snowball())
		platform_add_devices(snowball_platform_devs,
					ARRAY_SIZE(snowball_platform_devs));
	else
		platform_add_devices(mop500_platform_devs,
					ARRAY_SIZE(mop500_platform_devs));

	mop500_i2c_init();
	mop500_sdi_init();
	mop500_spi_init();
	mop500_uart_init();

	i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
	if (machine_is_hrefv60())
		i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;

	i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
	i2c_register_board_info(2, mop500_i2c2_devices,
				ARRAY_SIZE(mop500_i2c2_devices));

	/* This board has full regulator constraints */
	regulator_has_full_constraints();
}
Exemplo n.º 7
0
void __init mop500_pins_init(void)
{
	nmk_config_pins(mop500_pins_common,
				ARRAY_SIZE(mop500_pins_common));
	if (machine_is_hrefv60())
		nmk_config_pins(mop500_pins_hrefv60,
				ARRAY_SIZE(mop500_pins_hrefv60));
	else
		nmk_config_pins(mop500_pins_default,
				ARRAY_SIZE(mop500_pins_default));
}
void __init mop500_pins_init(void)
{
	nmk_config_pins(mop500_pins_common,
				ARRAY_SIZE(mop500_pins_common));

	ux500_pins_add(mop500_runtime_pins, ARRAY_SIZE(mop500_runtime_pins));

	if (machine_is_hrefv60() || machine_is_u8520() || machine_is_u9540())
		ux500_pins_add(mop500_runtime_pins_v60,
			       ARRAY_SIZE(mop500_runtime_pins_v60));
	else if (machine_is_snowball())
		ux500_pins_add(mop500_runtime_pins_snowball,
			       ARRAY_SIZE(mop500_runtime_pins_snowball));
	else
		ux500_pins_add(mop500_runtime_pins_pre_v60,
			       ARRAY_SIZE(mop500_runtime_pins_pre_v60));

	if (machine_is_hrefv60() || machine_is_u8520() || machine_is_u9540())
		nmk_config_pins(mop500_pins_hrefv60,
				ARRAY_SIZE(mop500_pins_hrefv60));
	else if (machine_is_snowball())
		nmk_config_pins(snowball_pins,
				ARRAY_SIZE(snowball_pins));
	else
		nmk_config_pins(mop500_pins_default,
				ARRAY_SIZE(mop500_pins_default));

	switch (pinsfor) {
	case PINS_FOR_U9500:
		nmk_config_pins(u9500_pins, ARRAY_SIZE(u9500_pins));
		break;

	case PINS_FOR_DEFAULT:
		nmk_config_pins(u8500_pins, ARRAY_SIZE(u8500_pins));
	default:
		break;
	}

	suspend_set_pins_force_fn(mop500_pins_suspend_force,
				  mop500_pins_suspend_force_mux);
}
void __init mop500_vibra_init(void)
{
	int ret;

	if (machine_is_hrefv60())
		ux500_vibra_device.dev.platform_data = &linear_vibra_plat_data;
	else
		ux500_vibra_device.dev.platform_data = &rotary_vibra_plat_data;

	ret = platform_device_register(&ux500_vibra_device);
	if (ret < 0)
		pr_err("vibra dev register failed");
}
void __init mop500_stuib_init(void)
{
	if (machine_is_hrefv60())	{
		lsm303dlh_pdata_st_uib.irq_a1 = HREFV60_ACCEL_INT1_GPIO;
		lsm303dlh_pdata_st_uib.irq_a2 = HREFV60_ACCEL_INT2_GPIO;
		lsm303dlh_pdata_st_uib.irq_m = HREFV60_MAGNET_DRDY_GPIO;
	} else	{
		lsm303dlh_pdata_st_uib.irq_a1 = EGPIO_PIN_10;
		lsm303dlh_pdata_st_uib.irq_a2 = EGPIO_PIN_11;
		lsm303dlh_pdata_st_uib.irq_m = EGPIO_PIN_1;
	}
	mop500_uib_i2c_add(2, mop500_i2c2_devices_st_uib,
			ARRAY_SIZE(mop500_i2c2_devices_st_uib));
}
Exemplo n.º 11
0
void __init mop500_sdi_init(void)
{
	/* v2 has a new version of this block that need to be forced */
	u32 periphid = 0x10480180;

	/* sdi2 on snowball is in ATL_B mode for FSMC (LAN) */
	if (!machine_is_snowball())
		db8500_add_sdi2(&mop500_sdi2_data, periphid);

	/* On-board eMMC */
	db8500_add_sdi4(&mop500_sdi4_data, periphid);

	if (machine_is_hrefv60() || machine_is_u8520() ||
	    machine_is_snowball() || machine_is_u9540()) {
		if (machine_is_hrefv60() || machine_is_u9540()) {
			mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
			sdi0_en = HREFV60_SDMMC_EN_GPIO;
			sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO;
		} else if (machine_is_u8520()) {
			mop500_sdi0_data.gpio_cd = U8520_SDMMC_CD_GPIO;
			sdi0_en = U8520_SDMMC_EN_GPIO;
			sdi0_vsel = U8520_SDMMC_1V8_3V_GPIO;
		} else if (machine_is_snowball()) {
			mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
			mop500_sdi0_data.cd_invert = true;
			sdi0_en = SNOWBALL_SDMMC_EN_GPIO;
			sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO;
		}
		sdi0_sdi1_configure();
	}

	/*
	 * On boards with the TC35892 GPIO expander, sdi0 and sdi1 will finally
	 * be added when the TC35892 initializes and calls
	 * mop500_sdi_tc35892_init() above.
	 */
}
static int mmio_pin_cfg_init(struct mmio_platform_data *pdata)
{
	int err;
	struct mmio_board_data *extra = pdata->extra;
	dev_dbg(pdata->dev , "Board %s() Enter\n", __func__);

	extra->xshutdown_pins[PRIMARY_CAMERA].gpio = XSHUTDOWN_PRIMARY_SENSOR;
	extra->xshutdown_pins[PRIMARY_CAMERA].active_high = 0;
	extra->xshutdown_pins[PRIMARY_CAMERA].udelay = 500;

	extra->xshutdown_pins[SECONDARY_CAMERA].active_high = 0;
	extra->xshutdown_pins[SECONDARY_CAMERA].udelay = 500;

	/* Update GPIO mappings according to board */
	if (machine_is_hrefv60()) {
		extra->xenon_charge = HREFV60_MMIO_XENON_CHARGE;
		xshutdown_host[SECONDARY_CAMERA] = GPIO140_GPIO;
		xshutdown_fw[SECONDARY_CAMERA] = GPIO140_IP_GPIO7;
		xshutdown_disable[SECONDARY_CAMERA] =
						GPIO140_GPIO | PIN_OUTPUT_LOW;
		extra->xshutdown_pins[SECONDARY_CAMERA].gpio = 140;
	} else {
		extra->xenon_charge = EGPIO_PIN_5;
		xshutdown_host[SECONDARY_CAMERA] = GPIO142_GPIO;
		xshutdown_fw[SECONDARY_CAMERA] = GPIO142_IP_GPIO3;
		xshutdown_disable[SECONDARY_CAMERA] =
						GPIO142_GPIO | PIN_OUTPUT_LOW;
		extra->xshutdown_pins[SECONDARY_CAMERA].gpio = 142;
	}
	/* Setup Xenon Charge */
	err = gpio_request(extra->xenon_charge, "xenon charge");
	if (err) {
		dev_err(pdata->dev, "Error %d while requesting xenon charge\n",
			err);
		goto err_xenon_gpio_req;
	}
	err = gpio_direction_output(extra->xenon_charge, 0);
	if (err) {
		dev_err(pdata->dev, "Error %d while setting xenon charge in"
			"output mode\n", err);
		goto err_xenon_gpio_set_dir;
	}
	dev_dbg(pdata->dev , "Board %s() Exit\n", __func__);
	return 0;
err_xenon_gpio_set_dir:
	gpio_free(extra->xenon_charge);
err_xenon_gpio_req:
	return err;
}
Exemplo n.º 13
0
void __init mop500_stuib_init(void)
{
	if (machine_is_hrefv60()) {
		tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
		tsc_plat2_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
	} else {
		tsc_plat_device.cs_pin = GPIO_BU21013_CS;
		tsc_plat2_device.cs_pin = GPIO_BU21013_CS;

	}

	mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib,
			ARRAY_SIZE(mop500_i2c0_devices_stuib));

	mop500_uib_i2c_add(3, u8500_i2c3_devices_stuib,
			ARRAY_SIZE(u8500_i2c3_devices_stuib));
}
static void device_gpio_cfg(void)
{
	if (machine_is_hrefv60())	{
		tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
		tsc_cntl2_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO;
#ifdef CONFIG_SENSORS1P_MOP
		sensors1p_config.proximity.pin = HREFV60_PROX_SENSE_GPIO;
		sensors1p_config.hal.pin = HREFV60_HAL_SW_GPIO;
#endif
	} else {
		tsc_plat_device.cs_pin = EGPIO_PIN_13;
		tsc_cntl2_plat_device.cs_pin = EGPIO_PIN_13;
#ifdef CONFIG_SENSORS1P_MOP
		sensors1p_config.proximity.pin = EGPIO_PIN_7;
		sensors1p_config.hal.pin = EGPIO_PIN_8;
#endif
	}
}
/* 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);
}
Exemplo n.º 16
0
/* 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);
}
static void __init mop500_init_machine(void)
{
	device_gpio_cfg();
	accessory_detect_config();

#ifdef CONFIG_REGULATOR
	platform_device_register(&u8500_regulator_dev);
#endif

	u8500_init_devices();

#ifdef CONFIG_USB_ANDROID
	fetch_usb_serial_no(USB_SERIAL_NUMBER_LEN);
#endif

	platform_add_devices(platform_devs,
			ARRAY_SIZE(platform_devs));

	mop500_pins_init();
	u8500_cryp1_hash1_init();

	platform_device_register(&ux500_ab8500_device);

#ifdef CONFIG_MFD_CG2900
#ifdef CONFIG_MFD_CG2900_TEST
	dcg2900_init_platdata(&cg2900_test_platform_data);
#endif /* CONFIG_MFD_CG2900_TEST */
#ifdef CONFIG_MFD_CG2900_UART
	dcg2900_init_platdata(&cg2900_uart_platform_data);
#endif /* CONFIG_MFD_CG2900_UART */

	platform_device_register(&ux500_cg2900_device);
#ifdef CONFIG_MFD_CG2900_UART
	if (pins_for_u9500()) {
		ux500_cg2900_uart_device.num_resources =
				ARRAY_SIZE(cg2900_uart_resources_u9500);
		ux500_cg2900_uart_device.resource =
				cg2900_uart_resources_u9500;
	} else if (machine_is_hrefv60()) {
		ux500_cg2900_uart_device.num_resources =
				ARRAY_SIZE(cg2900_uart_resources);
		ux500_cg2900_uart_device.resource =
				cg2900_uart_resources;
	} else {
		ux500_cg2900_uart_device.num_resources =
				ARRAY_SIZE(cg2900_uart_resources_pre_v60);
		ux500_cg2900_uart_device.resource =
				cg2900_uart_resources_pre_v60;
	}

	platform_device_register(&ux500_cg2900_uart_device);
#endif /* CONFIG_MFD_CG2900_UART */
#ifdef CONFIG_MFD_CG2900_TEST
	platform_device_register(&ux500_cg2900_test_device);
#endif /* CONFIG_MFD_CG2900_TEST */
#ifdef CONFIG_MFD_CG2900_CHIP
	platform_device_register(&ux500_cg2900_chip_device);
#endif /* CONFIG_MFD_CG2900_CHIP */
#ifdef CONFIG_MFD_STLC2690_CHIP
	platform_device_register(&ux500_stlc2690_chip_device);
#endif /* CONFIG_MFD_STLC2690_CHIP */
#endif /* CONFIG_MFD_CG2900 */

	mop500_i2c_init();
	mop500_msp_init();
	mop500_spi_init();
	mop500_uart_init();
	mop500_wlan_init();

	db8500_add_ske_keypad(&mop500_ske_keypad_data);

#ifdef CONFIG_HSI
	hsi_register_board_info(u8500_hsi_devices,
				ARRAY_SIZE(u8500_hsi_devices));
#endif

#ifdef CONFIG_MOP500_NUIB
	mop500_nuib_init();
#endif

#ifdef CONFIG_ANDROID_STE_TIMED_VIBRA
	mop500_vibra_init();
#endif

	platform_add_devices(u8500_platform_devices,
			     ARRAY_SIZE(u8500_platform_devices));
}
Exemplo n.º 18
0
static int __devinit adp1653_probe(struct i2c_client *client,
				   const struct i2c_device_id *id)
{
	int err=0;
	struct flash_chip *flash_chip_p=NULL;
	struct adp1653_priv_data *priv_p=NULL;

	DEBUG_LOG("> adp1653_probe\n");

	priv_p = kzalloc(sizeof(struct adp1653_priv_data),GFP_KERNEL);
	if(!priv_p){
		DEBUG_LOG("Kmalloc failed for priv data\n");
		err = ENOMEM;
		goto out;
	}
	priv_p->i2c_client = client;
	flash_chip_p = kzalloc(sizeof(struct flash_chip),GFP_KERNEL);
	if(!flash_chip_p){
		DEBUG_LOG("Kmalloc failed for flash_chip_p");
		err = ENOMEM;
		goto out;
	}
	flash_chip_p->priv_data = priv_p;
	flash_chip_p->ops = &adp1653_ops;
	SET_FLASHCHIP_TYPE(flash_chip_p,FLASH_TYPE_HPLED);
	SET_FLASHCHIP_ID(flash_chip_p,ADP1653_ID);

	strncpy(flash_chip_p->name,"Adp1653",FLASH_NAME_SIZE);

	i2c_set_clientdata(client,priv_p);
	/*Request GPIO and Register IRQ if supported by platform and flash chip*/

	if(machine_is_hrefv60())
		enable_gpio = 21;
	else
		enable_gpio = 272;

	if(enable_gpio){
		err = gpio_request(enable_gpio,"Camera LED flash Enable");
		if(err){
			DEBUG_LOG("Unable to get GPIO %d, for enable\n",enable_gpio);
			goto out;
		}
		priv_p->enable_gpio = enable_gpio;

		err = gpio_direction_output(priv_p->enable_gpio,GPIO_HIGH);
		if(err){
			DEBUG_LOG("Unable to set GPIO %lu in output mode, err %d\n",priv_p->enable_gpio,err);
			gpio_free(priv_p->enable_gpio);
			goto out;
		}
		gpio_set_value(priv_p->enable_gpio,GPIO_HIGH);
	}

	if (strobe_gpio != 0)
	{
		err = gpio_request(STR_GPIO,"Camera flash strobe\n");
		if(err){
			DEBUG_LOG("Unable to request strobe GPIO\n");
			// somebody else requested this gpio ...
			//goto out;
		}

		err = gpio_direction_output(STR_GPIO,GPIO_LOW);
		if(err){
			DEBUG_LOG("Unable to set GPIO %d in output mode, err %d\n",STR_GPIO,err);
			goto out;
		}
	}
	else
	{
		err = gpio_request(STR_GPIO,"Camera flash strobe\n");
		if(err){
			DEBUG_LOG("Unable to request strobe GPIO\n");
			// somebody else requested this gpio ...
			//goto out;
		}

		err = gpio_direction_input(STR_GPIO);
		if(err){
			DEBUG_LOG("Unable to set GPIO %d in input mode, err %d\n",STR_GPIO,err);
			goto out;
		}

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
		err = nmk_gpio_set_pull(STR_GPIO, NMK_GPIO_PULL_DOWN);
#endif
		if(err){
			DEBUG_LOG("Unable to set pull down on GPIO %d\n",STR_GPIO);
			goto out;
		}

	}

	priv_p->strobe_gpio = STR_GPIO;

	if(client->irq){
		err = request_threaded_irq(client->irq,NULL,adp1653_irq_hdlr,
			IRQF_ONESHOT|IRQF_TRIGGER_FALLING,
			"Adp1653 flash",priv_p);
		if(err){
			DEBUG_LOG("Unable to register flash IRQ handler, irq %d, err %d\n",
				client->irq,err);
			goto out;
		}
	}
	err = register_flash_chip(flash_position,flash_chip_p);
	if(err){
		DEBUG_LOG("Failed to register Adp1653 as flash for %s camera\n",
			(flash_position?"Primary":"Secondary"));
		goto out;
	}
	SET_FLASH_STATUS(priv_p->status,FLASH_STATUS_READY);
	DEBUG_LOG("< adp1653_probe ok\n");
	return err;
out:
	if(priv_p->irq_no)
		free_irq(priv_p->irq_no,NULL);
	if(priv_p->enable_gpio)
		gpio_free(priv_p->enable_gpio);
	if(priv_p)
		kfree(priv_p);
	if(flash_chip_p)
		kfree(flash_chip_p);
	DEBUG_LOG("< adp1653_probe (%d)\n", err);
	return err;
}
static int __init handle_display_devices_in_u8500(void)
{
	struct mcde_platform_data *pdata = ux500_mcde_device.dev.platform_data;

	pr_debug("%s\n", __func__);

#ifdef CONFIG_FB_MCDE
	(void)mcde_dss_register_notifier(&display_nb);
#endif

	/* Set powermode to STANDBY if startup graphics is executed */
	if (display_initialized_during_boot) {
		samsung_s6d16d0_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
		sony_acx424akp_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
	}

	/* Display reset GPIO is different depending on reference boards */
	if (machine_is_hrefv60() || machine_is_u8520() || machine_is_u9540()) {
		samsung_s6d16d0_pdata0.reset_gpio = HREFV60_DISP1_RST_GPIO;
		samsung_s6d16d0_pdata1.reset_gpio = HREFV60_DISP2_RST_GPIO;
	} else {
		samsung_s6d16d0_pdata0.reset_gpio = MOP500_DISP1_RST_GPIO;
		samsung_s6d16d0_pdata1.reset_gpio = MOP500_DISP2_RST_GPIO;
	}

	/* Initialize all needed clocks*/
	if (!display_initialized_during_boot) {
		struct clk *clk_dsi_pll;
		struct clk *clk_hdmi;
		struct clk *clk_tv;

		/*
		 * The TV CLK is used as parent for the
		 * DSI LP clock.
		 */
		clk_tv = clk_get(&ux500_mcde_device.dev, "tv");
		if (TV_FREQ_HZ != clk_round_rate(clk_tv, TV_FREQ_HZ))
			pr_warning("%s: TV_CLK freq differs %ld\n", __func__,
					clk_round_rate(clk_tv, TV_FREQ_HZ));
		clk_set_rate(clk_tv, TV_FREQ_HZ);
		clk_put(clk_tv);

		/*
		 * The HDMI CLK is used as parent for the
		 * DSI HS clock.
		 */
		clk_hdmi = clk_get(&ux500_mcde_device.dev, "hdmi");
		if (HDMI_FREQ_HZ != clk_round_rate(clk_hdmi, HDMI_FREQ_HZ))
			pr_warning("%s: HDMI freq differs %ld\n", __func__,
					clk_round_rate(clk_hdmi, HDMI_FREQ_HZ));
		clk_set_rate(clk_hdmi, HDMI_FREQ_HZ);
		clk_put(clk_hdmi);

		/*
		 * The DSI PLL CLK is used as DSI PLL for direct freq for
		 * link 2. Link 0/1 is then divided with 1/2/4 from this freq.
		 */
		clk_dsi_pll = clk_get(&ux500_mcde_device.dev, "dsihs2");
		if (DSI_PLL_FREQ_HZ != clk_round_rate(clk_dsi_pll,
							DSI_PLL_FREQ_HZ))
			pr_warning("%s: DSI_PLL freq differs %ld\n", __func__,
				clk_round_rate(clk_dsi_pll, DSI_PLL_FREQ_HZ));
		clk_set_rate(clk_dsi_pll, DSI_PLL_FREQ_HZ);
		clk_put(clk_dsi_pll);
	}

	/* MCDE pixelfetchwtrmrk levels per overlay */
	pdata->pixelfetchwtrmrk[0] = 48;	/* LCD 32 bpp */
	pdata->pixelfetchwtrmrk[1] = 64;	/* LCD 16 bpp */
	pdata->pixelfetchwtrmrk[2] = 128;	/* HDMI 32 bpp */
	pdata->pixelfetchwtrmrk[3] = 192;	/* HDMI 16 bpp */

	/* Not all STUIBs supports VSYNC, disable vsync for STUIB */
	if (uib_is_stuib()) {
		/* Samsung display on STUIB */
		samsung_s6d16d0_display0.port->sync_src = MCDE_SYNCSRC_OFF;
		samsung_s6d16d0_display0.orientation = MCDE_DISPLAY_ROT_90_CCW;
		(void)mcde_display_device_register(&samsung_s6d16d0_display0);
	} else if (uib_is_u8500uib()) {
		/* Samsung display on U8500UIB */
		samsung_s6d16d0_display0.orientation = MCDE_DISPLAY_ROT_90_CW;
		(void)mcde_display_device_register(&samsung_s6d16d0_display0);
	} else if (uib_is_u8500uibr3()) {
		/* Sony display on U8500UIBV3 */
		(void)mcde_display_device_register(&sony_acx424akp_display0);
	} else {
		WARN_ON("Unknown UI board");
	}

	/* Display reset GPIO is different depending on reference boards */
	if (uib_is_stuib())
		(void)mcde_display_device_register(&samsung_s6d16d0_display1);

#if defined(CONFIG_U8500_TV_OUTPUT_AV8100)
	INIT_DELAYED_WORK_DEFERRABLE(&work_dispreg_hdmi,
			delayed_work_dispreg_hdmi);
	schedule_delayed_work(&work_dispreg_hdmi,
			msecs_to_jiffies(DISPREG_HDMI_DELAY));
#endif

	return 0;
}
static void mop500_pins_suspend_force(void)
{
	if (machine_is_hrefv60() || machine_is_u8520() ||
	    machine_is_u9540())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank0_href60,
			ARRAY_SIZE(mop500_pins_common_power_save_bank0_href60));
	else
		sleep_pins_config_pm(mop500_pins_common_power_save_bank0,
			ARRAY_SIZE(mop500_pins_common_power_save_bank0));

	sleep_pins_config_pm(mop500_pins_common_power_save_bank1,
		ARRAY_SIZE(mop500_pins_common_power_save_bank1));

	if (machine_is_hrefv60() || machine_is_u8520() ||
	    machine_is_u9540())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank2_href60,
			ARRAY_SIZE(mop500_pins_common_power_save_bank2_href60));
	else
		sleep_pins_config_pm(mop500_pins_common_power_save_bank2,
			ARRAY_SIZE(mop500_pins_common_power_save_bank2));

	sleep_pins_config_pm(mop500_pins_common_power_save_bank3,
		ARRAY_SIZE(mop500_pins_common_power_save_bank3));


	if (pins_for_u9500() && uib_is_u8500uibr3())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank4_u9500_uibr3,
			ARRAY_SIZE(mop500_pins_common_power_save_bank4_u9500_uibr3));
	else
		sleep_pins_config_pm(mop500_pins_common_power_save_bank4,
			ARRAY_SIZE(mop500_pins_common_power_save_bank4));

	if (machine_is_hrefv60() || machine_is_u8520() ||
	    machine_is_u9540())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank5_href60,
			ARRAY_SIZE(mop500_pins_common_power_save_bank5_href60));
	else
		sleep_pins_config_pm(mop500_pins_common_power_save_bank5,
			ARRAY_SIZE(mop500_pins_common_power_save_bank5));

	if (pins_for_u9500())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank6_u9500,
			ARRAY_SIZE(mop500_pins_common_power_save_bank6_u9500));
	else if (machine_is_hrefv60() || machine_is_u8520() ||
		 machine_is_u9540())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank6_href60,
			ARRAY_SIZE(mop500_pins_common_power_save_bank6_href60));
	else
		sleep_pins_config_pm(mop500_pins_common_power_save_bank6,
			ARRAY_SIZE(mop500_pins_common_power_save_bank6));

	if (pins_for_u9500())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank7_u9500,
			ARRAY_SIZE(mop500_pins_common_power_save_bank7_u9500));
	else if (machine_is_hrefv60() || machine_is_u8520() ||
		 machine_is_u9540())
		sleep_pins_config_pm(mop500_pins_common_power_save_bank7_href60,
			ARRAY_SIZE(mop500_pins_common_power_save_bank7_href60));
	else
		sleep_pins_config_pm(mop500_pins_common_power_save_bank7,
			ARRAY_SIZE(mop500_pins_common_power_save_bank7));

	sleep_pins_config_pm(mop500_pins_common_power_save_bank8,
		ARRAY_SIZE(mop500_pins_common_power_save_bank8));
}
/*
 * 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;
}
int __init init_display_devices(void)
{
	int ret;

#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_VSYNC
	struct i2c_adapter *i2c0;
#endif

	ret = fb_register_client(&framebuffer_nb);
	if (ret)
		pr_warning("Failed to register framebuffer notifier\n");

	ret = mcde_dss_register_notifier(&display_nb);
	if (ret)
		pr_warning("Failed to register dss notifier\n");

#ifdef CONFIG_DISPLAY_GENERIC_PRIMARY
	if (machine_is_hrefv60())
		generic_display0_pdata.reset_gpio = HREFV60_DISP1_RST_GPIO;
	else
		generic_display0_pdata.reset_gpio = EGPIO_PIN_15;

#ifdef CONFIG_DISPLAY_GENERIC_DSI_PRIMARY_VSYNC
	i2c0 = i2c_get_adapter(0);
	if (i2c0) {
		/*
		* U8500-UIB has the TC35893 at 0x44 on I2C0, the
		* ST-UIB has not.
		*/
		ret = i2c_smbus_xfer(i2c0, 0x44, 0, I2C_SMBUS_WRITE, 0,
							I2C_SMBUS_QUICK, NULL);
		i2c_put_adapter(i2c0);

		/* ret == 0 => U8500 UIB connected */
		generic_display0.synchronized_update = (ret == 0);
	}
#endif

	if (display_initialized_during_boot)
		generic_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
	ret = mcde_display_device_register(&generic_display0);
	if (ret)
		pr_warning("Failed to register generic display device 0\n");
#endif

#ifdef CONFIG_DISPLAY_GENERIC_DSI_SECONDARY
	if (machine_is_hrefv60())
		generic_subdisplay_pdata.reset_gpio = HREFV60_DISP2_RST_GPIO;
	else
		generic_subdisplay_pdata.reset_gpio = EGPIO_PIN_14;
	ret = mcde_display_device_register(&generic_subdisplay);
	if (ret)
		pr_warning("Failed to register generic sub display device\n");
#endif

#ifdef CONFIG_DISPLAY_AV8100_TERTIARY
	INIT_DELAYED_WORK_DEFERRABLE(&work_dispreg_hdmi,
			delayed_work_dispreg_hdmi);

	schedule_delayed_work(&work_dispreg_hdmi,
			msecs_to_jiffies(DISPREG_HDMI_DELAY));
#endif
#ifdef CONFIG_DISPLAY_AB8500_TERTIARY
	ret = mcde_display_device_register(&tvout_ab8500_display);
	if (ret)
		pr_warning("Failed to register ab8500 tvout device\n");
#endif

	return ret;
}
static int __init handle_display_devices(void)
{
	bool video_mode = false;
	struct mcde_platform_data *pdata = ux500_mcde_device.dev.platform_data;

	pr_debug("%s\n", __func__);

#ifdef CONFIG_FB_MCDE
	(void)mcde_dss_register_notifier(&display_nb);
#endif

	if (uib_is_u8500uibr3() && sony_port0.mode == MCDE_PORTMODE_VID)
		video_mode = true;

	/*
	 * display_initialized_during_boot will have the
	 * port_video_mode value + 1 if the display was initiated during boot,
	 * otherwise zero
	 */
	if (display_initialized_during_boot) {
		/* restore video_mode value from boot */
		u32 boot_video_mode = display_initialized_during_boot - 1;
		/* if boot_video_mode not expected,
		 * clear already initiated flag */
		if ((boot_video_mode == MCDE_PORTMODE_VID) != video_mode)
			display_initialized_during_boot = 0;
	}

	/* Set powermode to STANDBY if startup graphics is executed */
	if (display_initialized_during_boot) {
		samsung_s6d16d0_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
		sony_acx424akp_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
		sharp_lq043t1_display0.power_mode = MCDE_DISPLAY_PM_STANDBY;
	}

	/* Display reset GPIO is different depending on reference boards */
	if (machine_is_hrefv60() || machine_is_u8520()) {
		samsung_s6d16d0_pdata0.reset_gpio = HREFV60_DISP1_RST_GPIO;
		samsung_s6d16d0_pdata1.reset_gpio = HREFV60_DISP2_RST_GPIO;
	} else {
		samsung_s6d16d0_pdata0.reset_gpio = MOP500_DISP1_RST_GPIO;
		samsung_s6d16d0_pdata1.reset_gpio = MOP500_DISP2_RST_GPIO;
	}

	/* Initialize all needed clocks*/
	if (!display_initialized_during_boot) {
		struct clk *clk_dsi_pll;
		struct clk *clk_hdmi;
		struct clk *clk_tv;
		u32 freq;

		/*
		 * The TV CLK is used as parent for the
		 * DSI LP clock.
		 */
		clk_tv = clk_get(&ux500_mcde_device.dev, "tv");
		if (TV_FREQ_HZ != clk_round_rate(clk_tv, TV_FREQ_HZ))
			pr_warning("%s: TV_CLK freq differs %ld\n", __func__,
					clk_round_rate(clk_tv, TV_FREQ_HZ));
		clk_set_rate(clk_tv, TV_FREQ_HZ);
		clk_put(clk_tv);

		/*
		 * The HDMI CLK is used as parent for the
		 * DSI HS clock.
		 */
		clk_hdmi = clk_get(&ux500_mcde_device.dev, "hdmi");
		if (HDMI_FREQ_HZ != clk_round_rate(clk_hdmi, HDMI_FREQ_HZ))
			pr_warning("%s: HDMI freq differs %ld\n", __func__,
					clk_round_rate(clk_hdmi, HDMI_FREQ_HZ));
		clk_set_rate(clk_hdmi, HDMI_FREQ_HZ);
		clk_put(clk_hdmi);

		/*
		 * The DSI PLL CLK is used as DSI PLL for direct freq for
		 * link 2. Link 0/1 is then divided with 1/2/4 from this freq.
		 */
		freq = video_mode ? DSI_PLL_FREQ_HZ_VID : DSI_PLL_FREQ_HZ_CMD;
		clk_dsi_pll = clk_get(&ux500_mcde_device.dev, "dsipll");
		if (freq != clk_round_rate(clk_dsi_pll, freq))
			pr_warning("%s: DSI_PLL freq differs %ld\n", __func__,
					clk_round_rate(clk_dsi_pll, freq));
		clk_set_rate(clk_dsi_pll, freq);
		clk_put(clk_dsi_pll);
	}

	/* MCDE pixelfetchwtrmrk levels per overlay */
	pdata->pixelfetchwtrmrk[0] = video_mode ? 128 : 48;	/* LCD 32bpp */
	pdata->pixelfetchwtrmrk[1] = video_mode ? 128 : 64;	/* LCD 16bpp */
	pdata->pixelfetchwtrmrk[2] = 128;			/* HDMI 32bpp */
	pdata->pixelfetchwtrmrk[3] = 192;			/* HDMI 16bpp */

	/* Not all STUIBs supports VSYNC, disable vsync for STUIB */
	if (uib_is_stuib()) {
		/* Samsung display on STUIB */
		samsung_s6d16d0_display0.port->sync_src = MCDE_SYNCSRC_OFF;
		samsung_s6d16d0_display0.orientation = MCDE_DISPLAY_ROT_90_CCW;
		(void)mcde_display_device_register(&samsung_s6d16d0_display0);
	} else if (uib_is_u8500uib()) {
		/* Samsung display on U8500UIB */
		samsung_s6d16d0_display0.orientation = MCDE_DISPLAY_ROT_90_CW;
		(void)mcde_display_device_register(&samsung_s6d16d0_display0);
	} else if (uib_is_u8500uibr3()) {
		/* Sony display on U8500UIBV3 */
		sony_acx424akp_display0_pdata.reset_gpio = HREFV60_DISP1_RST_GPIO;
		(void)mcde_display_device_register(&sony_acx424akp_display0);
	} else {
		sharp_lq043t1_display0_pdata.reset_gpio = HREFV60_DISP1_RST_GPIO;
		(void)mcde_display_device_register(&sharp_lq043t1_display0);
	}

	/* Display reset GPIO is different depending on reference boards */
	if (uib_is_stuib())
		(void)mcde_display_device_register(&samsung_s6d16d0_display1);

#if defined(CONFIG_U8500_TV_OUTPUT_AV8100)
	INIT_DELAYED_WORK_DEFERRABLE(&work_dispreg_hdmi,
			delayed_work_dispreg_hdmi);
	schedule_delayed_work(&work_dispreg_hdmi,
			msecs_to_jiffies(DISPREG_HDMI_DELAY));
#endif

	return 0;
}