void __init msm_camera_vreg_init(void)
{
	int rc;
	platform_add_devices(camera_devices,
				ARRAY_SIZE(camera_devices));

	if (!machine_is_msm7627a_qrd1())
		register_i2c_devices();

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		return;
	}

	if (machine_is_msm7627a_qrd1())
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	else
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}
Esempio n. 2
0
static int qrf6285_init_regs(void)
{
	struct regulator_bulk_data regs[ARRAY_SIZE(vreg_info)];
	int i, rc;

	for (i = 0; i < ARRAY_SIZE(regs); i++) {
		regs[i].supply = vreg_info[i].vreg_id;
		regs[i].min_uV = vreg_info[i].vreg_level;
		regs[i].max_uV = vreg_info[i].vreg_level;
	}

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs), regs);
	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		goto out;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs), regs);
	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		goto reg_free;
	}

	for (i = 0; i < ARRAY_SIZE(regs); i++)
		vreg_info[i].reg = regs[i].consumer;

	return 0;

reg_free:
	regulator_bulk_free(ARRAY_SIZE(regs), regs);
out:
	return rc;
}
static int ft5x06_ts_power_on(bool on)
{
	int rc;

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_ft5x06), regs_ft5x06);
	if (rc) {
		printk("%s: could not get regulators: %d\n",
				__func__, rc);
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_ft5x06), regs_ft5x06);
	if (rc) {
		printk("%s: could not set voltages: %d\n",
				__func__, rc);
	}

	rc = on ?
		regulator_bulk_enable(ARRAY_SIZE(regs_ft5x06), regs_ft5x06) :
		regulator_bulk_disable(ARRAY_SIZE(regs_ft5x06), regs_ft5x06);

	if (rc)
		pr_err("%s: could not %sable regulators: %d\n",
				__func__, on ? "en" : "dis", rc);
	else
		msleep(50);

	return rc;
}
Esempio n. 4
0
static int atmel_ts_platform_init(struct i2c_client *client)
{
	int rc;
	struct device *dev = &client->dev;

	rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
	if (rc) {
		dev_err(dev, "%s: could not get regulators: %d\n",
				__func__, rc);
		goto out;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
	if (rc) {
		dev_err(dev, "%s: could not set voltages: %d\n",
				__func__, rc);
		goto reg_free;
	}

	rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
				GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
				GPIO_CFG_8MA), GPIO_CFG_ENABLE);
	if (rc) {
		dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
			__func__, ATMEL_TS_GPIO_IRQ);
		goto reg_free;
	}

	/* configure touchscreen interrupt gpio */
	rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
	if (rc) {
		dev_err(dev, "%s: unable to request gpio %d\n",
			__func__, ATMEL_TS_GPIO_IRQ);
		goto ts_gpio_tlmm_unconfig;
	}

	rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
	if (rc < 0) {
		dev_err(dev, "%s: unable to set the direction of gpio %d\n",
			__func__, ATMEL_TS_GPIO_IRQ);
		goto free_ts_gpio;
	}
	return 0;

free_ts_gpio:
	gpio_free(ATMEL_TS_GPIO_IRQ);
ts_gpio_tlmm_unconfig:
	gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
				GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_2MA), GPIO_CFG_DISABLE);
reg_free:
	regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
out:
	return rc;
}
static void msm_camera_vreg_enable(struct platform_device *pdev)
{
/*<BU5D09497  lijuan 00152865  20100514 begin*/
#ifndef CONFIG_HUAWEI_CAMERA
	int count, rc;

	struct device *dev = &pdev->dev;

	/* Use gp6 and gp16 if and only if dev name matches. */
	if (!strncmp(pdev->name, "msm_camera_sn12m0pz", 20))
		count = ARRAY_SIZE(regs);
	else
		count = ARRAY_SIZE(regs) - 2;

	rc = regulator_bulk_get(dev, count, regs);

	if (rc) {
		dev_err(dev, "%s: could not get regulators: %d\n",
				__func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(count, regs);

	if (rc) {
		dev_err(dev, "%s: could not set voltages: %d\n",
				__func__, rc);
		goto reg_free;
	}

	rc = regulator_bulk_enable(count, regs);

	if (rc) {
		dev_err(dev, "%s: could not enable regulators: %d\n",
				__func__, rc);
		goto reg_free;
	}

	reg_count = count;
	return;

reg_free:
	regulator_bulk_free(count, regs);
	return;
#endif
/*BU5D09497  lijuan 00152865  20100514 end>*/
}
Esempio n. 6
0
void __init msm7627a_camera_init(void)
{
	int rc;

#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		qrd1_camera_gpio_cfg();
		platform_add_devices(camera_devices_qrd,
				ARRAY_SIZE(camera_devices_qrd));
	} else
		platform_add_devices(camera_devices_msm,
				ARRAY_SIZE(camera_devices_msm));
#endif
	if (!machine_is_msm7627a_qrd1())
		register_i2c_devices();
	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		return;
	}

#if defined(CONFIG_MSM_CAMERA_V4L2)
	msm7x27a_init_cam();
#endif
#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1())
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	else
#endif
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}
Esempio n. 7
0
static void msm_camera_vreg_enable(struct platform_device *pdev)
{
    int count, rc;

    struct device *dev = &pdev->dev;

    /* Use gp6 and gp16 if and only if dev name matches. */
    if (!strncmp(pdev->name, "msm_camera_sn12m0pz", 20))
        count = ARRAY_SIZE(regs);
    else
        count = ARRAY_SIZE(regs) - 2;

    rc = regulator_bulk_get(dev, count, regs);

    if (rc) {
        dev_err(dev, "%s: could not get regulators: %d\n",
                __func__, rc);
        return;
    }

    rc = regulator_bulk_set_voltage(count, regs);

    if (rc) {
        dev_err(dev, "%s: could not set voltages: %d\n",
                __func__, rc);
        goto reg_free;
    }

    rc = regulator_bulk_enable(count, regs);

    if (rc) {
        dev_err(dev, "%s: could not enable regulators: %d\n",
                __func__, rc);
        goto reg_free;
    }

    reg_count = count;
    return;

reg_free:
    regulator_bulk_free(count, regs);
    return;
}
Esempio n. 8
0
static int mipi_dsi_panel_power(int on)
{
	int rc = 0;
	uint32_t lcdc_reset_cfg;

	/* I2C-controlled GPIO Expander -init of the GPIOs very late */
	if (unlikely(!dsi_gpio_initialized)) {
		pmapp_disp_backlight_init();

		rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
		if (rc < 0) {
			pr_err("failed to request gpio_disp_pwr\n");
			return rc;
		}

		if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
			rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
			if (rc < 0) {
				pr_err("failed to enable display pwr\n");
				goto fail_gpio1;
			}

			rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
			if (rc < 0) {
				pr_err("failed to request gpio_bkl_en\n");
				goto fail_gpio1;
			}

			rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
			if (rc < 0) {
				pr_err("failed to enable backlight\n");
				goto fail_gpio2;
			}
		}

		rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
		if (rc) {
			pr_err("%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio2;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
		if (rc) {
			pr_err("%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}
		if (pmapp_disp_backlight_set_brightness(100))
			pr_err("backlight set brightness failed\n");

		dsi_gpio_initialized = 1;
	}

	if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()) {
		gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
		gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
	} else if (machine_is_msm7x27a_ffa() ||
			 machine_is_msm7625a_ffa()) {
		if (on) {
			/* This line drives an active low pin on FFA */
			rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
			if (rc < 0)
				pr_err("failed to set direction for "
					"display pwr\n");
		} else {
			gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
			rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
			if (rc < 0)
				pr_err("failed to set direction for "
					"display pwr\n");
		}
	}

	if (on) {
		gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);

		if (machine_is_msm7x27a_surf() ||
				 machine_is_msm7625a_surf()) {
			lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
			rmb();
			lcdc_reset_cfg &= ~1;

			writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
			msleep(20);
			wmb();
			lcdc_reset_cfg |= 1;
			writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
		} else {
			gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
			msleep(20);
			gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
		}
	} else {
		gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
	}

	rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
		  regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);

	if (rc)
		pr_err("%s: could not %sable regulators: %d\n",
				__func__, on ? "en" : "dis", rc);

	return rc;

fail_vreg:
	regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
fail_gpio2:
	gpio_free(GPIO_BACKLIGHT_EN);
fail_gpio1:
	gpio_free(GPIO_DISPLAY_PWR_EN);
	dsi_gpio_initialized = 0;
	return rc;
}
void __init msm7627a_camera_init(void)
{
	int rc;
/* <DTS2012041003722 sibingsong 20120410 begin */
/*< DTS2012021000399 yuguangcai 20120211 begin */
#ifdef CONFIG_HUAWEI_CAMERA
		/*before camera probe, config the camera pwd gpio*/
		camera_sensor_pwd_config();
#endif
/* DTS2012021000399 yuguangcai 20120211 end > */
/* DTS2012041003722 sibingsong 20120410 end> */
#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		qrd1_camera_gpio_cfg();
		platform_add_devices(camera_devices_qrd,
				ARRAY_SIZE(camera_devices_qrd));
	} else
		platform_add_devices(camera_devices_msm,
				ARRAY_SIZE(camera_devices_msm));
#endif
	if (!machine_is_msm7627a_qrd1())
		register_i2c_devices();
/* < DTS2012050205820 zhouqiwei 20120502 begin */
	if (WIFI_QUALCOMM == get_hw_wifi_device_type())
	{
		if (HW_DS != get_hw_ds_type())
		{
			rc = regulator_bulk_get(NULL, 
			ARRAY_SIZE(regs_camera_WIFI_QUALCOMM), regs_camera_WIFI_QUALCOMM);

			if (rc) {
				pr_err("%s: could not get regs_camera_WIFI_QUALCOMM: %d\n", __func__, rc);
					return;
			}

			rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera_WIFI_QUALCOMM), regs_camera_WIFI_QUALCOMM);

			if (rc) {
				pr_err("%s: could not set regs_camera_WIFI_QUALCOMM: %d\n", __func__, rc);
				return;
			}
		}
		else
		{
			rc = regulator_bulk_get(NULL, 
			ARRAY_SIZE(regs_camera_HW_DS), regs_camera_HW_DS);

			if (rc) {
				pr_err("%s: could not get regs_camera_HW_DSs: %d\n", __func__, rc);
				return;
			}

			rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera_HW_DS), regs_camera_HW_DS);

			if (rc) {
				pr_err("%s: could not set regs_camera_HW_DS: %d\n", __func__, rc);
				return;
			}
		}
	}
	else
	{
		rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

		if (rc) {
			pr_err("%s: could not get regulators: %d\n", __func__, rc);
			return;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

		if (rc) {
			pr_err("%s: could not set voltages: %d\n", __func__, rc);
			return;
		}
	}
/* DTS2012050205820 zhouqiwei 20120502 end > */

#if defined(CONFIG_MSM_CAMERA_V4L2)
	msm7x27a_init_cam();
#endif
#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1())
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	else
#endif
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}
void __init msm7627a_camera_init(void)
{

#ifndef CONFIG_MSM_CAMERA_V4L2
	int rc;
#endif

	pr_debug("msm7627a_camera_init Entered\n");

	if (machine_is_msm7627a_qrd3() || machine_is_msm8625_qrd7()) {
		ov7692_cam_req_gpio[0].gpio =
			GPIO_SKU7_CAM_VGA_SHDN;
		ov7692_cam_gpio_set_tbl[0].gpio = GPIO_SKU7_CAM_VGA_SHDN;
		ov7692_cam_gpio_set_tbl[1].gpio = GPIO_SKU7_CAM_VGA_SHDN;

		msm_camera_sensor_ov5647_data.sensor_pwd =
			GPIO_SKU7_CAM_5MP_SHDN_N;
		msm_camera_sensor_ov5647_data.sensor_reset =
			GPIO_SKU7_CAM_5MP_CAMIF_RESET;
	}

	/* LCD and camera power (VREG & LDO) init */
	if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()
			|| machine_is_msm8625_evt()
			|| machine_is_msm7627a_qrd3()
			|| machine_is_msm8625_qrd7()) {
#ifndef CONFIG_MSM_CAMERA_V4L2
		lcd_camera_power_init();
#endif
		evb_camera_gpio_cfg();
	}

#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		qrd1_camera_gpio_cfg();
		platform_add_devices(camera_devices_qrd,
				ARRAY_SIZE(camera_devices_qrd));
	} else if (machine_is_msm7627a_evb()
			|| machine_is_msm8625_evb()
			|| machine_is_msm8625_evt()
			|| machine_is_msm7627a_qrd3()
			|| machine_is_msm8625_qrd7()) {
		platform_add_devices(camera_devices_evb,
				ARRAY_SIZE(camera_devices_evb));
	} else if (machine_is_msm7627a_qrd3())
		return;
	else
		platform_add_devices(camera_devices_msm,
				ARRAY_SIZE(camera_devices_msm));
#endif
	if (!machine_is_msm7627a_qrd1() || !machine_is_msm7627a_evb()
					|| !machine_is_msm8625_evb()
					|| !machine_is_msm8625_evt()
					|| !machine_is_msm7627a_qrd3()
					|| !machine_is_msm8625_qrd7())
		register_i2c_devices();
#ifndef CONFIG_MSM_CAMERA_V4L2
	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		return;
	}
#endif

#if defined(CONFIG_MSM_CAMERA_V4L2)
	msm7x27a_init_cam();
#endif
#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	} else if (machine_is_msm7627a_evb()
			|| machine_is_msm8625_evb()
			|| machine_is_msm8625_evt()
			|| machine_is_msm7627a_qrd3()
			|| machine_is_msm8625_qrd7()) {
		pr_debug("machine_is_msm7627a_evb i2c_register_board_info\n");
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_evb,
				ARRAY_SIZE(i2c_camera_devices_evb));
	} else
#endif
		pr_debug("i2c_register_board_info\n");
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}
Esempio n. 11
0
void sku3_lcdc_lcd_camera_power_init(void)
{
	int rc = 0;
	u32 socinfo = socinfo_get_platform_type();

	  /* LDO_EXT2V8 */
	if (gpio_request(SKU3_LCDC_LCD_CAMERA_LDO_2V8, "lcd_camera_ldo_2v8")) {
		pr_err("failed to request gpio lcd_camera_ldo_2v8\n");
		return;
	}

	rc = gpio_tlmm_config(GPIO_CFG(SKU3_LCDC_LCD_CAMERA_LDO_2V8, 0,
		GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
		GPIO_CFG_ENABLE);

	if (rc < 0) {
		pr_err("%s:unable to enable lcd_camera_ldo_2v8!\n", __func__);
		goto fail_gpio2;
	}

	/* LDO_EVT1V8 */
	if (socinfo == 0x0B) {
		if (gpio_request(SKU3_LCDC_LCD_CAMERA_LDO_1V8,
				"lcd_camera_ldo_1v8")) {
			pr_err("failed to request gpio lcd_camera_ldo_1v8\n");
			goto fail_gpio1;
		}

		rc = gpio_tlmm_config(GPIO_CFG(SKU3_LCDC_LCD_CAMERA_LDO_1V8, 0,
			GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
			GPIO_CFG_ENABLE);

		if (rc < 0) {
			pr_err("%s: unable to enable lcdc_camera_ldo_1v8!\n",
				__func__);
			goto fail_gpio1;
		}
	} else if (socinfo == 0x0F || machine_is_msm8625_qrd7()) {
		if (gpio_request(SKU3_1_LCDC_LCD_CAMERA_LDO_1V8,
				"lcd_camera_ldo_1v8")) {
			pr_err("failed to request gpio lcd_camera_ldo_1v8\n");
			goto fail_gpio1;
		}

		rc = gpio_tlmm_config(GPIO_CFG(SKU3_1_LCDC_LCD_CAMERA_LDO_1V8,
			0, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA),
			GPIO_CFG_ENABLE);

		if (rc < 0) {
			pr_err("%s: unable to enable lcdc_camera_ldo_1v8!\n",
				__func__);
			goto fail_gpio1;
		}
	}

	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_truly_lcdc),
			regs_truly_lcdc);
	if (rc)
		pr_err("%s: could not get regulators: %d\n", __func__, rc);

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_truly_lcdc),
			regs_truly_lcdc);
	if (rc)
		pr_err("%s: could not set voltages: %d\n", __func__, rc);

	return;

fail_gpio1:
	if (socinfo == 0x0B)
		gpio_free(SKU3_LCDC_LCD_CAMERA_LDO_1V8);
	else if (socinfo == 0x0F || machine_is_msm8625_qrd7())
		gpio_free(SKU3_1_LCDC_LCD_CAMERA_LDO_1V8);
fail_gpio2:
	gpio_free(SKU3_LCDC_LCD_CAMERA_LDO_2V8);
	return;
}
static int mipi_dsi_panel_msm_power(int on)
{
	int rc = 0;





	/* Power off, Reset Pin pull LOW must before power source off */
	//if ((!on) || (!dsi_gpio_initialized)){
	if (!on){
		rc = msm_fb_dsi_client_msm_reset(1);
		if (rc < 0) {
			pr_err("[DISPLAY] %s: Failed to pull low lcm reset\n", __func__);
			goto fail_gpio2;
		}
	}

	/* I2C-controlled GPIO Expander -init of the GPIOs very late */
	if (unlikely(!dsi_gpio_initialized)) {

		rc = regulator_bulk_get(NULL, ARRAY_SIZE(fih_regs_dsi), fih_regs_dsi);
		if (rc) {
			pr_err("[DISPLAY]%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio2;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(fih_regs_dsi),
						fih_regs_dsi);
		if (rc) {
			pr_err("[DISPLAY]%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}

		msm_fb_dsi_client_msm_reset(1);

		dsi_gpio_initialized = 1;
	}

	rc = on ? regulator_bulk_enable(ARRAY_SIZE(fih_regs_dsi), fih_regs_dsi) :
		  regulator_bulk_disable(ARRAY_SIZE(fih_regs_dsi), fih_regs_dsi);

	if (rc)
		pr_err("[DISPLAY]%s: could not %sable regulators: %d\n",
				__func__, on ? "en" : "dis", rc);

printk(KERN_INFO "[DISPLAY]%s: X\n", __func__);

	return rc;
fail_vreg:
	regulator_bulk_free(ARRAY_SIZE(fih_regs_dsi), fih_regs_dsi);
fail_gpio2:
	//gpio_free(GPIO_BACKLIGHT_EN);
//fail_gpio1:
	//gpio_free(GPIO_DISPLAY_PWR_EN);
	dsi_gpio_initialized = 0;
    printk(KERN_ERR "[DISPLAY]%s: X, failed\n", __func__);

	return rc;
}
int vga_camera_power_on (struct platform_device *pdev)
{
    int count1, count2, rc;
		struct device *dev = &pdev->dev;

    printk(KERN_ERR "vga_camera_power_on\n");

    gpio_set_value(CAM_VGA_GPIO_RESET_N, 0);
    mdelay(1);

    gpio_set_value(CAM_VGA_GPIO_PWDN, 0);
    mdelay(1);


		// Turn On Main Camera Power Part1
		count1 = ARRAY_SIZE(regs_vga1);
		rc = regulator_bulk_get(dev, count1, regs_vga1);
		if (rc) {
			dev_err(dev, "%s: regs_vga1 could not get regulators: %d\n", __func__, rc);
			return 0;
		}
		
		rc = regulator_bulk_set_voltage(count1, regs_vga1);
		if (rc) {
			dev_err(dev, "%s: regs_vga1 could not set voltages: %d\n", __func__, rc);
			goto reg_free1;
		}
		
		rc = regulator_bulk_enable(count1, regs_vga1);
		if (rc) {
			dev_err(dev, "%s: regs_vga1 could not enable regulators: %d\n", __func__, rc);
			goto reg_free1;
		}
		
		reg_count_vga1 = count1;

		// Turn On Main Camera Power Part2
		count2 = ARRAY_SIZE(regs_vga2);
		rc = regulator_bulk_get(dev, count2, regs_vga2);
		if (rc) {
			dev_err(dev, "%s: regs_vga2 could not get regulators: %d\n", __func__, rc);
			goto reg_free1;;
		}
		
		rc = regulator_bulk_set_voltage(count2, regs_vga2);
		if (rc) {
			dev_err(dev, "%s: regs_vga2 could not set voltages: %d\n", __func__, rc);
			goto reg_free2;
		}
		
		rc = regulator_bulk_enable(count2, regs_vga2);
		if (rc) {
			dev_err(dev, "%s: regs_vga2 could not enable regulators: %d\n", __func__, rc);
			goto reg_free2;
		}
		
		reg_count_vga2 = count2;

    gpio_set_value(CAM_VGA_GPIO_PWDN, 1);
    mdelay(1);

    msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
    mdelay(1);
    
    gpio_set_value(CAM_VGA_GPIO_PWDN, 0);
    mdelay(1);
    
    gpio_set_value(CAM_VGA_GPIO_RESET_N, 1);
    mdelay(10);

    return 0;
    
reg_free2:
    regulator_bulk_free(count2, regs_vga2);
    reg_count_vga2 = 0;
    regulator_bulk_disable(reg_count_vga1, regs_vga1);
reg_free1:
    regulator_bulk_free(count1, regs_vga1);
    reg_count_vga1 = 0;

    return 0;
}
int main_camera_power_on (struct platform_device *pdev)
{
		int count1, count2, rc;
		struct device *dev = &pdev->dev;
				
    printk(KERN_ERR "%s: main_camera_power_on \n",__func__);

    gpio_set_value(CAM_MAIN_GPIO_RESET_N, 0);

		// Turn On Main Camera Power Part1
		count1 = ARRAY_SIZE(regs_main1);
		rc = regulator_bulk_get(dev, count1, regs_main1);
		if (rc) {
			dev_err(dev, "%s: regs_main1 could not get regulators: %d\n", __func__, rc);
			return 0;
		}
		
		rc = regulator_bulk_set_voltage(count1, regs_main1);
		if (rc) {
			dev_err(dev, "%s: regs_main1 could not set voltages: %d\n", __func__, rc);
			goto reg_free1;
		}
		
		rc = regulator_bulk_enable(count1, regs_main1);
		if (rc) {
			dev_err(dev, "%s: regs_main1 could not enable regulators: %d\n", __func__, rc);
			goto reg_free1;
		}
		
		reg_count_main1 = count1;

    mdelay(20);
		// Supply Clock and Make high on reset
		msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
	mdelay(10);

    gpio_set_value(CAM_MAIN_GPIO_RESET_N, 1);
    mdelay(10);
		
		// Turn On Main Camera Power Part2
		count2 = ARRAY_SIZE(regs_main2);
		rc = regulator_bulk_get(dev, count2, regs_main2);
		if (rc) {
			dev_err(dev, "%s: regs_main2 could not get regulators: %d\n", __func__, rc);
			goto reg_free1;;
		}
		
		rc = regulator_bulk_set_voltage(count2, regs_main2);
		if (rc) {
			dev_err(dev, "%s: regs_main2 could not set voltages: %d\n", __func__, rc);
			goto reg_free2;
		}
		
		rc = regulator_bulk_enable(count2, regs_main2);
		if (rc) {
			dev_err(dev, "%s: regs_main2 could not enable regulators: %d\n", __func__, rc);
			goto reg_free2;
		}
		
		reg_count_main2 = count2;

    mdelay(3);

    return 0;
    
reg_free2:
    regulator_bulk_free(count2, regs_main2);
    reg_count_main2 = 0;
    regulator_bulk_disable(reg_count_main1, regs_main1);
reg_free1:
    regulator_bulk_free(count1, regs_main1);
    reg_count_main1 = 0;

    return 0;
}
static int mipi_dsi_panel_power(int on)
{
	int rc = 0;
#if 1 // #suwg.
    if(!odmm_dsi_gpio_initialized){
		rc = gpio_request(ODMM_LCD_BACKLIGHT,
			"odmm_gpio_bkl_en");
		if (rc < 0)
			return rc;

		rc = gpio_tlmm_config(GPIO_CFG(ODMM_LCD_BACKLIGHT, 0,
			GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
			GPIO_CFG_ENABLE);
		if (rc < 0) {
			pr_err("failed odmm GPIO_BACKLIGHT_EN tlmm config\n");
			return rc;
		}
		rc = gpio_direction_output(ODMM_LCD_BACKLIGHT, 1);
		if (rc < 0) {
			pr_err("failed to enable backlight\n");
			gpio_free(ODMM_LCD_BACKLIGHT);
			return rc;
		}
		rc = regulator_bulk_get(NULL, ARRAY_SIZE(odmm_regs_dsi), odmm_regs_dsi);
		if (rc) {
			pr_err("%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio2;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(odmm_regs_dsi),
						odmm_regs_dsi);
		if (rc) {
			pr_err("%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}

        rc =  regulator_bulk_enable(ARRAY_SIZE(odmm_regs_dsi), odmm_regs_dsi);
             // regulator_bulk_disable(ARRAY_SIZE(odmm_regs_dsi), odmm_regs_dsi);
        
        if (rc)
            pr_err("%s: could not %sable regulators: %d\n",
                    __func__, on ? "en" : "dis", rc);

		odmm_dsi_gpio_initialized = 1;
        
    }
    

    return rc;
fail_vreg:
    regulator_bulk_free(ARRAY_SIZE(odmm_regs_dsi), odmm_regs_dsi);
fail_gpio2:
    gpio_free(ODMM_LCD_BACKLIGHT);
    return rc;
#endif
	if (machine_is_msm7627a_qrd1())
		rc = mipi_dsi_panel_qrd1_power(on);
	else if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()
                        || machine_is_msm8625_qrd5() || machine_is_msm7x27a_qrd5a())
		rc = mipi_dsi_panel_qrd3_power(on);
        else if (machine_is_msm8625q_skud())
                rc = mipi_dsi_panel_skud_power(on);
        else if (machine_is_msm8625q_evbd())
                rc = mipi_dsi_panel_evbd_power(on);
        else if (machine_is_msm8625q_skue())
                rc = mipi_dsi_panel_skue_power(on);
	else
		rc = mipi_dsi_panel_msm_power(on);
	return rc;
}
static int mipi_dsi_panel_msm_power(int on)
{
	/*++ Huize - 20120927 Modify for identifying what the code is used by customization ++*/
	#ifdef DISPLAY_CUSTOMIZATION
	int rc = 0;
	if (unlikely(!dsi_gpio_initialized)) {
		pr_emerg("%s\n", __func__);
		#ifndef CONFIG_LEDS_CHIP_LM3533
		rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bl_en");
		if (rc < 0) {
			pr_err("failed to request gpio_bl_en\n");
			return rc;
		}
		rc = gpio_tlmm_config(
			GPIO_CFG(GPIO_BACKLIGHT_EN,0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
			GPIO_CFG_ENABLE);
		#endif	
		if (rc) {
			pr_err("Failed to enable gpio_bl_en\n");
			goto fail_gpio1;
		}
		rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
		if (rc) {
			pr_err("%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio2;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi), regs_dsi);
		if (rc) {
			pr_err("%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}

		dsi_gpio_initialized = 1;
	}
	#else
	int rc = 0;
	uint32_t lcdc_reset_cfg;

	/* I2C-controlled GPIO Expander -init of the GPIOs very late */
	if (unlikely(!dsi_gpio_initialized)) {
		pmapp_disp_backlight_init();

		rc = gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr");
		if (rc < 0) {
			pr_err("failed to request gpio_disp_pwr\n");
			return rc;
		}

		if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf()
				|| machine_is_msm8625_surf()) {
			rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, 1);
			if (rc < 0) {
				pr_err("failed to enable display pwr\n");
				goto fail_gpio1;
			}

			rc = gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en");
			if (rc < 0) {
				pr_err("failed to request gpio_bkl_en\n");
				goto fail_gpio1;
			}

			rc = gpio_direction_output(GPIO_BACKLIGHT_EN, 1);
			if (rc < 0) {
				pr_err("failed to enable backlight\n");
				goto fail_gpio2;
			}
		}

		rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_dsi), regs_dsi);
		if (rc) {
			pr_err("%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio2;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_dsi),
						regs_dsi);
		if (rc) {
			pr_err("%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}
		if (pmapp_disp_backlight_set_brightness(100))
			pr_err("backlight set brightness failed\n");

		dsi_gpio_initialized = 1;
	}
	if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() ||
			machine_is_msm8625_surf()) {
		gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, on);
		gpio_set_value_cansleep(GPIO_BACKLIGHT_EN, on);
	} else if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa()
					|| machine_is_msm8625_ffa()) {
		if (on) {
			/* This line drives an active low pin on FFA */
			rc = gpio_direction_output(GPIO_DISPLAY_PWR_EN, !on);
			if (rc < 0)
				pr_err("failed to set direction for "
					"display pwr\n");
		} else {
			gpio_set_value_cansleep(GPIO_DISPLAY_PWR_EN, !on);
			rc = gpio_direction_input(GPIO_DISPLAY_PWR_EN);
			if (rc < 0)
				pr_err("failed to set direction for "
					"display pwr\n");
		}
	}

	if (on) {
		gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 0);

		if (machine_is_msm7x27a_surf() ||
				 machine_is_msm7625a_surf() ||
				 machine_is_msm8625_surf()) {
			lcdc_reset_cfg = readl_relaxed(lcdc_reset_ptr);
			rmb();
			lcdc_reset_cfg &= ~1;

			writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
			msleep(20);
			wmb();
			lcdc_reset_cfg |= 1;
			writel_relaxed(lcdc_reset_cfg, lcdc_reset_ptr);
		} else {
			gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 0);
			msleep(20);
			gpio_set_value_cansleep(GPIO_LCDC_BRDG_RESET_N, 1);
		}
	} else {
		gpio_set_value_cansleep(GPIO_LCDC_BRDG_PD, 1);
	}
	#endif
	/*-- Huize - 20120927 Modify for identifying what the code is used by customization --*/

	rc = on ? regulator_bulk_enable(ARRAY_SIZE(regs_dsi), regs_dsi) :
		  regulator_bulk_disable(ARRAY_SIZE(regs_dsi), regs_dsi);

	if (rc)
		pr_err("%s: could not %sable regulators: %d\n",
				__func__, on ? "en" : "dis", rc);

	return rc;
fail_vreg:
	regulator_bulk_free(ARRAY_SIZE(regs_dsi), regs_dsi);
fail_gpio2:
	gpio_free(GPIO_BACKLIGHT_EN);
fail_gpio1:
//Jordan-20111230 , remove 	
//	gpio_free(GPIO_DISPLAY_PWR_EN);
	dsi_gpio_initialized = 0;
	return rc;
}
Esempio n. 17
0
static void lcdc_toshiba_gpio_init(void)
{
	int rc = 0;
	if (!lcdc_gpio_initialized) {
		if (gpio_request(GPIO_SPI_CLK, "spi_clk")) {
			pr_err("failed to request gpio spi_clk\n");
			return;
		}
		if (gpio_request(GPIO_SPI_CS0_N, "spi_cs")) {
			pr_err("failed to request gpio spi_cs0_N\n");
			goto fail_gpio6;
		}
		if (gpio_request(GPIO_SPI_MOSI, "spi_mosi")) {
			pr_err("failed to request gpio spi_mosi\n");
			goto fail_gpio5;
		}
		if (gpio_request(GPIO_SPI_MISO, "spi_miso")) {
			pr_err("failed to request gpio spi_miso\n");
			goto fail_gpio4;
		}
		if (gpio_request(GPIO_DISPLAY_PWR_EN, "gpio_disp_pwr")) {
			pr_err("failed to request gpio_disp_pwr\n");
			goto fail_gpio3;
		}
		if (gpio_request(GPIO_BACKLIGHT_EN, "gpio_bkl_en")) {
			pr_err("failed to request gpio_bkl_en\n");
			goto fail_gpio2;
		}
		pmapp_disp_backlight_init();

		rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_lcdc), regs_lcdc);
		if (rc) {
			pr_err("%s: could not get regulators: %d\n",
					__func__, rc);
			goto fail_gpio1;
		}

		rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_lcdc),
				regs_lcdc);
		if (rc) {
			pr_err("%s: could not set voltages: %d\n",
					__func__, rc);
			goto fail_vreg;
		}
		lcdc_gpio_initialized = 1;
	}
	return;
fail_vreg:
	regulator_bulk_free(ARRAY_SIZE(regs_lcdc), regs_lcdc);
fail_gpio1:
	gpio_free(GPIO_BACKLIGHT_EN);
fail_gpio2:
	gpio_free(GPIO_DISPLAY_PWR_EN);
fail_gpio3:
	gpio_free(GPIO_SPI_MISO);
fail_gpio4:
	gpio_free(GPIO_SPI_MOSI);
fail_gpio5:
	gpio_free(GPIO_SPI_CS0_N);
fail_gpio6:
	gpio_free(GPIO_SPI_CLK);
	lcdc_gpio_initialized = 0;
}
Esempio n. 18
0
void __init msm7627a_camera_init(void)
{

#ifndef CONFIG_MSM_CAMERA_V4L2
	int rc;
#endif

	pr_debug("msm7627a_camera_init Entered\n");

	/* LCD and camera power (VREG & LDO) init */
	if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()
			|| machine_is_msm8625_evt()
			|| machine_is_msm7627a_qrd3()
			|| machine_is_msm8625_qrd7()) {
#ifndef CONFIG_MSM_CAMERA_V4L2
		lcd_camera_power_init();
#endif
		evb_camera_gpio_cfg();
	}

#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		qrd1_camera_gpio_cfg();
		platform_add_devices(camera_devices_qrd,
				ARRAY_SIZE(camera_devices_qrd));
	} else if (machine_is_msm7627a_evb()
			|| machine_is_msm8625_evb()
			|| machine_is_msm8625_evt()
			|| machine_is_msm7627a_qrd3()
			|| machine_is_msm8625_qrd7()) {
		platform_add_devices(camera_devices_evb,
				ARRAY_SIZE(camera_devices_evb));
	} else if (machine_is_msm7627a_qrd3())
		return;
	else
		platform_add_devices(camera_devices_msm,
				ARRAY_SIZE(camera_devices_msm));
#endif
#ifndef CONFIG_MSM_CAMERA_V4L2
	rc = regulator_bulk_get(NULL, ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not get regulators: %d\n", __func__, rc);
		return;
	}

	rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_camera), regs_camera);

	if (rc) {
		pr_err("%s: could not set voltages: %d\n", __func__, rc);
		return;
	}
#endif

#if defined(CONFIG_MSM_CAMERA_V4L2)
	msm7x27a_init_cam();
#endif
#ifndef CONFIG_MSM_CAMERA_V4L2
	if (machine_is_msm7627a_qrd1()) {
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_qrd,
				ARRAY_SIZE(i2c_camera_devices_qrd));
	} else if (machine_is_msm7627a_evb()
			|| machine_is_msm8625_evb()
			|| machine_is_msm8625_evt()
			|| machine_is_msm7627a_qrd3()
			|| machine_is_msm8625_qrd7()) {
		pr_debug("machine_is_msm7627a_evb i2c_register_board_info\n");
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices_evb,
				ARRAY_SIZE(i2c_camera_devices_evb));
	} else
#endif
		pr_debug("i2c_register_board_info\n");
		i2c_register_board_info(MSM_GSBI0_QUP_I2C_BUS_ID,
				i2c_camera_devices,
				ARRAY_SIZE(i2c_camera_devices));
}