示例#1
0
static int sensor_flip_cb(struct i2c_client *client, int flip)
{
	char val;
	int err = 0;	

	SENSOR_DG("flip: %d",flip);
	if (flip) {
		
		sensor_write(client, 0xfe, 0);
		err = sensor_read(client, 0x17, &val);
		val-=4;
		if (err == 0) {
			if((val & 0x2) == 0){
				err = sensor_write(client, 0x17, ((val |0x2)+4));
				}
			else {
				err = sensor_write(client, 0x17, ((val & 0xfc)+4));
				}
		}
	} else {
		//do nothing
	}

	return err;    
}
/*
* the function is called in open sensor  
*/
static int sensor_activate_cb(struct i2c_client *client)
{
    SENSOR_DG("%s",__FUNCTION__);
	
	
	return 0;
}
示例#3
0
static int sensor_resume(struct soc_camera_device *icd)
{

	SENSOR_DG("Resume");

	return 0;

}
示例#4
0
static int sensor_flip_cb(struct i2c_client *client, int flip)
{
	int err = 0;	

    SENSOR_DG("flip: %d",flip);
	
	return err;    
}
示例#5
0
/*
* the function is called in close sensor
*/
static int sensor_deactivate_cb(struct i2c_client *client)
{
	//struct generic_sensor *sensor = to_generic_sensor(client);

    SENSOR_DG("%s",__FUNCTION__);
    
	return 0;
}
示例#6
0
static int sensor_mirror_cb (struct i2c_client *client, int mirror)
{
	int err = 0;
    
    SENSOR_DG("mirror: %d",mirror);
	

	return err;    
}
示例#7
0
/*
* the function is v4l2 control V4L2_CID_VFLIP callback	
*/
static int sensor_v4l2ctrl_flip_cb(struct soc_camera_device *icd, struct sensor_v4l2ctrl_info_s *ctrl_info, 
													 struct v4l2_ext_control *ext_ctrl)
{
	struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));

	if (sensor_flip_cb(client,ext_ctrl->value) != 0)
		SENSOR_TR("sensor_flip failed, value:0x%x",ext_ctrl->value);
	
	SENSOR_DG("sensor_flip success, value:0x%x",ext_ctrl->value);
	return 0;
}
示例#8
0
static int sensor_suspend(struct soc_camera_device *icd, pm_message_t pm_msg)
{
	//struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
		
	if (pm_msg.event == PM_EVENT_SUSPEND) {
		SENSOR_DG("Suspend");
		
	} else {
		SENSOR_TR("pm_msg.event(0x%x) != PM_EVENT_SUSPEND\n",pm_msg.event);
		return -EINVAL;
	}
	return 0;
}
/*
* the function is called in close sensor
*/
static int sensor_deactivate_cb(struct i2c_client *client)
{
	struct generic_sensor *sensor = to_generic_sensor(client);

    SENSOR_DG("%s",__FUNCTION__);
    
	/* [email protected] : all sensor output pin must switch into Hi-Z */
	if (sensor->info_priv.funmodule_state & SENSOR_INIT_IS_OK) {
		sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;;
	}
	
	return 0;
}
示例#10
0
static int sensor_mirror_cb (struct i2c_client *client, int mirror)
{
	char val;
	int err = 0;
    
    SENSOR_DG("mirror: %d",mirror);
	if (mirror) {
		err = sensor_read(client, 0x3022, &val);
		if (err == 0) {
			val |= 0x02;
			err = sensor_write(client, 0x3022, val);
		}
	} else {
		err = sensor_read(client, 0x3022, &val);
		if (err == 0) {
			val &= 0xfd;
			err = sensor_write(client, 0x3022, val);
		}
	}

	return err;    
}
示例#11
0
static int sensor_flip_cb(struct i2c_client *client, int flip)
{
	char val1,val2,val3;
	int err = 0;	

	SENSOR_DG("flip: %d",flip);
	if (flip) {
			sensor_write(client, 0xf0, 0);
			err = sensor_read(client,0x0f,&val1);
			err = sensor_read(client,0x45,&val2);
			err = sensor_read(client,0x47,&val3);
			if(err ==0){
				if((val1 == 0xb2) && (val2 == 0x27) && (val3 == 0x2c)){//normal
					err = sensor_write(client, 0x0f, 0x92);
					err = sensor_write(client, 0x45, 0x25);
					err = sensor_write(client, 0x47, 0x24);
				}else if((val1 == 0xa2) && (val2 == 0x26) && (val3 == 0x28)){//h_mir
					err = sensor_write(client, 0x0f, 0x82);
					err = sensor_write(client, 0x45, 0x24);
					err = sensor_write(client, 0x47, 0x20);
				}else if((val1 == 0x92) && (val2 == 0x25) && (val3 == 0x24)){//v_flip
					err = sensor_write(client, 0x0f, 0xb2);
					err = sensor_write(client, 0x45, 0x27);
					err = sensor_write(client, 0x47, 0x2c);
				}else if((val1 == 0x82) && (val2 == 0x24) && (val3 == 0x20)){//h_v_mir
					err = sensor_write(client, 0x0f, 0xa2);
					err = sensor_write(client, 0x45, 0x26);
					err = sensor_write(client, 0x47, 0x28);
				}
	
			}
			
		} else {
			//do nothing
		}

	return err;    
}
示例#12
0
static int sensor_flip_cb(struct i2c_client *client, int flip)
{
	char val;
	int err = 0;	


    SENSOR_DG("flip: %d",flip);
	if (flip) {
		err = sensor_read(client, 0x3022, &val);
		if (err == 0) {
			val |= 0x01;
			err = sensor_write(client, 0x3022, val);
		}
	} else {
		err = sensor_read(client, 0x3022, &val);
		if (err == 0) {
			val &= 0xfe;
			err = sensor_write(client, 0x3022, val);
		}
	}

	return err;       
}