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>
8 #include "pvrusb2-audio.h"
9 #include "pvrusb2-hdw-internal.h"
10 #include "pvrusb2-debug.h"
11 #include <linux/videodev2.h>
12 #include <media/drv-intf/msp3400.h>
13 #include <media/v4l2-common.h>
16 struct routing_scheme
{
21 static const int routing_scheme0
[] = {
22 [PVR2_CVAL_INPUT_TV
] = MSP_INPUT_DEFAULT
,
23 [PVR2_CVAL_INPUT_RADIO
] = MSP_INPUT(MSP_IN_SCART2
,
27 [PVR2_CVAL_INPUT_COMPOSITE
] = MSP_INPUT(MSP_IN_SCART1
,
31 [PVR2_CVAL_INPUT_SVIDEO
] = MSP_INPUT(MSP_IN_SCART1
,
37 static const struct routing_scheme routing_def0
= {
38 .def
= routing_scheme0
,
39 .cnt
= ARRAY_SIZE(routing_scheme0
),
42 static const struct routing_scheme
*routing_schemes
[] = {
43 [PVR2_ROUTING_SCHEME_HAUPPAUGE
] = &routing_def0
,
46 void pvr2_msp3400_subdev_update(struct pvr2_hdw
*hdw
, struct v4l2_subdev
*sd
)
48 if (hdw
->input_dirty
|| hdw
->force_dirty
) {
49 const struct routing_scheme
*sp
;
50 unsigned int sid
= hdw
->hdw_desc
->signal_routing_scheme
;
53 pvr2_trace(PVR2_TRACE_CHIPS
, "subdev msp3400 v4l2 set_stereo");
54 sp
= (sid
< ARRAY_SIZE(routing_schemes
)) ?
55 routing_schemes
[sid
] : NULL
;
58 (hdw
->input_val
>= 0) &&
59 (hdw
->input_val
< sp
->cnt
)) {
60 input
= sp
->def
[hdw
->input_val
];
62 pvr2_trace(PVR2_TRACE_ERROR_LEGS
,
63 "*** WARNING *** subdev msp3400 set_input: Invalid routing scheme (%u) and/or input (%d)",
67 sd
->ops
->audio
->s_routing(sd
, input
,
68 MSP_OUTPUT(MSP_SC_IN_DSP_SCART1
), 0);