static int YushanII_set_defcor_level(void __user *argp) { Ilp0100_structDefcorConfig DefcorConfig; Ilp0100_structDefcorParams DefcorParams; defcor_level_t defcor_level; bool_t defcorParamsUpdate = FALSE; if(copy_from_user(&defcor_level, argp, sizeof(defcor_level_t))) { pr_err("[CAM] copy from user error\n"); return -EFAULT; } if(yushanii_init_cam == 1) { pr_info("[CAM] init cam is in progress, update defcor level later\n"); return -EBUSY; } switch(defcor_level) { case DEFCOR_LEVEL_0: DefcorConfig.Mode = OFF; defcorParamsUpdate = FALSE; break; case DEFCOR_LEVEL_1: DefcorConfig.Mode = SINGLET_AND_COUPLET; DefcorParams.BlackStrength = 16; DefcorParams.CoupletThreshold = 150; DefcorParams.SingletThreshold = 20; DefcorParams.WhiteStrength = 16; defcorParamsUpdate = TRUE; break; case DEFCOR_LEVEL_2: DefcorConfig.Mode = SINGLET_AND_COUPLET; DefcorParams.BlackStrength = 16; DefcorParams.CoupletThreshold = 200; DefcorParams.SingletThreshold = 12; DefcorParams.WhiteStrength = 16; defcorParamsUpdate = TRUE; break; default: DefcorConfig.Mode = SINGLET_AND_COUPLET; DefcorParams.BlackStrength = 16; DefcorParams.CoupletThreshold = 150; DefcorParams.SingletThreshold = 20; DefcorParams.WhiteStrength = 16; defcorParamsUpdate = TRUE; break; } Ilp0100_configDefcorShortOrNormal(DefcorConfig); Ilp0100_configDefcorLong(DefcorConfig); if (defcorParamsUpdate) { Ilp0100_updateDefcorShortOrNormal(DefcorParams); Ilp0100_updateDefcorLong(DefcorParams); } return 0; }
int YushanII_set_defcor(int disable_defcor){ Ilp0100_structDefcorConfig DefcorConfig; Ilp0100_structDefcorParams DefcorParams; pr_info("[CAM] %s, set disable defcor correction:%d", __func__, disable_defcor); DefcorParams.BlackStrength = 16; DefcorParams.CoupletThreshold = 150; DefcorParams.SingletThreshold = 20; DefcorParams.WhiteStrength = 16; if (disable_defcor == 1) { DefcorConfig.Mode = OFF; Ilp0100_configDefcorShortOrNormal(DefcorConfig); Ilp0100_configDefcorLong(DefcorConfig); } else { DefcorConfig.Mode = SINGLET_AND_COUPLET; Ilp0100_configDefcorShortOrNormal(DefcorConfig); Ilp0100_configDefcorLong(DefcorConfig); Ilp0100_updateDefcorShortOrNormal(DefcorParams); Ilp0100_updateDefcorLong(DefcorParams); } return 0; }