1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 *
4 *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
5 *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
6 */
7
8/*
9
10   This source file is specifically designed to interface with the
11   wm8775.
12
13*/
14
15#include "pvrusb2-wm8775.h"
16
17
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>
23
24void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
25{
26	if (hdw->input_dirty || hdw->force_dirty) {
27		u32 input;
28
29		switch (hdw->input_val) {
30		case PVR2_CVAL_INPUT_RADIO:
31			input = 1;
32			break;
33		default:
34			/* All other cases just use the second input */
35			input = 2;
36			break;
37		}
38		pvr2_trace(PVR2_TRACE_CHIPS, "subdev wm8775 set_input(val=%d route=0x%x)",
39			   hdw->input_val, input);
40
41		sd->ops->audio->s_routing(sd, input, 0, 0);
42	}
43}
44