int camdrv_ss_sr030pc50_set_preview_start(struct v4l2_subdev *sd) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct camdrv_ss_state *state = to_state(sd); int err = 0; CAM_INFO_PRINTK( "%s :\n", __func__); if (!state->pix.width || !state->pix.height) { CAM_ERROR_PRINTK( "%s : width or height is NULL!!!\n",__func__); return -EINVAL; } if (state->mode_switch == PICTURE_CAPTURE_TO_CAMERA_PREVIEW_RETURN) { // do nothing } if(state->mode_switch == CAMERA_PREVIEW_TO_CAMCORDER_PREVIEW) { // do nothing } else if(state->mode_switch == INIT_DONE_TO_CAMCORDER_PREVIEW) { // do nothing } else if(state->mode_switch == CAMCORDER_PREVIEW_TO_CAMERA_PREVIEW) { err = camdrv_ss_i2c_set_config_register(client, sr030pc50_init_regs, ARRAY_SIZE(sr030pc50_init_regs), "init_regs"); if (err < 0) { CAM_ERROR_PRINTK( "%s :sr030pc50_init_regs IS FAILED\n",__func__); return -EIO; } } /* err = camdrv_ss_set_preview_size(sd); if (err < 0) { CAM_ERROR_PRINTK( "%s : camdrv_ss_set_preview_size is FAILED !!\n", __func__); return -EIO; } */ state->camera_flash_fire = 0; state->camera_af_flash_checked = 0; if (state->check_dataline) { /* Output Test Pattern */ err = camdrv_ss_set_dataline_onoff(sd, 1); if (err < 0) { CAM_ERROR_PRINTK( "%s : check_dataline is FAILED !!\n", __func__); return -EIO; } } return 0; }
int camdrv_ss_sr030pc50_set_preview_start(struct v4l2_subdev *sd) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct camdrv_ss_state *state = to_state(sd); int err = 0; unsigned int read_value1=0,read_value2=0,read_value3=0,read_value4=0,read_value5=0,read_value6=0; unsigned char read_chvalue1=0,read_chvalue2=0,read_chvalue3=0,read_chvalue4=0,read_chvalue5=0,read_chvalue6=0; int Exptime=0,Expmax=0; CAM_INFO_PRINTK( "%s :\n", __func__); if (!state->pix.width || !state->pix.height) { CAM_ERROR_PRINTK( "%s : width or height is NULL!!!\n",__func__); return -EINVAL; } if (state->mode_switch == PICTURE_CAPTURE_TO_CAMERA_PREVIEW_RETURN) { // do nothing } if(state->mode_switch == CAMERA_PREVIEW_TO_CAMCORDER_PREVIEW) { /* if ( (ARRAY_SIZE(sr030pc50_fps_auto_normal_regs) != NULL ) ||(ARRAY_SIZE(sr030pc50_fps_auto_Dark_regs) != NULL)) { camdrv_ss_i2c_write_2_bytes(client, 0x03, 0x20); camdrv_ss_i2c_write_2_bytes(client, 0x10, 0x1C); camdrv_ss_i2c_read_1_byte(client, 0x80, &read_value1); camdrv_ss_i2c_read_1_byte(client, 0x81, &read_value2); camdrv_ss_i2c_read_1_byte(client, 0x82, &read_value3); Exptime = (read_value1) << 16 | (read_value2)<<8 | read_value3; camdrv_ss_i2c_read_1_byte(client, 0xA0, &read_value4); camdrv_ss_i2c_read_1_byte(client, 0xA1, &read_value5); camdrv_ss_i2c_read_1_byte(client, 0xA2, &read_value6); Expmax = (read_value4) << 16 |(read_value5)<<8 | read_value6; // 50 hz if( Exptime < Expmax ) { err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_normal_regs, ARRAY_SIZE(sr030pc50_fps_auto_normal_regs), "fps_auto_normal_regs"); } else { err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_Dark_regs, ARRAY_SIZE(sr030pc50_fps_auto_Dark_regs), "fps_auto_Dark_regs"); } //err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_regs, ARRAY_SIZE(sr030pc50_fps_auto_regs), "fps_auto_regs"); if (err < 0) { CAM_ERROR_PRINTK( "%s :sr030pc50_fps_auto_regs IS FAILED\n",__func__); return -EIO; } }*/ // do nothing /* Fixed FPS */ // if (ARRAY_SIZE(sr030pc50_fps_auto_regs)!= NULL) // err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_regs, ARRAY_SIZE(sr030pc50_fps_auto_regs), "fps_auto_regs"); // else if (ARRAY_SIZE(sr030pc50_fps_30_regs) != NULL) // err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_30_regs, ARRAY_SIZE(sr030pc50_fps_30_regs), "fps_30_regs"); if (ARRAY_SIZE(sr030pc50_fps_25_regs) != (int)NULL) err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_25_regs, ARRAY_SIZE(sr030pc50_fps_25_regs), "fps_25_regs"); else if (ARRAY_SIZE(sr030pc50_fps_20_regs) !=(int) NULL) err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_20_regs, ARRAY_SIZE(sr030pc50_fps_20_regs), "fps_20_regs"); else if (ARRAY_SIZE(sr030pc50_fps_15_regs) !=(int) NULL) err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_15_regs, ARRAY_SIZE(sr030pc50_fps_15_regs), "fps_15_regs"); else CAM_ERROR_PRINTK("%s : Fixed FPS setting is not supported for 30,25,20,15 fps !!\n", __func__); if (err < 0) { CAM_ERROR_PRINTK("%s : Fixed FPS setting is FAILED !!\n", __func__); return -EIO; } } else if(state->mode_switch == INIT_DONE_TO_CAMCORDER_PREVIEW) { // do nothing } else if(state->mode_switch == CAMCORDER_PREVIEW_TO_CAMERA_PREVIEW) { camdrv_ss_i2c_write_2_bytes(client, 0x03, 0x20); camdrv_ss_i2c_write_2_bytes(client, 0x10, 0x1C); camdrv_ss_i2c_read_1_byte(client, 0x80, &read_chvalue1); camdrv_ss_i2c_read_1_byte(client, 0x81, &read_chvalue2); camdrv_ss_i2c_read_1_byte(client, 0x82, &read_chvalue3); read_value1 = (unsigned short)read_chvalue1; read_value2 = (unsigned short)read_chvalue2; read_value3 = (unsigned short)read_chvalue3; Exptime = (read_value1) << 16 | (read_value2)<<8 | read_value3; camdrv_ss_i2c_read_1_byte(client, 0xA0, &read_chvalue4); camdrv_ss_i2c_read_1_byte(client, 0xA1, &read_chvalue5); camdrv_ss_i2c_read_1_byte(client, 0xA2, &read_chvalue6); read_value4 = (unsigned short)read_chvalue4; read_value5 = (unsigned short)read_chvalue5; read_value6 = (unsigned short)read_chvalue6; Expmax = (read_value4) << 16 |(read_value5)<<8 | read_value6; // 50 hz if( Exptime < Expmax ) { err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_normal_regs, ARRAY_SIZE(sr030pc50_fps_auto_normal_regs), "fps_auto_normal_regs"); } else { err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_Dark_regs, ARRAY_SIZE(sr030pc50_fps_auto_Dark_regs), "fps_auto_Dark_regs"); } //err = camdrv_ss_i2c_set_config_register(client, sr030pc50_fps_auto_regs, ARRAY_SIZE(sr030pc50_fps_auto_regs), "fps_auto_regs"); if (err < 0) { CAM_ERROR_PRINTK( "%s :sr030pc50_fps_auto_regs IS FAILED\n",__func__); return -EIO; } } /* err = camdrv_ss_set_preview_size(sd); if (err < 0) { CAM_ERROR_PRINTK( "%s : camdrv_ss_set_preview_size is FAILED !!\n", __func__); return -EIO; } */ state->camera_flash_fire = 0; state->camera_af_flash_checked = 0; if (state->check_dataline) { /* Output Test Pattern */ err = camdrv_ss_set_dataline_onoff(sd, 1); if (err < 0) { CAM_ERROR_PRINTK( "%s : check_dataline is FAILED !!\n", __func__); return -EIO; } } return 0; }