Exemple #1
0
static int icp_hd_reset(int set)
{
	int rc = 0;

	rc = gpio_tlmm_config(GPIO_CFG(SENSOR_RESET_8M, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),GPIO_CFG_ENABLE);

	if (!rc) {
		CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
		gpio_set_value(SENSOR_RESET_8M,0);		
		if(set){
			gpio_set_value(SENSOR_RESET_8M,1);		
		}
	}
	else{
		CAM_ERR("icp_hd_reset gpio_tlmm_config Failed!\n");
		goto reset_fail;
	}

	CAM_INFO("%s %s Success:%d\n", __FILE__, __func__, __LINE__);
	return rc;

reset_fail:
	CAM_ERR("%s %s Failed!:%d\n", __FILE__, __func__, __LINE__);
	return rc;
}
static int mt9v113_power(int on)
{
	int rc = 0;
	int status = 0;
	//CAM_INFO("%s %s:%d power = %d\n", __FILE__, __func__, __LINE__,on);
	if(on) {
		rc = regulator_enable(lvs3b_1p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator lvs3b_1p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		rc = regulator_enable(lvs1b_1p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator lvs1b_1p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		rc = regulator_enable(l15a_2p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator l15a_2p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
	}
	else {
		rc = regulator_disable(l15a_2p8v);
		if (rc)
			CAM_INFO("%s: Disable regulator l15a_2p8v failed\n", __func__);
		regulator_put(l15a_2p8v);
		
		rc = regulator_disable(lvs3b_1p8v);
		if (rc)
			CAM_ERR("%s: Disable regulator lvs3b_1p8v failed\n", __func__);
		rc = regulator_disable(lvs1b_1p8v);
		if (rc)
			CAM_ERR("%s: Disable regulator lvs1b_1p8v failed\n", __func__);
	}
	//CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);

	status = gpio_tlmm_config(GPIO_CFG(SENSOR_RESET, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),GPIO_CFG_ENABLE);

	if (!status) 
    {
		//CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
		gpio_set_value(SENSOR_RESET,0);
	}
	
	return rc;
fail:
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
	if(l15a_2p8v)
		regulator_put(l15a_2p8v);
	return rc;			
}
static int mt9v113_reset(int set)//const struct msm_camera_sensor_info *dev)
{
	int rc = 0;

	//standby
	rc = gpio_tlmm_config(GPIO_CFG(SENSOR_RESET, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),GPIO_CFG_ENABLE);

	if (!rc) {
		//CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
		gpio_set_value(SENSOR_RESET,0);
		//rc = gpio_direction_output(137, 0);
		mdelay(10);  //hhs 20); //10
		gpio_set_value(SENSOR_RESET,1);
		//rc = gpio_direction_output(137, 1);
	}
  
	//standby
	rc = gpio_tlmm_config(GPIO_CFG(SENSOR_STANDBY, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),GPIO_CFG_ENABLE);

	if (!rc) {
		//CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
		if(set)
			set=0;
		else
			set=1;
		gpio_set_value(SENSOR_STANDBY,set);
		//rc = gpio_direction_output(137, 0);
		mdelay(10);  //hhs 20);		
	}
  
    CAM_ERR("%s: mt9v113_reset set=%d=\n", __func__, set);
	return rc;
}
Exemple #4
0
static int s5k6aafx13_vreg_init()
{
	int rc;
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
#if 0
	lvs3b_1p8v = regulator_get(NULL, "8901_mvs0");//"8901_lvs3");
	if (IS_ERR(lvs3b_1p8v)) {
		CAM_ERR("regulator_get lvs2b_1p8v fail\n" );;
		return -ENODEV;
	}
	
	lvs2b_1p8v = regulator_get(NULL, "8901_lvs2");
	if (IS_ERR(lvs2b_1p8v)) {
		CAM_ERR("regulator_get lvs2b_1p8v fail\n" );;
		return -ENODEV;
	}
#endif	
	l1b_2p8v = regulator_get(NULL, "8901_l1");
	if (IS_ERR(l1b_2p8v)) {
		CAM_ERR("regulator_get l1b_2p8v fail\n" );;
		return -ENODEV;
	}
	rc = regulator_set_voltage(l1b_2p8v, 2800000, 2800000);
	if (rc) {
		CAM_ERR("%s: unable to set l1b_2p8v voltage to 2.8V\n", __func__);
		goto fail;
	}
	
	l15a_1p5v = regulator_get(NULL, "8058_l15");
	if (IS_ERR(l15a_1p5v)) {
		CAM_ERR("regulator_get l15a_1p5v fail\n" );;
		return -ENODEV;
	}	
	rc = regulator_set_voltage(l15a_1p5v, 1500000, 1500000);
	if (rc) {
		CAM_ERR("%s: unable to set l15a_1p5v voltage to 1.5V\n", __func__);
		goto fail;
	}
	
	lvs1b_1p8v = regulator_get(NULL, "8901_lvs1");
	if (IS_ERR(lvs1b_1p8v)) {
		CAM_ERR("regulator_get lvs1b_1p8v fail\n" );;
		return -ENODEV;
	}	
	
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
	return rc;
fail:
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
	if(l15a_1p5v) {
	regulator_put(l15a_1p5v);
	}
	if(l1b_2p8v) {
	regulator_put(l1b_2p8v);
	}
	return rc;	
}
Exemple #5
0
static int s5k6aafx13_power(int on)
{
	int rc = 0;
	CAM_INFO("%s %s:%d power = %d\n", __FILE__, __func__, __LINE__,on);
	if(on) {
#if 0		
		rc = regulator_enable(lvs3b_1p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator lvs3b_1p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		rc = regulator_enable(lvs2b_1p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator lvs2b_1p8v failed\n", __func__);
			goto fail;
		}
#endif		
		rc = regulator_enable(l1b_2p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator l1b_2p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		rc = regulator_enable(l15a_1p5v);
		if (rc) {
			CAM_ERR("%s: Enable regulator l15a_1p5v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		rc = regulator_enable(lvs1b_1p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator lvs1b_1p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
	}
	else {
#if 0		
		rc = regulator_disable(lvs3b_1p8v);
		if (rc)
			CAM_ERR("%s: Disable regulator lvs3b_1p8v failed\n", __func__);

		rc = regulator_disable(lvs2b_1p8v);
		if (rc)
			CAM_ERR("%s: Disable regulator lvs2b_1p8v failed\n", __func__);
#endif
		rc = regulator_disable(lvs1b_1p8v);
		if (rc)
			CAM_ERR("%s: Disable regulator lvs1b_1p8v failed\n", __func__);

		rc = regulator_disable(l15a_1p5v);
		if (rc)
			CAM_INFO("%s: Disable regulator l15a_1p5v failed\n", __func__);
		regulator_put(l15a_1p5v);
		
		rc = regulator_disable(l1b_2p8v);
		if (rc)
			CAM_ERR("%s: Disable regulator l1b_2p8v failed\n", __func__);
		regulator_put(l1b_2p8v);		
		
	}
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
	return rc;
fail:
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
	if(l1b_2p8v)
		regulator_put(l1b_2p8v);
	if(l15a_1p5v)
		regulator_put(l15a_1p5v);
	return rc;			
}
Exemple #6
0
static int icp_hd_power(int on)
{
	int rc = 0;
		CAM_INFO("%s %s:%d power = %d\n", __FILE__, __func__, __LINE__,on);
	if(on) {
		//standby control
		rc = gpio_tlmm_config(GPIO_CFG(SENSOR_STANDBY_8M, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),GPIO_CFG_ENABLE);
		if (!rc) {
			CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);
			gpio_set_value(SENSOR_STANDBY_8M,0);					
		}
		
		rc = regulator_enable(s2b_1p2v_8m);
		if (rc) {
			CAM_ERR("%s: Enable regulator s2b_1p2v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		
		rc = regulator_enable(mvs0b_1p8v_8m);
		if (rc) {
			CAM_ERR("%s: Enable regulator mvs0b_1p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		
		rc = regulator_enable(lvs3b_1p8v);
		if (rc) {
			CAM_ERR("%s: Enable regulator lvs3b_1p8v failed\n", __func__);
			goto fail;
		}		
		msleep(1);
		
		rc = regulator_enable(l2b_2p8v_8m);
		if (rc) {
			CAM_ERR("%s: Enable regulator l2b_2p8v failed\n", __func__);
			goto fail;
		}
		msleep(1);
		
		rc = regulator_enable(l3b_2p8v_8m);
		if (rc) {
			CAM_ERR("%s: Enable regulator l3b_2p8v failed\n", __func__);
			goto fail;
		}

		CAM_INFO("%s %s ON Success:%d\n", __FILE__, __func__, __LINE__);
	}
	else {
		CAM_INFO("%s %s:%d power \n", __FILE__, __func__, __LINE__);
		if(s2b_1p2v_8m) 
		{
			rc = regulator_disable(s2b_1p2v_8m);
			if (rc){
				CAM_ERR("%s: Disable regulator s2b_1p2v failed\n", __func__);
				goto fail;
			}
			regulator_put(s2b_1p2v_8m);
		}
		if(1)//lvs3b_1p8v) {
		{
			rc = regulator_disable(lvs3b_1p8v);
			if (rc){
				CAM_ERR("%s: Disable regulator lvs3b_1p8v failed\n", __func__);		
				goto fail;
			}
		}
		
		CAM_INFO("%s %s:%d power \n", __FILE__, __func__, __LINE__);
		if(1)//mvs0b_1p8v) 
		{
			rc = regulator_disable(mvs0b_1p8v_8m);
			if (rc){
				CAM_ERR("%s: Disable regulator mvs0b_1p8v failed\n", __func__);
				goto fail;
			}
		}
		CAM_INFO("%s %s:%d power \n", __FILE__, __func__, __LINE__);
		if(1)//l2b_2p8v) 
		{
			rc = regulator_disable(l2b_2p8v_8m);
			if (rc){
				CAM_ERR("%s: Disable regulator l2b_2p8v failed\n", __func__);
				goto fail;
			}
			regulator_put(l2b_2p8v_8m);
		}
		CAM_INFO("%s %s:%d power \n", __FILE__, __func__, __LINE__);
		if(1)//l3b_2p8v) 
		{
		rc = regulator_disable(l3b_2p8v_8m);
			if (rc){
				CAM_ERR("%s: Disable regulator l3b_2p8v failed\n", __func__);
				goto fail;
			}
			regulator_put(l3b_2p8v_8m);		
		}
		CAM_INFO("%s %s OFF Success:%d\n", __FILE__, __func__, __LINE__);
	}
	
	return rc;
fail:
	CAM_ERR("%s %s Failed!:%d\n", __FILE__, __func__, __LINE__);
	if(l2b_2p8v_8m){
		regulator_put(l2b_2p8v_8m);
	}
	if(s2b_1p2v_8m){
		regulator_put(s2b_1p2v_8m);
	}
	if(l3b_2p8v_8m){
		regulator_put(l3b_2p8v_8m);
	}
	return rc;			
}
Exemple #7
0
static int icp_hd_vreg_init()
{
	int rc = 0;
	CAM_INFO("%s %s:%d\n", __FILE__, __func__, __LINE__);

	s2b_1p2v_8m = regulator_get(NULL, "8901_s2");
	if (IS_ERR(s2b_1p2v_8m)) {
		CAM_ERR("regulator_get s2b_1p2v fail : 0x%x\n", s2b_1p2v_8m);
		return -ENODEV;
	}
	rc = regulator_set_voltage(s2b_1p2v_8m, 1300000, 1300000);
	if (rc) {
		CAM_ERR("%s: unable to set s2b_1p2v voltage to 1.2V\n", __func__);
		goto fail;
	}

	lvs3b_1p8v = regulator_get(NULL, "8901_lvs3");
	if (IS_ERR(lvs3b_1p8v)) {
		CAM_ERR("regulator_get lvs3b_1p8v : 0x%x fail\n", lvs3b_1p8v);
		return -ENODEV;
	}

	mvs0b_1p8v_8m = regulator_get(NULL, "8901_mvs0");
	if (IS_ERR(mvs0b_1p8v_8m)) {
		CAM_ERR("regulator_get mvs0b_1p8v : 0x%x fail\n", mvs0b_1p8v_8m);
		return -ENODEV;
	}
	
	l2b_2p8v_8m = regulator_get(NULL, "8901_l2");
	if (IS_ERR(l2b_2p8v_8m)) {
		CAM_ERR("regulator_get l2b_2p8v : 0x%x fail\n", l2b_2p8v_8m);
		return -ENODEV;
	}

	rc = regulator_set_voltage(l2b_2p8v_8m, 2800000, 2800000);
	if (rc) {
		CAM_ERR("%s: unable to set l2b_2p8v voltage to 2.8V\n", __func__);
		goto fail;
	}

	l3b_2p8v_8m = regulator_get(NULL, "8901_l3");
	if (IS_ERR(l3b_2p8v_8m)) {
		CAM_ERR("regulator_get l3b_2p8v : 0x%x fail\n", l3b_2p8v_8m);
		return -ENODEV;
	}
	rc = regulator_set_voltage(l3b_2p8v_8m, 2800000, 2800000);
	if (rc) {
		CAM_ERR("%s: unable to set l3b_2p8v voltage to 2.8V\n", __func__);
		goto fail;
	}
	
	CAM_INFO("%s %s Success!:%d\n", __FILE__, __func__, __LINE__);
	return rc;
fail:
	CAM_INFO("%s %s Failed!:%d\n", __FILE__, __func__, __LINE__);
	if(l2b_2p8v_8m) {
		regulator_put(l2b_2p8v_8m);
	}
	if(s2b_1p2v_8m) {
		regulator_put(s2b_1p2v_8m);
	}
	if(l3b_2p8v_8m) {
		regulator_put(l3b_2p8v_8m);
	}
	return rc;	
}