diff options
author | Mike Isely <isely@pobox.com> | 2009-01-16 01:06:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:23 -0400 |
commit | 2cc3b6bff46129374ee31236f804637278c5f323 (patch) | |
tree | a927d10d6f77bda3b6212291aaaf0a616685933f | |
parent | 8ed06fd4729d25959f6af8b7ce4e3888866bfe56 (diff) |
V4L/DVB (10258): pvrusb2: Issue VIDIOC_INT_INIT to v4l2 modules when they first attach
It appears that various v4l-dvb drivers are changing to require
explicit initialization before use. This change to the pvrusb2 driver
implements an automatic issuance of VIDIOC_INT_INIT when a module is
bound to the driver, thus conforming to the new behavior.
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4 files changed, 29 insertions, 11 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c index 94a47718e88e..4cf980c49d01 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c | |||
@@ -31,17 +31,19 @@ | |||
31 | 31 | ||
32 | #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) | 32 | #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) |
33 | 33 | ||
34 | #define OP_STANDARD 0 | 34 | #define OP_INIT 0 /* MUST come first so it is run first */ |
35 | #define OP_AUDIOMODE 1 | 35 | #define OP_STANDARD 1 |
36 | #define OP_BCSH 2 | 36 | #define OP_AUDIOMODE 2 |
37 | #define OP_VOLUME 3 | 37 | #define OP_BCSH 3 |
38 | #define OP_FREQ 4 | 38 | #define OP_VOLUME 4 |
39 | #define OP_AUDIORATE 5 | 39 | #define OP_FREQ 5 |
40 | #define OP_CROP 6 | 40 | #define OP_AUDIORATE 6 |
41 | #define OP_SIZE 7 | 41 | #define OP_CROP 7 |
42 | #define OP_LOG 8 | 42 | #define OP_SIZE 8 |
43 | #define OP_LOG 9 | ||
43 | 44 | ||
44 | static const struct pvr2_i2c_op * const ops[] = { | 45 | static const struct pvr2_i2c_op * const ops[] = { |
46 | [OP_INIT] = &pvr2_i2c_op_v4l2_init, | ||
45 | [OP_STANDARD] = &pvr2_i2c_op_v4l2_standard, | 47 | [OP_STANDARD] = &pvr2_i2c_op_v4l2_standard, |
46 | [OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode, | 48 | [OP_AUDIOMODE] = &pvr2_i2c_op_v4l2_audiomode, |
47 | [OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh, | 49 | [OP_BCSH] = &pvr2_i2c_op_v4l2_bcsh, |
@@ -56,7 +58,8 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) | |||
56 | { | 58 | { |
57 | int id; | 59 | int id; |
58 | id = cp->client->driver->id; | 60 | id = cp->client->driver->id; |
59 | cp->ctl_mask = ((1 << OP_STANDARD) | | 61 | cp->ctl_mask = ((1 << OP_INIT) | |
62 | (1 << OP_STANDARD) | | ||
60 | (1 << OP_AUDIOMODE) | | 63 | (1 << OP_AUDIOMODE) | |
61 | (1 << OP_BCSH) | | 64 | (1 << OP_BCSH) | |
62 | (1 << OP_VOLUME) | | 65 | (1 << OP_VOLUME) | |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c index 16bb11902a52..0f2885440f2f 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c | |||
@@ -25,6 +25,20 @@ | |||
25 | #include <linux/videodev2.h> | 25 | #include <linux/videodev2.h> |
26 | #include <media/v4l2-common.h> | 26 | #include <media/v4l2-common.h> |
27 | 27 | ||
28 | static void execute_init(struct pvr2_hdw *hdw) | ||
29 | { | ||
30 | u32 dummy = 0; | ||
31 | pvr2_trace(PVR2_TRACE_CHIPS, "i2c v4l2 init"); | ||
32 | pvr2_i2c_core_cmd(hdw, VIDIOC_INT_INIT, &dummy); | ||
33 | } | ||
34 | |||
35 | |||
36 | const struct pvr2_i2c_op pvr2_i2c_op_v4l2_init = { | ||
37 | .update = execute_init, | ||
38 | .name = "v4l2_init", | ||
39 | }; | ||
40 | |||
41 | |||
28 | static void set_standard(struct pvr2_hdw *hdw) | 42 | static void set_standard(struct pvr2_hdw *hdw) |
29 | { | 43 | { |
30 | pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 set_standard"); | 44 | pvr2_trace(PVR2_TRACE_CHIPS,"i2c v4l2 set_standard"); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.h b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.h index eb744a20610d..69a63f2a8a7b 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.h +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.h | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include "pvrusb2-i2c-core.h" | 25 | #include "pvrusb2-i2c-core.h" |
26 | 26 | ||
27 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_init; | ||
27 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_standard; | 28 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_standard; |
28 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_radio; | 29 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_radio; |
29 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_bcsh; | 30 | extern const struct pvr2_i2c_op pvr2_i2c_op_v4l2_bcsh; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index d6a35401fefb..57a024737722 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -763,7 +763,7 @@ int pvr2_i2c_core_check_stale(struct pvr2_hdw *hdw) | |||
763 | if (!(msk & pm)) continue; | 763 | if (!(msk & pm)) continue; |
764 | pm &= ~msk; | 764 | pm &= ~msk; |
765 | opf = pvr2_i2c_get_op(idx); | 765 | opf = pvr2_i2c_get_op(idx); |
766 | if (!opf) continue; | 766 | if (!(opf && opf->check)) continue; |
767 | if (opf->check(hdw)) { | 767 | if (opf->check(hdw)) { |
768 | sm |= msk; | 768 | sm |= msk; |
769 | } | 769 | } |