void sensor_native_control_front(void __user *arg)
{
	int err = 0;
	struct ioctl_native_cmd ctrl_info;
	struct msm_camera_v4l2_ioctl_t *ioctl_ptr = arg;

	if (copy_from_user(&ctrl_info,
		(void __user *)ioctl_ptr->ioctl_ptr,
		sizeof(ctrl_info))) {
		pr_info("fail copy_from_user!");
	}
/*	pr_info("mode : %d", ctrl_info.mode);*/

	switch (ctrl_info.mode) {
	case EXT_CAM_EV:
		err = sr130pc10_set_exposure_value(0, ctrl_info.value_1);
		break;

	case EXT_CAM_MOVIE_MODE:
		sr130pc10_ctrl->cam_mode = ctrl_info.value_1;
		/*sr130pc10_set_movie_mode(ctrl_info.value_1);*/
		break;

	case EXT_CAM_EXIF:
		ctrl_info.value_1 = sr130pc10_get_exif(ctrl_info.address,
			ctrl_info.value_2);
		break;
	case EXT_CAM_SET_FLIP:
		sr130pc10_set_flipmode(ctrl_info.value_1);
		break;

	case EXT_CAM_DTP_TEST:
		sr130pc10_check_dataline(ctrl_info.value_1);
		sr130pc10_ctrl->dtp_mode = ctrl_info.value_1;
		break;

	default:
		break;
	}

	if (copy_to_user((void __user *)ioctl_ptr->ioctl_ptr,
		(const void *)&ctrl_info,
			sizeof(ctrl_info)))
		pr_info("fail copy_to_user!");

	return ;
}
Пример #2
0
int sr130pc10_sensor_ext_config(void __user *argp)
{
	struct sensor_ext_cfg_data cfg_data;
	int err = 0;

	printk(KERN_DEBUG "[teddy][%s][E]\n", __func__);

	if (copy_from_user(
		(void *)&cfg_data, (const void *)argp, sizeof(cfg_data)))
		printk(KERN_DEBUG "fail copy_from_user!\n");

	switch (cfg_data.cmd) {
	case EXT_CFG_SET_BRIGHTNESS:
		err = sr130pc10_set_exposure_value(0, cfg_data.value_1);
		break;

	case EXT_CFG_SET_ISO:
		/*err = s5k5ccg_set_ISO(0, cfg_data.value_1);*/
		break;

	case EXT_CFG_SET_MOVIE_MODE:
		sr130pc10_set_movie_mode(cfg_data.value_1);
		break;

	case EXT_CFG_GET_EXIF:
		sr130pc10_get_exif(&cfg_data.value_1, &cfg_data.value_2);
		break;
	case EXT_CAM_SET_FLIP:
		sr130pc10_set_flipmode(cfg_data.value_1);
		break;
	default:
		break;
	}

	if (copy_to_user(
		(void *)argp, (const void *)&cfg_data, sizeof(cfg_data)))
		printk(KERN_DEBUG "fail copy_to_user!\n");

	return err;
}
Пример #3
0
int sr130pc10_sensor_ext_config(void __user *argp)
{
    long ext_config_return = 0;
    sensor_ext_cfg_data cfg_data;
    int exposureTime_value1 = 0, exposureTime_value2 = 0, exposureTime_value3 = 0;
    int exposureTime = 0;

    if (copy_from_user((void *)&cfg_data, (const void *)argp, sizeof(cfg_data)))
        return -EFAULT;

    //printk("sr130pc10_sensor_ext_config, cfg_data.cmd=%d\n", cfg_data.cmd);

    switch(cfg_data.cmd)
    {
        case EXT_CFG_SET_EFFECT:
            sr1_effect = cfg_data.value_1;
            ext_config_return = sr130pc10_set_effect(sr1_effect);
            break;

        case EXT_CFG_GET_EXIF_INFO:
            printk("[SR130PC10] EXT_CFG_GET_EXIF_INFO\n");
            sr130pc10_sensor_write(0x03, 0x20);
            sr130pc10_sensor_read(0x80, &exposureTime_value1);
            sr130pc10_sensor_read(0x81, &exposureTime_value2);
            sr130pc10_sensor_read(0x82, &exposureTime_value3);
            // MCLK = 24 MHz. Divide by 24000 to get exposure time in msec.
            exposureTime = ((exposureTime_value1<<19) + (exposureTime_value2<<11) + (exposureTime_value3<<3)) / 24000;
            cfg_data.value_1 = exposureTime;
            printk("[SR130PC10] EXT_CFG_GET_EXIF_INFO: A(%x), B(%x), C(%x)\n", exposureTime_value1, exposureTime_value2, exposureTime_value3);
            printk("[SR130PC10] exposureTime=%d\n", exposureTime);
            break;
         case EXT_CFG_SET_BRIGHTNESS:
         //  printk(KERN_ERR "[CAMDRV/SR130PC10] EXT_CFG_SET_BRIGHTNESS *** ( %d) brightness =%d preview_enable = %d \n",cfg_data.value_1, ,brightness,preview_enable);
			if((brightness == 0) && (preview_enable == 0)){ 
				//Brightness control should be applied only once before preview is enabled
            	ext_config_return = sr130pc10_set_exposure_value(cfg_data.value_1);
         		brightness = 1;
			}
			//P110909-1364 : running camera, control  Brightness, take a shot and then check image in quick view, return to preview 
			//error : there’s difference on brightness before Quick view and after
			//This created a side effect so chaged the condition to  ||  
			if((brightness) || (preview_enable))
				//This enables when the used tries to change the exposure from UI
            	ext_config_return = sr130pc10_set_exposure_value(cfg_data.value_1);

            break;
         case EXT_CFG_SET_FPS_MODE:
         // printk(KERN_ERR "[CAMDRV/SR130PC100] EXT_CFG_SET_FPS_MODE ***(%d %d)\n",cfg_data.cmd,cfg_data.value_1);
            sr130pc10_set_fps_mode(cfg_data.value_1); 
            break;
        case EXT_CFG_SET_WB:
            sr1_whiteBalance = cfg_data.value_1;
            ext_config_return = sr130pc10_set_whitebalance(sr1_whiteBalance);
	    break;

	case EXT_CFG_SET_DTP:
	    printk(KERN_ERR "[SR130PC10] EXT_CFG_SET_DTP (%d %d)\n",cfg_data.cmd,cfg_data.value_1);
	    ext_config_return = sr130pc10_set_dtp(cfg_data.value_1);
	    if(cfg_data.value_1 == 0) {
	        cfg_data.value_2 = 2;
	    } else if(cfg_data.value_1 == 1) {
	        cfg_data.value_2 = 3;
	    }        
	break;

        default: break;
    }

    if(copy_to_user((void *)argp, (const void *)&cfg_data, sizeof(cfg_data)))
        printk("[sr130pc10]%s fail on copy_to_user!\n", __func__);

#if 0
  struct sensor_cfg_data cfg_data;
  long   rc = 0;
  
  unsigned int value_1, value_2, value_3;
  
  if (copy_from_user(&cfg_data, (void *)argp, sizeof(struct sensor_cfg_data)))
    return -EFAULT;*/
  
  /* down(&sr130pc10_sem); */
  
  printk("sr130pc10_ioctl, cfgtype = %d, mode = %d\n", \
          cfg_data.cfgtype, cfg_data.mode);
  
  switch (cfg_data.cfgtype) {
    case CFG_SET_MODE:
    rc = sr130pc10_set_sensor_mode(cfg_data.mode);
    break;
    
    case CFG_SET_EFFECT:
    rc = sr130pc10_set_effect(cfg_data.mode, cfg_data.cfg.effect);
    break;
    
    case CFG_SET_EXPOSURE_VALUE:
    rc = sr130pc10_set_exposure_value(cfg_data.mode, cfg_data.cfg.ev);			
    break;
    
    case CFG_SET_WB:
    rc = sr130pc10_set_whitebalance(cfg_data.mode, cfg_data.cfg.wb);
    break;
    
    case CFG_SET_ROTATION:
    rc = sr130pc10_set_rotation(cfg_data.cfg.rotation);
    break;
    
    
    case CFG_SET_DATALINE_CHECK:
    if(cfg_data.cfg.dataline)
    {
      printk("[SR130PC10] CFG_SET_DATALINE_CHECK ON\n");
      sr130pc10_sensor_write(0x03, 0x00);
      sr130pc10_sensor_write(0x50, 0x05);
      factory_test = 1;                        
    }
    else
    {         
      printk("[SR130PC10] CFG_SET_DATALINE_CHECK OFF \n");
      sr130pc10_sensor_write(0x03, 0x00);
      sr130pc10_sensor_write(0x50, 0x00);
    }                            
    break;
    
    case CFG_GET_AF_MAX_STEPS:
    default:
    //			rc = -EINVAL;
    rc = 0;
    break;
  }
  /* up(&sr130pc10_sem); */
#endif
  
  return ext_config_return;
}
static long sr130pc10_set_sensor_mode(int mode)
{
	int cnt, vsync_value;
	printk(KERN_DEBUG "[CAM-SENSOR] =Sensor Mode\n ");

	switch (mode) {
	case SENSOR_PREVIEW_MODE:
	case SENSOR_VIDEO_MODE:
		printk(KERN_DEBUG "[SR130PC10]-> Preview\n");
		if (sr130pc10_ctrl->op_mode == 0) {
			sr130pc10_sensor_write_list(sr130pc10_reg_init,
					sizeof(sr130pc10_reg_init) /
					sizeof(sr130pc10_reg_init[0]),
					"sr130pc10_reg_init");
			sr130pc10_ctrl->op_mode = 1;
			if (sr130pc10_ctrl->dtp_mode == 1)
				sr130pc10_check_dataline(1);
		}

		factory_test = 0;
		for (cnt = 0; cnt < 200; cnt++) {
			vsync_value = __gpio_get_value(14);
			if (vsync_value) {
				/*printk(KERN_DEBUG " on preview,
			start cnt:%d vsync_value:%d\n", cnt, vsync_value); */
				break;
			} else {
				/*printk(KERN_DEBUG
				    " on preview,  "
					"wait cnt:%d vsync_value:%d\n",
				     cnt, vsync_value);*/
				/*msleep(1);	changed for coding rule*/
				udelay(1000);
			}
		}
		printk(KERN_DEBUG
		  " on preview,  "
		  "wait cnt:%d vsync_value:%d\n",
		  cnt, vsync_value);

		sr130pc10_sensor_write_list(sr130pc10_preview_reg,
			sizeof(sr130pc10_preview_reg) /
			sizeof(sr130pc10_preview_reg[0]),
			"sr130pc10_preview_reg");	/* preview start */
		if (sr130pc10_ctrl->cam_mode == SENSOR_MOVIE)
			sr130pc10_set_movie_mode(SENSOR_MOVIE);
		sr130pc10_set_exposure_value(0, sr130pc10_ctrl->settings.exposure);

		break;

	case SENSOR_SNAPSHOT_MODE:
	case SENSOR_RAW_SNAPSHOT_MODE:
		printk(KERN_DEBUG "[PGH}-> Capture\n");
		if (Flipmode) {
			sr130pc10_sensor_write_list(
				sr130pc10_capture_reg_X_Flip,
				sizeof(sr130pc10_capture_reg_X_Flip) /
				sizeof(sr130pc10_capture_reg_X_Flip[0]),
				"sr130pc10_capture_reg_X_Flip");
			/* preview start */
		} else {
		sr130pc10_sensor_write_list(sr130pc10_capture_reg,
			sizeof(sr130pc10_capture_reg) /
			sizeof(sr130pc10_capture_reg[0]),
			"sr130pc10_capture_reg");	/* preview start */
		}
		   /*SecFeature : for Android CCD preview mirror
			/ snapshot non-mirror
		   if(factory_test == 0) {
			   if(rotation_status == 90 || rotation_status
				== 270) {
				   sr130pc10_sensor_write(0x03, 0x00);
				   sr130pc10_sensor_write(0x11, 0x93);
			   } else {
				   sr130pc10_sensor_write(0x03, 0x00);
				   sr130pc10_sensor_write(0x11, 0x90);
			   }
		   }
		 */
		break;
	default:
		return 0;
	}

	return 0;
}
Пример #5
0
int sr130pc10_sensor_config(void __user *argp)
{
	struct sensor_cfg_data cfg_data;
	long rc = 0;

	if (copy_from_user(&cfg_data,
			   (void *)argp, sizeof(struct sensor_cfg_data)))
		return -EFAULT;

	/* down(&sr130pc10_sem); */

	printk(KERN_DEBUG "sr130pc10_ioctl, cfgtype = %d, mode = %d\n",
	       cfg_data.cfgtype, cfg_data.mode);

	switch (cfg_data.cfgtype) {
	case CFG_SET_MODE:
		rc = sr130pc10_set_sensor_mode(cfg_data.mode);
		break;

	case CFG_SET_EFFECT:
		rc = sr130pc10_set_effect(cfg_data.mode, cfg_data.cfg.effect);
		break;

	case CFG_SET_EXPOSURE_VALUE:
		rc = sr130pc10_set_exposure_value(cfg_data.mode,
						  cfg_data.cfg.ev);
		break;

	case CFG_SET_WB:
		rc = sr130pc10_set_whitebalance(cfg_data.mode, cfg_data.cfg.wb);
		break;

	case CFG_SET_ROTATION:
		rc = sr130pc10_set_rotation(cfg_data.cfg.rotation);
		break;

	case CFG_SET_DATALINE_CHECK:
		if (cfg_data.cfg.dataline) {
			printk(KERN_DEBUG
				"[SR130PC10] CFG_SET_DATALINE_CHECK ON\n");
			sr130pc10_sensor_write(0x03, 0x00);
			sr130pc10_sensor_write(0x50, 0x05);
			factory_test = 1;
		} else {
			printk(KERN_DEBUG
				"[SR130PC10] CFG_SET_DATALINE_CHECK OFF\n");
			sr130pc10_sensor_write(0x03, 0x00);
			sr130pc10_sensor_write(0x50, 0x00);
		}
		break;

	case CFG_GET_AF_MAX_STEPS:
	default:
/*                      rc = -EINVAL; */
		rc = 0;
		break;
	}

	/* up(&sr130pc10_sem); */

	return rc;
}