aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMike Isely <isely@pobox.com>2009-03-06 22:54:02 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:37 -0400
commit634ba268b965b57da1f60edbc57f14299a5326f6 (patch)
treede8badd54cd13ce31b86e0dcc94e7fc50cae4aec /drivers
parent1e481cca49bf1c444562f5b86a0e5315d68640c7 (diff)
V4L/DVB (11182): pvrusb2: Tie in cx25840 sub-device support
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c52
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.h5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c2
3 files changed, 51 insertions, 8 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index 9494c6a5b5d8..9df3623a3e4c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -39,14 +39,6 @@
39#include <linux/errno.h> 39#include <linux/errno.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41 41
42struct pvr2_v4l_cx2584x {
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 42
51struct routing_scheme_item { 43struct routing_scheme_item {
52 int vid; 44 int vid;
@@ -110,6 +102,15 @@ static const struct routing_scheme routing_schemes[] = {
110 }, 102 },
111}; 103};
112 104
105struct pvr2_v4l_cx2584x {
106 struct pvr2_i2c_handler handler;
107 struct pvr2_decoder_ctrl ctrl;
108 struct pvr2_i2c_client *client;
109 struct pvr2_hdw *hdw;
110 unsigned long stale_mask;
111};
112
113
113static void set_input(struct pvr2_v4l_cx2584x *ctxt) 114static void set_input(struct pvr2_v4l_cx2584x *ctxt)
114{ 115{
115 struct pvr2_hdw *hdw = ctxt->hdw; 116 struct pvr2_hdw *hdw = ctxt->hdw;
@@ -321,6 +322,41 @@ int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *hdw,
321} 322}
322 323
323 324
325void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
326{
327 if (hdw->input_dirty) {
328 struct v4l2_routing route;
329 enum cx25840_video_input vid_input;
330 enum cx25840_audio_input aud_input;
331 const struct routing_scheme *sp;
332 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
333
334 memset(&route, 0, sizeof(route));
335
336 if ((sid < ARRAY_SIZE(routing_schemes)) &&
337 ((sp = routing_schemes + sid) != NULL) &&
338 (hdw->input_val >= 0) &&
339 (hdw->input_val < sp->cnt)) {
340 vid_input = sp->def[hdw->input_val].vid;
341 aud_input = sp->def[hdw->input_val].aud;
342 } else {
343 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
344 "*** WARNING *** subdev cx2584x set_input:"
345 " Invalid routing scheme (%u)"
346 " and/or input (%d)",
347 sid, hdw->input_val);
348 return;
349 }
350
351 pvr2_trace(PVR2_TRACE_CHIPS,
352 "i2c cx2584x set_input vid=0x%x aud=0x%x",
353 vid_input, aud_input);
354 route.input = (u32)vid_input;
355 sd->ops->video->s_routing(sd, &route);
356 route.input = (u32)aud_input;
357 sd->ops->audio->s_routing(sd, &route);
358 }
359}
324 360
325 361
326 362
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.h b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.h
index f664f5942002..e48ce808bfe5 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.h
@@ -39,6 +39,11 @@
39int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *,struct pvr2_i2c_client *); 39int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *,struct pvr2_i2c_client *);
40 40
41 41
42#include "pvrusb2-hdw-internal.h"
43
44void pvr2_cx25840_subdev_update(struct pvr2_hdw *, struct v4l2_subdev *sd);
45
46
42#endif /* __PVRUSB2_CX2584X_V4L_H */ 47#endif /* __PVRUSB2_CX2584X_V4L_H */
43 48
44/* 49/*
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index ff7af062002b..1158021b1e12 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -38,6 +38,7 @@
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#include "pvrusb2-video-v4l.h"
41#include "pvrusb2-cx2584x-v4l.h"
41#include "pvrusb2-audio.h" 42#include "pvrusb2-audio.h"
42 43
43#define TV_MIN_FREQ 55250000L 44#define TV_MIN_FREQ 55250000L
@@ -115,6 +116,7 @@ static const pvr2_subdev_update_func pvr2_module_update_functions[] = {
115 [PVR2_CLIENT_ID_WM8775] = pvr2_wm8775_subdev_update, 116 [PVR2_CLIENT_ID_WM8775] = pvr2_wm8775_subdev_update,
116 [PVR2_CLIENT_ID_SAA7115] = pvr2_saa7115_subdev_update, 117 [PVR2_CLIENT_ID_SAA7115] = pvr2_saa7115_subdev_update,
117 [PVR2_CLIENT_ID_MSP3400] = pvr2_msp3400_subdev_update, 118 [PVR2_CLIENT_ID_MSP3400] = pvr2_msp3400_subdev_update,
119 [PVR2_CLIENT_ID_CX25840] = pvr2_cx25840_subdev_update,
118}; 120};
119 121
120static const char *module_names[] = { 122static const char *module_names[] = {