1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
10 This source file is specifically designed to interface with the
11 v4l-dvb cs53l32a module.
15 #include "pvrusb2-cs53l32a.h"
18 #include "pvrusb2-hdw-internal.h"
19 #include "pvrusb2-debug.h"
20 #include <linux/videodev2.h>
21 #include <media/v4l2-common.h>
22 #include <linux/errno.h>
24 struct routing_scheme
{
30 static const int routing_scheme1
[] = {
31 [PVR2_CVAL_INPUT_TV
] = 2, /* 1 or 2 seems to work here */
32 [PVR2_CVAL_INPUT_RADIO
] = 2,
33 [PVR2_CVAL_INPUT_COMPOSITE
] = 0,
34 [PVR2_CVAL_INPUT_SVIDEO
] = 0,
37 static const struct routing_scheme routing_def1
= {
38 .def
= routing_scheme1
,
39 .cnt
= ARRAY_SIZE(routing_scheme1
),
42 static const struct routing_scheme
*routing_schemes
[] = {
43 [PVR2_ROUTING_SCHEME_ONAIR
] = &routing_def1
,
47 void pvr2_cs53l32a_subdev_update(struct pvr2_hdw
*hdw
, struct v4l2_subdev
*sd
)
49 if (hdw
->input_dirty
|| hdw
->force_dirty
) {
50 const struct routing_scheme
*sp
;
51 unsigned int sid
= hdw
->hdw_desc
->signal_routing_scheme
;
53 pvr2_trace(PVR2_TRACE_CHIPS
, "subdev v4l2 set_input(%d)",
55 sp
= (sid
< ARRAY_SIZE(routing_schemes
)) ?
56 routing_schemes
[sid
] : NULL
;
58 (hdw
->input_val
< 0) ||
59 (hdw
->input_val
>= sp
->cnt
)) {
60 pvr2_trace(PVR2_TRACE_ERROR_LEGS
,
61 "*** WARNING *** subdev v4l2 set_input: Invalid routing scheme (%u) and/or input (%d)",
65 input
= sp
->def
[hdw
->input_val
];
66 sd
->ops
->audio
->s_routing(sd
, input
, 0, 0);