#define CONFIG_SENSOR_Focus 0
#endif
-#define CONFIG_SENSOR_I2C_SPEED 50*1000 /* Hz */
+#define CONFIG_SENSOR_I2C_SPEED 400*1000 /* Hz */
/* Sensor write register continues by preempt_disable/preempt_enable for current process not be scheduled */
#define CONFIG_SENSOR_I2C_NOSCHED 0
#define CONFIG_SENSOR_I2C_RDWRCHK 0
#endif
static struct reginfo sensor_ClrFmt_YUYV[]=
{
- {0x4300,0x30},
{0x4300,0x30},
{0x4300,0x30},
{SEQUENCE_END, 0x00}
static struct reginfo sensor_ClrFmt_UYVY[]=
{
- {0x4300,0x32},
{0x4300,0x32},
{0x4300,0x32},
{SEQUENCE_END, 0x00}
ret = -1;
goto sensor_af_single_end;
}
-
+
cnt = 0;
do
{
static int sensor_af_init(struct i2c_client *client)
{
- int ret = 0;
- char state,cnt;
+ int ret = 0, cnt;
+ char state;
ret = sensor_write_array(client, sensor_af_firmware);
if (ret != 0) {
cnt = 0;
do
{
- if (cnt != 0) {
- msleep(1);
- }
- cnt++;
- ret = sensor_read(client, STA_FOCUS_Reg, &state);
+ msleep(1);
+ if (cnt++ > 500)
+ break;
+ ret = sensor_read(client, STA_FOCUS_Reg, &state);
if (ret != 0){
SENSOR_TR("%s[%d] read focus_status failed\n",SENSOR_NAME_STRING(),__LINE__);
ret = -1;
goto sensor_af_init_end;
}
- }while((state == S_STARTUP) && (cnt<100));
+ } while (state != S_IDLE);
if (state != S_IDLE) {
SENSOR_TR("%s focus state(0x%x) is error!\n",SENSOR_NAME_STRING(),state);
* and VIDIOC_DQBUF is sched. so unlock video_lock here.
*/
if (wait == true) {
- mutex_unlock(&icd->video_lock);
- if (wait_event_timeout(wk->done, (wk->result != WqRet_inval), msecs_to_jiffies(2500)) == 0) {
- SENSOR_TR("%s %s cmd(%d) is timeout!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
+ mutex_unlock(&icd->video_lock);
+ if (wait_event_timeout(wk->done, (wk->result != WqRet_inval), msecs_to_jiffies(5000)) == 0) { //hhb
+ SENSOR_TR("%s %s cmd(%d) is timeout!\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
}
ret = wk->result;
kfree((void*)wk);
}
ret = sensor_write_array(client, sensor_init_data);
+ udelay(1000); //wait sensor power on,so that I2C write sensor registers would sucess hhb@rock-chips.con
+
if (ret != 0) {
SENSOR_TR("error: %s initial failed\n",SENSOR_NAME_STRING());
goto sensor_INIT_ERR;
if (((winseqe_set_addr->reg == SEQUENCE_PROPERTY) && (winseqe_set_addr->val == SEQUENCE_NORMAL))
|| (winseqe_set_addr->reg != SEQUENCE_PROPERTY)) {
ret |= sensor_write_array(client,sensor_init_data);
+ udelay(1000); //wait sensor power on,so that I2C write sensor registers would sucess hhb@rock-chips.con
SENSOR_DG("\n%s reinit ret:0x%x \n",SENSOR_NAME_STRING(), ret);
}
}