4 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #include "pvrusb2-audio.h"
19 #include "pvrusb2-hdw-internal.h"
20 #include "pvrusb2-debug.h"
21 #include <linux/videodev2.h>
22 #include <media/drv-intf/msp3400.h>
23 #include <media/v4l2-common.h>
26 struct routing_scheme
{
31 static const int routing_scheme0
[] = {
32 [PVR2_CVAL_INPUT_TV
] = MSP_INPUT_DEFAULT
,
33 [PVR2_CVAL_INPUT_RADIO
] = MSP_INPUT(MSP_IN_SCART2
,
37 [PVR2_CVAL_INPUT_COMPOSITE
] = MSP_INPUT(MSP_IN_SCART1
,
41 [PVR2_CVAL_INPUT_SVIDEO
] = MSP_INPUT(MSP_IN_SCART1
,
47 static const struct routing_scheme routing_def0
= {
48 .def
= routing_scheme0
,
49 .cnt
= ARRAY_SIZE(routing_scheme0
),
52 static const struct routing_scheme
*routing_schemes
[] = {
53 [PVR2_ROUTING_SCHEME_HAUPPAUGE
] = &routing_def0
,
56 void pvr2_msp3400_subdev_update(struct pvr2_hdw
*hdw
, struct v4l2_subdev
*sd
)
58 if (hdw
->input_dirty
|| hdw
->force_dirty
) {
59 const struct routing_scheme
*sp
;
60 unsigned int sid
= hdw
->hdw_desc
->signal_routing_scheme
;
63 pvr2_trace(PVR2_TRACE_CHIPS
, "subdev msp3400 v4l2 set_stereo");
64 sp
= (sid
< ARRAY_SIZE(routing_schemes
)) ?
65 routing_schemes
[sid
] : NULL
;
68 (hdw
->input_val
>= 0) &&
69 (hdw
->input_val
< sp
->cnt
)) {
70 input
= sp
->def
[hdw
->input_val
];
72 pvr2_trace(PVR2_TRACE_ERROR_LEGS
,
73 "*** WARNING *** subdev msp3400 set_input: Invalid routing scheme (%u) and/or input (%d)",
77 sd
->ops
->audio
->s_routing(sd
, input
,
78 MSP_OUTPUT(MSP_SC_IN_DSP_SCART1
), 0);