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>
This commit is contained in:
parent
936053516a
commit
fbc46e74fa
|
@ -87,38 +87,53 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
struct wm8775_state *state = i2c_get_clientdata(client);
|
struct wm8775_state *state = i2c_get_clientdata(client);
|
||||||
int *input = arg;
|
struct v4l2_audio *input = arg;
|
||||||
|
struct v4l2_control *ctrl = arg;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case AUDC_SET_INPUT:
|
case VIDIOC_S_AUDIO:
|
||||||
|
/* There are 4 inputs and one output. Zero or more inputs
|
||||||
|
are multiplexed together to the output. Hence there are
|
||||||
|
16 combinations.
|
||||||
|
If only one input is active (the normal case) then the
|
||||||
|
input values 1, 2, 4 or 8 should be used. */
|
||||||
|
if (input->index > 15) {
|
||||||
|
wm8775_err("Invalid input %d.\n", input->index);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
state->input = input->index;
|
||||||
|
if (state->muted)
|
||||||
|
break;
|
||||||
wm8775_write(client, R21, 0x0c0);
|
wm8775_write(client, R21, 0x0c0);
|
||||||
wm8775_write(client, R14, 0x1d4);
|
wm8775_write(client, R14, 0x1d4);
|
||||||
wm8775_write(client, R15, 0x1d4);
|
wm8775_write(client, R15, 0x1d4);
|
||||||
|
|
||||||
if (*input == AUDIO_RADIO) {
|
|
||||||
wm8775_write(client, R21, 0x108);
|
|
||||||
state->input = 8;
|
|
||||||
state->muted = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*input == AUDIO_MUTE) {
|
|
||||||
state->muted = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*input == AUDIO_UNMUTE) {
|
|
||||||
wm8775_write(client, R21, 0x100 + state->input);
|
wm8775_write(client, R21, 0x100 + state->input);
|
||||||
state->muted = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
/* All other inputs... */
|
case VIDIOC_G_AUDIO:
|
||||||
wm8775_write(client, R21, 0x102);
|
memset(input, 0, sizeof(*input));
|
||||||
state->input = 2;
|
input->index = state->input;
|
||||||
state->muted = 0;
|
break;
|
||||||
|
|
||||||
|
case VIDIOC_G_CTRL:
|
||||||
|
if (ctrl->id != V4L2_CID_AUDIO_MUTE)
|
||||||
|
return -EINVAL;
|
||||||
|
ctrl->value = state->muted;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIDIOC_S_CTRL:
|
||||||
|
if (ctrl->id != V4L2_CID_AUDIO_MUTE)
|
||||||
|
return -EINVAL;
|
||||||
|
state->muted = ctrl->value;
|
||||||
|
wm8775_write(client, R21, 0x0c0);
|
||||||
|
wm8775_write(client, R14, 0x1d4);
|
||||||
|
wm8775_write(client, R15, 0x1d4);
|
||||||
|
if (!state->muted)
|
||||||
|
wm8775_write(client, R21, 0x100 + state->input);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIDIOC_LOG_STATUS:
|
case VIDIOC_LOG_STATUS:
|
||||||
wm8775_info("Input: %s%s\n",
|
wm8775_info("Input: %d%s\n", state->input,
|
||||||
state->input == 8 ? "radio" : "default",
|
|
||||||
state->muted ? " (muted)" : "");
|
state->muted ? " (muted)" : "");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue