Пример #1
0
int __init endeavor_regulator_init(void)
{
	void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
	u32 pmc_ctrl;
	u32 pmc_dpd_pads;

	/* configure the power management controller to trigger PMU
	 * interrupts when low */

	pmc_ctrl = readl(pmc + PMC_CTRL);
	writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL);

	pmc_dpd_pads = readl(pmc + PMC_DPD_PADS_ORIDE);
	writel(pmc_dpd_pads & ~PMC_DPD_PADS_ORIDE_BLINK , pmc + PMC_DPD_PADS_ORIDE);

	endeavor_gpio_rtc_init();

	int projectPhase = htc_get_pcbid_info();

	if (machine_is_endeavoru())
	{
		if (projectPhase == PROJECT_PHASE_XD){
			tps_platform.num_subdevs = ARRAY_SIZE(tps80031_devs_xd);
			tps_platform.subdevs = tps80031_devs_xd;
		} else if (projectPhase >= PROJECT_PHASE_XE){
			tps_platform.num_subdevs = ARRAY_SIZE(tps80031_devs_xe);
			tps_platform.subdevs = tps80031_devs_xe;
		}
	}
	else if (machine_is_erau())
	{
		tps_platform.num_subdevs = ARRAY_SIZE(tps80031_devs_xe);
		tps_platform.subdevs = tps80031_devs_xe;
	}

	i2c_register_board_info(4, endeavor_regulators, 1);
	endeavor_gpio_switch_regulator_init();
	pm_power_off = endeavor_power_off;


	if ( machine_is_endeavoru() && (htc_get_pcbid_info() <= PROJECT_PHASE_XC) ) {
		pr_info("[PMIC]Registering the device FAN53555\n");
		i2c_register_board_info(4, fan53555_boardinfo, 1);
	}

	return 0;
}
static int __init endeavoru_wifi_prepower(void)
{
	if (!machine_is_endeavoru())
		return 0;

	endeavor_wifi_power(1);

	return 0;
}
Пример #3
0
static int __init endeavoru_regulators_fixed_gpio_init(void)
{
    int ret;

    if (!machine_is_endeavoru())
        return 0;

    ret = endeavoru_fixed_regulator_init();
    if (ret)
        return ret;

    ret = endeavoru_gpio_regulator_init();
    return ret;
}
Пример #4
0
static int __init endeavor_gpio_switch_regulator_init(void)
{
	int i;
	if( machine_is_endeavoru() && (htc_get_pcbid_info() >= PROJECT_PHASE_XD) ) {
		gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_xd);
		gswitch_pdata.subdevs = gswitch_subdevs_xd;
	}
	else if (machine_is_erau()) {
                gswitch_pdata.num_subdevs = ARRAY_SIZE(gswitch_subdevs_xd);
                gswitch_pdata.subdevs = gswitch_subdevs_xd;
        }


	for (i = 0; i < gswitch_pdata.num_subdevs; ++i) {
		struct gpio_switch_regulator_subdev_data *gswitch_data =
						gswitch_pdata.subdevs[i];
		if (gswitch_data->gpio_nr <= TEGRA_NR_GPIOS)
			tegra_gpio_enable(gswitch_data->gpio_nr);
	}
	return platform_device_register(&gswitch_regulator_pdata);
}
Пример #5
0
static int endeavor_s5k3h2y_power_on(void)
{
	int ret;

	pr_info("[CAM] s5k3h2y power on ++\n");

	if (endeavor_s5k3h2y_power_state)
		return 0;

	tegra_gpio_disable(RAW_SPI_CLK);
	tegra_gpio_disable(RAW_SPI_CS);
	tegra_gpio_disable(RAW_SPI_DI);
	tegra_gpio_disable(RAW_SPI_DO);
	//tegra_gpio_disable(RAW_INTR0);
	//tegra_gpio_disable(RAW_INTR1);
	tegra_gpio_disable(CAM_I2C_SCL_GPIO);
	tegra_gpio_disable(CAM_I2C_SDA_GPIO);
	tegra_gpio_disable(CAM_MCLK_GPIO);

	gpio_direction_output(CAM_PWDN, 0);
	gpio_direction_output(CAM1_VCM_PD_GPIO, 0);
#if RAWCHIP
	gpio_direction_output(RAW_RSTN, 0);
#endif
	//ENR_msleep(1); //TODO

#ifdef CAMERA_REGULATOR
	//pr_info("[CAM] use regurator to get power\n");

#if RAWCHIP
	/*RAW_1V8_EN */
	gpio_direction_output(RAW_1V8_EN, 1);
	ENR_usleep(200);
#endif

	/* VCM */
	ret = regulator_enable(cam_vcm_2v85_en);
	if (ret < 0)
	{
		pr_err("[CAM] couldn't enable regulator v_cam1_vcm_2v85\n");
		regulator_put(cam_vcm_2v85_en);
		cam_vcm_2v85_en = NULL;
		return ret;
	}

	/* main/front cam analog*/
	ret = regulator_enable(cam_a2v85_en);
	if (ret < 0)
	{
		pr_err("[CAM] couldn't enable regulator cam_a2v85_en\n");
		regulator_put(cam_a2v85_en);
		cam_a2v85_en = NULL;
		return ret;
	}
	ENR_usleep(200);

	/*main cam core 1v2 & rawchip external 1v2 */
	ret = regulator_enable(cam_d1v2_en);
	if (ret < 0)
	{
		pr_err("[CAM] couldn't enable regulator cam_d1v2_en\n");
		regulator_put(cam_d1v2_en);
		cam_d1v2_en = NULL;
		return ret;
	}
	ENR_usleep(200);

#if RAWCHIP
	/*RAW_1V2_EN */
	if ((htc_get_pcbid_info() < PROJECT_PHASE_XE) && machine_is_endeavoru())
	{
		gpio_direction_output(RAW_1V2_EN, 1);
		ENR_usleep(200);
	}
#endif

	/* IO */
	ret = regulator_enable(cam_vddio_1v8_en);
	if (ret < 0)
	{
		pr_err("[CAM] couldn't enable regulator cam_vddio_1v8_en\n");
		regulator_put(cam_vddio_1v8_en);
		cam_vddio_1v8_en = NULL;
		return ret;
	}
	ENR_usleep(100);

	/*CAM SEL */
	gpio_direction_output(CAM_SEL_GPIO, 0);
	ENR_usleep(100);

#if RAWCHIP
	/*RAW_RSTN */
	gpio_direction_output(RAW_RSTN, 1);
	ENR_msleep(3);
	/*SPI send command to configure RAWCHIP here!*/
	yushan_spi_write(0x0008, 0x7f);
	ENR_msleep(1);
#endif

	/* XSHUTDOWM */
	gpio_direction_output(CAM_PWDN, 1);
	ENR_usleep(100);

	/* VCM PD*/
	gpio_direction_output(CAM1_VCM_PD_GPIO, 1);
	ENR_usleep(100);

#else/* use gpio pull up to get power*/
#if RAWCHIP
	/*RAW_1V8_EN */
	gpio_direction_output(RAW_1V8_EN, 1);
	ENR_usleep(200);
#endif

	/* VCM */
	gpio_direction_output(CAM_VCM2V85, 1);
	ENR_usleep(200);

	/* analog */
	gpio_direction_output(CAM_A2V85_EN, 1);
	ENR_usleep(200);

	/*core*/
	gpio_direction_output(CAM_D1V2_EN, 1);
	ENR_usleep(200);

#if RAWCHIP
	/*RAW_1V2_EN */
	if ((htc_get_pcbid_info() < PROJECT_PHASE_XE) && machine_is_endeavoru())
	{
		ret = gpio_direction_output(RAW_1V2_EN, 1);
		ENR_usleep(200);
	}
#endif

	/* IO */
	gpio_direction_output(CAMIO_1V8_EN, 1);
	ENR_usleep(100);

	/*CAM SEL */
	gpio_direction_output(CAM_SEL_GPIO, 0);
	ENR_usleep(100);

#if RAWCHIP
	/*RAW_RSTN */
	ret = gpio_direction_output(RAW_RSTN, 1);
	ENR_msleep(3);

	/*SPI send command to configure RAWCHIP here!*/
	yushan_spi_write(0x0008, 0x7f);
	ENR_msleep(1);
#endif

	/* XSHUTDOWM */
	gpio_direction_output(CAM_PWDN, 1);
	ENR_usleep(100);
	/* VCM PD*/
	gpio_direction_output(CAM1_VCM_PD_GPIO, 1);
	ENR_usleep(100);
#endif
	endeavor_s5k3h2y_power_state = 1;
	//pr_info("[CAM] s5k3h2y power on --\n");
	return 0;
}
Пример #6
0
static int endeavor_s5k3h2y_power_off(void)
{
	pr_info("[CAM] s5k3h2y power off ++\n");
	if (!endeavor_s5k3h2y_power_state)
		return 0;
	endeavor_s5k3h2y_power_state = 0;
#ifdef CAMERA_REGULATOR
	/* VCM PD*/
	gpio_direction_output(CAM1_VCM_PD_GPIO, 0);
	ENR_msleep(1);

	/* XSHUTDOWN */
	gpio_direction_output(CAM_PWDN, 0);
	ENR_msleep(1);

#if RAWCHIP
	/* RAW RSTN*/
	gpio_direction_output(RAW_RSTN, 0);
	ENR_msleep(3);
#endif

	/* VCM */
	regulator_disable(cam_vcm_2v85_en);
	ENR_msleep(1);

#if RAWCHIP
	/*RAW_1V2_EN */
	if ((htc_get_pcbid_info() < PROJECT_PHASE_XE) && machine_is_endeavoru())
	{
		gpio_direction_output(RAW_1V2_EN, 0);
		ENR_msleep(5);
	}
#endif

	/* digital */
	regulator_disable(cam_d1v2_en);
	ENR_msleep(1);

#if RAWCHIP
	/*RAW_1V8_EN */
	gpio_direction_output(RAW_1V8_EN, 0);
	ENR_msleep(1);
#endif

	/* analog */
	regulator_disable(cam_a2v85_en);
	ENR_msleep(5);
	/* IO */
	regulator_disable(cam_vddio_1v8_en);
	ENR_msleep(10);

#else/* use gpio pull down to disable power */
	/* VCM PD*/
	gpio_direction_output(CAM1_VCM_PD_GPIO, 0);
	ENR_msleep(1);
	/* TODO: Set 0x0100[0] = 0 (Enter SW Standby mode)*/

	/* XSHUTDOWN */
	gpio_direction_output(CAM_PWDN, 0);
	ENR_msleep(1);

#if RAWCHIP
	/* RAW RSTN*/
	gpio_direction_output(RAW_RSTN, 0);
	ENR_msleep(3);
#endif

	/* VCM */
	gpio_direction_output(CAM_VCM2V85, 0);
	ENR_msleep(1);

#if RAWCHIP
	/*RAW_1V2_EN */
	if ((htc_get_pcbid_info() < PROJECT_PHASE_XE) && machine_is_endeavoru())
	{
		gpio_direction_output(RAW_1V2_EN, 0);
		ENR_msleep(5);
	}
#endif

	/* digital */
	gpio_direction_output(CAM_D1V2_EN, 0);
	ENR_msleep(1);

#if RAWCHIP
	/*RAW_1V8_EN */
	gpio_direction_output(RAW_1V8_EN, 0);
	ENR_msleep(1);
#endif

	/* analog */
	gpio_direction_output(CAM_A2V85_EN, 0);
	ENR_msleep(5);
	/* IO */
	gpio_direction_output(CAMIO_1V8_EN, 0);
	ENR_msleep(10);
#endif

	/* set gpio output low : O(L) */
	tegra_gpio_enable(RAW_SPI_CLK);
	tegra_gpio_enable(RAW_SPI_CS);
	tegra_gpio_enable(RAW_SPI_DI);
	tegra_gpio_enable(RAW_SPI_DO);
	//tegra_gpio_enable(RAW_INTR0);
	//tegra_gpio_enable(RAW_INTR1);
	tegra_gpio_enable(CAM_I2C_SCL_GPIO);
	tegra_gpio_enable(CAM_I2C_SDA_GPIO);
	tegra_gpio_enable(CAM_MCLK_GPIO);

	return 0;
}