atomic_add(1, &sensor->tasklock_cnt);
} else {
- atomic_sub(1, &sensor->tasklock_cnt);
+ if (atomic_read(&sensor->tasklock_cnt) > 0) {
+ atomic_sub(1, &sensor->tasklock_cnt);
- if (atomic_read(&sensor->tasklock_cnt) == 0)
- preempt_enable();
+ if (atomic_read(&sensor->tasklock_cnt) == 0)
+ preempt_enable();
+ }
}
#endif
return 0;
return 0;
sensor_INIT_ERR:
+ sensor_task_lock(client,0);
sensor_deactivate(client);
return ret;
}
#define dprintk(level, fmt, arg...) do { \
if (debug >= level) \
- printk(KERN_DEBUG fmt , ## arg); } while (0)
+ printk(KERN_WARNING fmt , ## arg); } while (0)
#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__)
-#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__)
+#define SENSOR_DG(format, ...) dprintk(0, format, ## __VA_ARGS__)
#define _CONS(a,b) a##b
atomic_add(1, &sensor->tasklock_cnt);
} else {
- atomic_sub(1, &sensor->tasklock_cnt);
+ if (atomic_read(&sensor->tasklock_cnt) > 0) {
+ atomic_sub(1, &sensor->tasklock_cnt);
- if (atomic_read(&sensor->tasklock_cnt) == 0)
- preempt_enable();
+ if (atomic_read(&sensor->tasklock_cnt) == 0)
+ preempt_enable();
+ }
}
#endif
return 0;
ret = -ENODEV;
goto sensor_INIT_ERR;
}
-
mdelay(5); //delay 5 microseconds
/* check if it is an sensor sensor */
return 0;
sensor_INIT_ERR:
+ sensor_task_lock(client,0);
sensor_deactivate(client);
return ret;
}
#define dprintk(level, fmt, arg...) do { \
if (debug >= level) \
- printk(KERN_DEBUG fmt , ## arg); } while (0)
+ printk(KERN_WARNING fmt , ## arg); } while (0)
#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__)
-#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__)
+#define SENSOR_DG(format, ...) dprintk(0, format, ## __VA_ARGS__)
#define _CONS(a,b) a##b
#define CONS(a,b) _CONS(a,b)
atomic_add(1, &sensor->tasklock_cnt);
} else {
- atomic_sub(1, &sensor->tasklock_cnt);
+ if (atomic_read(&sensor->tasklock_cnt) > 0) {
+ atomic_sub(1, &sensor->tasklock_cnt);
- if (atomic_read(&sensor->tasklock_cnt) == 0)
- preempt_enable();
+ if (atomic_read(&sensor->tasklock_cnt) == 0)
+ preempt_enable();
+ }
}
#endif
return 0;
return 0;
sensor_INIT_ERR:
+ sensor_task_lock(client,0);
sensor_deactivate(client);
return ret;
}
mutex_unlock(&sensor->wq_lock);
sensor->sensor_wk.client = client;
INIT_WORK(&(sensor->sensor_wk.dwork.work), sensor_af_workqueue);
- queue_delayed_work(sensor->sensor_wq,&(sensor->sensor_wk.dwork.work), 0);
+ queue_delayed_work(sensor->sensor_wq,&(sensor->sensor_wk.dwork), 0);
}
sensor->info_priv.affm_reinit = 0;
}
#define dprintk(level, fmt, arg...) do { \
if (debug >= level) \
- printk(KERN_DEBUG fmt , ## arg); } while (0)
+ printk(KERN_WARNING fmt , ## arg); } while (0)
#define SENSOR_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__)
-#define SENSOR_DG(format, ...) dprintk(1, format, ## __VA_ARGS__)
+#define SENSOR_DG(format, ...) dprintk(0, format, ## __VA_ARGS__)
#define _CONS(a,b) a##b
#define CONS(a,b) _CONS(a,b)
atomic_add(1, &sensor->tasklock_cnt);
} else {
- atomic_sub(1, &sensor->tasklock_cnt);
+ if (atomic_read(&sensor->tasklock_cnt) > 0) {
+ atomic_sub(1, &sensor->tasklock_cnt);
- if (atomic_read(&sensor->tasklock_cnt) == 0)
- preempt_enable();
+ if (atomic_read(&sensor->tasklock_cnt) == 0)
+ preempt_enable();
+ }
}
#endif
return 0;
{
int err = 0, cnt;
int i = 0;
+#if CONFIG_SENSOR_Focus
struct sensor *sensor = to_sensor(client);
+#endif
+#if CONFIG_SENSOR_I2C_RDWRCHK
char valchk;
+#endif
cnt = 0;
sensor_task_lock(client, 1);
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
#if CONFIG_SENSOR_Focus
struct af_cmdinfo
{
{
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());
return 0;
sensor_INIT_ERR:
+ sensor_task_lock(client,0);
sensor_deactivate(client);
return ret;
}
mutex_unlock(&sensor->wq_lock);
sensor->sensor_wk.client = client;
INIT_WORK(&(sensor->sensor_wk.dwork.work), sensor_af_workqueue);
- queue_delayed_work(sensor->sensor_wq,&(sensor->sensor_wk.dwork.work), 0);
+ queue_delayed_work(sensor->sensor_wq,&(sensor->sensor_wk.dwork), 0);
}
sensor->info_priv.affm_reinit = 0;
}
#define dprintk(level, fmt, arg...) do { \
if (debug >= level) \
- printk(KERN_DEBUG "rk29xx_camera: " fmt , ## arg); } while (0)
+ printk(KERN_WARNING"rk29xx_camera: " fmt , ## arg); } while (0)
#define RK29CAMERA_TR(format, ...) printk(KERN_ERR format, ## __VA_ARGS__)
-#define RK29CAMERA_DG(format, ...) dprintk(1, format, ## __VA_ARGS__)
+#define RK29CAMERA_DG(format, ...) dprintk(0, format, ## __VA_ARGS__)
// VIP Reg Offset
#define RK29_VIP_AHBR_CTRL 0x00
{
struct device *control;
struct v4l2_subdev *sd;
- struct i2c_client *client;
- struct soc_camera_device *icd;
struct v4l2_format cam_f;
const struct soc_camera_format_xlate *xlate;
int ret;