[Fireprime] s5k4ec AF function has some error!!

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

I fixed it,

sensor_write(client,0x002c, 0x7000);
sensor_write(client,0x002E, 0x2EEE),
ret = sensor_read(client, 0x0f12, &state);

it needs more write,

But its captured image is still burred..

I need it to be more cleared.

Somebody can help???

This is a stellar article, thank you for sharing it with us. I got promoted and received a raise thanks to this DP-900 latest test practice. Now, I’m sharing it for free with everyone. Best of luck with your career growth!

I walked away from the article feeling much more informed. The Reliable SDS test notes platform offers detailed material at no cost, aimed at assisting you.