diff options
author | Mike Isely <isely@pobox.com> | 2009-03-06 22:43:26 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:35 -0400 |
commit | 6f9565120f5c2944b3d31daf03a07c272e12867b (patch) | |
tree | adc35c22d3d52fa99ff848fcbf8cea7828cb61db /drivers/media/video | |
parent | 5f6dae802c0f6a943c2c873c203642d1d3c2fc3f (diff) |
V4L/DVB (11177): pvrusb2: Tie in saa7115 sub-device handling
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 2 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | 64 | ||||
-rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-video-v4l.h | 2 |
3 files changed, 58 insertions, 10 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 3a93860310ed..e92ea6af8bc0 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "pvrusb2-debug.h" | 37 | #include "pvrusb2-debug.h" |
38 | #include "pvrusb2-fx2-cmd.h" | 38 | #include "pvrusb2-fx2-cmd.h" |
39 | #include "pvrusb2-wm8775.h" | 39 | #include "pvrusb2-wm8775.h" |
40 | #include "pvrusb2-video-v4l.h" | ||
40 | 41 | ||
41 | #define TV_MIN_FREQ 55250000L | 42 | #define TV_MIN_FREQ 55250000L |
42 | #define TV_MAX_FREQ 850000000L | 43 | #define TV_MAX_FREQ 850000000L |
@@ -111,6 +112,7 @@ typedef void (*pvr2_subdev_update_func)(struct pvr2_hdw *, | |||
111 | 112 | ||
112 | static const pvr2_subdev_update_func pvr2_module_update_functions[] = { | 113 | static const pvr2_subdev_update_func pvr2_module_update_functions[] = { |
113 | [PVR2_CLIENT_ID_WM8775] = pvr2_wm8775_update, | 114 | [PVR2_CLIENT_ID_WM8775] = pvr2_wm8775_update, |
115 | [PVR2_CLIENT_ID_SAA7115] = pvr2_saa7115_subdev_update, | ||
114 | }; | 116 | }; |
115 | 117 | ||
116 | static const char *module_names[] = { | 118 | static const char *module_names[] = { |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c index 4059648c7056..ad28c5d3ad83 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.c | |||
@@ -28,9 +28,10 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "pvrusb2-video-v4l.h" | 30 | #include "pvrusb2-video-v4l.h" |
31 | #include "pvrusb2-i2c-cmd-v4l2.h" | ||
32 | 31 | ||
33 | 32 | ||
33 | #include "pvrusb2-i2c-cmd-v4l2.h" | ||
34 | |||
34 | #include "pvrusb2-hdw-internal.h" | 35 | #include "pvrusb2-hdw-internal.h" |
35 | #include "pvrusb2-debug.h" | 36 | #include "pvrusb2-debug.h" |
36 | #include <linux/videodev2.h> | 37 | #include <linux/videodev2.h> |
@@ -39,15 +40,6 @@ | |||
39 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
41 | 42 | ||
42 | struct pvr2_v4l_decoder { | ||
43 | struct pvr2_i2c_handler handler; | ||
44 | struct pvr2_decoder_ctrl ctrl; | ||
45 | struct pvr2_i2c_client *client; | ||
46 | struct pvr2_hdw *hdw; | ||
47 | unsigned long stale_mask; | ||
48 | }; | ||
49 | |||
50 | |||
51 | struct routing_scheme { | 43 | struct routing_scheme { |
52 | const int *def; | 44 | const int *def; |
53 | unsigned int cnt; | 45 | unsigned int cnt; |
@@ -70,6 +62,16 @@ static const struct routing_scheme routing_schemes[] = { | |||
70 | }, | 62 | }, |
71 | }; | 63 | }; |
72 | 64 | ||
65 | struct pvr2_v4l_decoder { | ||
66 | struct pvr2_i2c_handler handler; | ||
67 | struct pvr2_decoder_ctrl ctrl; | ||
68 | struct pvr2_i2c_client *client; | ||
69 | struct pvr2_hdw *hdw; | ||
70 | unsigned long stale_mask; | ||
71 | }; | ||
72 | |||
73 | |||
74 | |||
73 | static void set_input(struct pvr2_v4l_decoder *ctxt) | 75 | static void set_input(struct pvr2_v4l_decoder *ctxt) |
74 | { | 76 | { |
75 | struct pvr2_hdw *hdw = ctxt->hdw; | 77 | struct pvr2_hdw *hdw = ctxt->hdw; |
@@ -245,6 +247,48 @@ int pvr2_i2c_decoder_v4l_setup(struct pvr2_hdw *hdw, | |||
245 | } | 247 | } |
246 | 248 | ||
247 | 249 | ||
250 | void pvr2_saa7115_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) | ||
251 | { | ||
252 | if (hdw->srate_dirty) { | ||
253 | u32 val; | ||
254 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_audio %d", | ||
255 | hdw->srate_val); | ||
256 | switch (hdw->srate_val) { | ||
257 | default: | ||
258 | case V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000: | ||
259 | val = 48000; | ||
260 | break; | ||
261 | case V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100: | ||
262 | val = 44100; | ||
263 | break; | ||
264 | case V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000: | ||
265 | val = 32000; | ||
266 | break; | ||
267 | } | ||
268 | sd->ops->audio->s_clock_freq(sd, val); | ||
269 | } | ||
270 | if (hdw->input_dirty) { | ||
271 | struct v4l2_routing route; | ||
272 | const struct routing_scheme *sp; | ||
273 | unsigned int sid = hdw->hdw_desc->signal_routing_scheme; | ||
274 | pvr2_trace(PVR2_TRACE_CHIPS, "subdev v4l2 set_input(%d)", | ||
275 | hdw->input_val); | ||
276 | if ((sid < ARRAY_SIZE(routing_schemes)) && | ||
277 | ((sp = routing_schemes + sid) != NULL) && | ||
278 | (hdw->input_val >= 0) && | ||
279 | (hdw->input_val < sp->cnt)) { | ||
280 | route.input = sp->def[hdw->input_val]; | ||
281 | } else { | ||
282 | pvr2_trace(PVR2_TRACE_ERROR_LEGS, | ||
283 | "*** WARNING *** subdev v4l2 set_input:" | ||
284 | " Invalid routing scheme (%u) and/or input (%d)", | ||
285 | sid, hdw->input_val); | ||
286 | return; | ||
287 | } | ||
288 | route.output = 0; | ||
289 | sd->ops->video->s_routing(sd, &route); | ||
290 | } | ||
291 | } | ||
248 | 292 | ||
249 | 293 | ||
250 | /* | 294 | /* |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.h b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.h index b2cd3875bb5b..dac4b1ad3664 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-video-v4l.h +++ b/drivers/media/video/pvrusb2/pvrusb2-video-v4l.h | |||
@@ -37,6 +37,8 @@ | |||
37 | 37 | ||
38 | int pvr2_i2c_decoder_v4l_setup(struct pvr2_hdw *,struct pvr2_i2c_client *); | 38 | int pvr2_i2c_decoder_v4l_setup(struct pvr2_hdw *,struct pvr2_i2c_client *); |
39 | 39 | ||
40 | #include "pvrusb2-hdw-internal.h" | ||
41 | void pvr2_saa7115_subdev_update(struct pvr2_hdw *, struct v4l2_subdev *); | ||
40 | 42 | ||
41 | #endif /* __PVRUSB2_VIDEO_V4L_H */ | 43 | #endif /* __PVRUSB2_VIDEO_V4L_H */ |
42 | 44 | ||