コード例 #1
0
static int ov2720_power_up(const struct msm_camera_sensor_info *data)
{
	int32_t rc = 0;
	pr_err("%s: %d\n", __func__, __LINE__);
	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
	rc = gpio_request(data->sensor_reset, "SENSOR_NAME");
	if (rc < 0)
		goto gpio_request_fail;

	pr_err("%s: reset sensor\n", __func__);
	gpio_direction_output(data->sensor_reset, 0);
	msleep(50);
	gpio_set_value_cansleep(data->sensor_reset, 1);
	msleep(50);

	rc = msm_sensor_match_id(&ov2720_s_ctrl);
	if (rc < 0)
		goto init_probe_fail;

	goto init_probe_done;
gpio_request_fail:
	pr_err("%s: gpio request fail\n", __func__);
	return rc;
init_probe_fail:
	pr_err(" %s fails\n", __func__);
	ov2720_power_down(data);
	return rc;
init_probe_done:
	pr_err("%s finishes\n", __func__);
	return rc;
}
コード例 #2
0
static int camera_power_on_rear(void)
{
	int rc = 0;
	mutex_lock(&camera_power_mutex);
		
	rc = gpio_direction_output(GPIO_CAM_PWDN, 1);
	if (rc < 0) {
		pr_err("%s: gpio_direction_output(GPIO_CAM_PWDN, 1) failed(2)\n", __func__);
	}

	udelay(10);		

	msm_camio_clk_rate_set(HI351_MASTER_CLK_RATE);
	pr_err("%s: msm_camio_clk_rate_set\n", __func__);

	mdelay(10);

	gpio_set_value(GPIO_CAM_RESET, 1);
	pr_err("%s: gpio_set_value(GPIO_CAM_RESET, 1) final\n", __func__);

	mdelay(1);

	mutex_unlock(&camera_power_mutex);


	return rc;
}
コード例 #3
0
int tcm9001md_power_on(void)
{
    int rc = 0;

    /* Setting MCLK = 24MHz */
    msm_camio_clk_rate_set(24000000);
    msm_camio_camif_pad_reg_reset();
    printk(KERN_INFO "%s: Setting MCLK = 24MHz \n", __func__);

    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->vga_rst_pin, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Re-set config for gpio %d .\n", __func__, tcm9001mdinfo->vga_rst_pin);

    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->vga_pwdn_pin, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Re-set config for gpio %d .\n", __func__, tcm9001mdinfo->vga_pwdn_pin);

    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->vga_power_en_pin, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Re-set config for gpio %d .\n", __func__, tcm9001mdinfo->vga_power_en_pin);

    /* Pull hight power enable = GPIO98  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_power_en_pin, "tcm9001md", 1);
    if (rc)
        return rc;

    mdelay(1);  //t1+t2+t3 = 1ms

    /* Pull hight PWRDWN = CAM_VGA_STANDBY  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 1);
    if (rc)
        return rc;

    mdelay(2);  //t4 = 1ms

    /* Enable  MCLK = 24MHz */
    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->MCLK_PIN, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);//Div2-SW6-MM-MC-Camera-ModifiedPowerSequence-01*
    printk(KERN_INFO "%s: Output MCLK end.  \n", __func__);

    mdelay(2);

    /* Pull Low PWRDWN = CAM_VGA_STANDBY  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 0);
    if (rc)
        return rc;

    mdelay(2);  //t5 = 2ms

    /* Pull High REDET = CAM_VGA_RST_N  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_rst_pin, "tcm9001md", 1);
    if (rc)
        return rc;

    mdelay(2);  //t6 > 2ms

//Div2-SW6-MM-MC-FrontCameraInitFail-00+{
#ifdef CONFIG_TCM9001MD_STANDBY
    tcm9001md_first_init = 0;
#endif
//Div2-SW6-MM-MC-FrontCameraInitFail-00+}

    return rc;
}
コード例 #4
0
ファイル: msm_sensor.c プロジェクト: Snuzzo/funky_msm8960
int32_t msm_sensor_power_up(const struct msm_camera_sensor_info *data)
{
	int32_t rc = 0;
	int32_t gpio = 0;
	pr_info("%s: %d\n", __func__, __LINE__);
	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);

	if (data->sensor_platform_info->sensor_reset_enable)
		gpio = data->sensor_platform_info->sensor_reset;
	else
		gpio = data->sensor_platform_info->sensor_pwd;

	rc = gpio_request(gpio, "SENSOR_NAME");
	if (!rc) {
		CDBG("%s: reset sensor\n", __func__);
		gpio_direction_output(gpio, 0);
		usleep_range(1000, 2000);
		gpio_set_value_cansleep(gpio, 1);
		usleep_range(4000, 5000);
	} else {
		pr_err("%s: gpio request fail", __func__);
	}

	return rc;
}
コード例 #5
0
/* VT only have pwd pin */
static int ovm7692_power_on(const struct msm_camera_sensor_info *data)
{
	int rc = 0;

	if (ovm7692_probe_completed) {
		/* only enable after sensor probe */
		rc = msm_camio_clk_enable(CAMIO_MDC_CLK);
		rc = msm_camio_clk_enable(CAMIO_VFE_MDC_CLK);
	}

	/* Input MCLK = 24MHz */
	msm_camio_clk_rate_set(24000000);
	mdelay(5);

	rc = gpio_request(data->sensor_pwd, "ovm7692");
	if (rc == 0) {
		/* GPIO PIN turn on */
		rc = gpio_direction_output(data->sensor_pwd, 1); /* inactive */
		mdelay(5);
		rc = gpio_direction_output(data->sensor_pwd, 0); /* active */
	}
	gpio_free(data->sensor_pwd);

	CDBG("ovm7692_power_on [e]\n");
	return rc;
}
コード例 #6
0
static int s5k6aafx13_power_on(void)
{
	int rc = 0;

	CDBG("%s E\n", __func__);

	if (sgpio_ctrl(sgpios, CAMIO_R_RST_N, 0) < 0)	rc = -EIO;
	if (sgpio_ctrl(sgpios, CAMIO_R_STB_N, 0) < 0)	rc = -EIO;

	if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 0) < 0)	rc = -EIO;
	if (sgpio_ctrl(sgpios, CAMIO_F_STB_N, 0) < 0)	rc = -EIO;
	if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 20us */
	if (svreg_ctrl(svregs, CAMV_CORE_1P5V, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 15us */
	if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0)	rc = -EIO;
	mdelay(1);
	if (sgpio_ctrl(sgpios, CAMIO_F_STB_N, 1) < 0)	rc = -EIO;
	msm_camio_clk_rate_set(24000000);
	msleep(10); /* > 50us */
	if (sgpio_ctrl(sgpios, CAMIO_F_RST_N, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 50us */

	CDBG("%s X (%d)\n", __func__, rc);
	return rc;
}
コード例 #7
0
ファイル: sr130pc10.c プロジェクト: vitaliyy/msm7x30
int sr130pc10_sensor_init(const struct msm_camera_sensor_info *data)
{
  int i, rc = 0;
	printk("[SR130PC10] %s/%d \n", __func__, __LINE__);	

#ifdef CONFIG_LOAD_FILE
	if(0 > sr130pc10_regs_table_init()) {
			CDBG("%s file open failed!\n",__func__);
			rc = -1;
			goto init_fail;
	}
#endif
        
	sr130pc10_ctrl = kzalloc(sizeof(struct sr130pc10_ctrl_t), GFP_KERNEL);
	if (!sr130pc10_ctrl) {
		printk("[SR130PC10]sr130pc10_init failed!\n");
		rc = -ENOMEM;
		goto init_done;
	}
    prev_vtcall_mode=-1;

	if (data)
		sr130pc10_ctrl->sensordata = data;

  /* Input MCLK = 24MHz */
  msm_camio_clk_rate_set(24000000);
  msleep(5);
  
  msm_camio_camif_pad_reg_reset();
  sr130pc10_set_power(true);
  
  rc = sr130pc10_sensor_init_probe();

  if(rc < 0)
  {
    for(i=0;i<5;i++)
    {
      printk("[SR130PC10]sr130pc10_sensor_init failed!\n");
      sr130pc10_set_power(false);
      mdelay(50);
      msm_camio_camif_pad_reg_reset();
      sr130pc10_set_power(true);
      msleep(5);
      rc = sr130pc10_sensor_init_probe();
      probe_init_retry++;
      if(rc >= 0)break;
    }
    if(rc < 0)goto init_fail;
  }

init_done:
	return rc;

init_fail:
	kfree(sr130pc10_ctrl);
	return rc;
}
コード例 #8
0
static int s5k6aafx_hw_init()
{
	int rc = 0;

	printk("<=PCAM=> ++++++++++++++++++++++++++s5k6aafx test driver++++++++++++++++++++++++++++++++++++ \n");

	gpio_tlmm_config(GPIO_CFG(CAM_RESET, 0,GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); //CAM_RESET
	gpio_tlmm_config(GPIO_CFG(CAM_STANDBY, 0,GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); //CAM_STANDBY
	gpio_tlmm_config(GPIO_CFG(CAM_EN, 0,GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); //CAM_EN
	gpio_tlmm_config(GPIO_CFG(CAM_VT_RST, 0,GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); //CAM_VT_RST
	gpio_tlmm_config(GPIO_CFG(CAM_VT_nSTBY, 0,GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); //CAM_VT_nSTBY

	gpio_set_value(CAM_VT_RST, 0); //VT_RST -> DOWN
	mdelay(30);
	gpio_set_value(CAM_VT_nSTBY, 0); //VT_nSTBY -> DOWN
	mdelay(30);
	struct vreg* vreg_L8;
	vreg_L8 = vreg_get(NULL, "gp7");
	vreg_set_level(vreg_L8, 1500);
	vreg_disable(vreg_L8);
	mdelay(30);
	gpio_set_value(CAM_EN, 0); //EN -> DOWN

	msleep(300);
	
	gpio_set_value(CAM_EN, 1); //EN -> UP
	vreg_enable(vreg_L8);
	mdelay(1);

	gpio_set_value(CAM_VT_nSTBY, 1); //VT_nSTBY -> UP
	mdelay(1);

	/* Input MCLK = 24MHz */
       	gpio_tlmm_config(GPIO_CFG(CAM_MCLK, 1,GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_16MA), GPIO_CFG_ENABLE); //CAM_MCLK            
	msm_camio_clk_rate_set(24000000);	//MCLK
	msm_camio_camif_pad_reg_reset();
	mdelay(1);

	gpio_set_value(CAM_STANDBY, 1); //STBY -> UP
	mdelay(1);

	gpio_set_value(CAM_RESET, 1); //REST -> UP
	mdelay(1);

	gpio_set_value(CAM_STANDBY, 0); //STBY -> DOWN
	mdelay(1);

	gpio_set_value(CAM_VT_RST, 1); //VT_RST -> UP
	mdelay(30);

	cam_gpio_print(3);			//debug

	return rc;

}
コード例 #9
0
static int32_t ov7736_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
	int32_t rc = 0;
	struct msm_camera_sensor_platform_info *pinfo =
		s_ctrl->sensordata->sensor_platform_info;

	pr_info("ov7736_power_up R:%d P:%d A:%d 1.8:%s\n",
			pinfo->sensor_reset,
			pinfo->sensor_pwd,
			pinfo->analog_en,
			pinfo->reg_1p8);

	rc = gpio_request(pinfo->analog_en, "ov7736");
	if (rc < 0) {
		pr_err("ov7736: gpio request ANALOG_EN failed (%d)\n",
				rc);
		goto power_up_done;
	}
	rc = gpio_request(pinfo->sensor_pwd, "ov7736");
	if (rc < 0) {
		pr_err("ov7736: gpio request PWRDWN failed (%d)\n", rc);
		goto power_up_done;
	}
	rc = gpio_request(pinfo->sensor_reset, "ov7736");
	if (rc < 0) {
		pr_err("7736: gpio request RESET failed (%d)\n", rc);
		goto power_up_done;
	}
	gpio_direction_output(pinfo->sensor_pwd, 1);

	rc = ov7736_regulator_on(&reg_1p8, pinfo->reg_1p8, 1800000);
	if (rc < 0)
		goto power_up_done;
	usleep_range(5000, 5000);

	gpio_direction_output(pinfo->analog_en, 1);
	usleep(20000);

	msm_sensor_probe_on(&s_ctrl->sensor_i2c_client->client->dev);
	msm_camio_clk_rate_set(OV7736_DEFAULT_CLOCK_RATE);
	usleep(5000);

	gpio_direction_output(pinfo->sensor_pwd, 0);

	gpio_direction_output(pinfo->sensor_reset, 1);
	msleep(20);

power_up_done:
	return rc;
}
コード例 #10
0
void  main_camera_power_on (void)
{
    printk("%s: \n", __func__);
    
    gpio_set_value(157, 0); // RESET_BAR

    /* +1V8_5MCAM_VIO*/
    lvs0_1p8 = regulator_get(NULL, "8058_lvs0");
    if (IS_ERR(lvs0_1p8)) {
        pr_err("%s: LVS0 get failed\n", __func__);
        lvs0_1p8 = NULL;
        return;
    }
    regulator_set_voltage(lvs0_1p8, 1800000, 1800000);
    regulator_enable(lvs0_1p8);
    
    msm_camio_clk_rate_set(24000000);
    gpio_set_value(157, 1); // RESET_BAR
    msleep(1);
    
    /* +2V8_5MCAM_AVDD*/
    ldo9_2p8 = regulator_get(NULL, "8058_l9");
    if (IS_ERR(ldo9_2p8)) {
        pr_err("%s: VREG LDO9 get failed\n", __func__);
        ldo9_2p8 = NULL;
        return;
    }
    regulator_set_voltage(ldo9_2p8, 2800000, 2800000);
    regulator_enable(ldo9_2p8);
    
    /* +2V8_5MCAM_AF*/
    ldo8_2p8 = regulator_get(NULL, "8058_l8");
    if (IS_ERR(ldo8_2p8)) {
        pr_err("%s: VREG LDO8 get failed\n", __func__);
        ldo8_2p8 = NULL;
        return;
    }
    regulator_set_voltage(ldo8_2p8, 2800000, 2800000);
    regulator_enable(ldo8_2p8);
    
    msleep(1);			
}
コード例 #11
0
/* VT only have pwd pin */
static int ovm7692_power_off(const struct msm_camera_sensor_info *data)
{
	int rc = 0;

	rc = gpio_request(data->sensor_pwd, "ovm7692");
	if (rc == 0)
		rc = gpio_direction_output(data->sensor_pwd, 1); /* inactive */

	gpio_free(data->sensor_pwd);

	if (ovm7692_probe_completed) {	/* only enable after sensor probe */
		rc = msm_camio_clk_disable(CAMIO_MDC_CLK);
		rc = msm_camio_clk_disable(CAMIO_VFE_MDC_CLK);
	}

	/* Output CAM_MCLK(0MHz) */
	msm_camio_clk_rate_set(0);

	CDBG("ovm7692_sensor_poweroff [e]\n");
	return rc;
}
コード例 #12
0
int camera_power_on (void)
{
	struct device *dev = lu3100_backlight_dev();
	printk("dev = %d\n",dev);

	



    aat28xx_ldo_set_level(dev, 1, 1200);

	aat28xx_ldo_set_level(dev, 4, 2700);

	aat28xx_ldo_set_level(dev, 2, 2700);

	aat28xx_ldo_set_level(dev, 3, 2800);

	
	aat28xx_ldo_enable(dev, 1, 1);	
	mdelay(1);

	aat28xx_ldo_enable(dev, 4, 1);	
	mdelay(1);
	aat28xx_ldo_enable(dev, 2, 1);	
	mdelay(1);
	aat28xx_ldo_enable(dev, 3, 1);	
	mdelay(5);

#if 0
	msm_camio_clk_rate_set(24000000);
	mdelay(5);
	msm_camio_camif_pad_reg_reset();

	mdelay(5);

	gpio_set_value(0, 1);	
	
#endif
	return 0;
}
コード例 #13
0
ファイル: msm_sensor.c プロジェクト: CSRedRat/CM-LG-L5_Kernel
int32_t msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
	int32_t rc = 0;
	struct msm_camera_sensor_info *data = s_ctrl->sensordata;
	CDBG("%s: %d\n", __func__, __LINE__);
	msm_sensor_probe_on(&s_ctrl->sensor_i2c_client->client->dev);
	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
	rc = gpio_request(data->sensor_platform_info->sensor_reset,
		"SENSOR_NAME");
	if (!rc) {
		CDBG("%s: reset sensor\n", __func__);
		gpio_direction_output(data->sensor_platform_info->sensor_reset,
			 0);
		usleep_range(1000, 2000);
		gpio_set_value_cansleep(data->sensor_platform_info->
			sensor_reset, 1);
		usleep_range(4000, 5000);
	} else {
		CDBG("%s: gpio request fail", __func__);
	}
	return rc;
}
コード例 #14
0
int camera_power_on (void)
{
	int rc;
	struct device *dev = thunderg_backlight_dev();
	
	
	gpio_set_value(GPIO_CAM_RESET, 0);
	gpio_set_value(GPIO_CAM_PWDN, 0);

	
	if (lge_bd_rev == LGE_REV_B) {
		rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 2800);
		if (rc < 0) {
			printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AF_NO);
			return rc;
		}
		rc = aat28xx_ldo_enable(dev, LDO_CAM_AF_NO, 1);
		if (rc < 0) {
			printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AF_NO);
			return rc;
		}
	} else {	
		struct vreg *vreg_mmc = vreg_get(0, "mmc");
		vreg_set_level(vreg_mmc, 2800);
		vreg_enable(vreg_mmc);
	}

  
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 1200);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
		return rc;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
		return rc;
	}

  
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 2600);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
		return rc;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
		return rc;
	}

	
	
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
		return rc;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
		return rc;
	}	

	mdelay(5);
	
	msm_camio_clk_rate_set(mclk_rate);
	mdelay(5);
	msm_camio_camif_pad_reg_reset();
	mdelay(5);

	
	gpio_set_value(GPIO_CAM_RESET, 1);

	mdelay(5); 
	
	gpio_set_value(GPIO_CAM_PWDN, 1);
	
	mdelay(8);  


	return rc;

}
コード例 #15
0
int32_t mt9v113_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
	int32_t rc = 0;

	SKYCDBG("%s E\n", __func__);
	
	msm_sensor_probe_on(&s_ctrl->sensor_i2c_client->client->dev);
	SKYCDBG("%s msm_sensor_probe_on ok\n", __func__);
	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
	SKYCDBG("%s msm_camio_clk_rate_set ok\n", __func__);

	rc = sgpio_init(sgpios, CAMIO_MAX);
	if (rc < 0)
		goto sensor_init_fail;

	rc = svreg_init(svregs, CAMV_MAX);
	if (rc < 0)
		goto sensor_init_fail;

	if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0)	rc = -EIO;
	if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0)	rc = -EIO;
	mdelay(1);

	if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 1ms */

#if defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER < WS20)
	rc = gpio_direction_output(91, 1);
	if (rc < 0) {
		SKYCDBG("%s err(%d, gpio91)\n", __func__, rc);
		rc = -EIO;
		return rc;	
	}
	mdelay(1);	
#elif defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER >= WS20)	
	if (sgpio_ctrl(sgpios, CAMV_A_2P8V, 1) < 0)	rc = -EIO;	
	mdelay(1);
#endif

	if (sgpio_ctrl(sgpios, CAMV_CORE_1P8V, 1) < 0)	rc = -EIO;
	mdelay(1);	

	if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0)	rc = -EIO;
	mdelay(1); /* > 10 clks (approx. 0.42us) */
	if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 1 clk (apporx. 0.042us) */
	
	msleep(500); /* 500ms PANTECH_CAMERA_TODO */
	//msm_camio_clk_rate_set(24000000);
	msleep(10);

	SKYCDBG("%s X (%d)\n", __func__, rc);
	return rc;
   
sensor_init_fail:
	/*PANTECH_CAMERA_TODO, check correct timing, spec don't have off seq. */
	if (sgpio_ctrl(sgpios, CAMIO_STB_N, 0) < 0)	rc = -EIO;
	if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0)	rc = -EIO;
	mdelay(1);
	
	if (svreg_ctrl(svregs, CAMV_IO_1P8V, 0) < 0)	rc = -EIO;		
	if (sgpio_ctrl(sgpios, CAMV_CORE_1P8V, 0) < 0)	rc = -EIO;

#if defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER < WS20)
	rc = gpio_direction_output(91, 0);
	if (rc < 0) {
		SKYCDBG("%s err(%d, gpio91)\n", __func__, rc);
		rc = -EIO;
		return rc;
	}
	mdelay(1);	
#elif defined(CONFIG_MACH_MSM8960_STARQ) && (BOARD_VER >= WS20)	
	if (sgpio_ctrl(sgpios, CAMV_A_2P8V, 0) < 0)	rc = -EIO;	
	mdelay(1);
#endif

	svreg_release(svregs, CAMV_MAX);
	sgpio_release(sgpios, CAMIO_MAX);
	return rc;   		
}
コード例 #16
0
int camera_power_on (void)
{
	int rc;
	struct device *dev = gelato_backlight_dev();
	int retry  = 0;

	/* clear RESET, PWDN to Low*/
	gpio_set_value(GPIO_CAM_RESET, 0);
	gpio_set_value(GPIO_CAM_PWDN, 0);

	aat28xx_power(dev, 1);

	/*
	 * 2011-04-23, [email protected]
	 * wait for Backlight IC enable.
	 * because camera application does not work well permanently after power on failure.
	 */
	for (retry = 100; retry != 0; retry--) {
		/* FIXME: check the Backlight IC enable status using another method */
		rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 2800);
		if (rc < 0) {
			//printk("%s, wait for Backlight IC enabling, ramian retry %d\n", __func__, retry);
			msleep(50);
		} else {
			break;
		}
	}

	/*AVDD power 2.8V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AF_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AF_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AF_NO);
		goto power_on_fail;
	}

  /* DVDD power 1.2V */
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 1800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}

	udelay(500);

	/*AVDD power  2.7V*/
	/* LGE_CHANGE 
	  * Change AVDD level from 2.7V to 2.8V in order to reduce camera noise in dard environment.
	  * 2010-08-03. [email protected]
	  */
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}	

	udelay(100);
		
  /*IOVDD power 2.6V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}


	mdelay(5);
	/*M Clock -24Mhz*/
	msm_camio_clk_rate_set(mclk_rate);
	mdelay(5);
	msm_camio_camif_pad_reg_reset();
	mdelay(5);

	/*Nstandby high*/
	gpio_set_value(GPIO_CAM_PWDN, 1);

	udelay(20);

	/*reset high*/
	gpio_set_value(GPIO_CAM_RESET, 1);
	mdelay(5); 
	camera_power_state = CAM_POWER_ON;

	/*Hitachi LCD LUT*/
	if(gelato_panel_id==1){
		mdp_load_hitachi_lut(2);
	}
power_on_fail:
	return rc;
}
コード例 #17
0
ファイル: lsi_mc7.c プロジェクト: Oleg-k/Cranium_Kernel
static int mc7_sensor_open_init(const struct msm_camera_sensor_info *data)
{
	int rc = 0;
	unsigned int val;
	struct packet *i2c_pkt;

	FUNC_ENTER();

	/* Reset MIPI configuration flag */
	config_csi = 0;

	if (mc7_i2c_client->irq)
		rc = request_irq(mc7_i2c_client->irq, mc7_int_handler,
			       IRQF_DISABLED | IRQF_TRIGGER_RISING, mc7_i2c_client->name, NULL);
	if (rc)
		printk(KERN_ERR "LSI-MC7: %s: cannot request irq\n", __func__);

	mc7_ctrls = kzalloc(sizeof(struct mc7_ctrls_t), GFP_KERNEL);
	if (!mc7_ctrls) {
		printk(KERN_ERR "LSI-MC7: %s: probe from VFE failed\n", __func__);
		rc = -ENOMEM;
		goto vfe_probe_fail0;
	}

	if (data)
		mc7_ctrls->sensordata = data;

	msm_camio_clk_rate_set(24000000);

	mc7_gpio_int = 0;
	mc7_sensor_power_on_off(1 ,data);
	rc = wait_mc7_int(60);

	/* If the user has set update firmware flag then update the firmware first */
	if (mc7_firmware_upd) {
		mc7_firmware_upd = 0;
		/* write PLL divider value */
		mc7_catparam_i2c_write(2, 0xf, 0x24, 0x001A);

		/* firmware is send first */
		for (i2c_pkt = &dynamic_firmware_array[0]; i2c_pkt->length != 0; i2c_pkt++)
			firmware_write(i2c_pkt->length, i2c_pkt->firmware);
		/* Now send the flash writer program */
		for (i2c_pkt = &mc7_fl_write_array[0]; i2c_pkt->length != 0; i2c_pkt++)
			firmware_write(i2c_pkt->length, i2c_pkt->firmware);

		mc7_catparam_i2c_write(4, 0xf, 0x0C, 0x6807E000);
		mc7_catparam_i2c_write(1, 0xf, 0x12, 0x01);

		rc = wait_mc7_int(300);
		if (!rc)
			printk(KERN_ERR "LSI-MC7: firmware successfully writen to serial flash\n");
		else {
			printk(KERN_ERR "LSI-MC7: firmware update failed\n");
			return rc;
		}
		vfree(firmware_area);
		firmware_area = NULL;
	}

	/* Set the PLL divider value */
	mc7_catparam_i2c_write(2, 0xf, 0x24, 0x001A);

	/* Now send the flash loader program */
	firmware_write(sizeof(mc7_fl_load_1), mc7_fl_load_1);

	/* Set the camera start address */
	mc7_catparam_i2c_write(4, 0xf, 0x0C, 0x6807E000);

	/* start the loader program */
	mc7_catparam_i2c_write(1, 0xf, 0x12, 0x01);
	rc = wait_mc7_int(1);

#ifdef DOWNLOAD_IF_MC7_EMPTY
	if (rc) {
		printk(KERN_ERR "LSI-MC7: serial flash is empty, going to write it\n");
		/* Power recycle MC7 */
		mc7_sensor_power_on_off(0 ,data);
		mc7_sensor_power_on_off(1 ,data);
		rc = wait_mc7_int(60);

		/* write PLL divider value */
		mc7_catparam_i2c_write(2, 0xf, 0x24, 0x001A);

		/* firmware is send first */
		for (i2c_pkt = &mc7_firmware_array[0]; i2c_pkt->length != 0; i2c_pkt++)
			firmware_write(i2c_pkt->length, i2c_pkt->firmware);

		/* Now send the flash writer program */
		for (i2c_pkt = &mc7_fl_write_array[0]; i2c_pkt->length != 0; i2c_pkt++)
			firmware_write(i2c_pkt->length, i2c_pkt->firmware);

		/* write the address of the program */
		mc7_catparam_i2c_write(4, 0xf, 0x0C, 0x6807E000);

		/* start the writer program */
		mc7_catparam_i2c_write(1, 0xf, 0x12, 0x01);

		rc = wait_mc7_int(300);
		if (!rc)
			printk(KERN_ERR "LSI-MC7: firmware successfully writen to serial flash\n");
		else
			printk(KERN_ERR "LSI-MC7: firmware update failed\n");

		/* Set the PLL divider value */
		mc7_catparam_i2c_write(2, 0xf, 0x24, 0x001A);

		/* Now send the flash loader program */
		firmware_write(sizeof(mc7_fl_load_1), mc7_fl_load_1);

		/* Set the camera start address */
		mc7_catparam_i2c_write(4, 0xf, 0x0C, 0x6807E000);

		/* start the loader program */
		mc7_catparam_i2c_write(1, 0xf, 0x12, 0x01);
		rc = wait_mc7_int(1);
	}
#endif
	/* Read the interrupt status */
	mc7_catparam_i2c_read(1, 0x0, 0x1c, &val);
	MC7DBG("Loader program successfully booted the firmware\n");

	return rc;
vfe_probe_fail0:
	return rc;
}
コード例 #18
0
static int cam_hw_init()
{
	int rc = 0;
	struct vreg *vreg_L8;

#ifdef CONFIG_MACH_ICON
	msm_camio_camif_pad_reg_reset();
	mdelay(10);

	gpio_set_value(CAM_VT_RST, 1);
	mdelay(1);
#else
	printk(KERN_DEBUG
	    "<=PCAM=> ++++++++++++++++++++++++++"
		"sr130pc10 test driver"
		"++++++++++++++++++++++++++++++++++++\n");
	gpio_tlmm_config(GPIO_CFG(CAM_RESET, 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_RESET */
	gpio_tlmm_config(GPIO_CFG(CAM_STANDBY, 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_STANDBY */
	gpio_tlmm_config(GPIO_CFG(CAM_EN, 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_EN */
	gpio_tlmm_config(GPIO_CFG(CAM_EN_2, 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_EN_2 */
	gpio_tlmm_config(GPIO_CFG(CAM_VT_RST, 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_VT_RST */
	gpio_tlmm_config(GPIO_CFG(CAM_VT_nSTBY, 0, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_VT_nSTBY */

	vreg_L8 = vreg_get(NULL, "gp7");
	vreg_set_level(vreg_L8, 1800);
	vreg_disable(vreg_L8);

	gpio_set_value(CAM_RESET, 0);
	gpio_set_value(CAM_STANDBY, 0);
	gpio_set_value(CAM_EN, 0);
	gpio_set_value(CAM_EN_2, 0);
	gpio_set_value(CAM_VT_RST, 0);
	gpio_set_value(CAM_VT_nSTBY, 0);

	/*mdelay(1);		changed for coding rule*/
	mdelay(1);

	gpio_set_value(CAM_EN_2, 1);	/*CAM_EN->UP */
	gpio_set_value(CAM_EN, 1); /*CAM_EN->UP*/
	vreg_enable(vreg_L8);
	udelay(10);

	gpio_set_value(CAM_VT_nSTBY, 1); /*VGA_STBY UP*/
	udelay(10);

	gpio_tlmm_config(GPIO_CFG(CAM_MCLK, 1, GPIO_CFG_OUTPUT,
		GPIO_CFG_NO_PULL, GPIO_CFG_16MA),
		GPIO_CFG_ENABLE);	/*CAM_MCLK */
	msm_camio_clk_rate_set(24000000);	/*MCLK*/
	msm_camio_camif_pad_reg_reset();

	gpio_set_value(CAM_VT_RST, 1); /*VGA_RESET UP*/
	mdelay(1);
#endif
	return rc;
}
コード例 #19
0
//Div2-SW6-MM-MC-BringUpHM0357ForSF5PCR-00*{
static int tcm9001md_sensor_probe(const struct msm_camera_sensor_info *info,
				struct msm_sensor_ctrl *s)
{
    unsigned char v;
    int rc = i2c_add_driver(&tcm9001md_i2c_driver);

    printk(KERN_INFO "tcm9001md_sensor_probe: Called.....\n");

    if (rc < 0 || tcm9001md_client == NULL) {
        rc = -ENOTSUPP;
        goto probe_done;
    }
    tcm9001mdinfo= info;

    v = 0;
    /* Init VGA pins state */
#if 0
    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->vga_rst_pin, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Re-set config for gpio %d .\n", __func__, tcm9001mdinfo->vga_rst_pin);

    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->vga_pwdn_pin, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Re-set config for gpio %d .\n", __func__, tcm9001mdinfo->vga_pwdn_pin);

    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->vga_power_en_pin, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Re-set config for gpio %d .\n", __func__, tcm9001mdinfo->vga_power_en_pin);
#endif
    
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_rst_pin, "tcm9001md", 0);
    if (rc)
        return rc;
    
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 0);
    if (rc)
        return rc;
    
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_power_en_pin, "tcm9001md", 0);
    if (rc)
        return rc;

    /* Here to check sensor is existence */
    msm_camio_clk_enable(CAMIO_CAM_MCLK_CLK);
    msleep(30);

    /* Setting MCLK = 24MHz */
    msm_camio_clk_rate_set(24000000);
    //msm_camio_camif_pad_reg_reset();
    printk(KERN_INFO "%s: Setting MCLK = 24MHz \n", __func__);

    /* Pull hight power enable = GPIO98  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_power_en_pin, "tcm9001md", 1);
    if (rc)
        return rc;

    mdelay(1);  //t1+t2+t3 = 1ms

    /* Pull hight PWRDWN = CAM_VGA_STANDBY  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 1);
    if (rc)
        return rc;

    mdelay(2);  //t4 = 1ms

    /* Enable  MCLK = 24MHz */
    gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->MCLK_PIN, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
    printk(KERN_INFO "%s: Output MCLK end.  \n", __func__);

    mdelay(2);

    /* Pull Low PWRDWN = CAM_VGA_STANDBY  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 0);
    if (rc)
        return rc;

    mdelay(2);  //t5 = 2ms

    /* Pull High REDET = CAM_VGA_RST_N  */
    rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_rst_pin, "tcm9001md", 1);
    if (rc)
        return rc;

    mdelay(2);  //t6 > 2ms

    // Here to check chip version identification.
    rc = tcm9001md_i2c_read(tcm9001md_client, REG_TCM9001MD_MODEL_ID_1, &v);
    if (rc < 0 || v != TCM9001MD_MODEL_ID_1)
    {
        printk("tcm9001md_sensor_probe: ERR: Red MODEL_ID_1 = 0x%x failed !\n", v);
        goto probe_done;
    }
    printk("tcm9001md_sensor_probe: MODEL_ID_1 = 0x%x .\n", v);

    rc = tcm9001md_i2c_read(tcm9001md_client, REG_TCM9001MD_MODEL_ID_2, &v);
    if (rc < 0 || v != TCM9001MD_MODEL_ID_2)
    {
        printk("tcm9001md_sensor_probe: ERR: Red MODEL_ID_2 = 0x%x failed !\n", v);
        goto probe_done;
    }
    printk("tcm9001md_sensor_probe: MODEL_ID_2 = 0x%x .\n", v);

    s->s_init = tcm9001md_sensor_init;
    s->s_release = tcm9001md_sensor_release;
    s->s_config  = tcm9001md_sensor_config;
    s->s_camera_type = FRONT_CAMERA_2D; 
    s->s_mount_angle = 0;

probe_done:
    tcm9001md_power_off();
    msm_camio_clk_disable(CAMIO_CAM_MCLK_CLK);
    CDBG("%s %s:%d\n", __FILE__, __func__, __LINE__);
    return rc;
}
コード例 #20
0
////////////////////////////////
// Power ON
////////////////////////////////
static int cam12mp_sensor_poweron(void)
{
    struct vreg *vreg_gp1, *vreg_gp6;

    LOGI("+%s()\n", __func__);

    vreg_gp6 = vreg_get(NULL, "gp6");
    if (IS_ERR(vreg_gp6)) {
        LOGE(" - vreg_get(gp6) failed (%ld) !\n", PTR_ERR(vreg_gp6));
        return -1;
    }
    if (vreg_set_level(vreg_gp6, 1800)) {
        LOGE(" - vreg gp6 set level failed !\n");
        return -1;
    }
    vreg_gp1 = vreg_get(NULL, "gp1");
    if (IS_ERR(vreg_gp1)) {
        LOGE(" - vreg_get(gp1) failed (%ld)\n", PTR_ERR(vreg_gp1));
        return -1;
    }
    if (vreg_set_level(vreg_gp1, 2700)) {
        LOGE(" - vreg gp1 set level failed !\n");
        return -1;
    }

    sub_pmic_reg_ctrl(SUB_PMIC_REG2, SUB_PMIC_LDO_ON);
    mdelay(1);

    if (vreg_enable(vreg_gp6)) {
        LOGE(" - vreg gp6 enable failed !\n");
        goto _sensor_poweron_fail_1;
    }
    mdelay(1);

    sub_pmic_ldo_ctrl(SUB_PMIC_CAM12V, SUB_PMIC_LDO_ON);
    mdelay(1);

    gpio_set_value(CAM_18V, 1);
    mdelay(1);

    sub_pmic_ldo_ctrl(SUB_PMIC_CAM28V, SUB_PMIC_LDO_ON);
    mdelay(1);

    if (vreg_enable(vreg_gp1)) {
        LOGE(" - vreg gp1 enable failed !\n");
        goto _sensor_poweron_fail_2;
    }
    mdelay(1);

    gpio_tlmm_config(GPIO_CFG(MCLK, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), GPIO_ENABLE);
    msm_camio_clk_rate_set(9600000);
    msm_camio_camif_pad_reg_reset();

    gpio_set_value(H_STBY, 1);

    gpio_set_value(R_STBY, 1);
    mdelay(1);

    gpio_set_value(RESET, 1);
    mdelay(4);

    return 0;

_sensor_poweron_fail_2:
    sub_pmic_ldo_ctrl(SUB_PMIC_CAM28V, SUB_PMIC_LDO_OFF);
    gpio_set_value(CAM_18V, 0);
    sub_pmic_ldo_ctrl(SUB_PMIC_CAM12V, SUB_PMIC_LDO_OFF);
    vreg_disable(vreg_gp6);

_sensor_poweron_fail_1:
    sub_pmic_reg_ctrl(SUB_PMIC_REG2, SUB_PMIC_LDO_OFF);
    LOGI("-%s (fail.)\n", __func__);
    return -1;
}
コード例 #21
0
static int camera_dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)

{
    int rc;

    ddbg_print( "camera ioctl cmd = %u, arg = %lu\n", cmd, arg);

    switch(cmd)
    {
        case CAMERA_RESET_WRITE:
            rc = gpio_request (GPIO_RESET, GPIO_SENSOR_NAME);
            if (!rc)
            {
                gpio_direction_output (GPIO_RESET, (arg ? 1 : 0));
                dbg_print( "CAMERA_MISC set RESET line to %u\n", (arg ? 1 : 0));
            }
            gpio_free (GPIO_RESET);
            if (rc)
            {
              err_print ("CAMERA_MISC: gpio_request () failed. rc = %d; cmd = %d; arg = %lu", rc, cmd, arg); 
              return -EIO;
            }
            break;


        case CAMERA_POWERDOWN_WRITE:
            rc = gpio_request (GPIO_POWERDOWN, GPIO_SENSOR_NAME);
            if (!rc)
            {
                if (0 == arg)
                {
#if 0 // TODO: NEED TO HANDLE MCLK
                  msm_camio_camif_pad_reg_reset();
                  mdelay (50);
#endif // TODO: NEED TO HANDLE MCLK
                  rc = gpio_direction_output (GPIO_POWERDOWN, 0);
                }
                else
                {
                  rc = gpio_direction_output (GPIO_POWERDOWN, 1);
                }
                dbg_print( "CAMERA_MISC set POWERDOWN line to %u\n", (arg ? 1 : 0));
            }
            gpio_free (GPIO_POWERDOWN);
            if (rc)
            {
              err_print ("CAMERA_MISC: gpio_request () failed. rc = %d; cmd = %u; arg = %lu", rc, cmd, arg); 
              return -EIO;
            }
            break;

        case CAMERA_CLOCK_DISABLE:
            msm_camio_camif_pad_reg_reset();
            dbg_print( "CAMERA_MISC turned off MCLK done\n");
            break;

        case CAMERA_CLOCK_ENABLE:
            /* enable mclk */
            msm_camio_clk_rate_set ((int)arg);
            dbg_print( "CAMERA_MISC set MCLK to %d\n", (int) arg);
            break;

        default:
            err_print( "CAMERA_MISC received unsupported cmd; cmd = %u\n", cmd);
            return -EIO;
            break;
    }

    return 0;
}
コード例 #22
0
ファイル: tcm9001md.c プロジェクト: Austrie/SpeedDemon-Kernel
int tcm9001md_sensor_standby(int on)
{
    int rc = 0;

    if(on == 1)//Entering stanby mode
    {
        //Software standby setting. Set this register with STANDBY.
        rc = tcm9001md_i2c_write(tcm9001md_client, 0xFF, 0x05);//SLEEP: 0h: ON (Standby), 1h: OFF (Normal)
        if (rc < 0)
            return rc;

        mdelay(1);

        rc = tcm9001md_i2c_write(tcm9001md_client, 0x18, 0x1C);//STANDBY: 0h: ON (Standby), 1h: OFF (Normal)
        if (rc < 0)
            return rc;
        printk(KERN_INFO "%s: SW standby done . \n", __func__);

        mdelay(1);

        // Enter HW standby
        /* Pull Low REDET = CAM_VGA_RST_N  */
        rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_rst_pin, "tcm9001md", 0);
        if (rc)
            return rc;

        mdelay(1);

        /* Pull hight PWRDWN = CAM_VGA_STANDBY  */
        rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 1);
        if (rc)
            return rc;

        mdelay(1);

        /* Disable MCLK = 24MHz */
        gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->MCLK_PIN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
        rc = fih_cam_output_gpio_control(tcm9001mdinfo->MCLK_PIN, "tcm9001md", 0);
        if (rc)
            return rc;
        printk("%s: Disable mclk\n", __func__);

        printk(KERN_INFO "%s: Enter Hw standby done . \n", __func__);
    }
    else//Exiting stanby mode
    {
        /* Setting MCLK = 24MHz */
        msm_camio_clk_rate_set(24000000);
        msm_camio_camif_pad_reg_reset();
        printk(KERN_INFO "%s: Setting MCLK = 24MHz \n", __func__);

        gpio_tlmm_config(GPIO_CFG(tcm9001mdinfo->MCLK_PIN, 1, GPIO_CFG_OUTPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);//Div2-SW6-MM-MC-Camera-ModifiedPowerSequence-01*
        printk(KERN_INFO "%s: Output MCLK end.  \n", __func__);

        mdelay(1);

        /* Pull Low PWRDWN = CAM_VGA_STANDBY  */
        rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_pwdn_pin, "tcm9001md", 0);
        if (rc)
            return rc;

        mdelay(1);

        /* Pull High REDET = CAM_VGA_RST_N  */
        rc = fih_cam_output_gpio_control(tcm9001mdinfo->vga_rst_pin, "tcm9001md", 1);
        if (rc)
            return rc;

        mdelay(5);//Div2-SW6-MM-MC-AddErrorHandlingWhenCameraI2cReadAndWriteFail-00+
        
        //Exit SW standby
        rc = tcm9001md_i2c_write(tcm9001md_client, 0x18, 0x9C);//STANDBY: 0h: ON (Standby), 1h: OFF (Normal)
        if (rc < 0)
            return rc;

        mdelay(1);

        rc = tcm9001md_i2c_write(tcm9001md_client, 0xFF, 0x85);//SLEEP: 0h: ON (Standby), 1h: OFF (Normal)
        if (rc < 0)
            return rc;
        printk(KERN_INFO "%s: Exit HW standby done. \n", __func__);
    }

    return rc;
}
コード例 #23
0
int camera_power_on (void)
{
	int rc;
	struct device *dev = su370_backlight_dev();

	camera_power_mutex_lock();
	if(lcd_bl_power_state == BL_POWER_SUSPEND)
	{
		u370_pwrsink_resume();
		mdelay(50);
	}

	
	/* clear RESET, PWDN to Low*/
	gpio_set_value(GPIO_CAM_RESET, 0);
	gpio_set_value(GPIO_CAM_PWDN, 0);

	/*AVDD power 2.8V*/


	{	/* it is for rev.c and default */
		struct vreg *vreg_mmc = vreg_get(0, "mmc");
		vreg_set_level(vreg_mmc, 2800);
		vreg_enable(vreg_mmc);
	}

  /* DVDD power 1.2V */
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 1200);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}

  /*IOVDD power 2.6V*/
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 2600);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}

	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}	

	mdelay(5);
	/*M Clock -24Mhz*/
	msm_camio_clk_rate_set(mclk_rate);
	mdelay(5);
	msm_camio_camif_pad_reg_reset();
	mdelay(5);

	/*reset high*/
	gpio_set_value(GPIO_CAM_RESET, 1);

	mdelay(5); 
	/*Nstandby high*/
	gpio_set_value(GPIO_CAM_PWDN, 1);
	
	mdelay(8);  // T2 

	camera_power_state = CAM_POWER_ON;

power_on_fail:
	camera_power_mutex_unlock();
	return rc;

}
コード例 #24
0
static int cam_hw_init()
{

	int rc = 0;
	struct vreg *vreg_L8;
	int test_value;

	pr_info("[sr030pc30] %s/%d\n", __func__, __LINE__);

	gpio_tlmm_config(
			GPIO_CFG(CAM_RESET, 0,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_16MA), GPIO_CFG_ENABLE);/*CAM_RESET*/

	gpio_tlmm_config(
			GPIO_CFG(CAM_STANDBY, 0,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_16MA), GPIO_CFG_ENABLE);/*CAM_STANDBY*/

	gpio_tlmm_config(
			GPIO_CFG(CAM_EN, 0,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_16MA), GPIO_CFG_ENABLE);/*CAM_EN*/

	gpio_tlmm_config(
			GPIO_CFG(CAM_EN_2, 0,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_16MA), GPIO_CFG_ENABLE); /*CAM_EN_2*/

	gpio_tlmm_config(
			GPIO_CFG(CAM_VT_RST, 0,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_16MA), GPIO_CFG_ENABLE);/*CAM_VT_RST*/

	gpio_tlmm_config(
			GPIO_CFG(CAM_VT_nSTBY, 0,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_16MA), GPIO_CFG_ENABLE);

	vreg_L8 = vreg_get(NULL, "gp7");
	vreg_set_level(vreg_L8, 1800);

	gpio_set_value(CAM_RESET, 0);
	gpio_set_value(CAM_STANDBY, 0);
	gpio_set_value(CAM_EN, 0);

	gpio_set_value(CAM_EN_2, 0);


	gpio_set_value(CAM_VT_RST, 0);
	gpio_set_value(CAM_VT_nSTBY, 0);
	usleep(1000);

	gpio_set_value(CAM_EN, 1); /*CAM_A_2.8V //CAM_EN->UP*/
	usleep(1000);
	vreg_enable(vreg_L8);
	usleep(1000);
	gpio_set_value(CAM_EN_2, 1); /*CAM_IO, CAM_D, EN_2->UP*/

	usleep(1000);
	gpio_set_value(CAM_VT_nSTBY, 1); /*VGA_STBY UP*/

	usleep(1000);

	gpio_tlmm_config(GPIO_CFG(CAM_MCLK, 1,
				GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
				GPIO_CFG_14MA), GPIO_CFG_ENABLE); /*CAM_MCLK*/

	msm_camio_clk_rate_set(24000000);	/*MCLK*/
	msm_camio_camif_pad_reg_reset();
	usleep(1000);

	gpio_set_value(CAM_STANDBY, 1); /*3M_STBY UP*/
	usleep(10000);

	gpio_set_value(CAM_RESET, 1); /*3M_RESET UP*/
	usleep(10000);

	gpio_set_value(CAM_STANDBY, 0); /*3M_STBY DOWN*/
	usleep(1000);

	gpio_set_value(CAM_VT_RST, 1); /*VGA_RESET UP*/
	usleep(50000);

	return rc;
}
コード例 #25
0
ファイル: lsi_mc7.c プロジェクト: Oleg-k/Cranium_Kernel
//#define DOWNLOAD_WHILE_BOOT
static int mc7_sensor_probe(const struct msm_camera_sensor_info *info,
		struct msm_sensor_ctrl *s)
{
	int rc = 0;
	unsigned int val = 0;
#ifdef DOWNLOAD_WHILE_BOOT
	struct packet *i2c_pkt;
#endif

	FUNC_ENTER();
	rc = i2c_add_driver(&mc7_i2c_driver);
	if (rc < 0) {
		printk(KERN_ERR "LSI-MC7: %s: sensor probe failed\n", __func__);
		goto probe_fail0;
	}

	rc = i2c_add_driver(&lp8720_i2c_driver);
	if (rc < 0) {
		printk(KERN_ERR "LSI-MC7: %s: lp8720 probe failed\n", __func__);
		goto probe_fail1;
	}

	msm_camio_clk_rate_set(24000000);

	/* Check whether sensor is present and its powering on */
	mc7_sensor_power_on_off(1 ,info);
	rc = poll_mc7_int(5);
	if (!rc) {
		mc7_catparam_i2c_read(4, 0xf, 0x1c, &val);
		if (val != 0x68000000) {
			printk(KERN_ERR "LSI-MC7:%s: Invalid read value= %x\n", __func__, val);
			goto probe_fail2;
		}

#ifdef DOWNLOAD_WHILE_BOOT
		/* write PLL divider value */
		mc7_catparam_i2c_write(2, 0xf, 0x24, 0x001A);

		/* firmware is send first */
		for (i2c_pkt = &mc7_firmware_array[0]; i2c_pkt->length != 0; i2c_pkt++)
			firmware_write(i2c_pkt->length, i2c_pkt->firmware);

		/* Now send the flash writer program */
		for (i2c_pkt = &mc7_fl_write_array[0]; i2c_pkt->length != 0; i2c_pkt++)
			firmware_write(i2c_pkt->length, i2c_pkt->firmware);

		/* write the address of the program */
		mc7_catparam_i2c_write(4, 0xf, 0x0C, 0x6807E000);

		/* start the writer program */
		mc7_catparam_i2c_write(1, 0xf, 0x12, 0x01);

		rc = poll_mc7_int(300);
		if (!rc)
			printk(KERN_ERR "LSI-MC7: firmware successfully writen to serial flash\n");
		else
			printk(KERN_ERR "LSI-MC7: firmware update failed\n");
#endif

		/* Power off the sensor */
		mc7_sensor_power_on_off(0 ,info);

		s->s_init = mc7_sensor_open_init;
		s->s_release = mc7_sensor_release;
		s->s_config  = mc7_sensor_config;

		MC7DBG("mc7 sensor probe successful\n");
		return rc;
	}

probe_fail2:
	mc7_sensor_power_on_off(0 ,info);
probe_fail1:
	i2c_del_driver(&lp8720_i2c_driver);
probe_fail0:
	i2c_del_driver(&mc7_i2c_driver);
	printk(KERN_ERR "LSI-MC7: %s:probe failed\n", __func__);
	return rc;
}
コード例 #26
0
int32_t yacd5c1sbdbc_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
	int32_t rc = 0;
	pr_err("%s: %d\n", __func__, __LINE__);

#if 0
	msm_sensor_probe_on(&s_ctrl->sensor_i2c_client->client->dev);
	SKYCDBG("%s msm_sensor_probe_on ok\n", __func__); 
	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
	SKYCDBG("%s msm_camio_clk_rate_set ok\n", __func__);
#else
    rc = msm_sensor_power_up(s_ctrl);
    pr_err(" %s : msm_sensor_power_up : rc = %d E\n",__func__, rc);  
#endif

    	yacd5c1sbdbc_vreg_init();

	if (sgpio_ctrl(sgpios, CAM1_IOVDD_EN, 1) < 0)	rc = -EIO;

	if (sgpio_ctrl(sgpios, CAMIO_RST_N, 0) < 0)	rc = -EIO;

	if (svreg_ctrl(svregs, CAMV_IO_1P8V, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 20us */
	if (svreg_ctrl(svregs, CAMV_A_2P8V, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 15us */
	if (svreg_ctrl(svregs, CAMV_CORE_1P8V, 1) < 0)	rc = -EIO;
	mdelay(1);
	if (sgpio_ctrl(sgpios, CAMIO_STB_N, 1) < 0)	rc = -EIO;
	//msm_camio_clk_rate_set(24000000);
    mdelay(35); //yacd5c1sbdbc spec: >30ms
	if (sgpio_ctrl(sgpios, CAMIO_RST_N, 1) < 0)	rc = -EIO;
	mdelay(1); /* > 50us */

	pr_err("%s X (%d)\n", __func__, rc);
	return rc;

#if 0
    /* LDO enable ******************************************************/
   
    rc = gpio_request(CAM1_IOVDD_EN, "yacd5c1sbdbc");
    if (!rc) {
        printk("%s:%d\n", __func__, __LINE__);
        gpio_direction_output(CAM1_IOVDD_EN, 1);
    } else {
		printk("%s: gpio CAM1_IOVDD_EN request fail", __func__);
	}
    mdelay(1);
#if 0 
    rc = gpio_request(CAM1_AVDD_EN, "yacd5c1sbdbc");
    if (!rc) {
        printk("%s:%d\n", __func__, __LINE__);
        gpio_direction_output(CAM1_AVDD_EN, 1);
    } else {
		printk("%s: gpio CAM1_AVDD_EN request fail", __func__);
	}
    mdelay(1);

    rc = gpio_request(CAM1_DVDD_EN, "yacd5c1sbdbc");
    if (!rc) {
        printk("%s:%d\n", __func__, __LINE__);
        gpio_direction_output(CAM1_DVDD_EN, 1);
    } else {
		printk("%s: gpio CAM1_DVDD_EN request fail", __func__);
	}
    mdelay(1);
#endif
    /* VREG enable *****************************************************/
    rc = regulator_enable(vreg_lvs5_1p8);
    if (rc) {
        printk("%s: Enable regulator vreg_lvs5_1p8 failed\n", __func__);
        goto fail;
    }
    mdelay(1);

    rc = regulator_enable(vreg_l11_2p85);
    if (rc) {
        printk("%s: Enable regulator vreg_l11_2p85 failed\n", __func__);
        goto fail;
    }
    mdelay(1);  

    rc = regulator_enable(vreg_lvs6_1p8);
    if (rc) {
        printk("%s: Enable regulator vreg_lvs6_1p8 failed\n", __func__);
        goto fail;
    }
    mdelay(1);
    
    /* Standby *********************************************************/
    rc = gpio_request(data->sensor_platform_info->sensor_pwd, "yacd5c1sbdbc");
    if (!rc) {
        printk("%s:Standby\n", __func__);
        //gpio_set_value(SENSOR_STANDBY,1);
        gpio_set_value_cansleep(data->sensor_platform_info->sensor_pwd, 0);
        gpio_direction_output(data->sensor_platform_info->sensor_pwd, 1);
    } else {
		printk("%s: gpio Standby request fail", __func__);
	}
    mdelay(1);

    /* MCLK set ********************************************************/
    printk(" msm_camio_clk_rate_set E\n");
	msm_camio_clk_rate_set(MSM_SENSOR_MCLK_24HZ);
    printk(" msm_camio_clk_rate_set X\n");
    mdelay(1);

    /* Reset  *********************************************************/
	rc = gpio_request(data->sensor_platform_info->sensor_reset, "yacd5c1sbdbc");
	if (!rc) {
		printk("%s: reset sensor\n", __func__);
		gpio_direction_output(data->sensor_platform_info->sensor_reset, 0);
		usleep_range(1000, 2000);
		gpio_set_value_cansleep(data->sensor_platform_info->sensor_reset, 1);
		usleep_range(4000, 5000);
	} else {
		printk("%s: gpio Reset request fail", __func__);
	}

    return rc;

fail:
	printk("%s Failed!:%d\n",__func__, __LINE__);
	if(vreg_lvs6_1p8) {
		regulator_put(vreg_lvs6_1p8);
	}
	if(vreg_l11_2p85) {
		regulator_put(vreg_l11_2p85);
	}
    if(vreg_lvs5_1p8){
		regulator_put(vreg_lvs5_1p8);
	}    
    return rc;
#endif
}
コード例 #27
0
int camera_power_on (void)
{
    int rc;
    struct device *dev = pecan_backlight_dev();

    camera_power_mutex_lock();
    if(lcd_bl_power_state == BL_POWER_SUSPEND)
    {
        pecan_pwrsink_resume();
        mdelay(50);
    }

    /* clear RESET, PWDN to Low*/
    gpio_set_value(GPIO_CAM_RESET, 0);
    gpio_set_value(GPIO_CAM_PWDN, 0);
    //2010-11-02
    config_camera_off_gpios();
    mdelay(40);

    /*AVDD power 2.8V*/
    if (lge_bd_rev == LGE_REV_B) {
        rc = aat28xx_ldo_set_level(dev, LDO_CAM_AF_NO, 2800);
        if (rc < 0) {
            printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AF_NO);
            goto power_on_fail;
        }
        rc = aat28xx_ldo_enable(dev, LDO_CAM_AF_NO, 1);
        if (rc < 0) {
            printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AF_NO);
            goto power_on_fail;
        }
    } else {	/* it is for rev.c and default */
        struct vreg *vreg_mmc = vreg_get(0, "mmc");
        vreg_set_level(vreg_mmc, 2800);
        vreg_enable(vreg_mmc);
    }

    /* DVDD power 1.2V, change to 1.8V */
    rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 1800);
    if (rc < 0) {
        printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
        goto power_on_fail;
    }
    rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 1);
    if (rc < 0) {
        printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
        goto power_on_fail;
    }

    mdelay(1);

    /*IOVDD power 2.6V*/
    rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 2600);
    if (rc < 0) {
        printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
        goto power_on_fail;
    }
    rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 1);
    if (rc < 0) {
        printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
        goto power_on_fail;
    }

    /*AVDD power  2.7V*/
    /* LGE_CHANGE
      * Change AVDD level from 2.7V to 2.8V in order to reduce camera noise in dard environment.
      * 2010-08-03. [email protected]
      */
    rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 2800);
    if (rc < 0) {
        printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
        goto power_on_fail;
    }
    rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 1);
    if (rc < 0) {
        printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
        goto power_on_fail;
    }

    //mdelay(5);
    /*M Clock -24Mhz*/
    mdelay(20);
    config_camera_on_gpios();
    msm_camio_clk_rate_set(mclk_rate);
    mdelay(5);
    msm_camio_camif_pad_reg_reset();
    mdelay(5);

    /*Nstandby high*/
    gpio_set_value(GPIO_CAM_PWDN, 0);
    mdelay(1);

    /*reset high*/
    gpio_set_value(GPIO_CAM_RESET, 1);

    mdelay(8);  // T2

    camera_power_state = CAM_POWER_ON;

power_on_fail:
    camera_power_mutex_unlock();
    return rc;

}
コード例 #28
0
int camera_power_on (void)
{
	int rc;
	struct device *dev = su370_backlight_dev();

	camera_power_mutex_lock();
	if(lcd_bl_power_state == BL_POWER_SUSPEND)
	{
		u370_pwrsink_resume();
		mdelay(50);
	}

	
	
	gpio_set_value(GPIO_CAM_RESET, 0);
	gpio_set_value(GPIO_CAM_PWDN, 0);

	


	


	{	
		struct vreg *vreg_mmc = vreg_get(0, "mmc");
		vreg_set_level(vreg_mmc, 2800);
		vreg_enable(vreg_mmc);
	}

  
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_DVDD_NO, 1200);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_DVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_DVDD_NO);
		goto power_on_fail;
	}

  
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_IOVDD_NO, 2600);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_IOVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_IOVDD_NO);
		goto power_on_fail;
	}

	
	
	rc = aat28xx_ldo_set_level(dev, LDO_CAM_AVDD_NO, 2800);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d set level error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}
	rc = aat28xx_ldo_enable(dev, LDO_CAM_AVDD_NO, 1);
	if (rc < 0) {
		printk(KERN_ERR "%s: ldo %d control error\n", __func__, LDO_CAM_AVDD_NO);
		goto power_on_fail;
	}	

	mdelay(5);
	
	msm_camio_clk_rate_set(mclk_rate);
	mdelay(5);
	msm_camio_camif_pad_reg_reset();
	mdelay(5);

	
	gpio_set_value(GPIO_CAM_RESET, 1);

	mdelay(5); 
	
	gpio_set_value(GPIO_CAM_PWDN, 1);
	
	mdelay(8);  

	camera_power_state = CAM_POWER_ON;

power_on_fail:
	camera_power_mutex_unlock();
	return rc;

}