|  | 
[Fireprime] s5k4ec AF function has some error!!
    
    Posted at  6/12/2018 13:05:50
            
         View:3617
     |
     Replies:1
     
  
     
 
   	
    
  Print   
        
  
   
  Only Author 
    [Copy Link]
	
    
 
  	             
1# 
 
| Hi, 
 I have a problem using the s5k4ec module that you made.
 
 I modified your /media/video/s5k4ec.c to use Auto Focus as follows:
 
 static unsigned int SensorConfiguration = (CFG_WhiteBalance|CFG_Effect
 |CFG_Scene|CFG_Focus
 |CFG_FocusZone);
 //below is original code.
 //static unsigned int SensorConfiguration = (CFG_WhiteBalance|CFG_Effect
 //                                           |CFG_Scene
 //                                           |CFG_FocusZone);
 
 Without the AF function, the captured image is too burred, that is, it is not clean.
 If I use AF, the image is better than no AF.
 But it is still burr.
 
 So, I debugged the code, and then I found some error in your code
 
 the debugging message as follows:
 
 == error log  ->why this log is happening?
 [   72.292728] s5k4ec[8452] [jaym ################ single focus mode set !
 [   74.265015] s5k4ec(8479): s5k4ec[8479] [jaym ######]focus state(0x4718) is error!
 
 == source code s5k4ec.c
 static int sensor_focus_af_single_usr_cb(struct i2c_client *client)
 {
 
 int ret = 0;
 char cnt;
 u16 state;
 struct af_cmdinfo cmdinfo;
 //char s_zone[5],i;
 cmdinfo.cmd_tag = 0x01;
 cmdinfo.validate_bit = 0x80;
 printk("%s[%d] [jaym ################ single focus mode set !\n",SENSOR_NAME_STRING(),__LINE__);
 
 
 sensor_write(client,0xFCFC, 0xD000),
 sensor_write(client,0x0028, 0x7000),
 sensor_write(client,0x002A, 0x028E),
 sensor_write(client,0x0F12, 0x0000),
 sensor_write(client,0x002A, 0x028C),
 sensor_write(client,0x0F12, 0x0005),
 
 //sensor_write(client,0xffff, 150),   // delay 150ms
 
 cnt = 0;
 state=0x0000;
 do
 {
 if (cnt != 0) {
 msleep(1);
 }
 cnt++;
 sensor_write(client,0x002E, 0x2EEE),
 ret = sensor_read(client, 0x0f12, &state);
 //printk("[jaym ] printk ######### \n");
 
 }while((state != 0x0002) && (cnt<100));
 
 if (state != 0x0002) {
 SENSOR_TR("%s[%d] [jaym ######]focus state(0x%x) is error!\n",SENSOR_NAME_STRING(),__LINE__,state);
 ret = -1;
 goto sensor_af_single_end;
 } else {
 SENSOR_DG("%s[%d] single focus mode set success!\n",SENSOR_NAME_STRING(),__LINE__);
 }
 sensor_af_single_end:
 return ret;
 }
 
 Can you help me why this is happening?
 
 thank you
 
 | 
 |