aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-audio.c')
-rw-r--r--drivers/media/video/cx18/cx18-audio.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/media/video/cx18/cx18-audio.c b/drivers/media/video/cx18/cx18-audio.c
index 1adc404d955e..6d5b94fc7087 100644
--- a/drivers/media/video/cx18/cx18-audio.c
+++ b/drivers/media/video/cx18/cx18-audio.c
@@ -26,13 +26,17 @@
26#include "cx18-cards.h" 26#include "cx18-cards.h"
27#include "cx18-audio.h" 27#include "cx18-audio.h"
28 28
29#define CX18_AUDIO_ENABLE 0xc72014
30
29/* Selects the audio input and output according to the current 31/* Selects the audio input and output according to the current
30 settings. */ 32 settings. */
31int cx18_audio_set_io(struct cx18 *cx) 33int cx18_audio_set_io(struct cx18 *cx)
32{ 34{
33 struct v4l2_routing route; 35 struct v4l2_routing route;
34 u32 audio_input; 36 u32 audio_input;
37 u32 val;
35 int mux_input; 38 int mux_input;
39 int err;
36 40
37 /* Determine which input to use */ 41 /* Determine which input to use */
38 if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { 42 if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) {
@@ -51,8 +55,17 @@ int cx18_audio_set_io(struct cx18 *cx)
51 cx18_i2c_hw(cx, cx->card->hw_muxer, VIDIOC_INT_S_AUDIO_ROUTING, &route); 55 cx18_i2c_hw(cx, cx->card->hw_muxer, VIDIOC_INT_S_AUDIO_ROUTING, &route);
52 56
53 route.input = audio_input; 57 route.input = audio_input;
54 return cx18_i2c_hw(cx, cx->card->hw_audio_ctrl, 58 err = cx18_i2c_hw(cx, cx->card->hw_audio_ctrl,
55 VIDIOC_INT_S_AUDIO_ROUTING, &route); 59 VIDIOC_INT_S_AUDIO_ROUTING, &route);
60 if (err)
61 return err;
62
63 val = read_reg(CX18_AUDIO_ENABLE) & ~0x30;
64 val |= (audio_input > CX18_AV_AUDIO_SERIAL2) ? 0x20 :
65 (audio_input << 4);
66 write_reg(val | 0xb00, CX18_AUDIO_ENABLE);
67 cx18_vapi(cx, CX18_APU_RESETAI, 1, 0);
68 return 0;
56} 69}
57 70
58void cx18_audio_set_route(struct cx18 *cx, struct v4l2_routing *route) 71void cx18_audio_set_route(struct cx18 *cx, struct v4l2_routing *route)