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