diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/i2c/other/Makefile | 2 | ||||
-rw-r--r-- | sound/i2c/other/tea575x-tuner.c | 577 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 8 | ||||
-rw-r--r-- | sound/pci/Kconfig | 12 | ||||
-rw-r--r-- | sound/pci/ens1370.c | 2 | ||||
-rw-r--r-- | sound/pci/es1968.c | 2 | ||||
-rw-r--r-- | sound/pci/fm801.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 37 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 89 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 93 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 57 | ||||
-rw-r--r-- | sound/pci/via82xx.c | 2 | ||||
-rw-r--r-- | sound/soc/atmel/atmel_ssc_dai.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/Kconfig | 2 | ||||
-rw-r--r-- | sound/soc/codecs/mc13783.c | 4 | ||||
-rw-r--r-- | sound/soc/fsl/Kconfig | 1 | ||||
-rw-r--r-- | sound/soc/fsl/imx-audmux.c | 3 | ||||
-rw-r--r-- | sound/soc/fsl/imx-sgtl5000.c | 2 | ||||
-rw-r--r-- | sound/soc/fsl/imx-wm8962.c | 2 | ||||
-rw-r--r-- | sound/soc/kirkwood/kirkwood-i2s.c | 3 | ||||
-rw-r--r-- | sound/soc/samsung/Kconfig | 6 | ||||
-rw-r--r-- | sound/soc/sh/rcar/scu.c | 4 | ||||
-rw-r--r-- | sound/soc/soc-io.c | 2 |
23 files changed, 260 insertions, 654 deletions
diff --git a/sound/i2c/other/Makefile b/sound/i2c/other/Makefile index c95d8f1aae87..5526b03b95a2 100644 --- a/sound/i2c/other/Makefile +++ b/sound/i2c/other/Makefile | |||
@@ -8,10 +8,8 @@ snd-ak4117-objs := ak4117.o | |||
8 | snd-ak4113-objs := ak4113.o | 8 | snd-ak4113-objs := ak4113.o |
9 | snd-ak4xxx-adda-objs := ak4xxx-adda.o | 9 | snd-ak4xxx-adda-objs := ak4xxx-adda.o |
10 | snd-pt2258-objs := pt2258.o | 10 | snd-pt2258-objs := pt2258.o |
11 | snd-tea575x-tuner-objs := tea575x-tuner.o | ||
12 | 11 | ||
13 | # Module Dependency | 12 | # Module Dependency |
14 | obj-$(CONFIG_SND_PDAUDIOCF) += snd-ak4117.o | 13 | obj-$(CONFIG_SND_PDAUDIOCF) += snd-ak4117.o |
15 | obj-$(CONFIG_SND_ICE1712) += snd-ak4xxx-adda.o | 14 | obj-$(CONFIG_SND_ICE1712) += snd-ak4xxx-adda.o |
16 | obj-$(CONFIG_SND_ICE1724) += snd-ak4114.o snd-ak4113.o snd-ak4xxx-adda.o snd-pt2258.o | 15 | obj-$(CONFIG_SND_ICE1724) += snd-ak4114.o snd-ak4113.o snd-ak4xxx-adda.o snd-pt2258.o |
17 | obj-$(CONFIG_SND_TEA575X) += snd-tea575x-tuner.o | ||
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c deleted file mode 100644 index 8a36a1d9803f..000000000000 --- a/sound/i2c/other/tea575x-tuner.c +++ /dev/null | |||
@@ -1,577 +0,0 @@ | |||
1 | /* | ||
2 | * ALSA driver for TEA5757/5759 Philips AM/FM radio tuner chips | ||
3 | * | ||
4 | * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz> | ||
5 | * | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #include <asm/io.h> | ||
24 | #include <linux/delay.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/sched.h> | ||
29 | #include <media/v4l2-device.h> | ||
30 | #include <media/v4l2-dev.h> | ||
31 | #include <media/v4l2-fh.h> | ||
32 | #include <media/v4l2-ioctl.h> | ||
33 | #include <media/v4l2-event.h> | ||
34 | #include <sound/tea575x-tuner.h> | ||
35 | |||
36 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | ||
37 | MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); | ||
38 | MODULE_LICENSE("GPL"); | ||
39 | |||
40 | /* | ||
41 | * definitions | ||
42 | */ | ||
43 | |||
44 | #define TEA575X_BIT_SEARCH (1<<24) /* 1 = search action, 0 = tuned */ | ||
45 | #define TEA575X_BIT_UPDOWN (1<<23) /* 0 = search down, 1 = search up */ | ||
46 | #define TEA575X_BIT_MONO (1<<22) /* 0 = stereo, 1 = mono */ | ||
47 | #define TEA575X_BIT_BAND_MASK (3<<20) | ||
48 | #define TEA575X_BIT_BAND_FM (0<<20) | ||
49 | #define TEA575X_BIT_BAND_MW (1<<20) | ||
50 | #define TEA575X_BIT_BAND_LW (2<<20) | ||
51 | #define TEA575X_BIT_BAND_SW (3<<20) | ||
52 | #define TEA575X_BIT_PORT_0 (1<<19) /* user bit */ | ||
53 | #define TEA575X_BIT_PORT_1 (1<<18) /* user bit */ | ||
54 | #define TEA575X_BIT_SEARCH_MASK (3<<16) /* search level */ | ||
55 | #define TEA575X_BIT_SEARCH_5_28 (0<<16) /* FM >5uV, AM >28uV */ | ||
56 | #define TEA575X_BIT_SEARCH_10_40 (1<<16) /* FM >10uV, AM > 40uV */ | ||
57 | #define TEA575X_BIT_SEARCH_30_63 (2<<16) /* FM >30uV, AM > 63uV */ | ||
58 | #define TEA575X_BIT_SEARCH_150_1000 (3<<16) /* FM > 150uV, AM > 1000uV */ | ||
59 | #define TEA575X_BIT_DUMMY (1<<15) /* buffer */ | ||
60 | #define TEA575X_BIT_FREQ_MASK 0x7fff | ||
61 | |||
62 | enum { BAND_FM, BAND_FM_JAPAN, BAND_AM }; | ||
63 | |||
64 | static const struct v4l2_frequency_band bands[] = { | ||
65 | { | ||
66 | .type = V4L2_TUNER_RADIO, | ||
67 | .index = 0, | ||
68 | .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | | ||
69 | V4L2_TUNER_CAP_FREQ_BANDS, | ||
70 | .rangelow = 87500 * 16, | ||
71 | .rangehigh = 108000 * 16, | ||
72 | .modulation = V4L2_BAND_MODULATION_FM, | ||
73 | }, | ||
74 | { | ||
75 | .type = V4L2_TUNER_RADIO, | ||
76 | .index = 0, | ||
77 | .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | | ||
78 | V4L2_TUNER_CAP_FREQ_BANDS, | ||
79 | .rangelow = 76000 * 16, | ||
80 | .rangehigh = 91000 * 16, | ||
81 | .modulation = V4L2_BAND_MODULATION_FM, | ||
82 | }, | ||
83 | { | ||
84 | .type = V4L2_TUNER_RADIO, | ||
85 | .index = 1, | ||
86 | .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS, | ||
87 | .rangelow = 530 * 16, | ||
88 | .rangehigh = 1710 * 16, | ||
89 | .modulation = V4L2_BAND_MODULATION_AM, | ||
90 | }, | ||
91 | }; | ||
92 | |||
93 | /* | ||
94 | * lowlevel part | ||
95 | */ | ||
96 | |||
97 | static void snd_tea575x_write(struct snd_tea575x *tea, unsigned int val) | ||
98 | { | ||
99 | u16 l; | ||
100 | u8 data; | ||
101 | |||
102 | if (tea->ops->write_val) | ||
103 | return tea->ops->write_val(tea, val); | ||
104 | |||
105 | tea->ops->set_direction(tea, 1); | ||
106 | udelay(16); | ||
107 | |||
108 | for (l = 25; l > 0; l--) { | ||
109 | data = (val >> 24) & TEA575X_DATA; | ||
110 | val <<= 1; /* shift data */ | ||
111 | tea->ops->set_pins(tea, data | TEA575X_WREN); | ||
112 | udelay(2); | ||
113 | tea->ops->set_pins(tea, data | TEA575X_WREN | TEA575X_CLK); | ||
114 | udelay(2); | ||
115 | tea->ops->set_pins(tea, data | TEA575X_WREN); | ||
116 | udelay(2); | ||
117 | } | ||
118 | |||
119 | if (!tea->mute) | ||
120 | tea->ops->set_pins(tea, 0); | ||
121 | } | ||
122 | |||
123 | static u32 snd_tea575x_read(struct snd_tea575x *tea) | ||
124 | { | ||
125 | u16 l, rdata; | ||
126 | u32 data = 0; | ||
127 | |||
128 | if (tea->ops->read_val) | ||
129 | return tea->ops->read_val(tea); | ||
130 | |||
131 | tea->ops->set_direction(tea, 0); | ||
132 | tea->ops->set_pins(tea, 0); | ||
133 | udelay(16); | ||
134 | |||
135 | for (l = 24; l--;) { | ||
136 | tea->ops->set_pins(tea, TEA575X_CLK); | ||
137 | udelay(2); | ||
138 | if (!l) | ||
139 | tea->tuned = tea->ops->get_pins(tea) & TEA575X_MOST ? 0 : 1; | ||
140 | tea->ops->set_pins(tea, 0); | ||
141 | udelay(2); | ||
142 | data <<= 1; /* shift data */ | ||
143 | rdata = tea->ops->get_pins(tea); | ||
144 | if (!l) | ||
145 | tea->stereo = (rdata & TEA575X_MOST) ? 0 : 1; | ||
146 | if (rdata & TEA575X_DATA) | ||
147 | data++; | ||
148 | udelay(2); | ||
149 | } | ||
150 | |||
151 | if (tea->mute) | ||
152 | tea->ops->set_pins(tea, TEA575X_WREN); | ||
153 | |||
154 | return data; | ||
155 | } | ||
156 | |||
157 | static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val) | ||
158 | { | ||
159 | u32 freq = val & TEA575X_BIT_FREQ_MASK; | ||
160 | |||
161 | if (freq == 0) | ||
162 | return freq; | ||
163 | |||
164 | switch (tea->band) { | ||
165 | case BAND_FM: | ||
166 | /* freq *= 12.5 */ | ||
167 | freq *= 125; | ||
168 | freq /= 10; | ||
169 | /* crystal fixup */ | ||
170 | freq -= TEA575X_FMIF; | ||
171 | break; | ||
172 | case BAND_FM_JAPAN: | ||
173 | /* freq *= 12.5 */ | ||
174 | freq *= 125; | ||
175 | freq /= 10; | ||
176 | /* crystal fixup */ | ||
177 | freq += TEA575X_FMIF; | ||
178 | break; | ||
179 | case BAND_AM: | ||
180 | /* crystal fixup */ | ||
181 | freq -= TEA575X_AMIF; | ||
182 | break; | ||
183 | } | ||
184 | |||
185 | return clamp(freq * 16, bands[tea->band].rangelow, | ||
186 | bands[tea->band].rangehigh); /* from kHz */ | ||
187 | } | ||
188 | |||
189 | static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) | ||
190 | { | ||
191 | return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea)); | ||
192 | } | ||
193 | |||
194 | void snd_tea575x_set_freq(struct snd_tea575x *tea) | ||
195 | { | ||
196 | u32 freq = tea->freq / 16; /* to kHz */ | ||
197 | u32 band = 0; | ||
198 | |||
199 | switch (tea->band) { | ||
200 | case BAND_FM: | ||
201 | band = TEA575X_BIT_BAND_FM; | ||
202 | /* crystal fixup */ | ||
203 | freq += TEA575X_FMIF; | ||
204 | /* freq /= 12.5 */ | ||
205 | freq *= 10; | ||
206 | freq /= 125; | ||
207 | break; | ||
208 | case BAND_FM_JAPAN: | ||
209 | band = TEA575X_BIT_BAND_FM; | ||
210 | /* crystal fixup */ | ||
211 | freq -= TEA575X_FMIF; | ||
212 | /* freq /= 12.5 */ | ||
213 | freq *= 10; | ||
214 | freq /= 125; | ||
215 | break; | ||
216 | case BAND_AM: | ||
217 | band = TEA575X_BIT_BAND_MW; | ||
218 | /* crystal fixup */ | ||
219 | freq += TEA575X_AMIF; | ||
220 | break; | ||
221 | } | ||
222 | |||
223 | tea->val &= ~(TEA575X_BIT_FREQ_MASK | TEA575X_BIT_BAND_MASK); | ||
224 | tea->val |= band; | ||
225 | tea->val |= freq & TEA575X_BIT_FREQ_MASK; | ||
226 | snd_tea575x_write(tea, tea->val); | ||
227 | tea->freq = snd_tea575x_val_to_freq(tea, tea->val); | ||
228 | } | ||
229 | |||
230 | /* | ||
231 | * Linux Video interface | ||
232 | */ | ||
233 | |||
234 | static int vidioc_querycap(struct file *file, void *priv, | ||
235 | struct v4l2_capability *v) | ||
236 | { | ||
237 | struct snd_tea575x *tea = video_drvdata(file); | ||
238 | |||
239 | strlcpy(v->driver, tea->v4l2_dev->name, sizeof(v->driver)); | ||
240 | strlcpy(v->card, tea->card, sizeof(v->card)); | ||
241 | strlcat(v->card, tea->tea5759 ? " TEA5759" : " TEA5757", sizeof(v->card)); | ||
242 | strlcpy(v->bus_info, tea->bus_info, sizeof(v->bus_info)); | ||
243 | v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO; | ||
244 | if (!tea->cannot_read_data) | ||
245 | v->device_caps |= V4L2_CAP_HW_FREQ_SEEK; | ||
246 | v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS; | ||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | static int vidioc_enum_freq_bands(struct file *file, void *priv, | ||
251 | struct v4l2_frequency_band *band) | ||
252 | { | ||
253 | struct snd_tea575x *tea = video_drvdata(file); | ||
254 | int index; | ||
255 | |||
256 | if (band->tuner != 0) | ||
257 | return -EINVAL; | ||
258 | |||
259 | switch (band->index) { | ||
260 | case 0: | ||
261 | if (tea->tea5759) | ||
262 | index = BAND_FM_JAPAN; | ||
263 | else | ||
264 | index = BAND_FM; | ||
265 | break; | ||
266 | case 1: | ||
267 | if (tea->has_am) { | ||
268 | index = BAND_AM; | ||
269 | break; | ||
270 | } | ||
271 | /* Fall through */ | ||
272 | default: | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | |||
276 | *band = bands[index]; | ||
277 | if (!tea->cannot_read_data) | ||
278 | band->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED; | ||
279 | |||
280 | return 0; | ||
281 | } | ||
282 | |||
283 | static int vidioc_g_tuner(struct file *file, void *priv, | ||
284 | struct v4l2_tuner *v) | ||
285 | { | ||
286 | struct snd_tea575x *tea = video_drvdata(file); | ||
287 | struct v4l2_frequency_band band_fm = { 0, }; | ||
288 | |||
289 | if (v->index > 0) | ||
290 | return -EINVAL; | ||
291 | |||
292 | snd_tea575x_read(tea); | ||
293 | vidioc_enum_freq_bands(file, priv, &band_fm); | ||
294 | |||
295 | memset(v, 0, sizeof(*v)); | ||
296 | strlcpy(v->name, tea->has_am ? "FM/AM" : "FM", sizeof(v->name)); | ||
297 | v->type = V4L2_TUNER_RADIO; | ||
298 | v->capability = band_fm.capability; | ||
299 | v->rangelow = tea->has_am ? bands[BAND_AM].rangelow : band_fm.rangelow; | ||
300 | v->rangehigh = band_fm.rangehigh; | ||
301 | v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; | ||
302 | v->audmode = (tea->val & TEA575X_BIT_MONO) ? | ||
303 | V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO; | ||
304 | v->signal = tea->tuned ? 0xffff : 0; | ||
305 | return 0; | ||
306 | } | ||
307 | |||
308 | static int vidioc_s_tuner(struct file *file, void *priv, | ||
309 | const struct v4l2_tuner *v) | ||
310 | { | ||
311 | struct snd_tea575x *tea = video_drvdata(file); | ||
312 | u32 orig_val = tea->val; | ||
313 | |||
314 | if (v->index) | ||
315 | return -EINVAL; | ||
316 | tea->val &= ~TEA575X_BIT_MONO; | ||
317 | if (v->audmode == V4L2_TUNER_MODE_MONO) | ||
318 | tea->val |= TEA575X_BIT_MONO; | ||
319 | /* Only apply changes if currently tuning FM */ | ||
320 | if (tea->band != BAND_AM && tea->val != orig_val) | ||
321 | snd_tea575x_set_freq(tea); | ||
322 | |||
323 | return 0; | ||
324 | } | ||
325 | |||
326 | static int vidioc_g_frequency(struct file *file, void *priv, | ||
327 | struct v4l2_frequency *f) | ||
328 | { | ||
329 | struct snd_tea575x *tea = video_drvdata(file); | ||
330 | |||
331 | if (f->tuner != 0) | ||
332 | return -EINVAL; | ||
333 | f->type = V4L2_TUNER_RADIO; | ||
334 | f->frequency = tea->freq; | ||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static int vidioc_s_frequency(struct file *file, void *priv, | ||
339 | const struct v4l2_frequency *f) | ||
340 | { | ||
341 | struct snd_tea575x *tea = video_drvdata(file); | ||
342 | |||
343 | if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) | ||
344 | return -EINVAL; | ||
345 | |||
346 | if (tea->has_am && f->frequency < (20000 * 16)) | ||
347 | tea->band = BAND_AM; | ||
348 | else if (tea->tea5759) | ||
349 | tea->band = BAND_FM_JAPAN; | ||
350 | else | ||
351 | tea->band = BAND_FM; | ||
352 | |||
353 | tea->freq = clamp_t(u32, f->frequency, bands[tea->band].rangelow, | ||
354 | bands[tea->band].rangehigh); | ||
355 | snd_tea575x_set_freq(tea); | ||
356 | return 0; | ||
357 | } | ||
358 | |||
359 | static int vidioc_s_hw_freq_seek(struct file *file, void *fh, | ||
360 | const struct v4l2_hw_freq_seek *a) | ||
361 | { | ||
362 | struct snd_tea575x *tea = video_drvdata(file); | ||
363 | unsigned long timeout; | ||
364 | int i, spacing; | ||
365 | |||
366 | if (tea->cannot_read_data) | ||
367 | return -ENOTTY; | ||
368 | if (a->tuner || a->wrap_around) | ||
369 | return -EINVAL; | ||
370 | |||
371 | if (file->f_flags & O_NONBLOCK) | ||
372 | return -EWOULDBLOCK; | ||
373 | |||
374 | if (a->rangelow || a->rangehigh) { | ||
375 | for (i = 0; i < ARRAY_SIZE(bands); i++) { | ||
376 | if ((i == BAND_FM && tea->tea5759) || | ||
377 | (i == BAND_FM_JAPAN && !tea->tea5759) || | ||
378 | (i == BAND_AM && !tea->has_am)) | ||
379 | continue; | ||
380 | if (bands[i].rangelow == a->rangelow && | ||
381 | bands[i].rangehigh == a->rangehigh) | ||
382 | break; | ||
383 | } | ||
384 | if (i == ARRAY_SIZE(bands)) | ||
385 | return -EINVAL; /* No matching band found */ | ||
386 | if (i != tea->band) { | ||
387 | tea->band = i; | ||
388 | tea->freq = clamp(tea->freq, bands[i].rangelow, | ||
389 | bands[i].rangehigh); | ||
390 | snd_tea575x_set_freq(tea); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | spacing = (tea->band == BAND_AM) ? 5 : 50; /* kHz */ | ||
395 | |||
396 | /* clear the frequency, HW will fill it in */ | ||
397 | tea->val &= ~TEA575X_BIT_FREQ_MASK; | ||
398 | tea->val |= TEA575X_BIT_SEARCH; | ||
399 | if (a->seek_upward) | ||
400 | tea->val |= TEA575X_BIT_UPDOWN; | ||
401 | else | ||
402 | tea->val &= ~TEA575X_BIT_UPDOWN; | ||
403 | snd_tea575x_write(tea, tea->val); | ||
404 | timeout = jiffies + msecs_to_jiffies(10000); | ||
405 | for (;;) { | ||
406 | if (time_after(jiffies, timeout)) | ||
407 | break; | ||
408 | if (schedule_timeout_interruptible(msecs_to_jiffies(10))) { | ||
409 | /* some signal arrived, stop search */ | ||
410 | tea->val &= ~TEA575X_BIT_SEARCH; | ||
411 | snd_tea575x_set_freq(tea); | ||
412 | return -ERESTARTSYS; | ||
413 | } | ||
414 | if (!(snd_tea575x_read(tea) & TEA575X_BIT_SEARCH)) { | ||
415 | u32 freq; | ||
416 | |||
417 | /* Found a frequency, wait until it can be read */ | ||
418 | for (i = 0; i < 100; i++) { | ||
419 | msleep(10); | ||
420 | freq = snd_tea575x_get_freq(tea); | ||
421 | if (freq) /* available */ | ||
422 | break; | ||
423 | } | ||
424 | if (freq == 0) /* shouldn't happen */ | ||
425 | break; | ||
426 | /* | ||
427 | * if we moved by less than the spacing, or in the | ||
428 | * wrong direction, continue seeking | ||
429 | */ | ||
430 | if (abs(tea->freq - freq) < 16 * spacing || | ||
431 | (a->seek_upward && freq < tea->freq) || | ||
432 | (!a->seek_upward && freq > tea->freq)) { | ||
433 | snd_tea575x_write(tea, tea->val); | ||
434 | continue; | ||
435 | } | ||
436 | tea->freq = freq; | ||
437 | tea->val &= ~TEA575X_BIT_SEARCH; | ||
438 | return 0; | ||
439 | } | ||
440 | } | ||
441 | tea->val &= ~TEA575X_BIT_SEARCH; | ||
442 | snd_tea575x_set_freq(tea); | ||
443 | return -ENODATA; | ||
444 | } | ||
445 | |||
446 | static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl) | ||
447 | { | ||
448 | struct snd_tea575x *tea = container_of(ctrl->handler, struct snd_tea575x, ctrl_handler); | ||
449 | |||
450 | switch (ctrl->id) { | ||
451 | case V4L2_CID_AUDIO_MUTE: | ||
452 | tea->mute = ctrl->val; | ||
453 | snd_tea575x_set_freq(tea); | ||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | return -EINVAL; | ||
458 | } | ||
459 | |||
460 | static const struct v4l2_file_operations tea575x_fops = { | ||
461 | .unlocked_ioctl = video_ioctl2, | ||
462 | .open = v4l2_fh_open, | ||
463 | .release = v4l2_fh_release, | ||
464 | .poll = v4l2_ctrl_poll, | ||
465 | }; | ||
466 | |||
467 | static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { | ||
468 | .vidioc_querycap = vidioc_querycap, | ||
469 | .vidioc_g_tuner = vidioc_g_tuner, | ||
470 | .vidioc_s_tuner = vidioc_s_tuner, | ||
471 | .vidioc_g_frequency = vidioc_g_frequency, | ||
472 | .vidioc_s_frequency = vidioc_s_frequency, | ||
473 | .vidioc_s_hw_freq_seek = vidioc_s_hw_freq_seek, | ||
474 | .vidioc_enum_freq_bands = vidioc_enum_freq_bands, | ||
475 | .vidioc_log_status = v4l2_ctrl_log_status, | ||
476 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
477 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
478 | }; | ||
479 | |||
480 | static const struct video_device tea575x_radio = { | ||
481 | .ioctl_ops = &tea575x_ioctl_ops, | ||
482 | .release = video_device_release_empty, | ||
483 | }; | ||
484 | |||
485 | static const struct v4l2_ctrl_ops tea575x_ctrl_ops = { | ||
486 | .s_ctrl = tea575x_s_ctrl, | ||
487 | }; | ||
488 | |||
489 | /* | ||
490 | * initialize all the tea575x chips | ||
491 | */ | ||
492 | int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner) | ||
493 | { | ||
494 | int retval; | ||
495 | |||
496 | tea->mute = true; | ||
497 | |||
498 | /* Not all devices can or know how to read the data back. | ||
499 | Such devices can set cannot_read_data to true. */ | ||
500 | if (!tea->cannot_read_data) { | ||
501 | snd_tea575x_write(tea, 0x55AA); | ||
502 | if (snd_tea575x_read(tea) != 0x55AA) | ||
503 | return -ENODEV; | ||
504 | } | ||
505 | |||
506 | tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_5_28; | ||
507 | tea->freq = 90500 * 16; /* 90.5Mhz default */ | ||
508 | snd_tea575x_set_freq(tea); | ||
509 | |||
510 | tea->vd = tea575x_radio; | ||
511 | video_set_drvdata(&tea->vd, tea); | ||
512 | mutex_init(&tea->mutex); | ||
513 | strlcpy(tea->vd.name, tea->v4l2_dev->name, sizeof(tea->vd.name)); | ||
514 | tea->vd.lock = &tea->mutex; | ||
515 | tea->vd.v4l2_dev = tea->v4l2_dev; | ||
516 | tea->fops = tea575x_fops; | ||
517 | tea->fops.owner = owner; | ||
518 | tea->vd.fops = &tea->fops; | ||
519 | set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); | ||
520 | /* disable hw_freq_seek if we can't use it */ | ||
521 | if (tea->cannot_read_data) | ||
522 | v4l2_disable_ioctl(&tea->vd, VIDIOC_S_HW_FREQ_SEEK); | ||
523 | |||
524 | if (!tea->cannot_mute) { | ||
525 | tea->vd.ctrl_handler = &tea->ctrl_handler; | ||
526 | v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); | ||
527 | v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, | ||
528 | V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); | ||
529 | retval = tea->ctrl_handler.error; | ||
530 | if (retval) { | ||
531 | v4l2_err(tea->v4l2_dev, "can't initialize controls\n"); | ||
532 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | ||
533 | return retval; | ||
534 | } | ||
535 | |||
536 | if (tea->ext_init) { | ||
537 | retval = tea->ext_init(tea); | ||
538 | if (retval) { | ||
539 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | ||
540 | return retval; | ||
541 | } | ||
542 | } | ||
543 | |||
544 | v4l2_ctrl_handler_setup(&tea->ctrl_handler); | ||
545 | } | ||
546 | |||
547 | retval = video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->radio_nr); | ||
548 | if (retval) { | ||
549 | v4l2_err(tea->v4l2_dev, "can't register video device!\n"); | ||
550 | v4l2_ctrl_handler_free(tea->vd.ctrl_handler); | ||
551 | return retval; | ||
552 | } | ||
553 | |||
554 | return 0; | ||
555 | } | ||
556 | |||
557 | void snd_tea575x_exit(struct snd_tea575x *tea) | ||
558 | { | ||
559 | video_unregister_device(&tea->vd); | ||
560 | v4l2_ctrl_handler_free(tea->vd.ctrl_handler); | ||
561 | } | ||
562 | |||
563 | static int __init alsa_tea575x_module_init(void) | ||
564 | { | ||
565 | return 0; | ||
566 | } | ||
567 | |||
568 | static void __exit alsa_tea575x_module_exit(void) | ||
569 | { | ||
570 | } | ||
571 | |||
572 | module_init(alsa_tea575x_module_init) | ||
573 | module_exit(alsa_tea575x_module_exit) | ||
574 | |||
575 | EXPORT_SYMBOL(snd_tea575x_init); | ||
576 | EXPORT_SYMBOL(snd_tea575x_exit); | ||
577 | EXPORT_SYMBOL(snd_tea575x_set_freq); | ||
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 103b33373fd4..6effe99bbb9c 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -173,11 +173,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids); | |||
173 | 173 | ||
174 | #endif /* CONFIG_PNP */ | 174 | #endif /* CONFIG_PNP */ |
175 | 175 | ||
176 | #ifdef OPTi93X | 176 | #define DEV_NAME KBUILD_MODNAME |
177 | #define DEV_NAME "opti93x" | ||
178 | #else | ||
179 | #define DEV_NAME "opti92x" | ||
180 | #endif | ||
181 | 177 | ||
182 | static char * snd_opti9xx_names[] = { | 178 | static char * snd_opti9xx_names[] = { |
183 | "unknown", | 179 | "unknown", |
@@ -1167,7 +1163,7 @@ static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard) | |||
1167 | 1163 | ||
1168 | static struct pnp_card_driver opti9xx_pnpc_driver = { | 1164 | static struct pnp_card_driver opti9xx_pnpc_driver = { |
1169 | .flags = PNP_DRIVER_RES_DISABLE, | 1165 | .flags = PNP_DRIVER_RES_DISABLE, |
1170 | .name = "opti9xx", | 1166 | .name = DEV_NAME, |
1171 | .id_table = snd_opti9xx_pnpids, | 1167 | .id_table = snd_opti9xx_pnpids, |
1172 | .probe = snd_opti9xx_pnp_probe, | 1168 | .probe = snd_opti9xx_pnp_probe, |
1173 | .remove = snd_opti9xx_pnp_remove, | 1169 | .remove = snd_opti9xx_pnp_remove, |
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index fe6fa93a6262..46ed9e8ae0fd 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -1,10 +1,5 @@ | |||
1 | # ALSA PCI drivers | 1 | # ALSA PCI drivers |
2 | 2 | ||
3 | config SND_TEA575X | ||
4 | tristate | ||
5 | depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO || RADIO_SHARK | ||
6 | default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO || RADIO_SHARK | ||
7 | |||
8 | menuconfig SND_PCI | 3 | menuconfig SND_PCI |
9 | bool "PCI sound devices" | 4 | bool "PCI sound devices" |
10 | depends on PCI | 5 | depends on PCI |
@@ -542,7 +537,11 @@ config SND_ES1968_INPUT | |||
542 | config SND_ES1968_RADIO | 537 | config SND_ES1968_RADIO |
543 | bool "Enable TEA5757 radio tuner support for es1968" | 538 | bool "Enable TEA5757 radio tuner support for es1968" |
544 | depends on SND_ES1968 | 539 | depends on SND_ES1968 |
540 | depends on MEDIA_RADIO_SUPPORT | ||
545 | depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_ES1968 | 541 | depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_ES1968 |
542 | select RADIO_ADAPTERS | ||
543 | select RADIO_TEA575X | ||
544 | |||
546 | help | 545 | help |
547 | Say Y here to include support for TEA5757 radio tuner integrated on | 546 | Say Y here to include support for TEA5757 radio tuner integrated on |
548 | some MediaForte cards (e.g. SF64-PCE2). | 547 | some MediaForte cards (e.g. SF64-PCE2). |
@@ -562,7 +561,10 @@ config SND_FM801 | |||
562 | config SND_FM801_TEA575X_BOOL | 561 | config SND_FM801_TEA575X_BOOL |
563 | bool "ForteMedia FM801 + TEA5757 tuner" | 562 | bool "ForteMedia FM801 + TEA5757 tuner" |
564 | depends on SND_FM801 | 563 | depends on SND_FM801 |
564 | depends on MEDIA_RADIO_SUPPORT | ||
565 | depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_FM801 | 565 | depends on VIDEO_V4L2=y || VIDEO_V4L2=SND_FM801 |
566 | select RADIO_ADAPTERS | ||
567 | select RADIO_TEA575X | ||
566 | help | 568 | help |
567 | Say Y here to include support for soundcards based on the ForteMedia | 569 | Say Y here to include support for soundcards based on the ForteMedia |
568 | FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and | 570 | FM801 chip with a TEA5757 tuner (MediaForte SF256-PCS, SF256-PCP and |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index ca8929b9a5d6..61262f396004 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -1842,7 +1842,7 @@ static int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev) | |||
1842 | 1842 | ||
1843 | default: | 1843 | default: |
1844 | if (!request_region(io_port, 8, "ens137x: gameport")) { | 1844 | if (!request_region(io_port, 8, "ens137x: gameport")) { |
1845 | printk(KERN_WARNING "ens137x: gameport io port 0x%#x in use\n", | 1845 | printk(KERN_WARNING "ens137x: gameport io port %#x in use\n", |
1846 | io_port); | 1846 | io_port); |
1847 | return -EBUSY; | 1847 | return -EBUSY; |
1848 | } | 1848 | } |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index 5e2ec9687731..b0e3d92c4656 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -113,7 +113,7 @@ | |||
113 | #include <sound/initval.h> | 113 | #include <sound/initval.h> |
114 | 114 | ||
115 | #ifdef CONFIG_SND_ES1968_RADIO | 115 | #ifdef CONFIG_SND_ES1968_RADIO |
116 | #include <sound/tea575x-tuner.h> | 116 | #include <media/tea575x.h> |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | #define CARD_NAME "ESS Maestro1/2" | 119 | #define CARD_NAME "ESS Maestro1/2" |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 706c5b67b708..45bc8a95b7c4 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #include <asm/io.h> | 37 | #include <asm/io.h> |
38 | 38 | ||
39 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL | 39 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL |
40 | #include <sound/tea575x-tuner.h> | 40 | #include <media/tea575x.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); | 43 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c6c98298ac39..6e61a019aa5e 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -555,6 +555,9 @@ struct azx { | |||
555 | #ifdef CONFIG_SND_HDA_DSP_LOADER | 555 | #ifdef CONFIG_SND_HDA_DSP_LOADER |
556 | struct azx_dev saved_azx_dev; | 556 | struct azx_dev saved_azx_dev; |
557 | #endif | 557 | #endif |
558 | |||
559 | /* secondary power domain for hdmi audio under vga device */ | ||
560 | struct dev_pm_domain hdmi_pm_domain; | ||
558 | }; | 561 | }; |
559 | 562 | ||
560 | #define CREATE_TRACE_POINTS | 563 | #define CREATE_TRACE_POINTS |
@@ -1397,8 +1400,9 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
1397 | int i, ok; | 1400 | int i, ok; |
1398 | 1401 | ||
1399 | #ifdef CONFIG_PM_RUNTIME | 1402 | #ifdef CONFIG_PM_RUNTIME |
1400 | if (chip->pci->dev.power.runtime_status != RPM_ACTIVE) | 1403 | if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) |
1401 | return IRQ_NONE; | 1404 | if (chip->pci->dev.power.runtime_status != RPM_ACTIVE) |
1405 | return IRQ_NONE; | ||
1402 | #endif | 1406 | #endif |
1403 | 1407 | ||
1404 | spin_lock(&chip->reg_lock); | 1408 | spin_lock(&chip->reg_lock); |
@@ -1409,7 +1413,7 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) | |||
1409 | } | 1413 | } |
1410 | 1414 | ||
1411 | status = azx_readl(chip, INTSTS); | 1415 | status = azx_readl(chip, INTSTS); |
1412 | if (status == 0) { | 1416 | if (status == 0 || status == 0xffffffff) { |
1413 | spin_unlock(&chip->reg_lock); | 1417 | spin_unlock(&chip->reg_lock); |
1414 | return IRQ_NONE; | 1418 | return IRQ_NONE; |
1415 | } | 1419 | } |
@@ -2971,6 +2975,12 @@ static int azx_runtime_suspend(struct device *dev) | |||
2971 | struct snd_card *card = dev_get_drvdata(dev); | 2975 | struct snd_card *card = dev_get_drvdata(dev); |
2972 | struct azx *chip = card->private_data; | 2976 | struct azx *chip = card->private_data; |
2973 | 2977 | ||
2978 | if (chip->disabled) | ||
2979 | return 0; | ||
2980 | |||
2981 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | ||
2982 | return 0; | ||
2983 | |||
2974 | /* enable controller wake up event */ | 2984 | /* enable controller wake up event */ |
2975 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | | 2985 | azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) | |
2976 | STATESTS_INT_MASK); | 2986 | STATESTS_INT_MASK); |
@@ -2991,6 +3001,12 @@ static int azx_runtime_resume(struct device *dev) | |||
2991 | struct hda_codec *codec; | 3001 | struct hda_codec *codec; |
2992 | int status; | 3002 | int status; |
2993 | 3003 | ||
3004 | if (chip->disabled) | ||
3005 | return 0; | ||
3006 | |||
3007 | if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | ||
3008 | return 0; | ||
3009 | |||
2994 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) | 3010 | if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL) |
2995 | hda_display_power(true); | 3011 | hda_display_power(true); |
2996 | 3012 | ||
@@ -3020,6 +3036,9 @@ static int azx_runtime_idle(struct device *dev) | |||
3020 | struct snd_card *card = dev_get_drvdata(dev); | 3036 | struct snd_card *card = dev_get_drvdata(dev); |
3021 | struct azx *chip = card->private_data; | 3037 | struct azx *chip = card->private_data; |
3022 | 3038 | ||
3039 | if (chip->disabled) | ||
3040 | return 0; | ||
3041 | |||
3023 | if (!power_save_controller || | 3042 | if (!power_save_controller || |
3024 | !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) | 3043 | !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) |
3025 | return -EBUSY; | 3044 | return -EBUSY; |
@@ -3102,13 +3121,19 @@ static void azx_vs_set_state(struct pci_dev *pci, | |||
3102 | "%s: %s via VGA-switcheroo\n", pci_name(chip->pci), | 3121 | "%s: %s via VGA-switcheroo\n", pci_name(chip->pci), |
3103 | disabled ? "Disabling" : "Enabling"); | 3122 | disabled ? "Disabling" : "Enabling"); |
3104 | if (disabled) { | 3123 | if (disabled) { |
3124 | pm_runtime_put_sync_suspend(&pci->dev); | ||
3105 | azx_suspend(&pci->dev); | 3125 | azx_suspend(&pci->dev); |
3126 | /* when we get suspended by vga switcheroo we end up in D3cold, | ||
3127 | * however we have no ACPI handle, so pci/acpi can't put us there, | ||
3128 | * put ourselves there */ | ||
3129 | pci->current_state = PCI_D3cold; | ||
3106 | chip->disabled = true; | 3130 | chip->disabled = true; |
3107 | if (snd_hda_lock_devices(chip->bus)) | 3131 | if (snd_hda_lock_devices(chip->bus)) |
3108 | snd_printk(KERN_WARNING SFX "%s: Cannot lock devices!\n", | 3132 | snd_printk(KERN_WARNING SFX "%s: Cannot lock devices!\n", |
3109 | pci_name(chip->pci)); | 3133 | pci_name(chip->pci)); |
3110 | } else { | 3134 | } else { |
3111 | snd_hda_unlock_devices(chip->bus); | 3135 | snd_hda_unlock_devices(chip->bus); |
3136 | pm_runtime_get_noresume(&pci->dev); | ||
3112 | chip->disabled = false; | 3137 | chip->disabled = false; |
3113 | azx_resume(&pci->dev); | 3138 | azx_resume(&pci->dev); |
3114 | } | 3139 | } |
@@ -3163,6 +3188,9 @@ static int register_vga_switcheroo(struct azx *chip) | |||
3163 | if (err < 0) | 3188 | if (err < 0) |
3164 | return err; | 3189 | return err; |
3165 | chip->vga_switcheroo_registered = 1; | 3190 | chip->vga_switcheroo_registered = 1; |
3191 | |||
3192 | /* register as an optimus hdmi audio power domain */ | ||
3193 | vga_switcheroo_init_domain_pm_optimus_hdmi_audio(&chip->pci->dev, &chip->hdmi_pm_domain); | ||
3166 | return 0; | 3194 | return 0; |
3167 | } | 3195 | } |
3168 | #else | 3196 | #else |
@@ -3400,6 +3428,7 @@ static struct snd_pci_quirk msi_black_list[] = { | |||
3400 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ | 3428 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ |
3401 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ | 3429 | SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ |
3402 | SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ | 3430 | SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ |
3431 | SND_PCI_QUIRK(0x1179, 0xfb44, "Toshiba Satellite C870", 0), /* AMD Hudson */ | ||
3403 | SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ | 3432 | SND_PCI_QUIRK(0x1849, 0x0888, "ASRock", 0), /* Athlon64 X2 + nvidia */ |
3404 | SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */ | 3433 | SND_PCI_QUIRK(0xa0a0, 0x0575, "Aopen MZ915-M", 0), /* ICH6 */ |
3405 | {} | 3434 | {} |
@@ -3913,7 +3942,7 @@ static int azx_probe_continue(struct azx *chip) | |||
3913 | power_down_all_codecs(chip); | 3942 | power_down_all_codecs(chip); |
3914 | azx_notifier_register(chip); | 3943 | azx_notifier_register(chip); |
3915 | azx_add_card_list(chip); | 3944 | azx_add_card_list(chip); |
3916 | if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) | 3945 | if ((chip->driver_caps & AZX_DCAPS_PM_RUNTIME) || chip->use_vga_switcheroo) |
3917 | pm_runtime_put_noidle(&pci->dev); | 3946 | pm_runtime_put_noidle(&pci->dev); |
3918 | 3947 | ||
3919 | return 0; | 3948 | return 0; |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index cccaf9c7a7bb..b524f89a1f13 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -169,7 +169,7 @@ static void cs_automute(struct hda_codec *codec) | |||
169 | 169 | ||
170 | snd_hda_gen_update_outputs(codec); | 170 | snd_hda_gen_update_outputs(codec); |
171 | 171 | ||
172 | if (spec->gpio_eapd_hp) { | 172 | if (spec->gpio_eapd_hp || spec->gpio_eapd_speaker) { |
173 | spec->gpio_data = spec->gen.hp_jack_present ? | 173 | spec->gpio_data = spec->gen.hp_jack_present ? |
174 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; | 174 | spec->gpio_eapd_hp : spec->gpio_eapd_speaker; |
175 | snd_hda_codec_write(codec, 0x01, 0, | 175 | snd_hda_codec_write(codec, 0x01, 0, |
@@ -291,10 +291,11 @@ static int cs_init(struct hda_codec *codec) | |||
291 | { | 291 | { |
292 | struct cs_spec *spec = codec->spec; | 292 | struct cs_spec *spec = codec->spec; |
293 | 293 | ||
294 | /* init_verb sequence for C0/C1/C2 errata*/ | 294 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
295 | snd_hda_sequence_write(codec, cs_errata_init_verbs); | 295 | /* init_verb sequence for C0/C1/C2 errata*/ |
296 | 296 | snd_hda_sequence_write(codec, cs_errata_init_verbs); | |
297 | snd_hda_sequence_write(codec, cs_coef_init_verbs); | 297 | snd_hda_sequence_write(codec, cs_coef_init_verbs); |
298 | } | ||
298 | 299 | ||
299 | snd_hda_gen_init(codec); | 300 | snd_hda_gen_init(codec); |
300 | 301 | ||
@@ -307,8 +308,10 @@ static int cs_init(struct hda_codec *codec) | |||
307 | spec->gpio_data); | 308 | spec->gpio_data); |
308 | } | 309 | } |
309 | 310 | ||
310 | init_input_coef(codec); | 311 | if (spec->vendor_nid == CS420X_VENDOR_NID) { |
311 | init_digital_coef(codec); | 312 | init_input_coef(codec); |
313 | init_digital_coef(codec); | ||
314 | } | ||
312 | 315 | ||
313 | return 0; | 316 | return 0; |
314 | } | 317 | } |
@@ -552,6 +555,76 @@ static int patch_cs420x(struct hda_codec *codec) | |||
552 | } | 555 | } |
553 | 556 | ||
554 | /* | 557 | /* |
558 | * CS4208 support: | ||
559 | * Its layout is no longer compatible with CS4206/CS4207, and the generic | ||
560 | * parser seems working fairly well, except for trivial fixups. | ||
561 | */ | ||
562 | enum { | ||
563 | CS4208_GPIO0, | ||
564 | }; | ||
565 | |||
566 | static const struct hda_model_fixup cs4208_models[] = { | ||
567 | { .id = CS4208_GPIO0, .name = "gpio0" }, | ||
568 | {} | ||
569 | }; | ||
570 | |||
571 | static const struct snd_pci_quirk cs4208_fixup_tbl[] = { | ||
572 | /* codec SSID */ | ||
573 | SND_PCI_QUIRK(0x106b, 0x7100, "MacBookPro 6,1", CS4208_GPIO0), | ||
574 | SND_PCI_QUIRK(0x106b, 0x7200, "MacBookPro 6,2", CS4208_GPIO0), | ||
575 | {} /* terminator */ | ||
576 | }; | ||
577 | |||
578 | static void cs4208_fixup_gpio0(struct hda_codec *codec, | ||
579 | const struct hda_fixup *fix, int action) | ||
580 | { | ||
581 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
582 | struct cs_spec *spec = codec->spec; | ||
583 | spec->gpio_eapd_hp = 0; | ||
584 | spec->gpio_eapd_speaker = 1; | ||
585 | spec->gpio_mask = spec->gpio_dir = | ||
586 | spec->gpio_eapd_hp | spec->gpio_eapd_speaker; | ||
587 | } | ||
588 | } | ||
589 | |||
590 | static const struct hda_fixup cs4208_fixups[] = { | ||
591 | [CS4208_GPIO0] = { | ||
592 | .type = HDA_FIXUP_FUNC, | ||
593 | .v.func = cs4208_fixup_gpio0, | ||
594 | }, | ||
595 | }; | ||
596 | |||
597 | static int patch_cs4208(struct hda_codec *codec) | ||
598 | { | ||
599 | struct cs_spec *spec; | ||
600 | int err; | ||
601 | |||
602 | spec = cs_alloc_spec(codec, 0); /* no specific w/a */ | ||
603 | if (!spec) | ||
604 | return -ENOMEM; | ||
605 | |||
606 | spec->gen.automute_hook = cs_automute; | ||
607 | |||
608 | snd_hda_pick_fixup(codec, cs4208_models, cs4208_fixup_tbl, | ||
609 | cs4208_fixups); | ||
610 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | ||
611 | |||
612 | err = cs_parse_auto_config(codec); | ||
613 | if (err < 0) | ||
614 | goto error; | ||
615 | |||
616 | codec->patch_ops = cs_patch_ops; | ||
617 | |||
618 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | ||
619 | |||
620 | return 0; | ||
621 | |||
622 | error: | ||
623 | cs_free(codec); | ||
624 | return err; | ||
625 | } | ||
626 | |||
627 | /* | ||
555 | * Cirrus Logic CS4210 | 628 | * Cirrus Logic CS4210 |
556 | * | 629 | * |
557 | * 1 DAC => HP(sense) / Speakers, | 630 | * 1 DAC => HP(sense) / Speakers, |
@@ -991,6 +1064,7 @@ static int patch_cs4213(struct hda_codec *codec) | |||
991 | static const struct hda_codec_preset snd_hda_preset_cirrus[] = { | 1064 | static const struct hda_codec_preset snd_hda_preset_cirrus[] = { |
992 | { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, | 1065 | { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, |
993 | { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, | 1066 | { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, |
1067 | { .id = 0x10134208, .name = "CS4208", .patch = patch_cs4208 }, | ||
994 | { .id = 0x10134210, .name = "CS4210", .patch = patch_cs4210 }, | 1068 | { .id = 0x10134210, .name = "CS4210", .patch = patch_cs4210 }, |
995 | { .id = 0x10134213, .name = "CS4213", .patch = patch_cs4213 }, | 1069 | { .id = 0x10134213, .name = "CS4213", .patch = patch_cs4213 }, |
996 | {} /* terminator */ | 1070 | {} /* terminator */ |
@@ -998,6 +1072,7 @@ static const struct hda_codec_preset snd_hda_preset_cirrus[] = { | |||
998 | 1072 | ||
999 | MODULE_ALIAS("snd-hda-codec-id:10134206"); | 1073 | MODULE_ALIAS("snd-hda-codec-id:10134206"); |
1000 | MODULE_ALIAS("snd-hda-codec-id:10134207"); | 1074 | MODULE_ALIAS("snd-hda-codec-id:10134207"); |
1075 | MODULE_ALIAS("snd-hda-codec-id:10134208"); | ||
1001 | MODULE_ALIAS("snd-hda-codec-id:10134210"); | 1076 | MODULE_ALIAS("snd-hda-codec-id:10134210"); |
1002 | MODULE_ALIAS("snd-hda-codec-id:10134213"); | 1077 | MODULE_ALIAS("snd-hda-codec-id:10134213"); |
1003 | 1078 | ||
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 895a0d3320b4..3d8cd04455a6 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -44,6 +44,8 @@ static bool static_hdmi_pcm; | |||
44 | module_param(static_hdmi_pcm, bool, 0644); | 44 | module_param(static_hdmi_pcm, bool, 0644); |
45 | MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); | 45 | MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info"); |
46 | 46 | ||
47 | #define is_haswell(codec) ((codec)->vendor_id == 0x80862807) | ||
48 | |||
47 | struct hdmi_spec_per_cvt { | 49 | struct hdmi_spec_per_cvt { |
48 | hda_nid_t cvt_nid; | 50 | hda_nid_t cvt_nid; |
49 | int assigned; | 51 | int assigned; |
@@ -67,6 +69,8 @@ struct hdmi_spec_per_pin { | |||
67 | struct delayed_work work; | 69 | struct delayed_work work; |
68 | struct snd_kcontrol *eld_ctl; | 70 | struct snd_kcontrol *eld_ctl; |
69 | int repoll_count; | 71 | int repoll_count; |
72 | bool setup; /* the stream has been set up by prepare callback */ | ||
73 | int channels; /* current number of channels */ | ||
70 | bool non_pcm; | 74 | bool non_pcm; |
71 | bool chmap_set; /* channel-map override by ALSA API? */ | 75 | bool chmap_set; /* channel-map override by ALSA API? */ |
72 | unsigned char chmap[8]; /* ALSA API channel-map */ | 76 | unsigned char chmap[8]; /* ALSA API channel-map */ |
@@ -551,6 +555,17 @@ static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels) | |||
551 | } | 555 | } |
552 | } | 556 | } |
553 | 557 | ||
558 | if (!ca) { | ||
559 | /* if there was no match, select the regular ALSA channel | ||
560 | * allocation with the matching number of channels */ | ||
561 | for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { | ||
562 | if (channels == channel_allocations[i].channels) { | ||
563 | ca = channel_allocations[i].ca_index; | ||
564 | break; | ||
565 | } | ||
566 | } | ||
567 | } | ||
568 | |||
554 | snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf)); | 569 | snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf)); |
555 | snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", | 570 | snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n", |
556 | ca, channels, buf); | 571 | ca, channels, buf); |
@@ -868,18 +883,24 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid, | |||
868 | return true; | 883 | return true; |
869 | } | 884 | } |
870 | 885 | ||
871 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, int pin_idx, | 886 | static void hdmi_setup_audio_infoframe(struct hda_codec *codec, |
872 | bool non_pcm, | 887 | struct hdmi_spec_per_pin *per_pin, |
873 | struct snd_pcm_substream *substream) | 888 | bool non_pcm) |
874 | { | 889 | { |
875 | struct hdmi_spec *spec = codec->spec; | ||
876 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); | ||
877 | hda_nid_t pin_nid = per_pin->pin_nid; | 890 | hda_nid_t pin_nid = per_pin->pin_nid; |
878 | int channels = substream->runtime->channels; | 891 | int channels = per_pin->channels; |
879 | struct hdmi_eld *eld; | 892 | struct hdmi_eld *eld; |
880 | int ca; | 893 | int ca; |
881 | union audio_infoframe ai; | 894 | union audio_infoframe ai; |
882 | 895 | ||
896 | if (!channels) | ||
897 | return; | ||
898 | |||
899 | if (is_haswell(codec)) | ||
900 | snd_hda_codec_write(codec, pin_nid, 0, | ||
901 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
902 | AMP_OUT_UNMUTE); | ||
903 | |||
883 | eld = &per_pin->sink_eld; | 904 | eld = &per_pin->sink_eld; |
884 | if (!eld->monitor_present) | 905 | if (!eld->monitor_present) |
885 | return; | 906 | return; |
@@ -1019,10 +1040,10 @@ static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) | |||
1019 | hdmi_non_intrinsic_event(codec, res); | 1040 | hdmi_non_intrinsic_event(codec, res); |
1020 | } | 1041 | } |
1021 | 1042 | ||
1022 | static void haswell_verify_pin_D0(struct hda_codec *codec, | 1043 | static void haswell_verify_D0(struct hda_codec *codec, |
1023 | hda_nid_t cvt_nid, hda_nid_t nid) | 1044 | hda_nid_t cvt_nid, hda_nid_t nid) |
1024 | { | 1045 | { |
1025 | int pwr, lamp, ramp; | 1046 | int pwr; |
1026 | 1047 | ||
1027 | /* For Haswell, the converter 1/2 may keep in D3 state after bootup, | 1048 | /* For Haswell, the converter 1/2 may keep in D3 state after bootup, |
1028 | * thus pins could only choose converter 0 for use. Make sure the | 1049 | * thus pins could only choose converter 0 for use. Make sure the |
@@ -1038,25 +1059,6 @@ static void haswell_verify_pin_D0(struct hda_codec *codec, | |||
1038 | pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT; | 1059 | pwr = (pwr & AC_PWRST_ACTUAL) >> AC_PWRST_ACTUAL_SHIFT; |
1039 | snd_printd("Haswell HDMI audio: Power for pin 0x%x is now D%d\n", nid, pwr); | 1060 | snd_printd("Haswell HDMI audio: Power for pin 0x%x is now D%d\n", nid, pwr); |
1040 | } | 1061 | } |
1041 | |||
1042 | lamp = snd_hda_codec_read(codec, nid, 0, | ||
1043 | AC_VERB_GET_AMP_GAIN_MUTE, | ||
1044 | AC_AMP_GET_LEFT | AC_AMP_GET_OUTPUT); | ||
1045 | ramp = snd_hda_codec_read(codec, nid, 0, | ||
1046 | AC_VERB_GET_AMP_GAIN_MUTE, | ||
1047 | AC_AMP_GET_RIGHT | AC_AMP_GET_OUTPUT); | ||
1048 | if (lamp != ramp) { | ||
1049 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
1050 | AC_AMP_SET_RIGHT | AC_AMP_SET_OUTPUT | lamp); | ||
1051 | |||
1052 | lamp = snd_hda_codec_read(codec, nid, 0, | ||
1053 | AC_VERB_GET_AMP_GAIN_MUTE, | ||
1054 | AC_AMP_GET_LEFT | AC_AMP_GET_OUTPUT); | ||
1055 | ramp = snd_hda_codec_read(codec, nid, 0, | ||
1056 | AC_VERB_GET_AMP_GAIN_MUTE, | ||
1057 | AC_AMP_GET_RIGHT | AC_AMP_GET_OUTPUT); | ||
1058 | snd_printd("Haswell HDMI audio: Mute after set on pin 0x%x: [0x%x 0x%x]\n", nid, lamp, ramp); | ||
1059 | } | ||
1060 | } | 1062 | } |
1061 | 1063 | ||
1062 | /* | 1064 | /* |
@@ -1073,8 +1075,8 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid, | |||
1073 | int pinctl; | 1075 | int pinctl; |
1074 | int new_pinctl = 0; | 1076 | int new_pinctl = 0; |
1075 | 1077 | ||
1076 | if (codec->vendor_id == 0x80862807) | 1078 | if (is_haswell(codec)) |
1077 | haswell_verify_pin_D0(codec, cvt_nid, pin_nid); | 1079 | haswell_verify_D0(codec, cvt_nid, pin_nid); |
1078 | 1080 | ||
1079 | if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { | 1081 | if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) { |
1080 | pinctl = snd_hda_codec_read(codec, pin_nid, 0, | 1082 | pinctl = snd_hda_codec_read(codec, pin_nid, 0, |
@@ -1213,7 +1215,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, | |||
1213 | mux_idx); | 1215 | mux_idx); |
1214 | 1216 | ||
1215 | /* configure unused pins to choose other converters */ | 1217 | /* configure unused pins to choose other converters */ |
1216 | if (codec->vendor_id == 0x80862807) | 1218 | if (is_haswell(codec)) |
1217 | haswell_config_cvts(codec, pin_idx, mux_idx); | 1219 | haswell_config_cvts(codec, pin_idx, mux_idx); |
1218 | 1220 | ||
1219 | snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); | 1221 | snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); |
@@ -1330,6 +1332,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
1330 | eld_changed = true; | 1332 | eld_changed = true; |
1331 | } | 1333 | } |
1332 | if (update_eld) { | 1334 | if (update_eld) { |
1335 | bool old_eld_valid = pin_eld->eld_valid; | ||
1333 | pin_eld->eld_valid = eld->eld_valid; | 1336 | pin_eld->eld_valid = eld->eld_valid; |
1334 | eld_changed = pin_eld->eld_size != eld->eld_size || | 1337 | eld_changed = pin_eld->eld_size != eld->eld_size || |
1335 | memcmp(pin_eld->eld_buffer, eld->eld_buffer, | 1338 | memcmp(pin_eld->eld_buffer, eld->eld_buffer, |
@@ -1339,6 +1342,14 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) | |||
1339 | eld->eld_size); | 1342 | eld->eld_size); |
1340 | pin_eld->eld_size = eld->eld_size; | 1343 | pin_eld->eld_size = eld->eld_size; |
1341 | pin_eld->info = eld->info; | 1344 | pin_eld->info = eld->info; |
1345 | |||
1346 | /* Haswell-specific workaround: re-setup when the transcoder is | ||
1347 | * changed during the stream playback | ||
1348 | */ | ||
1349 | if (is_haswell(codec) && | ||
1350 | eld->eld_valid && !old_eld_valid && per_pin->setup) | ||
1351 | hdmi_setup_audio_infoframe(codec, per_pin, | ||
1352 | per_pin->non_pcm); | ||
1342 | } | 1353 | } |
1343 | mutex_unlock(&pin_eld->lock); | 1354 | mutex_unlock(&pin_eld->lock); |
1344 | 1355 | ||
@@ -1378,7 +1389,7 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | |||
1378 | if (get_defcfg_connect(config) == AC_JACK_PORT_NONE) | 1389 | if (get_defcfg_connect(config) == AC_JACK_PORT_NONE) |
1379 | return 0; | 1390 | return 0; |
1380 | 1391 | ||
1381 | if (codec->vendor_id == 0x80862807) | 1392 | if (is_haswell(codec)) |
1382 | intel_haswell_fixup_connect_list(codec, pin_nid); | 1393 | intel_haswell_fixup_connect_list(codec, pin_nid); |
1383 | 1394 | ||
1384 | pin_idx = spec->num_pins; | 1395 | pin_idx = spec->num_pins; |
@@ -1511,14 +1522,17 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1511 | hda_nid_t cvt_nid = hinfo->nid; | 1522 | hda_nid_t cvt_nid = hinfo->nid; |
1512 | struct hdmi_spec *spec = codec->spec; | 1523 | struct hdmi_spec *spec = codec->spec; |
1513 | int pin_idx = hinfo_to_pin_index(spec, hinfo); | 1524 | int pin_idx = hinfo_to_pin_index(spec, hinfo); |
1514 | hda_nid_t pin_nid = get_pin(spec, pin_idx)->pin_nid; | 1525 | struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); |
1526 | hda_nid_t pin_nid = per_pin->pin_nid; | ||
1515 | bool non_pcm; | 1527 | bool non_pcm; |
1516 | 1528 | ||
1517 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); | 1529 | non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); |
1530 | per_pin->channels = substream->runtime->channels; | ||
1531 | per_pin->setup = true; | ||
1518 | 1532 | ||
1519 | hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels); | 1533 | hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels); |
1520 | 1534 | ||
1521 | hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream); | 1535 | hdmi_setup_audio_infoframe(codec, per_pin, non_pcm); |
1522 | 1536 | ||
1523 | return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); | 1537 | return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); |
1524 | } | 1538 | } |
@@ -1558,6 +1572,9 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, | |||
1558 | snd_hda_spdif_ctls_unassign(codec, pin_idx); | 1572 | snd_hda_spdif_ctls_unassign(codec, pin_idx); |
1559 | per_pin->chmap_set = false; | 1573 | per_pin->chmap_set = false; |
1560 | memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); | 1574 | memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); |
1575 | |||
1576 | per_pin->setup = false; | ||
1577 | per_pin->channels = 0; | ||
1561 | } | 1578 | } |
1562 | 1579 | ||
1563 | return 0; | 1580 | return 0; |
@@ -1693,8 +1710,7 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol, | |||
1693 | per_pin->chmap_set = true; | 1710 | per_pin->chmap_set = true; |
1694 | memcpy(per_pin->chmap, chmap, sizeof(chmap)); | 1711 | memcpy(per_pin->chmap, chmap, sizeof(chmap)); |
1695 | if (prepared) | 1712 | if (prepared) |
1696 | hdmi_setup_audio_infoframe(codec, pin_idx, per_pin->non_pcm, | 1713 | hdmi_setup_audio_infoframe(codec, per_pin, per_pin->non_pcm); |
1697 | substream); | ||
1698 | 1714 | ||
1699 | return 0; | 1715 | return 0; |
1700 | } | 1716 | } |
@@ -1782,6 +1798,9 @@ static int generic_hdmi_build_controls(struct hda_codec *codec) | |||
1782 | struct snd_pcm_chmap *chmap; | 1798 | struct snd_pcm_chmap *chmap; |
1783 | struct snd_kcontrol *kctl; | 1799 | struct snd_kcontrol *kctl; |
1784 | int i; | 1800 | int i; |
1801 | |||
1802 | if (!codec->pcm_info[pin_idx].pcm) | ||
1803 | break; | ||
1785 | err = snd_pcm_add_chmap_ctls(codec->pcm_info[pin_idx].pcm, | 1804 | err = snd_pcm_add_chmap_ctls(codec->pcm_info[pin_idx].pcm, |
1786 | SNDRV_PCM_STREAM_PLAYBACK, | 1805 | SNDRV_PCM_STREAM_PLAYBACK, |
1787 | NULL, 0, pin_idx, &chmap); | 1806 | NULL, 0, pin_idx, &chmap); |
@@ -1979,7 +1998,7 @@ static int patch_generic_hdmi(struct hda_codec *codec) | |||
1979 | codec->spec = spec; | 1998 | codec->spec = spec; |
1980 | hdmi_array_init(spec, 4); | 1999 | hdmi_array_init(spec, 4); |
1981 | 2000 | ||
1982 | if (codec->vendor_id == 0x80862807) { | 2001 | if (is_haswell(codec)) { |
1983 | intel_haswell_enable_all_pins(codec, true); | 2002 | intel_haswell_enable_all_pins(codec, true); |
1984 | intel_haswell_fixup_enable_dp12(codec); | 2003 | intel_haswell_fixup_enable_dp12(codec); |
1985 | } | 2004 | } |
@@ -1990,7 +2009,7 @@ static int patch_generic_hdmi(struct hda_codec *codec) | |||
1990 | return -EINVAL; | 2009 | return -EINVAL; |
1991 | } | 2010 | } |
1992 | codec->patch_ops = generic_hdmi_patch_ops; | 2011 | codec->patch_ops = generic_hdmi_patch_ops; |
1993 | if (codec->vendor_id == 0x80862807) { | 2012 | if (is_haswell(codec)) { |
1994 | codec->patch_ops.set_power_state = haswell_set_power_state; | 2013 | codec->patch_ops.set_power_state = haswell_set_power_state; |
1995 | codec->dp_mst = true; | 2014 | codec->dp_mst = true; |
1996 | } | 2015 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4a909170b59e..bc07d369fac4 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -3443,6 +3443,56 @@ static void alc283_fixup_chromebook(struct hda_codec *codec, | |||
3443 | } | 3443 | } |
3444 | } | 3444 | } |
3445 | 3445 | ||
3446 | /* mute tablet speaker pin (0x14) via dock plugging in addition */ | ||
3447 | static void asus_tx300_automute(struct hda_codec *codec) | ||
3448 | { | ||
3449 | struct alc_spec *spec = codec->spec; | ||
3450 | snd_hda_gen_update_outputs(codec); | ||
3451 | if (snd_hda_jack_detect(codec, 0x1b)) | ||
3452 | spec->gen.mute_bits |= (1ULL << 0x14); | ||
3453 | } | ||
3454 | |||
3455 | static void alc282_fixup_asus_tx300(struct hda_codec *codec, | ||
3456 | const struct hda_fixup *fix, int action) | ||
3457 | { | ||
3458 | struct alc_spec *spec = codec->spec; | ||
3459 | /* TX300 needs to set up GPIO2 for the speaker amp */ | ||
3460 | static const struct hda_verb gpio2_verbs[] = { | ||
3461 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 }, | ||
3462 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 }, | ||
3463 | { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 }, | ||
3464 | {} | ||
3465 | }; | ||
3466 | static const struct hda_pintbl dock_pins[] = { | ||
3467 | { 0x1b, 0x21114000 }, /* dock speaker pin */ | ||
3468 | {} | ||
3469 | }; | ||
3470 | struct snd_kcontrol *kctl; | ||
3471 | |||
3472 | switch (action) { | ||
3473 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
3474 | snd_hda_add_verbs(codec, gpio2_verbs); | ||
3475 | snd_hda_apply_pincfgs(codec, dock_pins); | ||
3476 | spec->gen.auto_mute_via_amp = 1; | ||
3477 | spec->gen.automute_hook = asus_tx300_automute; | ||
3478 | snd_hda_jack_detect_enable_callback(codec, 0x1b, | ||
3479 | HDA_GEN_HP_EVENT, | ||
3480 | snd_hda_gen_hp_automute); | ||
3481 | break; | ||
3482 | case HDA_FIXUP_ACT_BUILD: | ||
3483 | /* this is a bit tricky; give more sane names for the main | ||
3484 | * (tablet) speaker and the dock speaker, respectively | ||
3485 | */ | ||
3486 | kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch"); | ||
3487 | if (kctl) | ||
3488 | strcpy(kctl->id.name, "Dock Speaker Playback Switch"); | ||
3489 | kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch"); | ||
3490 | if (kctl) | ||
3491 | strcpy(kctl->id.name, "Speaker Playback Switch"); | ||
3492 | break; | ||
3493 | } | ||
3494 | } | ||
3495 | |||
3446 | enum { | 3496 | enum { |
3447 | ALC269_FIXUP_SONY_VAIO, | 3497 | ALC269_FIXUP_SONY_VAIO, |
3448 | ALC275_FIXUP_SONY_VAIO_GPIO2, | 3498 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
@@ -3480,6 +3530,7 @@ enum { | |||
3480 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST, | 3530 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST, |
3481 | ALC269VB_FIXUP_ORDISSIMO_EVE2, | 3531 | ALC269VB_FIXUP_ORDISSIMO_EVE2, |
3482 | ALC283_FIXUP_CHROME_BOOK, | 3532 | ALC283_FIXUP_CHROME_BOOK, |
3533 | ALC282_FIXUP_ASUS_TX300, | ||
3483 | }; | 3534 | }; |
3484 | 3535 | ||
3485 | static const struct hda_fixup alc269_fixups[] = { | 3536 | static const struct hda_fixup alc269_fixups[] = { |
@@ -3735,6 +3786,10 @@ static const struct hda_fixup alc269_fixups[] = { | |||
3735 | .type = HDA_FIXUP_FUNC, | 3786 | .type = HDA_FIXUP_FUNC, |
3736 | .v.func = alc283_fixup_chromebook, | 3787 | .v.func = alc283_fixup_chromebook, |
3737 | }, | 3788 | }, |
3789 | [ALC282_FIXUP_ASUS_TX300] = { | ||
3790 | .type = HDA_FIXUP_FUNC, | ||
3791 | .v.func = alc282_fixup_asus_tx300, | ||
3792 | }, | ||
3738 | }; | 3793 | }; |
3739 | 3794 | ||
3740 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 3795 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -3784,6 +3839,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
3784 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 3839 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
3785 | SND_PCI_QUIRK(0x103c, 0x21ed, "HP Falco Chromebook", ALC283_FIXUP_CHROME_BOOK), | 3840 | SND_PCI_QUIRK(0x103c, 0x21ed, "HP Falco Chromebook", ALC283_FIXUP_CHROME_BOOK), |
3786 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), | 3841 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), |
3842 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), | ||
3787 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 3843 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
3788 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 3844 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
3789 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), | 3845 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), |
@@ -4490,6 +4546,7 @@ static const struct hda_fixup alc662_fixups[] = { | |||
4490 | 4546 | ||
4491 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { | 4547 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
4492 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), | 4548 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), |
4549 | SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), | ||
4493 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | 4550 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
4494 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), | 4551 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
4495 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), | 4552 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 3c511d0caf9e..5ae6f042c586 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -1940,7 +1940,7 @@ static int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legac | |||
1940 | 1940 | ||
1941 | r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); | 1941 | r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport"); |
1942 | if (!r) { | 1942 | if (!r) { |
1943 | printk(KERN_WARNING "via82xx: cannot reserve joystick port 0x%#x\n", | 1943 | printk(KERN_WARNING "via82xx: cannot reserve joystick port %#x\n", |
1944 | JOYSTICK_ADDR); | 1944 | JOYSTICK_ADDR); |
1945 | return -EBUSY; | 1945 | return -EBUSY; |
1946 | } | 1946 | } |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 0ecf356027f6..bb53dea85b17 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
@@ -649,7 +649,7 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream, | |||
649 | dma_params = ssc_p->dma_params[dir]; | 649 | dma_params = ssc_p->dma_params[dir]; |
650 | 650 | ||
651 | ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable); | 651 | ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_enable); |
652 | ssc_writel(ssc_p->ssc->regs, IER, dma_params->mask->ssc_error); | 652 | ssc_writel(ssc_p->ssc->regs, IDR, dma_params->mask->ssc_error); |
653 | 653 | ||
654 | pr_debug("%s enabled SSC_SR=0x%08x\n", | 654 | pr_debug("%s enabled SSC_SR=0x%08x\n", |
655 | dir ? "receive" : "transmit", | 655 | dir ? "receive" : "transmit", |
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 15106c045478..b33b45dfceec 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -107,7 +107,7 @@ config SND_SOC_ALL_CODECS | |||
107 | select SND_SOC_WM8782 | 107 | select SND_SOC_WM8782 |
108 | select SND_SOC_WM8804 if SND_SOC_I2C_AND_SPI | 108 | select SND_SOC_WM8804 if SND_SOC_I2C_AND_SPI |
109 | select SND_SOC_WM8900 if I2C | 109 | select SND_SOC_WM8900 if I2C |
110 | select SND_SOC_WM8903 if I2C && GENERIC_HARDIRQS | 110 | select SND_SOC_WM8903 if I2C |
111 | select SND_SOC_WM8904 if I2C | 111 | select SND_SOC_WM8904 if I2C |
112 | select SND_SOC_WM8940 if I2C | 112 | select SND_SOC_WM8940 if I2C |
113 | select SND_SOC_WM8955 if I2C | 113 | select SND_SOC_WM8955 if I2C |
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 4d3c8fd8c5db..ea141e1d6f28 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -125,6 +125,10 @@ static int mc13783_write(struct snd_soc_codec *codec, | |||
125 | 125 | ||
126 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); | 126 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); |
127 | 127 | ||
128 | /* include errata fix for spi audio problems */ | ||
129 | if (reg == MC13783_AUDIO_CODEC || reg == MC13783_AUDIO_DAC) | ||
130 | ret = mc13xxx_reg_write(priv->mc13xxx, reg, value); | ||
131 | |||
128 | mc13xxx_unlock(priv->mc13xxx); | 132 | mc13xxx_unlock(priv->mc13xxx); |
129 | 133 | ||
130 | return ret; | 134 | return ret; |
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 704e246f5b1e..b7ab71f2ccc1 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -198,6 +198,7 @@ config SND_SOC_IMX_SPDIF | |||
198 | select SND_SOC_IMX_PCM_DMA | 198 | select SND_SOC_IMX_PCM_DMA |
199 | select SND_SOC_FSL_SPDIF | 199 | select SND_SOC_FSL_SPDIF |
200 | select SND_SOC_SPDIF | 200 | select SND_SOC_SPDIF |
201 | select REGMAP_MMIO | ||
201 | help | 202 | help |
202 | SoC Audio support for i.MX boards with S/PDIF | 203 | SoC Audio support for i.MX boards with S/PDIF |
203 | Say Y if you want to add support for SoC audio on an i.MX board with | 204 | Say Y if you want to add support for SoC audio on an i.MX board with |
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index ab17381cc981..d3bf71a0ec56 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c | |||
@@ -335,7 +335,8 @@ static int imx_audmux_probe(struct platform_device *pdev) | |||
335 | if (audmux_type == IMX31_AUDMUX) | 335 | if (audmux_type == IMX31_AUDMUX) |
336 | audmux_debugfs_init(); | 336 | audmux_debugfs_init(); |
337 | 337 | ||
338 | imx_audmux_parse_dt_defaults(pdev, pdev->dev.of_node); | 338 | if (of_id) |
339 | imx_audmux_parse_dt_defaults(pdev, pdev->dev.of_node); | ||
339 | 340 | ||
340 | return 0; | 341 | return 0; |
341 | } | 342 | } |
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c index 389cbfa6dca7..46c5b4fdfc52 100644 --- a/sound/soc/fsl/imx-sgtl5000.c +++ b/sound/soc/fsl/imx-sgtl5000.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/of.h> | 14 | #include <linux/of.h> |
15 | #include <linux/of_platform.h> | 15 | #include <linux/of_platform.h> |
16 | #include <linux/of_i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
19 | 19 | ||
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index 1d70e278e915..722afe69169e 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
18 | #include <linux/of_i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 7fce340ab3ef..0f3d73d4ef48 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -559,7 +559,8 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev) | |||
559 | 559 | ||
560 | #ifdef CONFIG_OF | 560 | #ifdef CONFIG_OF |
561 | static struct of_device_id mvebu_audio_of_match[] = { | 561 | static struct of_device_id mvebu_audio_of_match[] = { |
562 | { .compatible = "marvell,mvebu-audio" }, | 562 | { .compatible = "marvell,kirkwood-audio" }, |
563 | { .compatible = "marvell,dove-audio" }, | ||
563 | { } | 564 | { } |
564 | }; | 565 | }; |
565 | MODULE_DEVICE_TABLE(of, mvebu_audio_of_match); | 566 | MODULE_DEVICE_TABLE(of, mvebu_audio_of_match); |
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index 9855dfc3e3ec..2eea1840315d 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -63,7 +63,7 @@ config SND_SOC_SAMSUNG_SMDK_WM8580 | |||
63 | config SND_SOC_SAMSUNG_SMDK_WM8994 | 63 | config SND_SOC_SAMSUNG_SMDK_WM8994 |
64 | tristate "SoC I2S Audio support for WM8994 on SMDK" | 64 | tristate "SoC I2S Audio support for WM8994 on SMDK" |
65 | depends on SND_SOC_SAMSUNG | 65 | depends on SND_SOC_SAMSUNG |
66 | depends on I2C=y && GENERIC_HARDIRQS | 66 | depends on I2C=y |
67 | select MFD_WM8994 | 67 | select MFD_WM8994 |
68 | select SND_SOC_WM8994 | 68 | select SND_SOC_WM8994 |
69 | select SND_SAMSUNG_I2S | 69 | select SND_SAMSUNG_I2S |
@@ -151,7 +151,7 @@ config SND_SOC_SMARTQ | |||
151 | config SND_SOC_GONI_AQUILA_WM8994 | 151 | config SND_SOC_GONI_AQUILA_WM8994 |
152 | tristate "SoC I2S Audio support for AQUILA/GONI - WM8994" | 152 | tristate "SoC I2S Audio support for AQUILA/GONI - WM8994" |
153 | depends on SND_SOC_SAMSUNG && (MACH_GONI || MACH_AQUILA) | 153 | depends on SND_SOC_SAMSUNG && (MACH_GONI || MACH_AQUILA) |
154 | depends on I2C=y && GENERIC_HARDIRQS | 154 | depends on I2C=y |
155 | select SND_SAMSUNG_I2S | 155 | select SND_SAMSUNG_I2S |
156 | select MFD_WM8994 | 156 | select MFD_WM8994 |
157 | select SND_SOC_WM8994 | 157 | select SND_SOC_WM8994 |
@@ -177,7 +177,7 @@ config SND_SOC_SMDK_WM8580_PCM | |||
177 | config SND_SOC_SMDK_WM8994_PCM | 177 | config SND_SOC_SMDK_WM8994_PCM |
178 | tristate "SoC PCM Audio support for WM8994 on SMDK" | 178 | tristate "SoC PCM Audio support for WM8994 on SMDK" |
179 | depends on SND_SOC_SAMSUNG | 179 | depends on SND_SOC_SAMSUNG |
180 | depends on I2C=y && GENERIC_HARDIRQS | 180 | depends on I2C=y |
181 | select MFD_WM8994 | 181 | select MFD_WM8994 |
182 | select SND_SOC_WM8994 | 182 | select SND_SOC_WM8994 |
183 | select SND_SAMSUNG_PCM | 183 | select SND_SAMSUNG_PCM |
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c index 184d9008cecd..2df2e9150b89 100644 --- a/sound/soc/sh/rcar/scu.c +++ b/sound/soc/sh/rcar/scu.c | |||
@@ -157,9 +157,9 @@ static int rsnd_scu_start(struct rsnd_mod *mod, | |||
157 | int ret; | 157 | int ret; |
158 | 158 | ||
159 | /* | 159 | /* |
160 | * SCU will be used if it has RSND_SCU_USB_HPBIF flags | 160 | * SCU will be used if it has RSND_SCU_USE_HPBIF flags |
161 | */ | 161 | */ |
162 | if (!(flags & RSND_SCU_USB_HPBIF)) { | 162 | if (!(flags & RSND_SCU_USE_HPBIF)) { |
163 | /* it use PIO transter */ | 163 | /* it use PIO transter */ |
164 | dev_dbg(dev, "%s%d is not used\n", | 164 | dev_dbg(dev, "%s%d is not used\n", |
165 | rsnd_mod_name(mod), rsnd_mod_id(mod)); | 165 | rsnd_mod_name(mod), rsnd_mod_id(mod)); |
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c index 8ca9ecc5ac57..122c0c18b9dd 100644 --- a/sound/soc/soc-io.c +++ b/sound/soc/soc-io.c | |||
@@ -158,7 +158,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
158 | return -EINVAL; | 158 | return -EINVAL; |
159 | } | 159 | } |
160 | 160 | ||
161 | return PTR_RET(codec->control_data); | 161 | return PTR_ERR_OR_ZERO(codec->control_data); |
162 | } | 162 | } |
163 | EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); | 163 | EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io); |
164 | #else | 164 | #else |