0001
0002
0003
0004
0005
0006
0007
0008 #include "pvrusb2-audio.h"
0009 #include "pvrusb2-hdw-internal.h"
0010 #include "pvrusb2-debug.h"
0011 #include <linux/videodev2.h>
0012 #include <media/drv-intf/msp3400.h>
0013 #include <media/v4l2-common.h>
0014
0015
0016 struct routing_scheme {
0017 const int *def;
0018 unsigned int cnt;
0019 };
0020
0021 static const int routing_scheme0[] = {
0022 [PVR2_CVAL_INPUT_TV] = MSP_INPUT_DEFAULT,
0023 [PVR2_CVAL_INPUT_RADIO] = MSP_INPUT(MSP_IN_SCART2,
0024 MSP_IN_TUNER1,
0025 MSP_DSP_IN_SCART,
0026 MSP_DSP_IN_SCART),
0027 [PVR2_CVAL_INPUT_COMPOSITE] = MSP_INPUT(MSP_IN_SCART1,
0028 MSP_IN_TUNER1,
0029 MSP_DSP_IN_SCART,
0030 MSP_DSP_IN_SCART),
0031 [PVR2_CVAL_INPUT_SVIDEO] = MSP_INPUT(MSP_IN_SCART1,
0032 MSP_IN_TUNER1,
0033 MSP_DSP_IN_SCART,
0034 MSP_DSP_IN_SCART),
0035 };
0036
0037 static const struct routing_scheme routing_def0 = {
0038 .def = routing_scheme0,
0039 .cnt = ARRAY_SIZE(routing_scheme0),
0040 };
0041
0042 static const struct routing_scheme *routing_schemes[] = {
0043 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
0044 };
0045
0046 void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
0047 {
0048 if (hdw->input_dirty || hdw->force_dirty) {
0049 const struct routing_scheme *sp;
0050 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
0051 u32 input;
0052
0053 pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo");
0054 sp = (sid < ARRAY_SIZE(routing_schemes)) ?
0055 routing_schemes[sid] : NULL;
0056
0057 if ((sp != NULL) &&
0058 (hdw->input_val >= 0) &&
0059 (hdw->input_val < sp->cnt)) {
0060 input = sp->def[hdw->input_val];
0061 } else {
0062 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
0063 "*** WARNING *** subdev msp3400 set_input: Invalid routing scheme (%u) and/or input (%d)",
0064 sid, hdw->input_val);
0065 return;
0066 }
0067 sd->ops->audio->s_routing(sd, input,
0068 MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0);
0069 }
0070 }