aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-28 11:49:20 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:15:19 -0400
commit81cb727d29eda7692a03be035b7228b4c3f6b610 (patch)
treef67766fa933419d80015624fc475448795733679 /drivers/media/video
parentf313da113fe083bfb1eb43377f551db4bbe702a6 (diff)
V4L/DVB (8167): cx18: set correct audio inputs for tuner and line-in 2.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx18/cx18-audio.c15
-rw-r--r--drivers/media/video/cx18/cx18-av-audio.c12
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c3
-rw-r--r--drivers/media/video/cx18/cx18-av-core.h3
-rw-r--r--drivers/media/video/cx18/cx18-av-firmware.c2
-rw-r--r--drivers/media/video/cx18/cx18-cards.c32
-rw-r--r--drivers/media/video/cx18/cx18-firmware.c3
-rw-r--r--drivers/media/video/cx18/cx18-mailbox.c1
-rw-r--r--drivers/media/video/cx18/cx23418.h5
9 files changed, 47 insertions, 29 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)
diff --git a/drivers/media/video/cx18/cx18-av-audio.c b/drivers/media/video/cx18/cx18-av-audio.c
index 2dc3a5dd170e..c40a286de1b9 100644
--- a/drivers/media/video/cx18/cx18-av-audio.c
+++ b/drivers/media/video/cx18/cx18-av-audio.c
@@ -34,7 +34,7 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
34 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */ 34 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */
35 cx18_av_write(cx, 0x127, 0x50); 35 cx18_av_write(cx, 0x127, 0x50);
36 36
37 if (state->aud_input != CX18_AV_AUDIO_SERIAL) { 37 if (state->aud_input > CX18_AV_AUDIO_SERIAL2) {
38 switch (freq) { 38 switch (freq) {
39 case 32000: 39 case 32000:
40 /* VID_PLL and AUX_PLL */ 40 /* VID_PLL and AUX_PLL */
@@ -148,7 +148,7 @@ void cx18_av_audio_set_path(struct cx18 *cx)
148 /* Mute everything to prevent the PFFT! */ 148 /* Mute everything to prevent the PFFT! */
149 cx18_av_write(cx, 0x8d3, 0x1f); 149 cx18_av_write(cx, 0x8d3, 0x1f);
150 150
151 if (state->aud_input == CX18_AV_AUDIO_SERIAL) { 151 if (state->aud_input <= CX18_AV_AUDIO_SERIAL2) {
152 /* Set Path1 to Serial Audio Input */ 152 /* Set Path1 to Serial Audio Input */
153 cx18_av_write4(cx, 0x8d0, 0x01011012); 153 cx18_av_write4(cx, 0x8d0, 0x01011012);
154 154
@@ -165,7 +165,7 @@ void cx18_av_audio_set_path(struct cx18 *cx)
165 /* deassert soft reset */ 165 /* deassert soft reset */
166 cx18_av_and_or(cx, 0x810, ~0x1, 0x00); 166 cx18_av_and_or(cx, 0x810, ~0x1, 0x00);
167 167
168 if (state->aud_input != CX18_AV_AUDIO_SERIAL) { 168 if (state->aud_input > CX18_AV_AUDIO_SERIAL2) {
169 /* When the microcontroller detects the 169 /* When the microcontroller detects the
170 * audio format, it will unmute the lines */ 170 * audio format, it will unmute the lines */
171 cx18_av_and_or(cx, 0x803, ~0x10, 0x10); 171 cx18_av_and_or(cx, 0x803, ~0x10, 0x10);
@@ -271,7 +271,7 @@ static void set_mute(struct cx18 *cx, int mute)
271{ 271{
272 struct cx18_av_state *state = &cx->av_state; 272 struct cx18_av_state *state = &cx->av_state;
273 273
274 if (state->aud_input != CX18_AV_AUDIO_SERIAL) { 274 if (state->aud_input > CX18_AV_AUDIO_SERIAL2) {
275 /* Must turn off microcontroller in order to mute sound. 275 /* Must turn off microcontroller in order to mute sound.
276 * Not sure if this is the best method, but it does work. 276 * Not sure if this is the best method, but it does work.
277 * If the microcontroller is running, then it will undo any 277 * If the microcontroller is running, then it will undo any
@@ -298,14 +298,14 @@ int cx18_av_audio(struct cx18 *cx, unsigned int cmd, void *arg)
298 298
299 switch (cmd) { 299 switch (cmd) {
300 case VIDIOC_INT_AUDIO_CLOCK_FREQ: 300 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
301 if (state->aud_input != CX18_AV_AUDIO_SERIAL) { 301 if (state->aud_input > CX18_AV_AUDIO_SERIAL2) {
302 cx18_av_and_or(cx, 0x803, ~0x10, 0); 302 cx18_av_and_or(cx, 0x803, ~0x10, 0);
303 cx18_av_write(cx, 0x8d3, 0x1f); 303 cx18_av_write(cx, 0x8d3, 0x1f);
304 } 304 }
305 cx18_av_and_or(cx, 0x810, ~0x1, 1); 305 cx18_av_and_or(cx, 0x810, ~0x1, 1);
306 retval = set_audclk_freq(cx, *(u32 *)arg); 306 retval = set_audclk_freq(cx, *(u32 *)arg);
307 cx18_av_and_or(cx, 0x810, ~0x1, 0); 307 cx18_av_and_or(cx, 0x810, ~0x1, 0);
308 if (state->aud_input != CX18_AV_AUDIO_SERIAL) 308 if (state->aud_input > CX18_AV_AUDIO_SERIAL2)
309 cx18_av_and_or(cx, 0x803, ~0x10, 0x10); 309 cx18_av_and_or(cx, 0x803, ~0x10, 0x10);
310 return retval; 310 return retval;
311 311
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index cf98b2c445f4..3ccdf613bce0 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -241,7 +241,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
241 } 241 }
242 242
243 switch (aud_input) { 243 switch (aud_input) {
244 case CX18_AV_AUDIO_SERIAL: 244 case CX18_AV_AUDIO_SERIAL1:
245 case CX18_AV_AUDIO_SERIAL2:
245 /* do nothing, use serial audio input */ 246 /* do nothing, use serial audio input */
246 break; 247 break;
247 case CX18_AV_AUDIO4: reg &= ~0x30; break; 248 case CX18_AV_AUDIO4: reg &= ~0x30; break;
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h
index 39f3c9397158..b54239959a68 100644
--- a/drivers/media/video/cx18/cx18-av-core.h
+++ b/drivers/media/video/cx18/cx18-av-core.h
@@ -62,7 +62,8 @@ enum cx18_av_video_input {
62 62
63enum cx18_av_audio_input { 63enum cx18_av_audio_input {
64 /* Audio inputs: serial or In4-In8 */ 64 /* Audio inputs: serial or In4-In8 */
65 CX18_AV_AUDIO_SERIAL, 65 CX18_AV_AUDIO_SERIAL1,
66 CX18_AV_AUDIO_SERIAL2,
66 CX18_AV_AUDIO4 = 4, 67 CX18_AV_AUDIO4 = 4,
67 CX18_AV_AUDIO5, 68 CX18_AV_AUDIO5,
68 CX18_AV_AUDIO6, 69 CX18_AV_AUDIO6,
diff --git a/drivers/media/video/cx18/cx18-av-firmware.c b/drivers/media/video/cx18/cx18-av-firmware.c
index ab86dc71bf8d..834b9248242e 100644
--- a/drivers/media/video/cx18/cx18-av-firmware.c
+++ b/drivers/media/video/cx18/cx18-av-firmware.c
@@ -22,6 +22,7 @@
22#include "cx18-driver.h" 22#include "cx18-driver.h"
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24 24
25#define CX18_AUDIO_ENABLE 0xc72014
25#define FWFILE "v4l-cx23418-dig.fw" 26#define FWFILE "v4l-cx23418-dig.fw"
26 27
27int cx18_av_loadfw(struct cx18 *cx) 28int cx18_av_loadfw(struct cx18 *cx)
@@ -118,7 +119,6 @@ int cx18_av_loadfw(struct cx18 *cx)
118 have a name in the spec. */ 119 have a name in the spec. */
119 cx18_av_write4(cx, 0x09CC, 1); 120 cx18_av_write4(cx, 0x09CC, 1);
120 121
121#define CX18_AUDIO_ENABLE 0xc72014
122 v = read_reg(CX18_AUDIO_ENABLE); 122 v = read_reg(CX18_AUDIO_ENABLE);
123 /* If bit 11 is 1 */ 123 /* If bit 11 is 1 */
124 if (v & 0x800) 124 if (v & 0x800)
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index 0b892aacabef..bb45bcf68ea6 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -67,12 +67,12 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
67 { CX18_CARD_INPUT_AUD_TUNER, 67 { CX18_CARD_INPUT_AUD_TUNER,
68 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 }, 68 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
69 { CX18_CARD_INPUT_LINE_IN1, 69 { CX18_CARD_INPUT_LINE_IN1,
70 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 }, 70 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
71 { CX18_CARD_INPUT_LINE_IN2, 71 { CX18_CARD_INPUT_LINE_IN2,
72 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 }, 72 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
73 }, 73 },
74 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 74 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
75 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 }, 75 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
76 .ddr = { 76 .ddr = {
77 /* ESMT M13S128324A-5B memory */ 77 /* ESMT M13S128324A-5B memory */
78 .chip_config = 0x003, 78 .chip_config = 0x003,
@@ -112,12 +112,12 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
112 { CX18_CARD_INPUT_AUD_TUNER, 112 { CX18_CARD_INPUT_AUD_TUNER,
113 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 }, 113 CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 },
114 { CX18_CARD_INPUT_LINE_IN1, 114 { CX18_CARD_INPUT_LINE_IN1,
115 CX18_AV_AUDIO_SERIAL, CS5345_IN_2 }, 115 CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 },
116 { CX18_CARD_INPUT_LINE_IN2, 116 { CX18_CARD_INPUT_LINE_IN2,
117 CX18_AV_AUDIO_SERIAL, CS5345_IN_3 }, 117 CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 },
118 }, 118 },
119 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 119 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
120 CX18_AV_AUDIO_SERIAL, CS5345_IN_4 }, 120 CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 },
121 .ddr = { 121 .ddr = {
122 /* Samsung K4D263238G-VC33 memory */ 122 /* Samsung K4D263238G-VC33 memory */
123 .chip_config = 0x003, 123 .chip_config = 0x003,
@@ -163,10 +163,10 @@ static const struct cx18_card cx18_card_h900 = {
163 { CX18_CARD_INPUT_AUD_TUNER, 163 { CX18_CARD_INPUT_AUD_TUNER,
164 CX18_AV_AUDIO8, 0 }, 164 CX18_AV_AUDIO8, 0 },
165 { CX18_CARD_INPUT_LINE_IN1, 165 { CX18_CARD_INPUT_LINE_IN1,
166 CX18_AV_AUDIO_SERIAL, 0 }, 166 CX18_AV_AUDIO_SERIAL1, 0 },
167 }, 167 },
168 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, 168 .radio_input = { CX18_CARD_INPUT_AUD_TUNER,
169 CX18_AV_AUDIO_SERIAL, 0 }, 169 CX18_AV_AUDIO_SERIAL1, 0 },
170 .tuners = { 170 .tuners = {
171 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, 171 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
172 }, 172 },
@@ -211,11 +211,11 @@ static const struct cx18_card cx18_card_mpc718 = {
211 { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 }, 211 { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 },
212 }, 212 },
213 .audio_inputs = { 213 .audio_inputs = {
214 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, 214 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
215 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 0 }, 215 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 0 },
216 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 0 }, 216 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL1, 0 },
217 }, 217 },
218 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 0 }, 218 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 0 },
219 .tuners = { 219 .tuners = {
220 /* XC3028 tuner */ 220 /* XC3028 tuner */
221 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, 221 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
@@ -261,14 +261,14 @@ static const struct cx18_card cx18_card_cnxt_raptor_pal = {
261 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 }, 261 { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
262 }, 262 },
263 .audio_inputs = { 263 .audio_inputs = {
264 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 0 }, 264 { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 },
265 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL, 1 }, 265 { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 },
266 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL, 1 }, 266 { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 },
267 }, 267 },
268 .tuners = { 268 .tuners = {
269 { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 }, 269 { .std = V4L2_STD_PAL_SECAM, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
270 }, 270 },
271 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 2 }, 271 .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 2 },
272 .ddr = { 272 .ddr = {
273 /* MT 46V16M16 memory */ 273 /* MT 46V16M16 memory */
274 .chip_config = 0x50306, 274 .chip_config = 0x50306,
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c
index 2c280728dd7e..02453f09693f 100644
--- a/drivers/media/video/cx18/cx18-firmware.c
+++ b/drivers/media/video/cx18/cx18-firmware.c
@@ -41,9 +41,6 @@
41 41
42#define CX18_REG_BUS_TIMEOUT_EN 0xc72024 42#define CX18_REG_BUS_TIMEOUT_EN 0xc72024
43 43
44#define CX18_AUDIO_ENABLE 0xc72014
45#define CX18_REG_BUS_TIMEOUT_EN 0xc72024
46
47#define CX18_FAST_CLOCK_PLL_INT 0xc78000 44#define CX18_FAST_CLOCK_PLL_INT 0xc78000
48#define CX18_FAST_CLOCK_PLL_FRAC 0xc78004 45#define CX18_FAST_CLOCK_PLL_FRAC 0xc78004
49#define CX18_FAST_CLOCK_PLL_POST 0xc78008 46#define CX18_FAST_CLOCK_PLL_POST 0xc78008
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c
index 2a5ccef9185b..93177514e846 100644
--- a/drivers/media/video/cx18/cx18-mailbox.c
+++ b/drivers/media/video/cx18/cx18-mailbox.c
@@ -81,6 +81,7 @@ static const struct cx18_api_info api_info[] = {
81 API_ENTRY(CPU, CX18_CPU_GET_ENC_PTS, 0), 81 API_ENTRY(CPU, CX18_CPU_GET_ENC_PTS, 0),
82 API_ENTRY(CPU, CX18_CPU_DE_SET_MDL_ACK, 0), 82 API_ENTRY(CPU, CX18_CPU_DE_SET_MDL_ACK, 0),
83 API_ENTRY(CPU, CX18_CPU_DE_SET_MDL, API_FAST), 83 API_ENTRY(CPU, CX18_CPU_DE_SET_MDL, API_FAST),
84 API_ENTRY(CPU, CX18_APU_RESETAI, API_FAST),
84 API_ENTRY(0, 0, 0), 85 API_ENTRY(0, 0, 0),
85}; 86};
86 87
diff --git a/drivers/media/video/cx18/cx23418.h b/drivers/media/video/cx18/cx23418.h
index 33f78da9dba8..e7ed053059a8 100644
--- a/drivers/media/video/cx18/cx23418.h
+++ b/drivers/media/video/cx18/cx23418.h
@@ -52,6 +52,11 @@
52#define EPU_CMD_MASK_DEBUG (EPU_CMD_MASK | 0x000000) 52#define EPU_CMD_MASK_DEBUG (EPU_CMD_MASK | 0x000000)
53#define EPU_CMD_MASK_DE (EPU_CMD_MASK | 0x040000) 53#define EPU_CMD_MASK_DE (EPU_CMD_MASK | 0x040000)
54 54
55#define APU_CMD_MASK 0x10000000
56#define APU_CMD_MASK_ACK (APU_CMD_MASK | 0x80000000)
57
58#define CX18_APU_RESETAI (APU_CMD_MASK | 0x05)
59
55/* Description: This command indicates that a Memory Descriptor List has been 60/* Description: This command indicates that a Memory Descriptor List has been
56 filled with the requested channel type 61 filled with the requested channel type
57 IN[0] - Task handle. Handle of the task 62 IN[0] - Task handle. Handle of the task