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>
This commit is contained in:
Mike Isely 2009-03-07 00:54:02 -03:00 коммит произвёл Mauro Carvalho Chehab
Родитель 1e481cca49
Коммит 634ba268b9
3 изменённых файлов: 51 добавлений и 8 удалений

Просмотреть файл

@ -39,14 +39,6 @@
#include <linux/errno.h>
#include <linux/slab.h>
struct pvr2_v4l_cx2584x {
struct pvr2_i2c_handler handler;
struct pvr2_decoder_ctrl ctrl;
struct pvr2_i2c_client *client;
struct pvr2_hdw *hdw;
unsigned long stale_mask;
};
struct routing_scheme_item {
int vid;
@ -110,6 +102,15 @@ static const struct routing_scheme routing_schemes[] = {
},
};
struct pvr2_v4l_cx2584x {
struct pvr2_i2c_handler handler;
struct pvr2_decoder_ctrl ctrl;
struct pvr2_i2c_client *client;
struct pvr2_hdw *hdw;
unsigned long stale_mask;
};
static void set_input(struct pvr2_v4l_cx2584x *ctxt)
{
struct pvr2_hdw *hdw = ctxt->hdw;
@ -321,6 +322,41 @@ int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *hdw,
}
void pvr2_cx25840_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
{
if (hdw->input_dirty) {
struct v4l2_routing route;
enum cx25840_video_input vid_input;
enum cx25840_audio_input aud_input;
const struct routing_scheme *sp;
unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
memset(&route, 0, sizeof(route));
if ((sid < ARRAY_SIZE(routing_schemes)) &&
((sp = routing_schemes + sid) != NULL) &&
(hdw->input_val >= 0) &&
(hdw->input_val < sp->cnt)) {
vid_input = sp->def[hdw->input_val].vid;
aud_input = sp->def[hdw->input_val].aud;
} else {
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
"*** WARNING *** subdev cx2584x set_input:"
" Invalid routing scheme (%u)"
" and/or input (%d)",
sid, hdw->input_val);
return;
}
pvr2_trace(PVR2_TRACE_CHIPS,
"i2c cx2584x set_input vid=0x%x aud=0x%x",
vid_input, aud_input);
route.input = (u32)vid_input;
sd->ops->video->s_routing(sd, &route);
route.input = (u32)aud_input;
sd->ops->audio->s_routing(sd, &route);
}
}

Просмотреть файл

@ -39,6 +39,11 @@
int pvr2_i2c_cx2584x_v4l_setup(struct pvr2_hdw *,struct pvr2_i2c_client *);
#include "pvrusb2-hdw-internal.h"
void pvr2_cx25840_subdev_update(struct pvr2_hdw *, struct v4l2_subdev *sd);
#endif /* __PVRUSB2_CX2584X_V4L_H */
/*

Просмотреть файл

@ -38,6 +38,7 @@
#include "pvrusb2-fx2-cmd.h"
#include "pvrusb2-wm8775.h"
#include "pvrusb2-video-v4l.h"
#include "pvrusb2-cx2584x-v4l.h"
#include "pvrusb2-audio.h"
#define TV_MIN_FREQ 55250000L
@ -115,6 +116,7 @@ static const pvr2_subdev_update_func pvr2_module_update_functions[] = {
[PVR2_CLIENT_ID_WM8775] = pvr2_wm8775_subdev_update,
[PVR2_CLIENT_ID_SAA7115] = pvr2_saa7115_subdev_update,
[PVR2_CLIENT_ID_MSP3400] = pvr2_msp3400_subdev_update,
[PVR2_CLIENT_ID_CX25840] = pvr2_cx25840_subdev_update,
};
static const char *module_names[] = {