diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/linus/0051-wm8775-Revert-changeset-fcb9757333-to-avoid-a-regres.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap/linus/0051-wm8775-Revert-changeset-fcb9757333-to-avoid-a-regres.patch | 518 |
1 files changed, 518 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/linus/0051-wm8775-Revert-changeset-fcb9757333-to-avoid-a-regres.patch b/extras/recipes-kernel/linux/linux-omap/linus/0051-wm8775-Revert-changeset-fcb9757333-to-avoid-a-regres.patch new file mode 100644 index 00000000..792fe440 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap/linus/0051-wm8775-Revert-changeset-fcb9757333-to-avoid-a-regres.patch | |||
@@ -0,0 +1,518 @@ | |||
1 | From 2d2e6426126f420da1df0e4c2b37069e00aefdb8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mauro Carvalho Chehab <mchehab@redhat.com> | ||
3 | Date: Mon, 3 Jan 2011 09:09:56 -0200 | ||
4 | Subject: [PATCH 51/65] wm8775: Revert changeset fcb9757333 to avoid a regression | ||
5 | |||
6 | It seems that cx88 and ivtv use wm8775 on some different modes. The | ||
7 | patch that added support for a board with wm8775 broke ivtv boards with | ||
8 | this device. As we're too close to release 2.6.37, let's just revert | ||
9 | it. | ||
10 | |||
11 | Reported-by: Andy Walls <awalls@md.metrocast.net> | ||
12 | Reported-by: Eric Sharkey <eric@lisaneric.org> | ||
13 | Reported-by: Auric <auric@aanet.com.au> | ||
14 | Reported by: David Gesswein <djg@pdp8online.com> | ||
15 | Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> | ||
16 | --- | ||
17 | drivers/media/video/cx88/cx88-alsa.c | 99 ++++--------------------------- | ||
18 | drivers/media/video/cx88/cx88-cards.c | 7 ++ | ||
19 | drivers/media/video/cx88/cx88-video.c | 27 +-------- | ||
20 | drivers/media/video/cx88/cx88.h | 6 +- | ||
21 | drivers/media/video/wm8775.c | 104 ++++++++++++-------------------- | ||
22 | include/media/wm8775.h | 3 - | ||
23 | 6 files changed, 61 insertions(+), 185 deletions(-) | ||
24 | |||
25 | diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c | ||
26 | index 4aaa47c..54b7fcd 100644 | ||
27 | --- a/drivers/media/video/cx88/cx88-alsa.c | ||
28 | +++ b/drivers/media/video/cx88/cx88-alsa.c | ||
29 | @@ -40,7 +40,6 @@ | ||
30 | #include <sound/control.h> | ||
31 | #include <sound/initval.h> | ||
32 | #include <sound/tlv.h> | ||
33 | -#include <media/wm8775.h> | ||
34 | |||
35 | #include "cx88.h" | ||
36 | #include "cx88-reg.h" | ||
37 | @@ -587,47 +586,26 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, | ||
38 | int left, right, v, b; | ||
39 | int changed = 0; | ||
40 | u32 old; | ||
41 | - struct v4l2_control client_ctl; | ||
42 | - | ||
43 | - /* Pass volume & balance onto any WM8775 */ | ||
44 | - if (value->value.integer.value[0] >= value->value.integer.value[1]) { | ||
45 | - v = value->value.integer.value[0] << 10; | ||
46 | - b = value->value.integer.value[0] ? | ||
47 | - (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] : | ||
48 | - 0x8000; | ||
49 | - } else { | ||
50 | - v = value->value.integer.value[1] << 10; | ||
51 | - b = value->value.integer.value[1] ? | ||
52 | - 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] : | ||
53 | - 0x8000; | ||
54 | - } | ||
55 | - client_ctl.value = v; | ||
56 | - client_ctl.id = V4L2_CID_AUDIO_VOLUME; | ||
57 | - call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
58 | - | ||
59 | - client_ctl.value = b; | ||
60 | - client_ctl.id = V4L2_CID_AUDIO_BALANCE; | ||
61 | - call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
62 | |||
63 | left = value->value.integer.value[0] & 0x3f; | ||
64 | right = value->value.integer.value[1] & 0x3f; | ||
65 | b = right - left; | ||
66 | if (b < 0) { | ||
67 | - v = 0x3f - left; | ||
68 | - b = (-b) | 0x40; | ||
69 | + v = 0x3f - left; | ||
70 | + b = (-b) | 0x40; | ||
71 | } else { | ||
72 | - v = 0x3f - right; | ||
73 | + v = 0x3f - right; | ||
74 | } | ||
75 | /* Do we really know this will always be called with IRQs on? */ | ||
76 | spin_lock_irq(&chip->reg_lock); | ||
77 | old = cx_read(AUD_VOL_CTL); | ||
78 | if (v != (old & 0x3f)) { | ||
79 | - cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v); | ||
80 | - changed = 1; | ||
81 | + cx_write(AUD_VOL_CTL, (old & ~0x3f) | v); | ||
82 | + changed = 1; | ||
83 | } | ||
84 | - if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) { | ||
85 | - cx_write(AUD_BAL_CTL, b); | ||
86 | - changed = 1; | ||
87 | + if (cx_read(AUD_BAL_CTL) != b) { | ||
88 | + cx_write(AUD_BAL_CTL, b); | ||
89 | + changed = 1; | ||
90 | } | ||
91 | spin_unlock_irq(&chip->reg_lock); | ||
92 | |||
93 | @@ -640,7 +618,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = { | ||
94 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
95 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | ||
96 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
97 | - .name = "Analog-TV Volume", | ||
98 | + .name = "Playback Volume", | ||
99 | .info = snd_cx88_volume_info, | ||
100 | .get = snd_cx88_volume_get, | ||
101 | .put = snd_cx88_volume_put, | ||
102 | @@ -671,14 +649,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, | ||
103 | vol = cx_read(AUD_VOL_CTL); | ||
104 | if (value->value.integer.value[0] != !(vol & bit)) { | ||
105 | vol ^= bit; | ||
106 | - cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); | ||
107 | - /* Pass mute onto any WM8775 */ | ||
108 | - if ((1<<6) == bit) { | ||
109 | - struct v4l2_control client_ctl; | ||
110 | - client_ctl.value = 0 != (vol & bit); | ||
111 | - client_ctl.id = V4L2_CID_AUDIO_MUTE; | ||
112 | - call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
113 | - } | ||
114 | + cx_write(AUD_VOL_CTL, vol); | ||
115 | ret = 1; | ||
116 | } | ||
117 | spin_unlock_irq(&chip->reg_lock); | ||
118 | @@ -687,7 +658,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, | ||
119 | |||
120 | static const struct snd_kcontrol_new snd_cx88_dac_switch = { | ||
121 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
122 | - .name = "Audio-Out Switch", | ||
123 | + .name = "Playback Switch", | ||
124 | .info = snd_ctl_boolean_mono_info, | ||
125 | .get = snd_cx88_switch_get, | ||
126 | .put = snd_cx88_switch_put, | ||
127 | @@ -696,49 +667,13 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = { | ||
128 | |||
129 | static const struct snd_kcontrol_new snd_cx88_source_switch = { | ||
130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
131 | - .name = "Analog-TV Switch", | ||
132 | + .name = "Capture Switch", | ||
133 | .info = snd_ctl_boolean_mono_info, | ||
134 | .get = snd_cx88_switch_get, | ||
135 | .put = snd_cx88_switch_put, | ||
136 | .private_value = (1<<6), | ||
137 | }; | ||
138 | |||
139 | -static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol, | ||
140 | - struct snd_ctl_elem_value *value) | ||
141 | -{ | ||
142 | - snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); | ||
143 | - struct cx88_core *core = chip->core; | ||
144 | - struct v4l2_control client_ctl; | ||
145 | - | ||
146 | - client_ctl.id = V4L2_CID_AUDIO_LOUDNESS; | ||
147 | - call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl); | ||
148 | - value->value.integer.value[0] = client_ctl.value ? 1 : 0; | ||
149 | - | ||
150 | - return 0; | ||
151 | -} | ||
152 | - | ||
153 | -static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol, | ||
154 | - struct snd_ctl_elem_value *value) | ||
155 | -{ | ||
156 | - snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); | ||
157 | - struct cx88_core *core = chip->core; | ||
158 | - struct v4l2_control client_ctl; | ||
159 | - | ||
160 | - client_ctl.value = 0 != value->value.integer.value[0]; | ||
161 | - client_ctl.id = V4L2_CID_AUDIO_LOUDNESS; | ||
162 | - call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
163 | - | ||
164 | - return 0; | ||
165 | -} | ||
166 | - | ||
167 | -static struct snd_kcontrol_new snd_cx88_alc_switch = { | ||
168 | - .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
169 | - .name = "Line-In ALC Switch", | ||
170 | - .info = snd_ctl_boolean_mono_info, | ||
171 | - .get = snd_cx88_alc_get, | ||
172 | - .put = snd_cx88_alc_put, | ||
173 | -}; | ||
174 | - | ||
175 | /**************************************************************************** | ||
176 | Basic Flow for Sound Devices | ||
177 | ****************************************************************************/ | ||
178 | @@ -860,7 +795,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, | ||
179 | { | ||
180 | struct snd_card *card; | ||
181 | snd_cx88_card_t *chip; | ||
182 | - struct v4l2_subdev *sd; | ||
183 | int err; | ||
184 | |||
185 | if (devno >= SNDRV_CARDS) | ||
186 | @@ -896,15 +830,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, | ||
187 | if (err < 0) | ||
188 | goto error; | ||
189 | |||
190 | - /* If there's a wm8775 then add a Line-In ALC switch */ | ||
191 | - list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) { | ||
192 | - if (WM8775_GID == sd->grp_id) { | ||
193 | - snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, | ||
194 | - chip)); | ||
195 | - break; | ||
196 | - } | ||
197 | - } | ||
198 | - | ||
199 | strcpy (card->driver, "CX88x"); | ||
200 | sprintf(card->shortname, "Conexant CX%x", pci->device); | ||
201 | sprintf(card->longname, "%s at %#llx", | ||
202 | diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c | ||
203 | index 9b9e169..0ccc2af 100644 | ||
204 | --- a/drivers/media/video/cx88/cx88-cards.c | ||
205 | +++ b/drivers/media/video/cx88/cx88-cards.c | ||
206 | @@ -1007,15 +1007,22 @@ static const struct cx88_board cx88_boards[] = { | ||
207 | .radio_type = UNSET, | ||
208 | .tuner_addr = ADDR_UNSET, | ||
209 | .radio_addr = ADDR_UNSET, | ||
210 | + .audio_chip = V4L2_IDENT_WM8775, | ||
211 | .input = {{ | ||
212 | .type = CX88_VMUX_DVB, | ||
213 | .vmux = 0, | ||
214 | + /* 2: Line-In */ | ||
215 | + .audioroute = 2, | ||
216 | },{ | ||
217 | .type = CX88_VMUX_COMPOSITE1, | ||
218 | .vmux = 1, | ||
219 | + /* 2: Line-In */ | ||
220 | + .audioroute = 2, | ||
221 | },{ | ||
222 | .type = CX88_VMUX_SVIDEO, | ||
223 | .vmux = 2, | ||
224 | + /* 2: Line-In */ | ||
225 | + .audioroute = 2, | ||
226 | }}, | ||
227 | .mpeg = CX88_MPEG_DVB, | ||
228 | }, | ||
229 | diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c | ||
230 | index 62cea95..d9249e5 100644 | ||
231 | --- a/drivers/media/video/cx88/cx88-video.c | ||
232 | +++ b/drivers/media/video/cx88/cx88-video.c | ||
233 | @@ -40,7 +40,6 @@ | ||
234 | #include "cx88.h" | ||
235 | #include <media/v4l2-common.h> | ||
236 | #include <media/v4l2-ioctl.h> | ||
237 | -#include <media/wm8775.h> | ||
238 | |||
239 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); | ||
240 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | ||
241 | @@ -977,7 +976,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) | ||
242 | const struct cx88_ctrl *c = NULL; | ||
243 | u32 value,mask; | ||
244 | int i; | ||
245 | - struct v4l2_control client_ctl; | ||
246 | |||
247 | for (i = 0; i < CX8800_CTLS; i++) { | ||
248 | if (cx8800_ctls[i].v.id == ctl->id) { | ||
249 | @@ -991,27 +989,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) | ||
250 | ctl->value = c->v.minimum; | ||
251 | if (ctl->value > c->v.maximum) | ||
252 | ctl->value = c->v.maximum; | ||
253 | - | ||
254 | - /* Pass changes onto any WM8775 */ | ||
255 | - client_ctl.id = ctl->id; | ||
256 | - switch (ctl->id) { | ||
257 | - case V4L2_CID_AUDIO_MUTE: | ||
258 | - client_ctl.value = ctl->value; | ||
259 | - break; | ||
260 | - case V4L2_CID_AUDIO_VOLUME: | ||
261 | - client_ctl.value = (ctl->value) ? | ||
262 | - (0x90 + ctl->value) << 8 : 0; | ||
263 | - break; | ||
264 | - case V4L2_CID_AUDIO_BALANCE: | ||
265 | - client_ctl.value = ctl->value << 9; | ||
266 | - break; | ||
267 | - default: | ||
268 | - client_ctl.id = 0; | ||
269 | - break; | ||
270 | - } | ||
271 | - if (client_ctl.id) | ||
272 | - call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
273 | - | ||
274 | mask=c->mask; | ||
275 | switch (ctl->id) { | ||
276 | case V4L2_CID_AUDIO_BALANCE: | ||
277 | @@ -1558,9 +1535,7 @@ static int radio_queryctrl (struct file *file, void *priv, | ||
278 | if (c->id < V4L2_CID_BASE || | ||
279 | c->id >= V4L2_CID_LASTP1) | ||
280 | return -EINVAL; | ||
281 | - if (c->id == V4L2_CID_AUDIO_MUTE || | ||
282 | - c->id == V4L2_CID_AUDIO_VOLUME || | ||
283 | - c->id == V4L2_CID_AUDIO_BALANCE) { | ||
284 | + if (c->id == V4L2_CID_AUDIO_MUTE) { | ||
285 | for (i = 0; i < CX8800_CTLS; i++) { | ||
286 | if (cx8800_ctls[i].v.id == c->id) | ||
287 | break; | ||
288 | diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h | ||
289 | index e8c732e..c9981e7 100644 | ||
290 | --- a/drivers/media/video/cx88/cx88.h | ||
291 | +++ b/drivers/media/video/cx88/cx88.h | ||
292 | @@ -398,19 +398,17 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev) | ||
293 | return container_of(v4l2_dev, struct cx88_core, v4l2_dev); | ||
294 | } | ||
295 | |||
296 | -#define call_hw(core, grpid, o, f, args...) \ | ||
297 | +#define call_all(core, o, f, args...) \ | ||
298 | do { \ | ||
299 | if (!core->i2c_rc) { \ | ||
300 | if (core->gate_ctrl) \ | ||
301 | core->gate_ctrl(core, 1); \ | ||
302 | - v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \ | ||
303 | + v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \ | ||
304 | if (core->gate_ctrl) \ | ||
305 | core->gate_ctrl(core, 0); \ | ||
306 | } \ | ||
307 | } while (0) | ||
308 | |||
309 | -#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args) | ||
310 | - | ||
311 | struct cx8800_dev; | ||
312 | struct cx8802_dev; | ||
313 | |||
314 | diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c | ||
315 | index 1355256..fe8ef64 100644 | ||
316 | --- a/drivers/media/video/wm8775.c | ||
317 | +++ b/drivers/media/video/wm8775.c | ||
318 | @@ -35,7 +35,6 @@ | ||
319 | #include <media/v4l2-device.h> | ||
320 | #include <media/v4l2-chip-ident.h> | ||
321 | #include <media/v4l2-ctrls.h> | ||
322 | -#include <media/wm8775.h> | ||
323 | |||
324 | MODULE_DESCRIPTION("wm8775 driver"); | ||
325 | MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); | ||
326 | @@ -51,16 +50,10 @@ enum { | ||
327 | TOT_REGS | ||
328 | }; | ||
329 | |||
330 | -#define ALC_HOLD 0x85 /* R17: use zero cross detection, ALC hold time 42.6 ms */ | ||
331 | -#define ALC_EN 0x100 /* R17: ALC enable */ | ||
332 | - | ||
333 | struct wm8775_state { | ||
334 | struct v4l2_subdev sd; | ||
335 | struct v4l2_ctrl_handler hdl; | ||
336 | struct v4l2_ctrl *mute; | ||
337 | - struct v4l2_ctrl *vol; | ||
338 | - struct v4l2_ctrl *bal; | ||
339 | - struct v4l2_ctrl *loud; | ||
340 | u8 input; /* Last selected input (0-0xf) */ | ||
341 | }; | ||
342 | |||
343 | @@ -92,30 +85,6 @@ static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val) | ||
344 | return -1; | ||
345 | } | ||
346 | |||
347 | -static void wm8775_set_audio(struct v4l2_subdev *sd, int quietly) | ||
348 | -{ | ||
349 | - struct wm8775_state *state = to_state(sd); | ||
350 | - u8 vol_l, vol_r; | ||
351 | - int muted = 0 != state->mute->val; | ||
352 | - u16 volume = (u16)state->vol->val; | ||
353 | - u16 balance = (u16)state->bal->val; | ||
354 | - | ||
355 | - /* normalize ( 65535 to 0 -> 255 to 0 (+24dB to -103dB) ) */ | ||
356 | - vol_l = (min(65536 - balance, 32768) * volume) >> 23; | ||
357 | - vol_r = (min(balance, (u16)32768) * volume) >> 23; | ||
358 | - | ||
359 | - /* Mute */ | ||
360 | - if (muted || quietly) | ||
361 | - wm8775_write(sd, R21, 0x0c0 | state->input); | ||
362 | - | ||
363 | - wm8775_write(sd, R14, vol_l | 0x100); /* 0x100= Left channel ADC zero cross enable */ | ||
364 | - wm8775_write(sd, R15, vol_r | 0x100); /* 0x100= Right channel ADC zero cross enable */ | ||
365 | - | ||
366 | - /* Un-mute */ | ||
367 | - if (!muted) | ||
368 | - wm8775_write(sd, R21, state->input); | ||
369 | -} | ||
370 | - | ||
371 | static int wm8775_s_routing(struct v4l2_subdev *sd, | ||
372 | u32 input, u32 output, u32 config) | ||
373 | { | ||
374 | @@ -133,26 +102,25 @@ static int wm8775_s_routing(struct v4l2_subdev *sd, | ||
375 | state->input = input; | ||
376 | if (!v4l2_ctrl_g_ctrl(state->mute)) | ||
377 | return 0; | ||
378 | - if (!v4l2_ctrl_g_ctrl(state->vol)) | ||
379 | - return 0; | ||
380 | - if (!v4l2_ctrl_g_ctrl(state->bal)) | ||
381 | - return 0; | ||
382 | - wm8775_set_audio(sd, 1); | ||
383 | + wm8775_write(sd, R21, 0x0c0); | ||
384 | + wm8775_write(sd, R14, 0x1d4); | ||
385 | + wm8775_write(sd, R15, 0x1d4); | ||
386 | + wm8775_write(sd, R21, 0x100 + state->input); | ||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl) | ||
391 | { | ||
392 | struct v4l2_subdev *sd = to_sd(ctrl); | ||
393 | + struct wm8775_state *state = to_state(sd); | ||
394 | |||
395 | switch (ctrl->id) { | ||
396 | case V4L2_CID_AUDIO_MUTE: | ||
397 | - case V4L2_CID_AUDIO_VOLUME: | ||
398 | - case V4L2_CID_AUDIO_BALANCE: | ||
399 | - wm8775_set_audio(sd, 0); | ||
400 | - return 0; | ||
401 | - case V4L2_CID_AUDIO_LOUDNESS: | ||
402 | - wm8775_write(sd, R17, (ctrl->val ? ALC_EN : 0) | ALC_HOLD); | ||
403 | + wm8775_write(sd, R21, 0x0c0); | ||
404 | + wm8775_write(sd, R14, 0x1d4); | ||
405 | + wm8775_write(sd, R15, 0x1d4); | ||
406 | + if (!ctrl->val) | ||
407 | + wm8775_write(sd, R21, 0x100 + state->input); | ||
408 | return 0; | ||
409 | } | ||
410 | return -EINVAL; | ||
411 | @@ -176,7 +144,16 @@ static int wm8775_log_status(struct v4l2_subdev *sd) | ||
412 | |||
413 | static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq) | ||
414 | { | ||
415 | - wm8775_set_audio(sd, 0); | ||
416 | + struct wm8775_state *state = to_state(sd); | ||
417 | + | ||
418 | + /* If I remove this, then it can happen that I have no | ||
419 | + sound the first time I tune from static to a valid channel. | ||
420 | + It's difficult to reproduce and is almost certainly related | ||
421 | + to the zero cross detect circuit. */ | ||
422 | + wm8775_write(sd, R21, 0x0c0); | ||
423 | + wm8775_write(sd, R14, 0x1d4); | ||
424 | + wm8775_write(sd, R15, 0x1d4); | ||
425 | + wm8775_write(sd, R21, 0x100 + state->input); | ||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | @@ -226,7 +203,6 @@ static int wm8775_probe(struct i2c_client *client, | ||
430 | { | ||
431 | struct wm8775_state *state; | ||
432 | struct v4l2_subdev *sd; | ||
433 | - int err; | ||
434 | |||
435 | /* Check if the adapter supports the needed features */ | ||
436 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | ||
437 | @@ -240,21 +216,15 @@ static int wm8775_probe(struct i2c_client *client, | ||
438 | return -ENOMEM; | ||
439 | sd = &state->sd; | ||
440 | v4l2_i2c_subdev_init(sd, client, &wm8775_ops); | ||
441 | - sd->grp_id = WM8775_GID; /* subdev group id */ | ||
442 | state->input = 2; | ||
443 | |||
444 | - v4l2_ctrl_handler_init(&state->hdl, 4); | ||
445 | + v4l2_ctrl_handler_init(&state->hdl, 1); | ||
446 | state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
447 | V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0); | ||
448 | - state->vol = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
449 | - V4L2_CID_AUDIO_VOLUME, 0, 65535, (65535+99)/100, 0xCF00); /* 0dB*/ | ||
450 | - state->bal = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
451 | - V4L2_CID_AUDIO_BALANCE, 0, 65535, (65535+99)/100, 32768); | ||
452 | - state->loud = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
453 | - V4L2_CID_AUDIO_LOUDNESS, 0, 1, 1, 1); | ||
454 | sd->ctrl_handler = &state->hdl; | ||
455 | - err = state->hdl.error; | ||
456 | - if (err) { | ||
457 | + if (state->hdl.error) { | ||
458 | + int err = state->hdl.error; | ||
459 | + | ||
460 | v4l2_ctrl_handler_free(&state->hdl); | ||
461 | kfree(state); | ||
462 | return err; | ||
463 | @@ -266,25 +236,29 @@ static int wm8775_probe(struct i2c_client *client, | ||
464 | wm8775_write(sd, R23, 0x000); | ||
465 | /* Disable zero cross detect timeout */ | ||
466 | wm8775_write(sd, R7, 0x000); | ||
467 | - /* HPF enable, I2S mode, 24-bit */ | ||
468 | - wm8775_write(sd, R11, 0x022); | ||
469 | + /* Left justified, 24-bit mode */ | ||
470 | + wm8775_write(sd, R11, 0x021); | ||
471 | /* Master mode, clock ratio 256fs */ | ||
472 | wm8775_write(sd, R12, 0x102); | ||
473 | /* Powered up */ | ||
474 | wm8775_write(sd, R13, 0x000); | ||
475 | - /* ALC stereo, ALC target level -5dB FS, ALC max gain +8dB */ | ||
476 | - wm8775_write(sd, R16, 0x1bb); | ||
477 | - /* Set ALC mode and hold time */ | ||
478 | - wm8775_write(sd, R17, (state->loud->val ? ALC_EN : 0) | ALC_HOLD); | ||
479 | + /* ADC gain +2.5dB, enable zero cross */ | ||
480 | + wm8775_write(sd, R14, 0x1d4); | ||
481 | + /* ADC gain +2.5dB, enable zero cross */ | ||
482 | + wm8775_write(sd, R15, 0x1d4); | ||
483 | + /* ALC Stereo, ALC target level -1dB FS max gain +8dB */ | ||
484 | + wm8775_write(sd, R16, 0x1bf); | ||
485 | + /* Enable gain control, use zero cross detection, | ||
486 | + ALC hold time 42.6 ms */ | ||
487 | + wm8775_write(sd, R17, 0x185); | ||
488 | /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */ | ||
489 | wm8775_write(sd, R18, 0x0a2); | ||
490 | /* Enable noise gate, threshold -72dBfs */ | ||
491 | wm8775_write(sd, R19, 0x005); | ||
492 | - /* Transient window 4ms, ALC min gain -5dB */ | ||
493 | - wm8775_write(sd, R20, 0x0fb); | ||
494 | - | ||
495 | - wm8775_set_audio(sd, 1); /* set volume/mute/mux */ | ||
496 | - | ||
497 | + /* Transient window 4ms, lower PGA gain limit -1dB */ | ||
498 | + wm8775_write(sd, R20, 0x07a); | ||
499 | + /* LRBOTH = 1, use input 2. */ | ||
500 | + wm8775_write(sd, R21, 0x102); | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | diff --git a/include/media/wm8775.h b/include/media/wm8775.h | ||
505 | index a1c4d41..60739c5 100644 | ||
506 | --- a/include/media/wm8775.h | ||
507 | +++ b/include/media/wm8775.h | ||
508 | @@ -32,7 +32,4 @@ | ||
509 | #define WM8775_AIN3 4 | ||
510 | #define WM8775_AIN4 8 | ||
511 | |||
512 | -/* subdev group ID */ | ||
513 | -#define WM8775_GID (1 << 0) | ||
514 | - | ||
515 | #endif | ||
516 | -- | ||
517 | 1.6.6.1 | ||
518 | |||