printk(KERN_WARNING fmt , ## arg); } while (0)
#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__)
-#define SENSOR_DG(format, ...) dprintk(0, format, ## __VA_ARGS__)
+#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__)
#define _CONS(a,b) a##b
#define CONS(a,b) _CONS(a,b)
#define SENSOR_AF_IS_ERR (0x00<<0)
#define SENSOR_AF_IS_OK (0x01<<0)
+#define SENSOR_INIT_IS_ERR (0x00<<28)
+#define SENSOR_INIT_IS_OK (0x01<<28)
#if CONFIG_SENSOR_Focus
#define SENSOR_AF_MODE_INFINITY 0
{0x0014, 0x2447, WORD_LEN, 0 }, // PLL_CONTROL
{0x0014, 0x2047, WORD_LEN, 0 }, // PLL_CONTROL
-{ SEQUENCE_WAIT_MS,10, WORD_LEN, 0},
+{SEQUENCE_WAIT_MS,50, WORD_LEN, 0},
// POLL PLL_CONTROL::PLL_LOCK => 0x01
{0x0014, 0x2046, WORD_LEN, 0 }, // PLL_CONTROL
{0x0022, 0x01E0, WORD_LEN, 0 }, // VDD_DIS_COUNTER//208
{0x0018, 0x402C, WORD_LEN, 0 }, // STANDBY_CONTROL_AND_STATUS
{0x001e,0x0006, WORD_LEN, 0 }, //adjust slew rate to minimize EMI
-{ SEQUENCE_WAIT_MS,10, WORD_LEN, 0},
+{SEQUENCE_WAIT_MS,100, WORD_LEN, 0},
// POLL STANDBY_CONTROL_AND_STATUS::STANDBY_DONE => 0x00
//{0x098E, 0x6006, WORD_LEN, 0 }, // MCU_ADDRESS
static struct reginfo sensor_Effect_Solarize[] =
{
-
+ {0x098E, 0xE883, WORD_LEN, 0}, // MCU_ADDRESS [PRI_A_CONFIG_SYSCTRL_SELECT_FX]
+ {0x0990, 0x0004, WORD_LEN, 0}, // MCU_DATA_0
+ {0x098E, 0xEC83, WORD_LEN, 0}, // MCU_ADDRESS [PRI_B_CONFIG_SYSCTRL_SELECT_FX]
+ {0x0990, 0x0004, WORD_LEN, 0}, // MCU_DATA_0
+
+ {0x098E, 0x8400, WORD_LEN, 0}, // MCU_ADDRESS [SEQ_CMD]
+ {0x0990, 0x0006, WORD_LEN, 0}, // MCU_DATA_0
{SEQUENCE_END, 0x00}
};
}
#endif
SENSOR_DG("\n%s..%s.. icd->width = %d.. icd->height %d\n",SENSOR_NAME_STRING(),((val == 0)?__FUNCTION__:"sensor_reinit"),icd->user_width,icd->user_height);
+
+ sensor->info_priv.funmodule_state |= SENSOR_INIT_IS_OK;
return 0;
sensor_INIT_ERR:
+ sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;
sensor_task_lock(client,0);
- sensor_deactivate(client);
+ sensor_deactivate(client);
return ret;
}
static int sensor_deactivate(struct i2c_client *client)
{
struct soc_camera_device *icd = client->dev.platform_data;
u16 reg_val = 0;
+ struct sensor *sensor = to_sensor(client);
struct reginfo reg_info;
SENSOR_DG("\n%s..%s.. Enter\n",SENSOR_NAME_STRING(),__FUNCTION__);
- /* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */
- sensor_task_lock(client, 1);
-
- sensor_read( client, 0x001a, ®_val);
- reg_info.reg = 0x001a;
- reg_info.val = reg_val & (~0x0200);//reg_val & (~0x02);
- reg_info.reg_len = 0x04;
- sensor_write(client, ®_info);
-
- sensor_task_lock(client, 0);
+ /* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */
+ if (sensor->info_priv.funmodule_state & SENSOR_INIT_IS_OK) {
+ sensor_task_lock(client, 1);
+
+ sensor_read( client, 0x001a, ®_val);
+ reg_info.reg = 0x001a;
+ reg_info.val = reg_val & (~0x0200);//reg_val & (~0x02);
+ reg_info.reg_len = 0x04;
+ sensor_write(client, ®_info);
+
+ sensor_task_lock(client, 0);
+ }
sensor_ioctrl(icd, Sensor_PowerDown, 1);
/* ddl@rock-chips.com : sensor config init width , because next open sensor quickly(soc_camera_open -> Try to configure with default parameters) */
icd->user_width = SENSOR_INIT_WIDTH;
icd->user_height = SENSOR_INIT_HEIGHT;
msleep(100);
+ sensor->info_priv.funmodule_state &= ~SENSOR_INIT_IS_OK;
return 0;
}
static struct reginfo sensor_power_down_sequence[]=
ret |= sensor_write_array(client, sensor_Preview2Capture);
if (ret != 0) {
- SENSOR_TR("-----------%s : %s : %d Preview 2 Capture failed\n", SENSOR_NAME_STRING(),__FUNCTION__,__LINE__);
- goto sensor_s_fmt_end;
- }
-
-
- SENSOR_TR("-----------%s : %s : %d Preview 2 Capture success!\n", SENSOR_NAME_STRING(),__FUNCTION__,__LINE__);
+ SENSOR_TR("%s Preview 2 Capture failed\n", SENSOR_NAME_STRING());
+ goto sensor_s_fmt_end;
+ }
+ SENSOR_DG("%s Preview 2 Capture success!\n", SENSOR_NAME_STRING());
#if CONFIG_SENSOR_Flash
if( (sensor->info_priv.flash == 1)|| (sensor->info_priv.flash == 2)) {
SENSOR_TR("%s Capture 2 Preview failed !!\n", SENSOR_NAME_STRING());
goto sensor_s_fmt_end;
}
+
+ mdelay(200); //delay microseconds to forbid invalidate data
- SENSOR_TR("%s Capture 2 Preview success\n", SENSOR_NAME_STRING());
+ SENSOR_DG("%s Capture 2 Preview success\n", SENSOR_NAME_STRING());
/* #if CONFIG_SENSOR_Flash
if ((sensor->info_priv.flash == 1) || (sensor->info_priv.flash == 2)) {
if (sensor_set_flash(icd, qctrl,ext_ctrl->value) != 0)
return -EINVAL;
sensor->info_priv.flash = ext_ctrl->value;
-
- SENSOR_DG("--------flash------------%s flash is %x %d\n",SENSOR_NAME_STRING(), sensor->info_priv.flash,__LINE__);
break;
}
#endif
{
struct i2c_client *client = sd->priv;
struct soc_camera_device *icd = client->dev.platform_data;
- int i, error_cnt=0, error_idx=-1;
-
- SENSOR_DG("\n%s..%s.. ext_ctrl->count = %d\n",__FUNCTION__,SENSOR_NAME_STRING(),ext_ctrl->count);
+ int i, error_cnt=0, error_idx=-1;
for (i=0; i<ext_ctrl->count; i++) {
if (sensor_s_ext_control(icd, &ext_ctrl->controls[i]) != 0) {