Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (3599): Implement new routing commands for wm8775 and cs53l32a.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
7fa033b1 a20c5224

+89 -10
+10 -5
drivers/media/video/cs53l32a.c
··· 59 59 static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, 60 60 void *arg) 61 61 { 62 - struct v4l2_audio *input = arg; 62 + struct v4l2_routing *route = arg; 63 63 struct v4l2_control *ctrl = arg; 64 64 65 65 switch (cmd) { 66 - case VIDIOC_S_AUDIO: 66 + case VIDIOC_INT_G_AUDIO_ROUTING: 67 + route->input = (cs53l32a_read(client, 0x01) >> 4) & 3; 68 + route->output = 0; 69 + break; 70 + 71 + case VIDIOC_INT_S_AUDIO_ROUTING: 67 72 /* There are 2 physical inputs, but the second input can be 68 73 placed in two modes, the first mode bypasses the PGA (gain), 69 74 the second goes through the PGA. Hence there are three 70 75 possible inputs to choose from. */ 71 - if (input->index > 2) { 72 - v4l_err(client, "Invalid input %d.\n", input->index); 76 + if (route->input > 2) { 77 + v4l_err(client, "Invalid input %d.\n", route->input); 73 78 return -EINVAL; 74 79 } 75 - cs53l32a_write(client, 0x01, 0x01 + (input->index << 4)); 80 + cs53l32a_write(client, 0x01, 0x01 + (route->input << 4)); 76 81 break; 77 82 78 83 case VIDIOC_G_CTRL:
+10 -5
drivers/media/video/wm8775.c
··· 79 79 void *arg) 80 80 { 81 81 struct wm8775_state *state = i2c_get_clientdata(client); 82 - struct v4l2_audio *input = arg; 82 + struct v4l2_routing *route = arg; 83 83 struct v4l2_control *ctrl = arg; 84 84 85 85 switch (cmd) { 86 - case VIDIOC_S_AUDIO: 86 + case VIDIOC_INT_G_AUDIO_ROUTING: 87 + route->input = state->input; 88 + route->output = 0; 89 + break; 90 + 91 + case VIDIOC_INT_S_AUDIO_ROUTING: 87 92 /* There are 4 inputs and one output. Zero or more inputs 88 93 are multiplexed together to the output. Hence there are 89 94 16 combinations. 90 95 If only one input is active (the normal case) then the 91 96 input values 1, 2, 4 or 8 should be used. */ 92 - if (input->index > 15) { 93 - v4l_err(client, "Invalid input %d.\n", input->index); 97 + if (route->input > 15) { 98 + v4l_err(client, "Invalid input %d.\n", route->input); 94 99 return -EINVAL; 95 100 } 96 - state->input = input->index; 101 + state->input = route->input; 97 102 if (state->muted) 98 103 break; 99 104 wm8775_write(client, R21, 0x0c0);
+34
include/media/cs53l32a.h
··· 1 + /* 2 + cs53l32a.h - definition for cs53l32a inputs and outputs 3 + 4 + Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 5 + 6 + This program is free software; you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation; either version 2 of the License, or 9 + (at your option) any later version. 10 + 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. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with this program; if not, write to the Free Software 18 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 + */ 20 + 21 + #ifndef _CS53L32A_H_ 22 + #define _CS53L32A_H_ 23 + 24 + /* There are 2 physical inputs, but the second input can be 25 + placed in two modes, the first mode bypasses the PGA (gain), 26 + the second goes through the PGA. Hence there are three 27 + possible inputs to choose from. */ 28 + 29 + /* CS53L32A HW inputs */ 30 + #define CS53L32A_IN0 0 31 + #define CS53L32A_IN1 1 32 + #define CS53L32A_IN2 2 33 + 34 + #endif
+35
include/media/wm8775.h
··· 1 + /* 2 + wm8775.h - definition for wm8775 inputs and outputs 3 + 4 + Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) 5 + 6 + This program is free software; you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation; either version 2 of the License, or 9 + (at your option) any later version. 10 + 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. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with this program; if not, write to the Free Software 18 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 + */ 20 + 21 + #ifndef _WM8775_H_ 22 + #define _WM8775_H_ 23 + 24 + /* The WM8775 has 4 inputs and one output. Zero or more inputs 25 + are multiplexed together to the output. Hence there are 26 + 16 combinations. 27 + If only one input is active (the normal case) then the 28 + input values 1, 2, 4 or 8 should be used. */ 29 + 30 + #define WM8775_AIN1 1 31 + #define WM8775_AIN2 2 32 + #define WM8775_AIN3 4 33 + #define WM8775_AIN4 8 34 + 35 + #endif