xref: /linux/drivers/media/usb/pvrusb2/pvrusb2-wm8775.c (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*2504ba9fSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
20c0d06caSMauro Carvalho Chehab /*
30c0d06caSMauro Carvalho Chehab  *
40c0d06caSMauro Carvalho Chehab  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
50c0d06caSMauro Carvalho Chehab  *  Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
60c0d06caSMauro Carvalho Chehab  */
70c0d06caSMauro Carvalho Chehab 
80c0d06caSMauro Carvalho Chehab /*
90c0d06caSMauro Carvalho Chehab 
100c0d06caSMauro Carvalho Chehab    This source file is specifically designed to interface with the
110c0d06caSMauro Carvalho Chehab    wm8775.
120c0d06caSMauro Carvalho Chehab 
130c0d06caSMauro Carvalho Chehab */
140c0d06caSMauro Carvalho Chehab 
150c0d06caSMauro Carvalho Chehab #include "pvrusb2-wm8775.h"
160c0d06caSMauro Carvalho Chehab 
170c0d06caSMauro Carvalho Chehab 
180c0d06caSMauro Carvalho Chehab #include "pvrusb2-hdw-internal.h"
190c0d06caSMauro Carvalho Chehab #include "pvrusb2-debug.h"
200c0d06caSMauro Carvalho Chehab #include <linux/videodev2.h>
210c0d06caSMauro Carvalho Chehab #include <media/v4l2-common.h>
220c0d06caSMauro Carvalho Chehab #include <linux/errno.h>
230c0d06caSMauro Carvalho Chehab 
pvr2_wm8775_subdev_update(struct pvr2_hdw * hdw,struct v4l2_subdev * sd)240c0d06caSMauro Carvalho Chehab void pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd)
250c0d06caSMauro Carvalho Chehab {
260c0d06caSMauro Carvalho Chehab 	if (hdw->input_dirty || hdw->force_dirty) {
270c0d06caSMauro Carvalho Chehab 		u32 input;
280c0d06caSMauro Carvalho Chehab 
290c0d06caSMauro Carvalho Chehab 		switch (hdw->input_val) {
300c0d06caSMauro Carvalho Chehab 		case PVR2_CVAL_INPUT_RADIO:
310c0d06caSMauro Carvalho Chehab 			input = 1;
320c0d06caSMauro Carvalho Chehab 			break;
330c0d06caSMauro Carvalho Chehab 		default:
340c0d06caSMauro Carvalho Chehab 			/* All other cases just use the second input */
350c0d06caSMauro Carvalho Chehab 			input = 2;
360c0d06caSMauro Carvalho Chehab 			break;
370c0d06caSMauro Carvalho Chehab 		}
3896292c89SMauro Carvalho Chehab 		pvr2_trace(PVR2_TRACE_CHIPS, "subdev wm8775 set_input(val=%d route=0x%x)",
390c0d06caSMauro Carvalho Chehab 			   hdw->input_val, input);
400c0d06caSMauro Carvalho Chehab 
410c0d06caSMauro Carvalho Chehab 		sd->ops->audio->s_routing(sd, input, 0, 0);
420c0d06caSMauro Carvalho Chehab 	}
430c0d06caSMauro Carvalho Chehab }
44