summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2009-03-07 01:57:25 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 12:43:38 -0300
commit27764726a8fa72a7e8a7cdccbe9e4425747a96fa (patch)
tree86415f280dd8423781d17ce723e245cfaa2b60fb
parent5e430ca5d25e99f99c055bc43f8f140722a643b8 (diff)
downloadop-kernel-dev-27764726a8fa72a7e8a7cdccbe9e4425747a96fa.zip
op-kernel-dev-27764726a8fa72a7e8a7cdccbe9e4425747a96fa.tar.gz
V4L/DVB (11194): pvrusb2: Implement mechanism to force a full sub-device update
When a pvrusb2 driver instance first initializes, we need to be sure to send out a complete state update for everything to all attached modules. The old i2c layer did this by keeping a separate mask of "stale" bits for each attached module - and setting that mask to all stale when that module attaches. But the new sub-device adaptation I've implemented here no longer has per-module stale bits. So instead there's now a global "force dirty" bit that is set upon instance initialization, before the sub-devices are attached. After the first update, this bit is cleared, allowing for normal update-on-dirty behavior. In this manner, we ensure that all sub-devices have been properly synchronized at initialization. Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-audio.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c21
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-video-v4l.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-wm8775.c2
6 files changed, 17 insertions, 13 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-audio.c b/drivers/media/video/pvrusb2/pvrusb2-audio.c
index 5296641..aca6b1d 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-audio.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-audio.c
@@ -184,7 +184,7 @@ int pvr2_i2c_msp3400_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
{
- if (hdw->input_dirty) {
+ if (hdw->input_dirty || hdw->force_dirty) {
struct v4l2_routing route;
const struct routing_scheme *sp;
unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 725f391..5adbf00 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -325,7 +325,7 @@ int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *hdw,
void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
{
pvr2_trace(PVR2_TRACE_CHIPS, "subdev cx2584x update...");
- if (hdw->input_dirty) {
+ if (hdw->input_dirty || hdw->force_dirty) {
struct v4l2_routing route;
enum cx25840_video_input vid_input;
enum cx25840_audio_input aud_input;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index 299bf58..2afbd9b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -288,6 +288,7 @@ struct pvr2_hdw {
wait_queue_head_t state_wait_data;
+ int force_dirty; /* consider all controls dirty if true */
int flag_ok; /* device in known good state */
int flag_disconnected; /* flag_ok == 0 due to disconnect */
int flag_init_ok; /* true if structure is fully initialized */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 89d5bb4..1fb9ca5 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -2185,6 +2185,8 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
if (!pvr2_hdw_dev_ok(hdw)) return;
+ hdw->force_dirty = !0;
+
if (!hdw->hdw_desc->flag_no_powerup) {
pvr2_hdw_cmd_powerup(hdw);
if (!pvr2_hdw_dev_ok(hdw)) return;
@@ -2935,7 +2937,7 @@ static void pvr2_subdev_set_control(struct pvr2_hdw *hdw, int id,
}
#define PVR2_SUBDEV_SET_CONTROL(hdw, id, lab) \
- if ((hdw)->lab##_dirty) { \
+ if ((hdw)->lab##_dirty || (hdw)->force_dirty) { \
pvr2_subdev_set_control(hdw, id, #lab, (hdw)->lab##_val); \
}
@@ -2949,7 +2951,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
pvr2_trace(PVR2_TRACE_CHIPS, "subdev update...");
- if (hdw->tuner_updated) {
+ if (hdw->tuner_updated || hdw->force_dirty) {
struct tuner_setup setup;
pvr2_trace(PVR2_TRACE_CHIPS, "subdev tuner set_type(%d)",
hdw->tuner_type);
@@ -2962,7 +2964,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
}
}
- if (hdw->input_dirty || hdw->std_dirty) {
+ if (hdw->input_dirty || hdw->std_dirty || hdw->force_dirty) {
pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_standard");
if (hdw->input_val == PVR2_CVAL_INPUT_RADIO) {
v4l2_device_call_all(&hdw->v4l2_dev, 0,
@@ -2987,14 +2989,14 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
PVR2_SUBDEV_SET_CONTROL(hdw, V4L2_CID_AUDIO_BASS, bass);
PVR2_SUBDEV_SET_CONTROL(hdw, V4L2_CID_AUDIO_TREBLE, treble);
- if (hdw->input_dirty || hdw->audiomode_dirty) {
+ if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) {
struct v4l2_tuner vt;
memset(&vt, 0, sizeof(vt));
vt.audmode = hdw->audiomode_val;
v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt);
}
- if (hdw->freqDirty) {
+ if (hdw->freqDirty || hdw->force_dirty) {
unsigned long fv;
struct v4l2_frequency freq;
fv = pvr2_hdw_get_cur_freq(hdw);
@@ -3019,7 +3021,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
s_frequency, &freq);
}
- if (hdw->res_hor_dirty || hdw->res_ver_dirty) {
+ if (hdw->res_hor_dirty || hdw->res_ver_dirty || hdw->force_dirty) {
struct v4l2_format fmt;
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -3030,7 +3032,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
v4l2_device_call_all(&hdw->v4l2_dev, 0, video, s_fmt, &fmt);
}
- if (hdw->srate_dirty) {
+ if (hdw->srate_dirty || hdw->force_dirty) {
u32 val;
pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_audio %d",
hdw->srate_val);
@@ -3061,7 +3063,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
(*fp)(hdw, sd);
}
- if (hdw->tuner_signal_stale && hdw->cropcap_stale) {
+ if (hdw->tuner_signal_stale || hdw->cropcap_stale) {
pvr2_hdw_status_poll(hdw);
}
}
@@ -3075,7 +3077,7 @@ static int pvr2_hdw_commit_setup(struct pvr2_hdw *hdw)
unsigned int idx;
struct pvr2_ctrl *cptr;
int value;
- int commit_flag = 0;
+ int commit_flag = hdw->force_dirty;
char buf[100];
unsigned int bcnt,ccnt;
@@ -3260,6 +3262,7 @@ static int pvr2_hdw_commit_execute(struct pvr2_hdw *hdw)
pvr2_subdev_update(hdw);
hdw->tuner_updated = 0;
+ hdw->force_dirty = 0;
for (idx = 0; idx < hdw->control_cnt; idx++) {
cptr = hdw->controls + idx;
if (!cptr->info->clear_dirty) continue;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
index c7a1621c..4e0c088 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c
@@ -249,7 +249,7 @@ int pvr2_i2c_decoder_v4l_setup(struct pvr2_hdw *hdw,
void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
{
- if (hdw->input_dirty) {
+ if (hdw->input_dirty || hdw->force_dirty) {
struct v4l2_routing route;
const struct routing_scheme *sp;
unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
index a099bf1..0068566 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-wm8775.c
@@ -162,7 +162,7 @@ int pvr2_i2c_wm8775_setup(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
{
- if (hdw->input_dirty) {
+ if (hdw->input_dirty || hdw->force_dirty) {
struct v4l2_routing route;
memset(&route, 0, sizeof(route));
OpenPOWER on IntegriCloud