diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-09 15:25:42 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 15:25:42 -0200 |
commit | a8bbf12ad8a8ad532cea0b67f0127ad90d336b04 (patch) | |
tree | bd8d9fb0888a7fe28b4795d7567c01ccf72b3c38 /drivers/media/video/cx25840/cx25840-audio.c | |
parent | 3578d3dd0b1e468a44a76a83efe90476a854625d (diff) |
V4L/DVB (3249): Generalized cx25840 video/audio input handling
- Added VIDIOC_S_AUDIO to set the audio inputs separately.
- Removed AUDC_SET_INPUT.
- Made the video inputs much more general.
- Removed cardtype CID and replaced with a CID to enable
the PVR150 workaround. The cardtype is no longer necessary
with the general video input change.
- Update VIDIOC_LOG_STATUS output to show the video and
audio inputs separately.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/cx25840/cx25840-audio.c')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-audio.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index 6c44bd9c170..fe6bc411d71 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c @@ -37,8 +37,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */ cx25840_write(client, 0x127, 0x50); - switch (state->audio_input) { - case AUDIO_TUNER: + if (state->aud_input != CX25840_AUDIO_SERIAL) { switch (freq) { case 32000: /* VID_PLL and AUX_PLL */ @@ -79,12 +78,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) cx25840_write4(client, 0x90c, 0xaa4f0108); break; } - break; - - case AUDIO_EXTERN_1: - case AUDIO_EXTERN_2: - case AUDIO_INTERN: - case AUDIO_RADIO: + } else { switch (freq) { case 32000: /* VID_PLL and AUX_PLL */ @@ -137,7 +131,6 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) cx25840_write4(client, 0x90c, 0x55550108); break; } - break; } /* deassert soft reset */ @@ -148,48 +141,33 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) return 0; } -static int set_input(struct i2c_client *client, int audio_input) +void cx25840_audio_set_path(struct i2c_client *client) { struct cx25840_state *state = i2c_get_clientdata(client); - cx25840_dbg("set audio input (%d)\n", audio_input); - /* stop microcontroller */ cx25840_and_or(client, 0x803, ~0x10, 0); /* Mute everything to prevent the PFFT! */ cx25840_write(client, 0x8d3, 0x1f); - switch (audio_input) { - case AUDIO_TUNER: - /* Set Path1 to Analog Demod Main Channel */ - cx25840_write4(client, 0x8d0, 0x7038061f); - - /* When the microcontroller detects the - * audio format, it will unmute the lines */ - cx25840_and_or(client, 0x803, ~0x10, 0x10); - break; - - case AUDIO_EXTERN_1: - case AUDIO_EXTERN_2: - case AUDIO_INTERN: - case AUDIO_RADIO: + if (state->aud_input == CX25840_AUDIO_SERIAL) { /* Set Path1 to Serial Audio Input */ cx25840_write4(client, 0x8d0, 0x12100101); /* The microcontroller should not be started for the * non-tuner inputs: autodetection is specific for * TV audio. */ - break; + } else { + /* Set Path1 to Analog Demod Main Channel */ + cx25840_write4(client, 0x8d0, 0x7038061f); - default: - cx25840_dbg("Invalid audio input selection %d\n", audio_input); - return -EINVAL; + /* When the microcontroller detects the + * audio format, it will unmute the lines */ + cx25840_and_or(client, 0x803, ~0x10, 0x10); } - state->audio_input = audio_input; - - return set_audclk_freq(client, state->audclk_freq); + set_audclk_freq(client, state->audclk_freq); } inline static int get_volume(struct i2c_client *client) @@ -292,7 +270,7 @@ inline static void set_mute(struct i2c_client *client, int mute) { struct cx25840_state *state = i2c_get_clientdata(client); - if (state->audio_input == AUDIO_TUNER) { + if (state->aud_input != CX25840_AUDIO_SERIAL) { /* Must turn off microcontroller in order to mute sound. * Not sure if this is the best method, but it does work. * If the microcontroller is running, then it will undo any @@ -316,10 +294,9 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) struct v4l2_control *ctrl = arg; switch (cmd) { - case AUDC_SET_INPUT: - return set_input(client, *(int *)arg); case VIDIOC_INT_AUDIO_CLOCK_FREQ: return set_audclk_freq(client, *(u32 *)arg); + case VIDIOC_G_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: @@ -341,6 +318,7 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) return -EINVAL; } break; + case VIDIOC_S_CTRL: switch (ctrl->id) { case V4L2_CID_AUDIO_VOLUME: @@ -362,6 +340,7 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) return -EINVAL; } break; + default: return -EINVAL; } |