atomic_t tasklock_cnt;
#endif
struct rk29camera_platform_data *sensor_io_request;
+ struct rk29camera_gpio_res *sensor_gpio_res;
};
static struct sensor* to_sensor(const struct i2c_client *client)
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
- return -1;
+ return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
struct soc_camera_link *icl = to_soc_camera_link(icd);
int ret = 0;
-
+ SENSOR_DG("%s %s cmd(%d) on(%d)\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd,on);
switch (cmd)
{
case Sensor_PowerDown:
}
default:
{
- SENSOR_TR("%s power cmd(0x%x) is unknown!",SENSOR_NAME_STRING(),cmd);
+ SENSOR_TR("%s %s cmd(0x%x) is unknown!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
break;
}
}
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
- int ret,pid = 0;
+ int ret;
+#if (SENSOR_ID_REG != SEQUENCE_END)
+ u16 pid = 0;
+#endif
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
sensor->info_priv.digitalzoom = qctrl->default_value;
/* ddl@rock-chips.com : if sensor support auto focus and flash, programer must run focus and flash code */
- qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_ABSOLUTE);
+ #if CONFIG_SENSOR_Focus
+ sensor_set_focus();
+ qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FOCUS_ABSOLUTE);
if (qctrl)
sensor->info_priv.focus = qctrl->default_value;
+ #endif
#if CONFIG_SENSOR_Flash
qctrl = soc_camera_find_qctrl(&sensor_ops, V4L2_CID_FLASH);
/* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */
sensor_task_lock(client, 1);
+ 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);
return 0;
}
static struct reginfo sensor_power_down_sequence[]=
return -EINVAL;
}
#endif
+#if CONFIG_SENSOR_Flash
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
+{
+ if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
+ if (value == 3) { /* ddl@rock-chips.com: torch */
+ sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
+ } else {
+ sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
+ }
+ SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
+ return 0;
+ }
+
+ SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
+ return -EINVAL;
+}
+#endif
#if CONFIG_SENSOR_Focus
static int sensor_set_focus_absolute(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
{
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
return -EINVAL;
}
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
return -EINVAL;
}
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
return -EINVAL;
}
}
case V4L2_CID_FOCUS_ABSOLUTE:
{
- return -EINVAL;
+ ext_ctrl->value = sensor->info_priv.focus;
+ break;
}
case V4L2_CID_FOCUS_RELATIVE:
{
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
return -EINVAL;
}
#if CONFIG_SENSOR_Flash
case V4L2_CID_FLASH:
{
+ if (sensor_set_flash(icd, qctrl,ext_ctrl->value) != 0)
+ return -EINVAL;
sensor->info_priv.flash = ext_ctrl->value;
SENSOR_DG("%s flash is %x\n",SENSOR_NAME_STRING(), sensor->info_priv.flash);
} else if (enable == 0) {
sensor->info_priv.enable = 0;
}
-
-sensor_s_stream_end:
+
return 0;
}
static int sensor_video_probe(struct soc_camera_device *icd,
struct i2c_client *client)
{
- int ret,pid = 0;
+ int ret;
+#if (SENSOR_ID_REG != SEQUENCE_END)
+ u16 pid = 0;
+#endif
+
struct sensor *sensor = to_sensor(client);
/* We must have a parent by now. And it cannot be a wrong one.
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
+ struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
-
+ int ret = 0;
+#if CONFIG_SENSOR_Flash
+ int i;
+#endif
+
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
switch (cmd)
{
case RK29_CAM_SUBDEV_IOREQUEST:
{
sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ if (sensor->sensor_io_request != NULL) {
+ if (sensor->sensor_io_request->gpio_res[0].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
+ } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ }
+ } else {
+ SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
+ }
+ /* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
+ for this project */
+ #if CONFIG_SENSOR_Flash
+ if (sensor->sensor_gpio_res) {
+ if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
+ for (i = 0; i < icd->ops->num_controls; i++) {
+ if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
+ memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
+ }
+ }
+ sensor->info_priv.flash = 0xff;
+ SENSOR_DG("%s flash gpio is invalidate!\n",SENSOR_NAME_STRING());
+ }
+ }
+ #endif
break;
}
default:
break;
}
}
-
- return 0;
+sensor_ioctl_end:
+ return ret;
}
preempt_enable();
}
}
-#endif
+
return 0;
sensor_task_lock_err:
- return -1;
+ return -1;
+#else
+ return 0;
+#endif
}
static int sensor_read(struct i2c_client *client, u16 reg, u16 *val);
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
struct i2c_client *client = sd->priv;
+ const struct v4l2_queryctrl *qctrl;
struct sensor *sensor = to_sensor(client);
struct soc_camera_device *icd = client->dev.platform_data;
- const struct v4l2_queryctrl *qctrl;
-
-
qctrl = soc_camera_find_qctrl(&sensor_ops, ctrl->id);
if (!qctrl)
const struct v4l2_queryctrl *qctrl;
struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
struct sensor *sensor = to_sensor(client);
- int val_offset;
+ int val_offset;
qctrl = soc_camera_find_qctrl(&sensor_ops, ext_ctrl->id);
sensor->info_priv.enable = 0;
}
-sensor_s_stream_end:
return 0;
}
{
int ret=0;
struct sensor *sensor = to_sensor(client);
+#if (SENSOR_ID_REG != SEQUENCE_END)
+ u16 pid;
+#endif
/* We must have a parent by now. And it cannot be a wrong one.
* So this entire test is completely redundant. */
/* check if it is an sensor sensor */
#if (SENSOR_ID_REG != SEQUENCE_END)
- u16 pid;
ret = sensor_read(client, SENSOR_ID_REG, &pid);
if (ret != 0) {
SENSOR_TR("read chip id failed\n");
atomic_t tasklock_cnt;
#endif
struct rk29camera_platform_data *sensor_io_request;
+ struct rk29camera_gpio_res *sensor_gpio_res;
};
static struct sensor* to_sensor(const struct i2c_client *client)
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
struct soc_camera_link *icl = to_soc_camera_link(icd);
int ret = 0;
-
+ SENSOR_DG("%s %s cmd(%d) on(%d)\n",SENSOR_NAME_STRING(),__FUNCTION__,cmd,on);
switch (cmd)
{
case Sensor_PowerDown:
}
default:
{
- SENSOR_TR("%s power cmd(0x%x) is unknown!",SENSOR_NAME_STRING(),cmd);
+ SENSOR_TR("%s %s cmd(0x%x) is unknown!",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
break;
}
}
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
int ret,pid = 0;
+#if (SENSOR_RESET_REG != SEQUENCE_END)
+ struct reginfo reg_info;
+#endif
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
goto sensor_INIT_ERR;
#if (SENSOR_RESET_REG != SEQUENCE_END)
- struct reginfo reg_info;
reg_info.reg = SENSOR_RESET_REG;
reg_info.val = SENSOR_RESET_VAL;
reg_info.reg_len = SENSOR_RESET_REG_LEN;
/* 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);
return 0;
}
static struct reginfo sensor_power_down_sequence[]=
return -EINVAL;
}
#endif
+#if CONFIG_SENSOR_Flash
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
+{
+ if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
+ if (value == 3) { /* ddl@rock-chips.com: torch */
+ sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
+ } else {
+ sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
+ }
+ SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
+ return 0;
+ }
+
+ SENSOR_TR("\n %s..%s valure = %d is invalidate.. \n",SENSOR_NAME_STRING(),__FUNCTION__,value);
+ return -EINVAL;
+}
+#endif
#if CONFIG_SENSOR_Focus
static int sensor_set_focus_absolute(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
{
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
return -EINVAL;
}
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ctrl->id);
return -EINVAL;
}
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
return -EINVAL;
}
}
case V4L2_CID_FOCUS_ABSOLUTE:
{
- return -EINVAL;
+ ext_ctrl->value = sensor->info_priv.focus;
+ break;
}
case V4L2_CID_FOCUS_RELATIVE:
{
if (!qctrl)
{
- SENSOR_TR("\n %s ioctrl id = 0x%x is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
+ SENSOR_TR("\n %s ioctrl id = %d is invalidate \n", SENSOR_NAME_STRING(), ext_ctrl->id);
return -EINVAL;
}
#if CONFIG_SENSOR_Flash
case V4L2_CID_FLASH:
{
+ if (sensor_set_flash(icd, qctrl,ext_ctrl->value) != 0)
+ return -EINVAL;
sensor->info_priv.flash = ext_ctrl->value;
SENSOR_DG("%s flash is %x\n",SENSOR_NAME_STRING(), sensor->info_priv.flash);
} else if (enable == 0) {
sensor->info_priv.enable = 0;
}
-
-sensor_s_stream_end:
return 0;
}
{
int ret,pid = 0;
struct sensor *sensor = to_sensor(client);
+#if (SENSOR_RESET_REG != SEQUENCE_END)
+ struct reginfo reg_info;
+#endif
/* We must have a parent by now. And it cannot be a wrong one.
* So this entire test is completely redundant. */
/* soft reset */
#if (SENSOR_RESET_REG != SEQUENCE_END)
- struct reginfo reg_info;
reg_info.reg = SENSOR_RESET_REG;
reg_info.val = SENSOR_RESET_VAL;
reg_info.reg_len = SENSOR_RESET_REG_LEN;
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct i2c_client *client = sd->priv;
+ struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
+ int ret = 0;
+#if CONFIG_SENSOR_Flash
+ int i;
+#endif
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
switch (cmd)
}
case RK29_CAM_SUBDEV_IOREQUEST:
{
- sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ sensor->sensor_io_request = (struct rk29camera_platform_data*)arg;
+ if (sensor->sensor_io_request != NULL) {
+ if (sensor->sensor_io_request->gpio_res[0].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[0].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[0];
+ } else if (sensor->sensor_io_request->gpio_res[1].dev_name &&
+ (strcmp(sensor->sensor_io_request->gpio_res[1].dev_name, dev_name(icd->pdev)) == 0)) {
+ sensor->sensor_gpio_res = (struct rk29camera_gpio_res*)&sensor->sensor_io_request->gpio_res[1];
+ }
+ } else {
+ SENSOR_TR("%s %s RK29_CAM_SUBDEV_IOREQUEST fail\n",SENSOR_NAME_STRING(),__FUNCTION__);
+ ret = -EINVAL;
+ goto sensor_ioctl_end;
+ }
+ /* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
+ for this project */
+ #if CONFIG_SENSOR_Flash
+ if (sensor->sensor_gpio_res) {
+ if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
+ for (i = 0; i < icd->ops->num_controls; i++) {
+ if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
+ memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
+ }
+ }
+ sensor->info_priv.flash = 0xff;
+ SENSOR_DG("%s flash gpio is invalidate!\n",SENSOR_NAME_STRING());
+ }
+ }
+ #endif
break;
}
default:
break;
}
}
-
- return 0;
+sensor_ioctl_end:
+ return ret;
}
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
{
int err = 0, cnt;
int i = 0;
+#if CONFIG_SENSOR_I2C_RDWRCHK
char valchk;
+#endif
cnt = 0;
if (sensor_task_lock(client, 1) < 0)
}
#endif
#if CONFIG_SENSOR_Flash
-static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int *value)
-{
- struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
- struct sensor *sensor = to_sensor(client);
- const struct v4l2_queryctrl *qctrl_info;
-
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
+{
if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
if (value == 3) { /* ddl@rock-chips.com: torch */
sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
- return -1;
+ return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
{
int err = 0, cnt;
int i = 0;
+#if CONFIG_SENSOR_I2C_RDWRCHK
char valchk;
+#endif
cnt = 0;
if (sensor_task_lock(client, 1) < 0)
sensor_task_lock(client,0);
return err;
}
+#if CONFIG_SENSOR_I2C_RDWRCHK
static int sensor_readchk_array(struct i2c_client *client, struct reginfo *regarray)
{
int cnt;
}
return 0;
}
+#endif
static int sensor_ioctrl(struct soc_camera_device *icd,enum rk29sensor_power_cmd cmd, int on)
{
struct soc_camera_link *icl = to_soc_camera_link(icd);
}
#endif
#if CONFIG_SENSOR_Flash
-static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int *value)
-{
- struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
- struct sensor *sensor = to_sensor(client);
- const struct v4l2_queryctrl *qctrl_info;
-
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
+{
if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
if (value == 3) { /* ddl@rock-chips.com: torch */
sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
/* ddl@rock-chips.com : if gpio_flash havn't been set in board-xxx.c, sensor driver must notify is not support flash control
for this project */
#if CONFIG_SENSOR_Flash
- if (sensor->sensor_gpio_res) {
+ if (sensor->sensor_gpio_res) {
if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
for (i = 0; i < icd->ops->num_controls; i++) {
if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
- memset(&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
+ memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
}
}
sensor->info_priv.flash = 0xff;
#endif
ret = sensor_video_probe(icd, client);
- if (ret) {
+ if (ret < 0) {
icd->ops = NULL;
i2c_set_clientdata(client, NULL);
kfree(sensor);
+ sensor = NULL;
}
SENSOR_DG("\n%s..%s..%d ret = %x \n",__FUNCTION__,__FILE__,__LINE__,ret);
return ret;
i2c_set_clientdata(client, NULL);
client->driver = NULL;
kfree(sensor);
-
+ sensor = NULL;
return 0;
}
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
- return -1;
+ return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
break;
}
default:
+ {
SENSOR_DG("%s focus mode(0x%x) is unkonwn\n",SENSOR_NAME_STRING(),sensor->info_priv.auto_focus);
+ goto sensor_af_wq_function_end;
+ }
}
SENSOR_DG("%s sensor_af_wq_function set focus mode(0x%x) ret:0x%x\n",SENSOR_NAME_STRING(), sensor->info_priv.auto_focus,ret);
{
struct sensor_work *sensor_work = container_of(work, struct sensor_work, dwork.work);
struct i2c_client *client = sensor_work->client;
- struct sensor *sensor = to_sensor(client);
if (sensor_af_wq_function(client) < 0) {
SENSOR_TR("%s af workqueue return false\n",SENSOR_NAME_STRING());
}
#endif
#if CONFIG_SENSOR_Flash
-static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int *value)
-{
- struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
- struct sensor *sensor = to_sensor(client);
- const struct v4l2_queryctrl *qctrl_info;
-
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
+{
if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
if (value == 3) { /* ddl@rock-chips.com: torch */
sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
} else {
sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
}
- SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
+ SENSOR_DG("%s..%s : %d\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
return 0;
}
for this project */
#if CONFIG_SENSOR_Flash
if (sensor->sensor_gpio_res) {
+ printk("flash io:%d\n",sensor->sensor_gpio_res->gpio_flash);
if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
for (i = 0; i < icd->ops->num_controls; i++) {
if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
- memset(&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
+ memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
}
}
sensor->info_priv.flash = 0xff;
#endif
ret = sensor_video_probe(icd, client);
- if (ret) {
+ if (ret < 0) {
icd->ops = NULL;
i2c_set_clientdata(client, NULL);
kfree(sensor);
struct mutex wq_lock;
int model; /* V4L2_IDENT_OV* codes from v4l2-chip-ident.h */
#if CONFIG_SENSOR_I2C_NOSCHED
- atomic_t tasklock_cnt;
+ atomic_t tasklock_cnt;
#endif
struct rk29camera_platform_data *sensor_io_request;
struct rk29camera_gpio_res *sensor_gpio_res;
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
- return -1;
+ return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
break;
}
default:
+ {
SENSOR_DG("%s focus mode(0x%x) is unkonwn\n",SENSOR_NAME_STRING(),sensor->info_priv.auto_focus);
+ goto sensor_af_wq_function_end;
+ }
}
SENSOR_DG("%s sensor_af_wq_function set focus mode(0x%x) ret:0x%x\n",SENSOR_NAME_STRING(), sensor->info_priv.auto_focus,ret);
#endif
#if CONFIG_SENSOR_Flash
-static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int *value)
-{
- struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
- struct sensor *sensor = to_sensor(client);
- const struct v4l2_queryctrl *qctrl_info;
-
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
+{
if ((value >= qctrl->minimum) && (value <= qctrl->maximum)) {
if (value == 3) { /* ddl@rock-chips.com: torch */
sensor_ioctrl(icd, Sensor_Flash, Flash_Torch); /* Flash On */
} else {
sensor_ioctrl(icd, Sensor_Flash, Flash_Off);
}
- SENSOR_DG("%s..%s : %x\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
+ SENSOR_DG("%s..%s : %d\n",SENSOR_NAME_STRING(),__FUNCTION__, value);
return 0;
}
if (sensor->sensor_gpio_res->gpio_flash == INVALID_GPIO) {
for (i = 0; i < icd->ops->num_controls; i++) {
if (V4L2_CID_FLASH == icd->ops->controls[i].id) {
- memset(&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
+ memset((char*)&icd->ops->controls[i],0x00,sizeof(struct v4l2_queryctrl));
}
}
sensor->info_priv.flash = 0xff;
/* Sensor Driver Configuration */
#define SENSOR_NAME RK29_CAM_SENSOR_S5K6AA
-#define SENSOR_V4L2_IDENT V4L2_IDENT_S5K66A
+#define SENSOR_V4L2_IDENT V4L2_IDENT_S5K66A
#define SENSOR_ID 0x06aa
#define SENSOR_ID_REG SEQUENCE_END//0x015a
#define SENSOR_RESET_REG SEQUENCE_END
preempt_enable();
}
}
-#endif
return 0;
sensor_task_lock_err:
return -1;
+#else
+ return 0;
+#endif
+
}
/* sensor register write */
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
const struct v4l2_queryctrl *qctrl;
- int ret,pid = 0;
+ int ret;
+ u16 pid = 0;
SENSOR_DG("\n%s..%s.. \n",SENSOR_NAME_STRING(),__FUNCTION__);
}
#endif
#if CONFIG_SENSOR_Flash
-static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int *value)
+static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_queryctrl *qctrl, int value)
{
struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
struct sensor *sensor = to_sensor(client);
sensor->info_priv.enable = 0;
}
-sensor_s_stream_end:
return 0;
}
/* Interface active, can use i2c. If it fails, it can indeed mean, that
struct i2c_client *client = sd->priv;
struct soc_camera_device *icd = client->dev.platform_data;
struct sensor *sensor = to_sensor(client);
- int ret = 0,i;
+ int ret = 0;
+#if CONFIG_SENSOR_Flash
+ int i;
+#endif
SENSOR_DG("\n%s..%s..cmd:%x \n",SENSOR_NAME_STRING(),__FUNCTION__,cmd);
switch (cmd)