Skip to content

Commit

Permalink
V4L/DVB (11182): pvrusb2: Tie in cx25840 sub-device support
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Mike Isely authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 1e481cc commit 634ba26
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
52 changes: 44 additions & 8 deletions drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}



Expand Down
5 changes: 5 additions & 0 deletions drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

/*
Expand Down
2 changes: 2 additions & 0 deletions drivers/media/video/pvrusb2/pvrusb2-hdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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[] = {
Expand Down

0 comments on commit 634ba26

Please sign in to comment.