diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-09 12:25:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 12:25:40 -0500 |
commit | fbc46e74fa437f16a3ffe4a5561a97f41680a124 (patch) | |
tree | 5e7fa7f91b30268d38812bc14d77f1411d967f37 /drivers/media/video | |
parent | 936053516aef6505ab3174c3443f3ba8749d4d98 (diff) |
V4L/DVB (3247): Replace AUDC_SET_INPUT with VIDIOC_S_AUDIO in wm8775.
- Replace AUDC_SET_INPUT with VIDIOC_S_AUDIO.
- Added V4L2_CID_AUDIO_MUTE.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/wm8775.c | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 1933cd25b610..a1b6a427ab74 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -87,38 +87,53 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, | |||
87 | void *arg) | 87 | void *arg) |
88 | { | 88 | { |
89 | struct wm8775_state *state = i2c_get_clientdata(client); | 89 | struct wm8775_state *state = i2c_get_clientdata(client); |
90 | int *input = arg; | 90 | struct v4l2_audio *input = arg; |
91 | struct v4l2_control *ctrl = arg; | ||
91 | 92 | ||
92 | switch (cmd) { | 93 | switch (cmd) { |
93 | case AUDC_SET_INPUT: | 94 | case VIDIOC_S_AUDIO: |
95 | /* There are 4 inputs and one output. Zero or more inputs | ||
96 | are multiplexed together to the output. Hence there are | ||
97 | 16 combinations. | ||
98 | If only one input is active (the normal case) then the | ||
99 | input values 1, 2, 4 or 8 should be used. */ | ||
100 | if (input->index > 15) { | ||
101 | wm8775_err("Invalid input %d.\n", input->index); | ||
102 | return -EINVAL; | ||
103 | } | ||
104 | state->input = input->index; | ||
105 | if (state->muted) | ||
106 | break; | ||
94 | wm8775_write(client, R21, 0x0c0); | 107 | wm8775_write(client, R21, 0x0c0); |
95 | wm8775_write(client, R14, 0x1d4); | 108 | wm8775_write(client, R14, 0x1d4); |
96 | wm8775_write(client, R15, 0x1d4); | 109 | wm8775_write(client, R15, 0x1d4); |
110 | wm8775_write(client, R21, 0x100 + state->input); | ||
111 | break; | ||
97 | 112 | ||
98 | if (*input == AUDIO_RADIO) { | 113 | case VIDIOC_G_AUDIO: |
99 | wm8775_write(client, R21, 0x108); | 114 | memset(input, 0, sizeof(*input)); |
100 | state->input = 8; | 115 | input->index = state->input; |
101 | state->muted = 0; | 116 | break; |
102 | break; | 117 | |
103 | } | 118 | case VIDIOC_G_CTRL: |
104 | if (*input == AUDIO_MUTE) { | 119 | if (ctrl->id != V4L2_CID_AUDIO_MUTE) |
105 | state->muted = 1; | 120 | return -EINVAL; |
106 | break; | 121 | ctrl->value = state->muted; |
107 | } | 122 | break; |
108 | if (*input == AUDIO_UNMUTE) { | 123 | |
124 | case VIDIOC_S_CTRL: | ||
125 | if (ctrl->id != V4L2_CID_AUDIO_MUTE) | ||
126 | return -EINVAL; | ||
127 | state->muted = ctrl->value; | ||
128 | wm8775_write(client, R21, 0x0c0); | ||
129 | wm8775_write(client, R14, 0x1d4); | ||
130 | wm8775_write(client, R15, 0x1d4); | ||
131 | if (!state->muted) | ||
109 | wm8775_write(client, R21, 0x100 + state->input); | 132 | wm8775_write(client, R21, 0x100 + state->input); |
110 | state->muted = 0; | ||
111 | break; | ||
112 | } | ||
113 | /* All other inputs... */ | ||
114 | wm8775_write(client, R21, 0x102); | ||
115 | state->input = 2; | ||
116 | state->muted = 0; | ||
117 | break; | 133 | break; |
118 | 134 | ||
119 | case VIDIOC_LOG_STATUS: | 135 | case VIDIOC_LOG_STATUS: |
120 | wm8775_info("Input: %s%s\n", | 136 | wm8775_info("Input: %d%s\n", state->input, |
121 | state->input == 8 ? "radio" : "default", | ||
122 | state->muted ? " (muted)" : ""); | 137 | state->muted ? " (muted)" : ""); |
123 | break; | 138 | break; |
124 | 139 | ||