1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#include "pvrusb2-audio.h"
23#include "pvrusb2-hdw-internal.h"
24#include "pvrusb2-debug.h"
25#include <linux/videodev2.h>
26#include <media/msp3400.h>
27#include <media/v4l2-common.h>
28
29
30struct routing_scheme {
31 const int *def;
32 unsigned int cnt;
33};
34
35static const int routing_scheme0[] = {
36 [PVR2_CVAL_INPUT_TV] = MSP_INPUT_DEFAULT,
37 [PVR2_CVAL_INPUT_RADIO] = MSP_INPUT(MSP_IN_SCART2,
38 MSP_IN_TUNER1,
39 MSP_DSP_IN_SCART,
40 MSP_DSP_IN_SCART),
41 [PVR2_CVAL_INPUT_COMPOSITE] = MSP_INPUT(MSP_IN_SCART1,
42 MSP_IN_TUNER1,
43 MSP_DSP_IN_SCART,
44 MSP_DSP_IN_SCART),
45 [PVR2_CVAL_INPUT_SVIDEO] = MSP_INPUT(MSP_IN_SCART1,
46 MSP_IN_TUNER1,
47 MSP_DSP_IN_SCART,
48 MSP_DSP_IN_SCART),
49};
50
51static const struct routing_scheme routing_def0 = {
52 .def = routing_scheme0,
53 .cnt = ARRAY_SIZE(routing_scheme0),
54};
55
56static const struct routing_scheme *routing_schemes[] = {
57 [PVR2_ROUTING_SCHEME_HAUPPAUGE] = &routing_def0,
58};
59
60void pvr2_msp3400_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
61{
62 if (hdw->input_dirty || hdw->force_dirty) {
63 const struct routing_scheme *sp;
64 unsigned int sid = hdw->hdw_desc->signal_routing_scheme;
65 u32 input;
66
67 pvr2_trace(PVR2_TRACE_CHIPS, "subdev msp3400 v4l2 set_stereo");
68 sp = (sid < ARRAY_SIZE(routing_schemes)) ?
69 routing_schemes[sid] : NULL;
70
71 if ((sp != NULL) &&
72 (hdw->input_val >= 0) &&
73 (hdw->input_val < sp->cnt)) {
74 input = sp->def[hdw->input_val];
75 } else {
76 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
77 "*** WARNING *** subdev msp3400 set_input:"
78 " Invalid routing scheme (%u)"
79 " and/or input (%d)",
80 sid, hdw->input_val);
81 return;
82 }
83 sd->ops->audio->s_routing(sd, input,
84 MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0);
85 }
86}
87
88
89
90
91
92
93
94
95
96
97