aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 12:08:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-04 12:08:25 -0400
commitb77279bc2e81545b20824da701b349272a78e4e7 (patch)
treed8f3a8ddf544cf201f8bdcb587cf360571487e5c /sound/pci
parent15b588303155b22edd559672905db8e59a44ef9a (diff)
parent16088cb6c02d0b766b9b8d7edff98da7f1c93205 (diff)
Merge tag 'sound-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into next
Pull sound updates from Takashi Iwai: "At this time, majority of changes come from ASoC world while we got a few new drivers in other places for FireWire and USB. There have been lots of ASoC core cleanups / refactoring, but very little visible to external users. ASoC: - Support for specifying aux CODECs in DT - Removal of the deprecated mux and enum macros - More moves towards full componentisation - Removal of some unused I/O code - Lots of cleanups, fixes and enhancements to the davinci, Freescale, Haswell and Realtek drivers - Several drivers exposed directly in Kconfig for use with simple-card - GPIO descriptor support for jacks - More updates and fixes to the Freescale SSI, Intel and rsnd drivers - New drivers for Cirrus CS42L56, Realtek RT5639, RT5642 and RT5651 and ST STA350, Analog Devices ADAU1361, ADAU1381, ADAU1761 and ADAU1781, and Realtek RT5677 HD-audio: - Clean up Dell headset quirks - Noise fixes for Dell and Sony laptops - Thinkpad T440 dock fix - Realtek codec updates (ALC293,ALC233,ALC3235) - Tegra HD-audio HDMI support FireWire-audio: - FireWire audio stack enhancement (AMDTP, MIDI), support for incoming isochronous stream and duplex streams with timestamp synchronization - BeBoB-based devices support - Fireworks-based device support USB-audio: - Behringer BCD2000 USB device support Misc: - Clean up of a few old drivers, atmel, fm801, etc" * tag 'sound-3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (480 commits) ASoC: Fix wrong argument for card remove callbacks ASoC: free jack GPIOs before the sound card is freed ALSA: firewire-lib: Remove a comment about restriction of asynchronous operation ASoC: cache: Fix error code when not using ASoC level cache ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop ALSA: firewire-lib: Use IEC 61883-6 compliant labels for Raw Audio data ASoC: add RT5677 CODEC driver ASoC: intel: The Baytrail/MAX98090 driver depends on I2C ASoC: rt5640: Add the function "get_clk_info" to RL6231 shared support ASoC: rt5640: Add the function of the PLL clock calculation to RL6231 shared support ASoC: rt5640: Add RL6231 class device shared support for RT5640, RT5645 and RT5651 ASoC: cache: Fix possible ZERO_SIZE_PTR pointer dereferencing error. ASoC: Add helper functions to cast from DAPM context to CODEC/platform ALSA: bebob: sizeof() vs ARRAY_SIZE() typo ASoC: wm9713: correct mono out PGA sources ALSA: synth: emux: soundfont.c: Cleaning up memory leak ASoC: fsl: Remove dependencies of boards for SND_SOC_EUKREA_TLV320 ASoC: fsl-ssi: Use regmap ASoC: fsl-ssi: reorder and document fsl_ssi_private ...
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/fm801.c226
-rw-r--r--sound/pci/hda/Kconfig15
-rw-r--r--sound/pci/hda/Makefile2
-rw-r--r--sound/pci/hda/hda_auto_parser.c46
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/hda_intel.c2
-rw-r--r--sound/pci/hda/hda_local.h14
-rw-r--r--sound/pci/hda/hda_tegra.c588
-rw-r--r--sound/pci/hda/patch_analog.c1
-rw-r--r--sound/pci/hda/patch_hdmi.c6
-rw-r--r--sound/pci/hda/patch_realtek.c474
-rw-r--r--sound/pci/hda/patch_sigmatel.c4
-rw-r--r--sound/pci/lola/lola_proc.c2
-rw-r--r--sound/pci/lx6464es/lx_core.c46
15 files changed, 1253 insertions, 176 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index db18ccabadd6..529f5f4f4c9c 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -23,6 +23,7 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/io.h>
26#include <linux/pci.h> 27#include <linux/pci.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <linux/module.h> 29#include <linux/module.h>
@@ -34,8 +35,6 @@
34#include <sound/opl3.h> 35#include <sound/opl3.h>
35#include <sound/initval.h> 36#include <sound/initval.h>
36 37
37#include <asm/io.h>
38
39#ifdef CONFIG_SND_FM801_TEA575X_BOOL 38#ifdef CONFIG_SND_FM801_TEA575X_BOOL
40#include <media/tea575x.h> 39#include <media/tea575x.h>
41#endif 40#endif
@@ -80,7 +79,10 @@ MODULE_PARM_DESC(radio_nr, "Radio device numbers");
80 * Direct registers 79 * Direct registers
81 */ 80 */
82 81
83#define FM801_REG(chip, reg) (chip->port + FM801_##reg) 82#define fm801_writew(chip,reg,value) outw((value), chip->port + FM801_##reg)
83#define fm801_readw(chip,reg) inw(chip->port + FM801_##reg)
84
85#define fm801_writel(chip,reg,value) outl((value), chip->port + FM801_##reg)
84 86
85#define FM801_PCM_VOL 0x00 /* PCM Output Volume */ 87#define FM801_PCM_VOL 0x00 /* PCM Output Volume */
86#define FM801_FM_VOL 0x02 /* FM Output Volume */ 88#define FM801_FM_VOL 0x02 /* FM Output Volume */
@@ -156,21 +158,27 @@ MODULE_PARM_DESC(radio_nr, "Radio device numbers");
156#define FM801_GPIO_GS3 (1<<15) 158#define FM801_GPIO_GS3 (1<<15)
157#define FM801_GPIO_GS(x) (1<<(12+(x))) 159#define FM801_GPIO_GS(x) (1<<(12+(x)))
158 160
159/* 161/**
160 162 * struct fm801 - describes FM801 chip
163 * @port: I/O port number
164 * @multichannel: multichannel support
165 * @secondary: secondary codec
166 * @secondary_addr: address of the secondary codec
167 * @tea575x_tuner: tuner access method & flags
168 * @ply_ctrl: playback control
169 * @cap_ctrl: capture control
161 */ 170 */
162
163struct fm801 { 171struct fm801 {
164 int irq; 172 int irq;
165 173
166 unsigned long port; /* I/O port number */ 174 unsigned long port;
167 unsigned int multichannel: 1, /* multichannel support */ 175 unsigned int multichannel: 1,
168 secondary: 1; /* secondary codec */ 176 secondary: 1;
169 unsigned char secondary_addr; /* address of the secondary codec */ 177 unsigned char secondary_addr;
170 unsigned int tea575x_tuner; /* tuner access method & flags */ 178 unsigned int tea575x_tuner;
171 179
172 unsigned short ply_ctrl; /* playback control */ 180 unsigned short ply_ctrl;
173 unsigned short cap_ctrl; /* capture control */ 181 unsigned short cap_ctrl;
174 182
175 unsigned long ply_buffer; 183 unsigned long ply_buffer;
176 unsigned int ply_buf; 184 unsigned int ply_buf;
@@ -222,6 +230,30 @@ MODULE_DEVICE_TABLE(pci, snd_fm801_ids);
222 * common I/O routines 230 * common I/O routines
223 */ 231 */
224 232
233static bool fm801_ac97_is_ready(struct fm801 *chip, unsigned int iterations)
234{
235 unsigned int idx;
236
237 for (idx = 0; idx < iterations; idx++) {
238 if (!(fm801_readw(chip, AC97_CMD) & FM801_AC97_BUSY))
239 return true;
240 udelay(10);
241 }
242 return false;
243}
244
245static bool fm801_ac97_is_valid(struct fm801 *chip, unsigned int iterations)
246{
247 unsigned int idx;
248
249 for (idx = 0; idx < iterations; idx++) {
250 if (fm801_readw(chip, AC97_CMD) & FM801_AC97_VALID)
251 return true;
252 udelay(10);
253 }
254 return false;
255}
256
225static int snd_fm801_update_bits(struct fm801 *chip, unsigned short reg, 257static int snd_fm801_update_bits(struct fm801 *chip, unsigned short reg,
226 unsigned short mask, unsigned short value) 258 unsigned short mask, unsigned short value)
227{ 259{
@@ -244,73 +276,54 @@ static void snd_fm801_codec_write(struct snd_ac97 *ac97,
244 unsigned short val) 276 unsigned short val)
245{ 277{
246 struct fm801 *chip = ac97->private_data; 278 struct fm801 *chip = ac97->private_data;
247 int idx;
248 279
249 /* 280 /*
250 * Wait until the codec interface is not ready.. 281 * Wait until the codec interface is not ready..
251 */ 282 */
252 for (idx = 0; idx < 100; idx++) { 283 if (!fm801_ac97_is_ready(chip, 100)) {
253 if (!(inw(FM801_REG(chip, AC97_CMD)) & FM801_AC97_BUSY)) 284 dev_err(chip->card->dev, "AC'97 interface is busy (1)\n");
254 goto ok1; 285 return;
255 udelay(10);
256 } 286 }
257 dev_err(chip->card->dev, "AC'97 interface is busy (1)\n");
258 return;
259 287
260 ok1:
261 /* write data and address */ 288 /* write data and address */
262 outw(val, FM801_REG(chip, AC97_DATA)); 289 fm801_writew(chip, AC97_DATA, val);
263 outw(reg | (ac97->addr << FM801_AC97_ADDR_SHIFT), FM801_REG(chip, AC97_CMD)); 290 fm801_writew(chip, AC97_CMD, reg | (ac97->addr << FM801_AC97_ADDR_SHIFT));
264 /* 291 /*
265 * Wait until the write command is not completed.. 292 * Wait until the write command is not completed..
266 */ 293 */
267 for (idx = 0; idx < 1000; idx++) { 294 if (!fm801_ac97_is_ready(chip, 1000))
268 if (!(inw(FM801_REG(chip, AC97_CMD)) & FM801_AC97_BUSY)) 295 dev_err(chip->card->dev, "AC'97 interface #%d is busy (2)\n",
269 return; 296 ac97->num);
270 udelay(10);
271 }
272 dev_err(chip->card->dev, "AC'97 interface #%d is busy (2)\n", ac97->num);
273} 297}
274 298
275static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short reg) 299static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short reg)
276{ 300{
277 struct fm801 *chip = ac97->private_data; 301 struct fm801 *chip = ac97->private_data;
278 int idx;
279 302
280 /* 303 /*
281 * Wait until the codec interface is not ready.. 304 * Wait until the codec interface is not ready..
282 */ 305 */
283 for (idx = 0; idx < 100; idx++) { 306 if (!fm801_ac97_is_ready(chip, 100)) {
284 if (!(inw(FM801_REG(chip, AC97_CMD)) & FM801_AC97_BUSY)) 307 dev_err(chip->card->dev, "AC'97 interface is busy (1)\n");
285 goto ok1; 308 return 0;
286 udelay(10);
287 } 309 }
288 dev_err(chip->card->dev, "AC'97 interface is busy (1)\n");
289 return 0;
290 310
291 ok1:
292 /* read command */ 311 /* read command */
293 outw(reg | (ac97->addr << FM801_AC97_ADDR_SHIFT) | FM801_AC97_READ, 312 fm801_writew(chip, AC97_CMD,
294 FM801_REG(chip, AC97_CMD)); 313 reg | (ac97->addr << FM801_AC97_ADDR_SHIFT) | FM801_AC97_READ);
295 for (idx = 0; idx < 100; idx++) { 314 if (!fm801_ac97_is_ready(chip, 100)) {
296 if (!(inw(FM801_REG(chip, AC97_CMD)) & FM801_AC97_BUSY)) 315 dev_err(chip->card->dev, "AC'97 interface #%d is busy (2)\n",
297 goto ok2; 316 ac97->num);
298 udelay(10); 317 return 0;
299 } 318 }
300 dev_err(chip->card->dev, "AC'97 interface #%d is busy (2)\n", ac97->num);
301 return 0;
302 319
303 ok2: 320 if (!fm801_ac97_is_valid(chip, 1000)) {
304 for (idx = 0; idx < 1000; idx++) { 321 dev_err(chip->card->dev,
305 if (inw(FM801_REG(chip, AC97_CMD)) & FM801_AC97_VALID) 322 "AC'97 interface #%d is not valid (2)\n", ac97->num);
306 goto ok3; 323 return 0;
307 udelay(10);
308 } 324 }
309 dev_err(chip->card->dev, "AC'97 interface #%d is not valid (2)\n", ac97->num);
310 return 0;
311 325
312 ok3: 326 return fm801_readw(chip, AC97_DATA);
313 return inw(FM801_REG(chip, AC97_DATA));
314} 327}
315 328
316static unsigned int rates[] = { 329static unsigned int rates[] = {
@@ -384,7 +397,7 @@ static int snd_fm801_playback_trigger(struct snd_pcm_substream *substream,
384 snd_BUG(); 397 snd_BUG();
385 return -EINVAL; 398 return -EINVAL;
386 } 399 }
387 outw(chip->ply_ctrl, FM801_REG(chip, PLY_CTRL)); 400 fm801_writew(chip, PLY_CTRL, chip->ply_ctrl);
388 spin_unlock(&chip->reg_lock); 401 spin_unlock(&chip->reg_lock);
389 return 0; 402 return 0;
390} 403}
@@ -419,7 +432,7 @@ static int snd_fm801_capture_trigger(struct snd_pcm_substream *substream,
419 snd_BUG(); 432 snd_BUG();
420 return -EINVAL; 433 return -EINVAL;
421 } 434 }
422 outw(chip->cap_ctrl, FM801_REG(chip, CAP_CTRL)); 435 fm801_writew(chip, CAP_CTRL, chip->cap_ctrl);
423 spin_unlock(&chip->reg_lock); 436 spin_unlock(&chip->reg_lock);
424 return 0; 437 return 0;
425} 438}
@@ -457,12 +470,13 @@ static int snd_fm801_playback_prepare(struct snd_pcm_substream *substream)
457 } 470 }
458 chip->ply_ctrl |= snd_fm801_rate_bits(runtime->rate) << FM801_RATE_SHIFT; 471 chip->ply_ctrl |= snd_fm801_rate_bits(runtime->rate) << FM801_RATE_SHIFT;
459 chip->ply_buf = 0; 472 chip->ply_buf = 0;
460 outw(chip->ply_ctrl, FM801_REG(chip, PLY_CTRL)); 473 fm801_writew(chip, PLY_CTRL, chip->ply_ctrl);
461 outw(chip->ply_count - 1, FM801_REG(chip, PLY_COUNT)); 474 fm801_writew(chip, PLY_COUNT, chip->ply_count - 1);
462 chip->ply_buffer = runtime->dma_addr; 475 chip->ply_buffer = runtime->dma_addr;
463 chip->ply_pos = 0; 476 chip->ply_pos = 0;
464 outl(chip->ply_buffer, FM801_REG(chip, PLY_BUF1)); 477 fm801_writel(chip, PLY_BUF1, chip->ply_buffer);
465 outl(chip->ply_buffer + (chip->ply_count % chip->ply_size), FM801_REG(chip, PLY_BUF2)); 478 fm801_writel(chip, PLY_BUF2,
479 chip->ply_buffer + (chip->ply_count % chip->ply_size));
466 spin_unlock_irq(&chip->reg_lock); 480 spin_unlock_irq(&chip->reg_lock);
467 return 0; 481 return 0;
468} 482}
@@ -483,12 +497,13 @@ static int snd_fm801_capture_prepare(struct snd_pcm_substream *substream)
483 chip->cap_ctrl |= FM801_STEREO; 497 chip->cap_ctrl |= FM801_STEREO;
484 chip->cap_ctrl |= snd_fm801_rate_bits(runtime->rate) << FM801_RATE_SHIFT; 498 chip->cap_ctrl |= snd_fm801_rate_bits(runtime->rate) << FM801_RATE_SHIFT;
485 chip->cap_buf = 0; 499 chip->cap_buf = 0;
486 outw(chip->cap_ctrl, FM801_REG(chip, CAP_CTRL)); 500 fm801_writew(chip, CAP_CTRL, chip->cap_ctrl);
487 outw(chip->cap_count - 1, FM801_REG(chip, CAP_COUNT)); 501 fm801_writew(chip, CAP_COUNT, chip->cap_count - 1);
488 chip->cap_buffer = runtime->dma_addr; 502 chip->cap_buffer = runtime->dma_addr;
489 chip->cap_pos = 0; 503 chip->cap_pos = 0;
490 outl(chip->cap_buffer, FM801_REG(chip, CAP_BUF1)); 504 fm801_writel(chip, CAP_BUF1, chip->cap_buffer);
491 outl(chip->cap_buffer + (chip->cap_count % chip->cap_size), FM801_REG(chip, CAP_BUF2)); 505 fm801_writel(chip, CAP_BUF2,
506 chip->cap_buffer + (chip->cap_count % chip->cap_size));
492 spin_unlock_irq(&chip->reg_lock); 507 spin_unlock_irq(&chip->reg_lock);
493 return 0; 508 return 0;
494} 509}
@@ -501,8 +516,8 @@ static snd_pcm_uframes_t snd_fm801_playback_pointer(struct snd_pcm_substream *su
501 if (!(chip->ply_ctrl & FM801_START)) 516 if (!(chip->ply_ctrl & FM801_START))
502 return 0; 517 return 0;
503 spin_lock(&chip->reg_lock); 518 spin_lock(&chip->reg_lock);
504 ptr = chip->ply_pos + (chip->ply_count - 1) - inw(FM801_REG(chip, PLY_COUNT)); 519 ptr = chip->ply_pos + (chip->ply_count - 1) - fm801_readw(chip, PLY_COUNT);
505 if (inw(FM801_REG(chip, IRQ_STATUS)) & FM801_IRQ_PLAYBACK) { 520 if (fm801_readw(chip, IRQ_STATUS) & FM801_IRQ_PLAYBACK) {
506 ptr += chip->ply_count; 521 ptr += chip->ply_count;
507 ptr %= chip->ply_size; 522 ptr %= chip->ply_size;
508 } 523 }
@@ -518,8 +533,8 @@ static snd_pcm_uframes_t snd_fm801_capture_pointer(struct snd_pcm_substream *sub
518 if (!(chip->cap_ctrl & FM801_START)) 533 if (!(chip->cap_ctrl & FM801_START))
519 return 0; 534 return 0;
520 spin_lock(&chip->reg_lock); 535 spin_lock(&chip->reg_lock);
521 ptr = chip->cap_pos + (chip->cap_count - 1) - inw(FM801_REG(chip, CAP_COUNT)); 536 ptr = chip->cap_pos + (chip->cap_count - 1) - fm801_readw(chip, CAP_COUNT);
522 if (inw(FM801_REG(chip, IRQ_STATUS)) & FM801_IRQ_CAPTURE) { 537 if (fm801_readw(chip, IRQ_STATUS) & FM801_IRQ_CAPTURE) {
523 ptr += chip->cap_count; 538 ptr += chip->cap_count;
524 ptr %= chip->cap_size; 539 ptr %= chip->cap_size;
525 } 540 }
@@ -533,12 +548,12 @@ static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id)
533 unsigned short status; 548 unsigned short status;
534 unsigned int tmp; 549 unsigned int tmp;
535 550
536 status = inw(FM801_REG(chip, IRQ_STATUS)); 551 status = fm801_readw(chip, IRQ_STATUS);
537 status &= FM801_IRQ_PLAYBACK|FM801_IRQ_CAPTURE|FM801_IRQ_MPU|FM801_IRQ_VOLUME; 552 status &= FM801_IRQ_PLAYBACK|FM801_IRQ_CAPTURE|FM801_IRQ_MPU|FM801_IRQ_VOLUME;
538 if (! status) 553 if (! status)
539 return IRQ_NONE; 554 return IRQ_NONE;
540 /* ack first */ 555 /* ack first */
541 outw(status, FM801_REG(chip, IRQ_STATUS)); 556 fm801_writew(chip, IRQ_STATUS, status);
542 if (chip->pcm && (status & FM801_IRQ_PLAYBACK) && chip->playback_substream) { 557 if (chip->pcm && (status & FM801_IRQ_PLAYBACK) && chip->playback_substream) {
543 spin_lock(&chip->reg_lock); 558 spin_lock(&chip->reg_lock);
544 chip->ply_buf++; 559 chip->ply_buf++;
@@ -546,10 +561,10 @@ static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id)
546 chip->ply_pos %= chip->ply_size; 561 chip->ply_pos %= chip->ply_size;
547 tmp = chip->ply_pos + chip->ply_count; 562 tmp = chip->ply_pos + chip->ply_count;
548 tmp %= chip->ply_size; 563 tmp %= chip->ply_size;
549 outl(chip->ply_buffer + tmp, 564 if (chip->ply_buf & 1)
550 (chip->ply_buf & 1) ? 565 fm801_writel(chip, PLY_BUF1, chip->ply_buffer + tmp);
551 FM801_REG(chip, PLY_BUF1) : 566 else
552 FM801_REG(chip, PLY_BUF2)); 567 fm801_writel(chip, PLY_BUF2, chip->ply_buffer + tmp);
553 spin_unlock(&chip->reg_lock); 568 spin_unlock(&chip->reg_lock);
554 snd_pcm_period_elapsed(chip->playback_substream); 569 snd_pcm_period_elapsed(chip->playback_substream);
555 } 570 }
@@ -560,10 +575,10 @@ static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id)
560 chip->cap_pos %= chip->cap_size; 575 chip->cap_pos %= chip->cap_size;
561 tmp = chip->cap_pos + chip->cap_count; 576 tmp = chip->cap_pos + chip->cap_count;
562 tmp %= chip->cap_size; 577 tmp %= chip->cap_size;
563 outl(chip->cap_buffer + tmp, 578 if (chip->cap_buf & 1)
564 (chip->cap_buf & 1) ? 579 fm801_writel(chip, CAP_BUF1, chip->cap_buffer + tmp);
565 FM801_REG(chip, CAP_BUF1) : 580 else
566 FM801_REG(chip, CAP_BUF2)); 581 fm801_writel(chip, CAP_BUF2, chip->cap_buffer + tmp);
567 spin_unlock(&chip->reg_lock); 582 spin_unlock(&chip->reg_lock);
568 snd_pcm_period_elapsed(chip->capture_substream); 583 snd_pcm_period_elapsed(chip->capture_substream);
569 } 584 }
@@ -747,7 +762,7 @@ static struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] = {
747static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) 762static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
748{ 763{
749 struct fm801 *chip = tea->private_data; 764 struct fm801 *chip = tea->private_data;
750 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); 765 unsigned short reg = fm801_readw(chip, GPIO_CTRL);
751 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip); 766 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
752 767
753 reg &= ~(FM801_GPIO_GP(gpio.data) | 768 reg &= ~(FM801_GPIO_GP(gpio.data) |
@@ -759,13 +774,13 @@ static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
759 /* WRITE_ENABLE is inverted */ 774 /* WRITE_ENABLE is inverted */
760 reg |= (pins & TEA575X_WREN) ? 0 : FM801_GPIO_GP(gpio.wren); 775 reg |= (pins & TEA575X_WREN) ? 0 : FM801_GPIO_GP(gpio.wren);
761 776
762 outw(reg, FM801_REG(chip, GPIO_CTRL)); 777 fm801_writew(chip, GPIO_CTRL, reg);
763} 778}
764 779
765static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea) 780static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea)
766{ 781{
767 struct fm801 *chip = tea->private_data; 782 struct fm801 *chip = tea->private_data;
768 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); 783 unsigned short reg = fm801_readw(chip, GPIO_CTRL);
769 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip); 784 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
770 u8 ret; 785 u8 ret;
771 786
@@ -780,7 +795,7 @@ static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea)
780static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output) 795static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output)
781{ 796{
782 struct fm801 *chip = tea->private_data; 797 struct fm801 *chip = tea->private_data;
783 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); 798 unsigned short reg = fm801_readw(chip, GPIO_CTRL);
784 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip); 799 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
785 800
786 /* use GPIO lines and set write enable bit */ 801 /* use GPIO lines and set write enable bit */
@@ -811,7 +826,7 @@ static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output
811 FM801_GPIO_GP(gpio.clk)); 826 FM801_GPIO_GP(gpio.clk));
812 } 827 }
813 828
814 outw(reg, FM801_REG(chip, GPIO_CTRL)); 829 fm801_writew(chip, GPIO_CTRL, reg);
815} 830}
816 831
817static struct snd_tea575x_ops snd_fm801_tea_ops = { 832static struct snd_tea575x_ops snd_fm801_tea_ops = {
@@ -962,7 +977,7 @@ static int snd_fm801_get_mux(struct snd_kcontrol *kcontrol,
962 struct fm801 *chip = snd_kcontrol_chip(kcontrol); 977 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
963 unsigned short val; 978 unsigned short val;
964 979
965 val = inw(FM801_REG(chip, REC_SRC)) & 7; 980 val = fm801_readw(chip, REC_SRC) & 7;
966 if (val > 4) 981 if (val > 4)
967 val = 4; 982 val = 4;
968 ucontrol->value.enumerated.item[0] = val; 983 ucontrol->value.enumerated.item[0] = val;
@@ -1073,12 +1088,12 @@ static int wait_for_codec(struct fm801 *chip, unsigned int codec_id,
1073{ 1088{
1074 unsigned long timeout = jiffies + waits; 1089 unsigned long timeout = jiffies + waits;
1075 1090
1076 outw(FM801_AC97_READ | (codec_id << FM801_AC97_ADDR_SHIFT) | reg, 1091 fm801_writew(chip, AC97_CMD,
1077 FM801_REG(chip, AC97_CMD)); 1092 reg | (codec_id << FM801_AC97_ADDR_SHIFT) | FM801_AC97_READ);
1078 udelay(5); 1093 udelay(5);
1079 do { 1094 do {
1080 if ((inw(FM801_REG(chip, AC97_CMD)) & (FM801_AC97_VALID|FM801_AC97_BUSY)) 1095 if ((fm801_readw(chip, AC97_CMD) &
1081 == FM801_AC97_VALID) 1096 (FM801_AC97_VALID | FM801_AC97_BUSY)) == FM801_AC97_VALID)
1082 return 0; 1097 return 0;
1083 schedule_timeout_uninterruptible(1); 1098 schedule_timeout_uninterruptible(1);
1084 } while (time_after(timeout, jiffies)); 1099 } while (time_after(timeout, jiffies));
@@ -1093,10 +1108,10 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume)
1093 goto __ac97_ok; 1108 goto __ac97_ok;
1094 1109
1095 /* codec cold reset + AC'97 warm reset */ 1110 /* codec cold reset + AC'97 warm reset */
1096 outw((1<<5) | (1<<6), FM801_REG(chip, CODEC_CTRL)); 1111 fm801_writew(chip, CODEC_CTRL, (1 << 5) | (1 << 6));
1097 inw(FM801_REG(chip, CODEC_CTRL)); /* flush posting data */ 1112 fm801_readw(chip, CODEC_CTRL); /* flush posting data */
1098 udelay(100); 1113 udelay(100);
1099 outw(0, FM801_REG(chip, CODEC_CTRL)); 1114 fm801_writew(chip, CODEC_CTRL, 0);
1100 1115
1101 if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0) 1116 if (wait_for_codec(chip, 0, AC97_RESET, msecs_to_jiffies(750)) < 0)
1102 if (!resume) { 1117 if (!resume) {
@@ -1117,7 +1132,7 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume)
1117 for (i = 3; i > 0; i--) { 1132 for (i = 3; i > 0; i--) {
1118 if (!wait_for_codec(chip, i, AC97_VENDOR_ID1, 1133 if (!wait_for_codec(chip, i, AC97_VENDOR_ID1,
1119 msecs_to_jiffies(50))) { 1134 msecs_to_jiffies(50))) {
1120 cmdw = inw(FM801_REG(chip, AC97_DATA)); 1135 cmdw = fm801_readw(chip, AC97_DATA);
1121 if (cmdw != 0xffff && cmdw != 0) { 1136 if (cmdw != 0xffff && cmdw != 0) {
1122 chip->secondary = 1; 1137 chip->secondary = 1;
1123 chip->secondary_addr = i; 1138 chip->secondary_addr = i;
@@ -1135,23 +1150,24 @@ static int snd_fm801_chip_init(struct fm801 *chip, int resume)
1135 __ac97_ok: 1150 __ac97_ok:
1136 1151
1137 /* init volume */ 1152 /* init volume */
1138 outw(0x0808, FM801_REG(chip, PCM_VOL)); 1153 fm801_writew(chip, PCM_VOL, 0x0808);
1139 outw(0x9f1f, FM801_REG(chip, FM_VOL)); 1154 fm801_writew(chip, FM_VOL, 0x9f1f);
1140 outw(0x8808, FM801_REG(chip, I2S_VOL)); 1155 fm801_writew(chip, I2S_VOL, 0x8808);
1141 1156
1142 /* I2S control - I2S mode */ 1157 /* I2S control - I2S mode */
1143 outw(0x0003, FM801_REG(chip, I2S_MODE)); 1158 fm801_writew(chip, I2S_MODE, 0x0003);
1144 1159
1145 /* interrupt setup */ 1160 /* interrupt setup */
1146 cmdw = inw(FM801_REG(chip, IRQ_MASK)); 1161 cmdw = fm801_readw(chip, IRQ_MASK);
1147 if (chip->irq < 0) 1162 if (chip->irq < 0)
1148 cmdw |= 0x00c3; /* mask everything, no PCM nor MPU */ 1163 cmdw |= 0x00c3; /* mask everything, no PCM nor MPU */
1149 else 1164 else
1150 cmdw &= ~0x0083; /* unmask MPU, PLAYBACK & CAPTURE */ 1165 cmdw &= ~0x0083; /* unmask MPU, PLAYBACK & CAPTURE */
1151 outw(cmdw, FM801_REG(chip, IRQ_MASK)); 1166 fm801_writew(chip, IRQ_MASK, cmdw);
1152 1167
1153 /* interrupt clear */ 1168 /* interrupt clear */
1154 outw(FM801_IRQ_PLAYBACK|FM801_IRQ_CAPTURE|FM801_IRQ_MPU, FM801_REG(chip, IRQ_STATUS)); 1169 fm801_writew(chip, IRQ_STATUS,
1170 FM801_IRQ_PLAYBACK | FM801_IRQ_CAPTURE | FM801_IRQ_MPU);
1155 1171
1156 return 0; 1172 return 0;
1157} 1173}
@@ -1165,9 +1181,9 @@ static int snd_fm801_free(struct fm801 *chip)
1165 goto __end_hw; 1181 goto __end_hw;
1166 1182
1167 /* interrupt setup - mask everything */ 1183 /* interrupt setup - mask everything */
1168 cmdw = inw(FM801_REG(chip, IRQ_MASK)); 1184 cmdw = fm801_readw(chip, IRQ_MASK);
1169 cmdw |= 0x00c3; 1185 cmdw |= 0x00c3;
1170 outw(cmdw, FM801_REG(chip, IRQ_MASK)); 1186 fm801_writew(chip, IRQ_MASK, cmdw);
1171 1187
1172 __end_hw: 1188 __end_hw:
1173#ifdef CONFIG_SND_FM801_TEA575X_BOOL 1189#ifdef CONFIG_SND_FM801_TEA575X_BOOL
@@ -1339,15 +1355,15 @@ static int snd_card_fm801_probe(struct pci_dev *pci,
1339 return err; 1355 return err;
1340 } 1356 }
1341 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801, 1357 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801,
1342 FM801_REG(chip, MPU401_DATA), 1358 chip->port + FM801_MPU401_DATA,
1343 MPU401_INFO_INTEGRATED | 1359 MPU401_INFO_INTEGRATED |
1344 MPU401_INFO_IRQ_HOOK, 1360 MPU401_INFO_IRQ_HOOK,
1345 -1, &chip->rmidi)) < 0) { 1361 -1, &chip->rmidi)) < 0) {
1346 snd_card_free(card); 1362 snd_card_free(card);
1347 return err; 1363 return err;
1348 } 1364 }
1349 if ((err = snd_opl3_create(card, FM801_REG(chip, OPL3_BANK0), 1365 if ((err = snd_opl3_create(card, chip->port + FM801_OPL3_BANK0,
1350 FM801_REG(chip, OPL3_BANK1), 1366 chip->port + FM801_OPL3_BANK1,
1351 OPL3_HW_OPL3_FM801, 1, &opl3)) < 0) { 1367 OPL3_HW_OPL3_FM801, 1, &opl3)) < 0) {
1352 snd_card_free(card); 1368 snd_card_free(card);
1353 return err; 1369 return err;
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index ac17c3fc9388..ebf4c2fb99df 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -20,6 +20,21 @@ config SND_HDA_INTEL
20 To compile this driver as a module, choose M here: the module 20 To compile this driver as a module, choose M here: the module
21 will be called snd-hda-intel. 21 will be called snd-hda-intel.
22 22
23config SND_HDA_TEGRA
24 tristate "NVIDIA Tegra HD Audio"
25 depends on ARCH_TEGRA
26 select SND_HDA
27 help
28 Say Y here to support the HDA controller present in NVIDIA
29 Tegra SoCs
30
31 This options enables support for the HD Audio controller
32 present in some NVIDIA Tegra SoCs, used to communicate audio
33 to the HDMI output.
34
35 To compile this driver as a module, choose M here: the module
36 will be called snd-hda-tegra.
37
23if SND_HDA 38if SND_HDA
24 39
25config SND_HDA_DSP_LOADER 40config SND_HDA_DSP_LOADER
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index d0d0c19ddfc2..194f30935e77 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -1,5 +1,6 @@
1snd-hda-intel-objs := hda_intel.o 1snd-hda-intel-objs := hda_intel.o
2snd-hda-controller-objs := hda_controller.o 2snd-hda-controller-objs := hda_controller.o
3snd-hda-tegra-objs := hda_tegra.o
3# for haswell power well 4# for haswell power well
4snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o 5snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o
5 6
@@ -47,3 +48,4 @@ obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
47# otherwise the codec patches won't be hooked before the PCI probe 48# otherwise the codec patches won't be hooked before the PCI probe
48# when built in kernel 49# when built in kernel
49obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o 50obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
51obj-$(CONFIG_SND_HDA_TEGRA) += snd-hda-tegra.o
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 90d2fda6c8f9..b684c6e4f301 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -839,6 +839,43 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action)
839} 839}
840EXPORT_SYMBOL_GPL(snd_hda_apply_fixup); 840EXPORT_SYMBOL_GPL(snd_hda_apply_fixup);
841 841
842static bool pin_config_match(struct hda_codec *codec,
843 const struct hda_pintbl *pins)
844{
845 for (; pins->nid; pins++) {
846 u32 def_conf = snd_hda_codec_get_pincfg(codec, pins->nid);
847 if (pins->val != def_conf)
848 return false;
849 }
850 return true;
851}
852
853void snd_hda_pick_pin_fixup(struct hda_codec *codec,
854 const struct snd_hda_pin_quirk *pin_quirk,
855 const struct hda_fixup *fixlist)
856{
857 const struct snd_hda_pin_quirk *pq;
858
859 if (codec->fixup_forced)
860 return;
861
862 for (pq = pin_quirk; pq->subvendor; pq++) {
863 if ((codec->subsystem_id & 0xffff0000) != (pq->subvendor << 16))
864 continue;
865 if (codec->vendor_id != pq->codec)
866 continue;
867 if (pin_config_match(codec, pq->pins)) {
868 codec->fixup_id = pq->value;
869#ifdef CONFIG_SND_DEBUG_VERBOSE
870 codec->fixup_name = pq->name;
871#endif
872 codec->fixup_list = fixlist;
873 return;
874 }
875 }
876}
877EXPORT_SYMBOL_GPL(snd_hda_pick_pin_fixup);
878
842void snd_hda_pick_fixup(struct hda_codec *codec, 879void snd_hda_pick_fixup(struct hda_codec *codec,
843 const struct hda_model_fixup *models, 880 const struct hda_model_fixup *models,
844 const struct snd_pci_quirk *quirk, 881 const struct snd_pci_quirk *quirk,
@@ -852,15 +889,17 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
852 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) { 889 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
853 codec->fixup_list = NULL; 890 codec->fixup_list = NULL;
854 codec->fixup_id = -1; 891 codec->fixup_id = -1;
892 codec->fixup_forced = 1;
855 return; 893 return;
856 } 894 }
857 895
858 if (codec->modelname && models) { 896 if (codec->modelname && models) {
859 while (models->name) { 897 while (models->name) {
860 if (!strcmp(codec->modelname, models->name)) { 898 if (!strcmp(codec->modelname, models->name)) {
861 id = models->id; 899 codec->fixup_id = models->id;
862 name = models->name; 900 codec->fixup_name = models->name;
863 break; 901 codec->fixup_forced = 1;
902 return;
864 } 903 }
865 models++; 904 models++;
866 } 905 }
@@ -889,6 +928,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
889 } 928 }
890 } 929 }
891 930
931 codec->fixup_forced = 0;
892 codec->fixup_id = id; 932 codec->fixup_id = id;
893 if (id >= 0) { 933 if (id >= 0) {
894 codec->fixup_list = fixlist; 934 codec->fixup_list = fixlist;
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index a4233136cb93..5825aa17d8e3 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -402,6 +402,7 @@ struct hda_codec {
402 402
403 /* fix-up list */ 403 /* fix-up list */
404 int fixup_id; 404 int fixup_id;
405 unsigned int fixup_forced:1; /* fixup explicitly set by user */
405 const struct hda_fixup *fixup_list; 406 const struct hda_fixup *fixup_list;
406 const char *fixup_name; 407 const char *fixup_name;
407 408
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 16133881e967..589e47c5aeb3 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3722,7 +3722,7 @@ static void parse_digital(struct hda_codec *codec)
3722 } else { 3722 } else {
3723 spec->multiout.slave_dig_outs = spec->slave_dig_outs; 3723 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
3724 if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1) 3724 if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
3725 break; 3725 break;
3726 spec->slave_dig_outs[nums - 1] = dig_nid; 3726 spec->slave_dig_outs[nums - 1] = dig_nid;
3727 } 3727 }
3728 nums++; 3728 nums++;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 6cc3cf285558..cd77b9b19b73 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1730,7 +1730,7 @@ static void azx_remove(struct pci_dev *pci)
1730} 1730}
1731 1731
1732/* PCI IDs */ 1732/* PCI IDs */
1733static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { 1733static const struct pci_device_id azx_ids[] = {
1734 /* CPT */ 1734 /* CPT */
1735 { PCI_DEVICE(0x8086, 0x1c20), 1735 { PCI_DEVICE(0x8086, 0x1c20),
1736 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM }, 1736 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index e51d15529215..ebd1fa6f015c 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -407,6 +407,16 @@ struct hda_fixup {
407 } v; 407 } v;
408}; 408};
409 409
410struct snd_hda_pin_quirk {
411 unsigned int codec; /* Codec vendor/device ID */
412 unsigned short subvendor; /* PCI subvendor ID */
413 const struct hda_pintbl *pins; /* list of matching pins */
414#ifdef CONFIG_SND_DEBUG_VERBOSE
415 const char *name;
416#endif
417 int value; /* quirk value */
418};
419
410/* fixup types */ 420/* fixup types */
411enum { 421enum {
412 HDA_FIXUP_INVALID, 422 HDA_FIXUP_INVALID,
@@ -434,6 +444,10 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
434 const struct hda_model_fixup *models, 444 const struct hda_model_fixup *models,
435 const struct snd_pci_quirk *quirk, 445 const struct snd_pci_quirk *quirk,
436 const struct hda_fixup *fixlist); 446 const struct hda_fixup *fixlist);
447void snd_hda_pick_pin_fixup(struct hda_codec *codec,
448 const struct snd_hda_pin_quirk *pin_quirk,
449 const struct hda_fixup *fixlist);
450
437 451
438/* 452/*
439 * unsolicited event handler 453 * unsolicited event handler
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c
new file mode 100644
index 000000000000..a366ba9293a8
--- /dev/null
+++ b/sound/pci/hda/hda_tegra.c
@@ -0,0 +1,588 @@
1/*
2 *
3 * Implementation of primary ALSA driver code base for NVIDIA Tegra HDA.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#include <linux/clk.h>
20#include <linux/clocksource.h>
21#include <linux/completion.h>
22#include <linux/delay.h>
23#include <linux/dma-mapping.h>
24#include <linux/init.h>
25#include <linux/interrupt.h>
26#include <linux/io.h>
27#include <linux/kernel.h>
28#include <linux/module.h>
29#include <linux/moduleparam.h>
30#include <linux/mutex.h>
31#include <linux/of_device.h>
32#include <linux/reboot.h>
33#include <linux/slab.h>
34#include <linux/time.h>
35
36#include <sound/core.h>
37#include <sound/initval.h>
38
39#include "hda_codec.h"
40#include "hda_controller.h"
41#include "hda_priv.h"
42
43/* Defines for Nvidia Tegra HDA support */
44#define HDA_BAR0 0x8000
45
46#define HDA_CFG_CMD 0x1004
47#define HDA_CFG_BAR0 0x1010
48
49#define HDA_ENABLE_IO_SPACE (1 << 0)
50#define HDA_ENABLE_MEM_SPACE (1 << 1)
51#define HDA_ENABLE_BUS_MASTER (1 << 2)
52#define HDA_ENABLE_SERR (1 << 8)
53#define HDA_DISABLE_INTR (1 << 10)
54#define HDA_BAR0_INIT_PROGRAM 0xFFFFFFFF
55#define HDA_BAR0_FINAL_PROGRAM (1 << 14)
56
57/* IPFS */
58#define HDA_IPFS_CONFIG 0x180
59#define HDA_IPFS_EN_FPCI 0x1
60
61#define HDA_IPFS_FPCI_BAR0 0x80
62#define HDA_FPCI_BAR0_START 0x40
63
64#define HDA_IPFS_INTR_MASK 0x188
65#define HDA_IPFS_EN_INTR (1 << 16)
66
67/* max number of SDs */
68#define NUM_CAPTURE_SD 1
69#define NUM_PLAYBACK_SD 1
70
71struct hda_tegra {
72 struct azx chip;
73 struct device *dev;
74 struct clk *hda_clk;
75 struct clk *hda2codec_2x_clk;
76 struct clk *hda2hdmi_clk;
77 void __iomem *regs;
78};
79
80#ifdef CONFIG_PM
81static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
82module_param(power_save, bint, 0644);
83MODULE_PARM_DESC(power_save,
84 "Automatic power-saving timeout (in seconds, 0 = disable).");
85#else
86static int power_save = 0;
87#endif
88
89/*
90 * DMA page allocation ops.
91 */
92static int dma_alloc_pages(struct azx *chip, int type, size_t size,
93 struct snd_dma_buffer *buf)
94{
95 return snd_dma_alloc_pages(type, chip->card->dev, size, buf);
96}
97
98static void dma_free_pages(struct azx *chip, struct snd_dma_buffer *buf)
99{
100 snd_dma_free_pages(buf);
101}
102
103static int substream_alloc_pages(struct azx *chip,
104 struct snd_pcm_substream *substream,
105 size_t size)
106{
107 struct azx_dev *azx_dev = get_azx_dev(substream);
108
109 azx_dev->bufsize = 0;
110 azx_dev->period_bytes = 0;
111 azx_dev->format_val = 0;
112 return snd_pcm_lib_malloc_pages(substream, size);
113}
114
115static int substream_free_pages(struct azx *chip,
116 struct snd_pcm_substream *substream)
117{
118 return snd_pcm_lib_free_pages(substream);
119}
120
121/*
122 * Register access ops. Tegra HDA register access is DWORD only.
123 */
124static void hda_tegra_writel(u32 value, u32 *addr)
125{
126 writel(value, addr);
127}
128
129static u32 hda_tegra_readl(u32 *addr)
130{
131 return readl(addr);
132}
133
134static void hda_tegra_writew(u16 value, u16 *addr)
135{
136 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
137 void *dword_addr = (void *)((unsigned long)(addr) & ~0x3);
138 u32 v;
139
140 v = readl(dword_addr);
141 v &= ~(0xffff << shift);
142 v |= value << shift;
143 writel(v, dword_addr);
144}
145
146static u16 hda_tegra_readw(u16 *addr)
147{
148 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
149 void *dword_addr = (void *)((unsigned long)(addr) & ~0x3);
150 u32 v;
151
152 v = readl(dword_addr);
153 return (v >> shift) & 0xffff;
154}
155
156static void hda_tegra_writeb(u8 value, u8 *addr)
157{
158 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
159 void *dword_addr = (void *)((unsigned long)(addr) & ~0x3);
160 u32 v;
161
162 v = readl(dword_addr);
163 v &= ~(0xff << shift);
164 v |= value << shift;
165 writel(v, dword_addr);
166}
167
168static u8 hda_tegra_readb(u8 *addr)
169{
170 unsigned int shift = ((unsigned long)(addr) & 0x3) << 3;
171 void *dword_addr = (void *)((unsigned long)(addr) & ~0x3);
172 u32 v;
173
174 v = readl(dword_addr);
175 return (v >> shift) & 0xff;
176}
177
178static const struct hda_controller_ops hda_tegra_ops = {
179 .reg_writel = hda_tegra_writel,
180 .reg_readl = hda_tegra_readl,
181 .reg_writew = hda_tegra_writew,
182 .reg_readw = hda_tegra_readw,
183 .reg_writeb = hda_tegra_writeb,
184 .reg_readb = hda_tegra_readb,
185 .dma_alloc_pages = dma_alloc_pages,
186 .dma_free_pages = dma_free_pages,
187 .substream_alloc_pages = substream_alloc_pages,
188 .substream_free_pages = substream_free_pages,
189};
190
191static void hda_tegra_init(struct hda_tegra *hda)
192{
193 u32 v;
194
195 /* Enable PCI access */
196 v = readl(hda->regs + HDA_IPFS_CONFIG);
197 v |= HDA_IPFS_EN_FPCI;
198 writel(v, hda->regs + HDA_IPFS_CONFIG);
199
200 /* Enable MEM/IO space and bus master */
201 v = readl(hda->regs + HDA_CFG_CMD);
202 v &= ~HDA_DISABLE_INTR;
203 v |= HDA_ENABLE_MEM_SPACE | HDA_ENABLE_IO_SPACE |
204 HDA_ENABLE_BUS_MASTER | HDA_ENABLE_SERR;
205 writel(v, hda->regs + HDA_CFG_CMD);
206
207 writel(HDA_BAR0_INIT_PROGRAM, hda->regs + HDA_CFG_BAR0);
208 writel(HDA_BAR0_FINAL_PROGRAM, hda->regs + HDA_CFG_BAR0);
209 writel(HDA_FPCI_BAR0_START, hda->regs + HDA_IPFS_FPCI_BAR0);
210
211 v = readl(hda->regs + HDA_IPFS_INTR_MASK);
212 v |= HDA_IPFS_EN_INTR;
213 writel(v, hda->regs + HDA_IPFS_INTR_MASK);
214}
215
216static int hda_tegra_enable_clocks(struct hda_tegra *data)
217{
218 int rc;
219
220 rc = clk_prepare_enable(data->hda_clk);
221 if (rc)
222 return rc;
223 rc = clk_prepare_enable(data->hda2codec_2x_clk);
224 if (rc)
225 goto disable_hda;
226 rc = clk_prepare_enable(data->hda2hdmi_clk);
227 if (rc)
228 goto disable_codec_2x;
229
230 return 0;
231
232disable_codec_2x:
233 clk_disable_unprepare(data->hda2codec_2x_clk);
234disable_hda:
235 clk_disable_unprepare(data->hda_clk);
236 return rc;
237}
238
239static void hda_tegra_disable_clocks(struct hda_tegra *data)
240{
241 clk_disable_unprepare(data->hda2hdmi_clk);
242 clk_disable_unprepare(data->hda2codec_2x_clk);
243 clk_disable_unprepare(data->hda_clk);
244}
245
246#ifdef CONFIG_PM_SLEEP
247/*
248 * power management
249 */
250static int hda_tegra_suspend(struct device *dev)
251{
252 struct snd_card *card = dev_get_drvdata(dev);
253 struct azx *chip = card->private_data;
254 struct azx_pcm *p;
255 struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
256
257 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
258 list_for_each_entry(p, &chip->pcm_list, list)
259 snd_pcm_suspend_all(p->pcm);
260 if (chip->initialized)
261 snd_hda_suspend(chip->bus);
262
263 azx_stop_chip(chip);
264 azx_enter_link_reset(chip);
265 hda_tegra_disable_clocks(hda);
266
267 return 0;
268}
269
270static int hda_tegra_resume(struct device *dev)
271{
272 struct snd_card *card = dev_get_drvdata(dev);
273 struct azx *chip = card->private_data;
274 struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
275 int status;
276
277 hda_tegra_enable_clocks(hda);
278
279 /* Read STATESTS before controller reset */
280 status = azx_readw(chip, STATESTS);
281
282 hda_tegra_init(hda);
283
284 azx_init_chip(chip, 1);
285
286 snd_hda_resume(chip->bus);
287 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
288
289 return 0;
290}
291#endif /* CONFIG_PM_SLEEP */
292
293static const struct dev_pm_ops hda_tegra_pm = {
294 SET_SYSTEM_SLEEP_PM_OPS(hda_tegra_suspend, hda_tegra_resume)
295};
296
297/*
298 * reboot notifier for hang-up problem at power-down
299 */
300static int hda_tegra_halt(struct notifier_block *nb, unsigned long event,
301 void *buf)
302{
303 struct azx *chip = container_of(nb, struct azx, reboot_notifier);
304 snd_hda_bus_reboot_notify(chip->bus);
305 azx_stop_chip(chip);
306 return NOTIFY_OK;
307}
308
309static void hda_tegra_notifier_register(struct azx *chip)
310{
311 chip->reboot_notifier.notifier_call = hda_tegra_halt;
312 register_reboot_notifier(&chip->reboot_notifier);
313}
314
315static void hda_tegra_notifier_unregister(struct azx *chip)
316{
317 if (chip->reboot_notifier.notifier_call)
318 unregister_reboot_notifier(&chip->reboot_notifier);
319}
320
321/*
322 * destructor
323 */
324static int hda_tegra_dev_free(struct snd_device *device)
325{
326 int i;
327 struct azx *chip = device->device_data;
328
329 hda_tegra_notifier_unregister(chip);
330
331 if (chip->initialized) {
332 for (i = 0; i < chip->num_streams; i++)
333 azx_stream_stop(chip, &chip->azx_dev[i]);
334 azx_stop_chip(chip);
335 }
336
337 azx_free_stream_pages(chip);
338
339 return 0;
340}
341
342static int hda_tegra_init_chip(struct azx *chip, struct platform_device *pdev)
343{
344 struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip);
345 struct device *dev = hda->dev;
346 struct resource *res;
347 int err;
348
349 hda->hda_clk = devm_clk_get(dev, "hda");
350 if (IS_ERR(hda->hda_clk))
351 return PTR_ERR(hda->hda_clk);
352 hda->hda2codec_2x_clk = devm_clk_get(dev, "hda2codec_2x");
353 if (IS_ERR(hda->hda2codec_2x_clk))
354 return PTR_ERR(hda->hda2codec_2x_clk);
355 hda->hda2hdmi_clk = devm_clk_get(dev, "hda2hdmi");
356 if (IS_ERR(hda->hda2hdmi_clk))
357 return PTR_ERR(hda->hda2hdmi_clk);
358
359 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
360 hda->regs = devm_ioremap_resource(dev, res);
361 if (IS_ERR(chip->remap_addr))
362 return PTR_ERR(chip->remap_addr);
363
364 chip->remap_addr = hda->regs + HDA_BAR0;
365 chip->addr = res->start + HDA_BAR0;
366
367 err = hda_tegra_enable_clocks(hda);
368 if (err)
369 return err;
370
371 hda_tegra_init(hda);
372
373 return 0;
374}
375
376/*
377 * The codecs were powered up in snd_hda_codec_new().
378 * Now all initialization done, so turn them down if possible
379 */
380static void power_down_all_codecs(struct azx *chip)
381{
382 struct hda_codec *codec;
383 list_for_each_entry(codec, &chip->bus->codec_list, list)
384 snd_hda_power_down(codec);
385}
386
387static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)
388{
389 struct snd_card *card = chip->card;
390 int err;
391 unsigned short gcap;
392 int irq_id = platform_get_irq(pdev, 0);
393
394 err = hda_tegra_init_chip(chip, pdev);
395 if (err)
396 return err;
397
398 err = devm_request_irq(chip->card->dev, irq_id, azx_interrupt,
399 IRQF_SHARED, KBUILD_MODNAME, chip);
400 if (err) {
401 dev_err(chip->card->dev,
402 "unable to request IRQ %d, disabling device\n",
403 irq_id);
404 return err;
405 }
406 chip->irq = irq_id;
407
408 synchronize_irq(chip->irq);
409
410 gcap = azx_readw(chip, GCAP);
411 dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap);
412
413 /* read number of streams from GCAP register instead of using
414 * hardcoded value
415 */
416 chip->capture_streams = (gcap >> 8) & 0x0f;
417 chip->playback_streams = (gcap >> 12) & 0x0f;
418 if (!chip->playback_streams && !chip->capture_streams) {
419 /* gcap didn't give any info, switching to old method */
420 chip->playback_streams = NUM_PLAYBACK_SD;
421 chip->capture_streams = NUM_CAPTURE_SD;
422 }
423 chip->capture_index_offset = 0;
424 chip->playback_index_offset = chip->capture_streams;
425 chip->num_streams = chip->playback_streams + chip->capture_streams;
426 chip->azx_dev = devm_kcalloc(card->dev, chip->num_streams,
427 sizeof(*chip->azx_dev), GFP_KERNEL);
428 if (!chip->azx_dev)
429 return -ENOMEM;
430
431 err = azx_alloc_stream_pages(chip);
432 if (err < 0)
433 return err;
434
435 /* initialize streams */
436 azx_init_stream(chip);
437
438 /* initialize chip */
439 azx_init_chip(chip, 1);
440
441 /* codec detection */
442 if (!chip->codec_mask) {
443 dev_err(card->dev, "no codecs found!\n");
444 return -ENODEV;
445 }
446
447 strcpy(card->driver, "tegra-hda");
448 strcpy(card->shortname, "tegra-hda");
449 snprintf(card->longname, sizeof(card->longname),
450 "%s at 0x%lx irq %i",
451 card->shortname, chip->addr, chip->irq);
452
453 return 0;
454}
455
456/*
457 * constructor
458 */
459static int hda_tegra_create(struct snd_card *card,
460 unsigned int driver_caps,
461 const struct hda_controller_ops *hda_ops,
462 struct hda_tegra *hda)
463{
464 static struct snd_device_ops ops = {
465 .dev_free = hda_tegra_dev_free,
466 };
467 struct azx *chip;
468 int err;
469
470 chip = &hda->chip;
471
472 spin_lock_init(&chip->reg_lock);
473 mutex_init(&chip->open_mutex);
474 chip->card = card;
475 chip->ops = hda_ops;
476 chip->irq = -1;
477 chip->driver_caps = driver_caps;
478 chip->driver_type = driver_caps & 0xff;
479 chip->dev_index = 0;
480 INIT_LIST_HEAD(&chip->pcm_list);
481 INIT_LIST_HEAD(&chip->list);
482
483 chip->position_fix[0] = POS_FIX_AUTO;
484 chip->position_fix[1] = POS_FIX_AUTO;
485 chip->codec_probe_mask = -1;
486
487 chip->single_cmd = false;
488 chip->snoop = true;
489
490 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
491 if (err < 0) {
492 dev_err(card->dev, "Error creating device\n");
493 return err;
494 }
495
496 return 0;
497}
498
499static const struct of_device_id hda_tegra_match[] = {
500 { .compatible = "nvidia,tegra30-hda" },
501 {},
502};
503MODULE_DEVICE_TABLE(of, hda_tegra_match);
504
505static int hda_tegra_probe(struct platform_device *pdev)
506{
507 struct snd_card *card;
508 struct azx *chip;
509 struct hda_tegra *hda;
510 int err;
511 const unsigned int driver_flags = AZX_DCAPS_RIRB_DELAY;
512
513 hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL);
514 if (!hda)
515 return -ENOMEM;
516 hda->dev = &pdev->dev;
517 chip = &hda->chip;
518
519 err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
520 THIS_MODULE, 0, &card);
521 if (err < 0) {
522 dev_err(&pdev->dev, "Error creating card!\n");
523 return err;
524 }
525
526 err = hda_tegra_create(card, driver_flags, &hda_tegra_ops, hda);
527 if (err < 0)
528 goto out_free;
529 card->private_data = chip;
530
531 dev_set_drvdata(&pdev->dev, card);
532
533 err = hda_tegra_first_init(chip, pdev);
534 if (err < 0)
535 goto out_free;
536
537 /* create codec instances */
538 err = azx_codec_create(chip, NULL, 0, &power_save);
539 if (err < 0)
540 goto out_free;
541
542 err = azx_codec_configure(chip);
543 if (err < 0)
544 goto out_free;
545
546 /* create PCM streams */
547 err = snd_hda_build_pcms(chip->bus);
548 if (err < 0)
549 goto out_free;
550
551 /* create mixer controls */
552 err = azx_mixer_create(chip);
553 if (err < 0)
554 goto out_free;
555
556 err = snd_card_register(chip->card);
557 if (err < 0)
558 goto out_free;
559
560 chip->running = 1;
561 power_down_all_codecs(chip);
562 hda_tegra_notifier_register(chip);
563
564 return 0;
565
566out_free:
567 snd_card_free(card);
568 return err;
569}
570
571static int hda_tegra_remove(struct platform_device *pdev)
572{
573 return snd_card_free(dev_get_drvdata(&pdev->dev));
574}
575
576static struct platform_driver tegra_platform_hda = {
577 .driver = {
578 .name = "tegra-hda",
579 .pm = &hda_tegra_pm,
580 .of_match_table = hda_tegra_match,
581 },
582 .probe = hda_tegra_probe,
583 .remove = hda_tegra_remove,
584};
585module_platform_driver(tegra_platform_hda);
586
587MODULE_DESCRIPTION("Tegra HDA bus driver");
588MODULE_LICENSE("GPL v2");
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 40ba06eb44af..06275f8807a8 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -332,6 +332,7 @@ static const struct hda_fixup ad1986a_fixups[] = {
332 332
333static const struct snd_pci_quirk ad1986a_fixup_tbl[] = { 333static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
334 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC), 334 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
335 SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
335 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK), 336 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
336 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK), 337 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
337 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK), 338 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index b4218a19df22..be0a9ee0b804 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1127,10 +1127,6 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
1127 AMP_OUT_UNMUTE); 1127 AMP_OUT_UNMUTE);
1128 1128
1129 eld = &per_pin->sink_eld; 1129 eld = &per_pin->sink_eld;
1130 if (!eld->monitor_present) {
1131 hdmi_set_channel_count(codec, per_pin->cvt_nid, channels);
1132 return;
1133 }
1134 1130
1135 if (!non_pcm && per_pin->chmap_set) 1131 if (!non_pcm && per_pin->chmap_set)
1136 ca = hdmi_manual_channel_allocation(channels, per_pin->chmap); 1132 ca = hdmi_manual_channel_allocation(channels, per_pin->chmap);
@@ -3324,6 +3320,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
3324{ .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi }, 3320{ .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi },
3325{ .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_nvhdmi }, 3321{ .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_nvhdmi },
3326{ .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_nvhdmi }, 3322{ .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_nvhdmi },
3323{ .id = 0x10de0028, .name = "Tegra12x HDMI", .patch = patch_nvhdmi },
3327{ .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_nvhdmi }, 3324{ .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_nvhdmi },
3328{ .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_nvhdmi }, 3325{ .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_nvhdmi },
3329{ .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_nvhdmi }, 3326{ .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_nvhdmi },
@@ -3380,6 +3377,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0019");
3380MODULE_ALIAS("snd-hda-codec-id:10de001a"); 3377MODULE_ALIAS("snd-hda-codec-id:10de001a");
3381MODULE_ALIAS("snd-hda-codec-id:10de001b"); 3378MODULE_ALIAS("snd-hda-codec-id:10de001b");
3382MODULE_ALIAS("snd-hda-codec-id:10de001c"); 3379MODULE_ALIAS("snd-hda-codec-id:10de001c");
3380MODULE_ALIAS("snd-hda-codec-id:10de0028");
3383MODULE_ALIAS("snd-hda-codec-id:10de0040"); 3381MODULE_ALIAS("snd-hda-codec-id:10de0040");
3384MODULE_ALIAS("snd-hda-codec-id:10de0041"); 3382MODULE_ALIAS("snd-hda-codec-id:10de0041");
3385MODULE_ALIAS("snd-hda-codec-id:10de0042"); 3383MODULE_ALIAS("snd-hda-codec-id:10de0042");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 49e884fb3e5d..12fb411adf77 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -951,7 +951,9 @@ static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
951 { 0x10ec0280, 0x1028, 0, "ALC3220" }, 951 { 0x10ec0280, 0x1028, 0, "ALC3220" },
952 { 0x10ec0282, 0x1028, 0, "ALC3221" }, 952 { 0x10ec0282, 0x1028, 0, "ALC3221" },
953 { 0x10ec0283, 0x1028, 0, "ALC3223" }, 953 { 0x10ec0283, 0x1028, 0, "ALC3223" },
954 { 0x10ec0288, 0x1028, 0, "ALC3263" },
954 { 0x10ec0292, 0x1028, 0, "ALC3226" }, 955 { 0x10ec0292, 0x1028, 0, "ALC3226" },
956 { 0x10ec0293, 0x1028, 0, "ALC3235" },
955 { 0x10ec0255, 0x1028, 0, "ALC3234" }, 957 { 0x10ec0255, 0x1028, 0, "ALC3234" },
956 { 0x10ec0668, 0x1028, 0, "ALC3661" }, 958 { 0x10ec0668, 0x1028, 0, "ALC3661" },
957 { } /* terminator */ 959 { } /* terminator */
@@ -1647,12 +1649,10 @@ static const struct hda_fixup alc260_fixups[] = {
1647 [ALC260_FIXUP_COEF] = { 1649 [ALC260_FIXUP_COEF] = {
1648 .type = HDA_FIXUP_VERBS, 1650 .type = HDA_FIXUP_VERBS,
1649 .v.verbs = (const struct hda_verb[]) { 1651 .v.verbs = (const struct hda_verb[]) {
1650 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, 1652 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1651 { 0x20, AC_VERB_SET_PROC_COEF, 0x3040 }, 1653 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
1652 { } 1654 { }
1653 }, 1655 },
1654 .chained = true,
1655 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1656 }, 1656 },
1657 [ALC260_FIXUP_GPIO1] = { 1657 [ALC260_FIXUP_GPIO1] = {
1658 .type = HDA_FIXUP_VERBS, 1658 .type = HDA_FIXUP_VERBS,
@@ -1667,8 +1667,8 @@ static const struct hda_fixup alc260_fixups[] = {
1667 [ALC260_FIXUP_REPLACER] = { 1667 [ALC260_FIXUP_REPLACER] = {
1668 .type = HDA_FIXUP_VERBS, 1668 .type = HDA_FIXUP_VERBS,
1669 .v.verbs = (const struct hda_verb[]) { 1669 .v.verbs = (const struct hda_verb[]) {
1670 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, 1670 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1671 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, 1671 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
1672 { } 1672 { }
1673 }, 1673 },
1674 .chained = true, 1674 .chained = true,
@@ -3522,6 +3522,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
3522 /* Direct Drive HP Amp control */ 3522 /* Direct Drive HP Amp control */
3523 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6); 3523 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8aa6);
3524 break; 3524 break;
3525 case 0x10ec0233:
3525 case 0x10ec0283: 3526 case 0x10ec0283:
3526 alc_write_coef_idx(codec, 0x1b, 0x0c0b); 3527 alc_write_coef_idx(codec, 0x1b, 0x0c0b);
3527 alc_write_coef_idx(codec, 0x45, 0xc429); 3528 alc_write_coef_idx(codec, 0x45, 0xc429);
@@ -3538,6 +3539,25 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
3538 alc_write_coef_idx(codec, 0x18, 0x7308); 3539 alc_write_coef_idx(codec, 0x18, 0x7308);
3539 alc_write_coef_idx(codec, 0x6b, 0xc429); 3540 alc_write_coef_idx(codec, 0x6b, 0xc429);
3540 break; 3541 break;
3542 case 0x10ec0293:
3543 /* SET Line1 JD to 0 */
3544 val = alc_read_coef_idx(codec, 0x10);
3545 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 6<<8);
3546 /* SET charge pump by verb */
3547 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3548 alc_write_coefex_idx(codec, 0x57, 0x05, (val & ~(1<<15|1<<13)) | 0x0);
3549 /* SET EN_OSW to 1 */
3550 val = alc_read_coefex_idx(codec, 0x57, 0x03);
3551 alc_write_coefex_idx(codec, 0x57, 0x03, (val & ~(1<<10)) | (1<<10) );
3552 /* Combo JD gating with LINE1-VREFO */
3553 val = alc_read_coef_idx(codec, 0x1a);
3554 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | (1<<3));
3555 /* Set to TRS type */
3556 alc_write_coef_idx(codec, 0x45, 0xc429);
3557 /* Combo Jack auto detect */
3558 val = alc_read_coef_idx(codec, 0x4a);
3559 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x000e);
3560 break;
3541 case 0x10ec0668: 3561 case 0x10ec0668:
3542 alc_write_coef_idx(codec, 0x15, 0x0d40); 3562 alc_write_coef_idx(codec, 0x15, 0x0d40);
3543 alc_write_coef_idx(codec, 0xb7, 0x802b); 3563 alc_write_coef_idx(codec, 0xb7, 0x802b);
@@ -3561,6 +3581,7 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3561 alc_write_coef_idx(codec, 0x06, 0x6100); 3581 alc_write_coef_idx(codec, 0x06, 0x6100);
3562 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); 3582 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3563 break; 3583 break;
3584 case 0x10ec0233:
3564 case 0x10ec0283: 3585 case 0x10ec0283:
3565 alc_write_coef_idx(codec, 0x45, 0xc429); 3586 alc_write_coef_idx(codec, 0x45, 0xc429);
3566 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); 3587 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
@@ -3576,6 +3597,21 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3576 alc_write_coef_idx(codec, 0x19, 0xa208); 3597 alc_write_coef_idx(codec, 0x19, 0xa208);
3577 alc_write_coef_idx(codec, 0x2e, 0xacf0); 3598 alc_write_coef_idx(codec, 0x2e, 0xacf0);
3578 break; 3599 break;
3600 case 0x10ec0293:
3601 /* Set to TRS mode */
3602 alc_write_coef_idx(codec, 0x45, 0xc429);
3603 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
3604 /* SET charge pump by verb */
3605 val = alc_read_coefex_idx(codec, 0x57, 0x05);
3606 alc_write_coefex_idx(codec, 0x57, 0x05, (val & ~(1<<15|1<<13)) | (1<<15|1<<13));
3607 /* SET EN_OSW to 0 */
3608 val = alc_read_coefex_idx(codec, 0x57, 0x03);
3609 alc_write_coefex_idx(codec, 0x57, 0x03, (val & ~(1<<10)) | 0x0);
3610 /* Combo JD gating without LINE1-VREFO */
3611 val = alc_read_coef_idx(codec, 0x1a);
3612 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | 0x0);
3613 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3614 break;
3579 case 0x10ec0668: 3615 case 0x10ec0668:
3580 alc_write_coef_idx(codec, 0x11, 0x0001); 3616 alc_write_coef_idx(codec, 0x11, 0x0001);
3581 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); 3617 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
@@ -3591,6 +3627,8 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3591 3627
3592static void alc_headset_mode_default(struct hda_codec *codec) 3628static void alc_headset_mode_default(struct hda_codec *codec)
3593{ 3629{
3630 int val;
3631
3594 switch (codec->vendor_id) { 3632 switch (codec->vendor_id) {
3595 case 0x10ec0255: 3633 case 0x10ec0255:
3596 alc_write_coef_idx(codec, 0x45, 0xc089); 3634 alc_write_coef_idx(codec, 0x45, 0xc089);
@@ -3598,6 +3636,7 @@ static void alc_headset_mode_default(struct hda_codec *codec)
3598 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6); 3636 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3599 alc_write_coef_idx(codec, 0x49, 0x0049); 3637 alc_write_coef_idx(codec, 0x49, 0x0049);
3600 break; 3638 break;
3639 case 0x10ec0233:
3601 case 0x10ec0283: 3640 case 0x10ec0283:
3602 alc_write_coef_idx(codec, 0x06, 0x2100); 3641 alc_write_coef_idx(codec, 0x06, 0x2100);
3603 alc_write_coef_idx(codec, 0x32, 0x4ea3); 3642 alc_write_coef_idx(codec, 0x32, 0x4ea3);
@@ -3608,6 +3647,16 @@ static void alc_headset_mode_default(struct hda_codec *codec)
3608 alc_write_coef_idx(codec, 0x6b, 0xc429); 3647 alc_write_coef_idx(codec, 0x6b, 0xc429);
3609 alc_write_coef_idx(codec, 0x18, 0x7308); 3648 alc_write_coef_idx(codec, 0x18, 0x7308);
3610 break; 3649 break;
3650 case 0x10ec0293:
3651 /* Combo Jack auto detect */
3652 val = alc_read_coef_idx(codec, 0x4a);
3653 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x000e);
3654 /* Set to TRS type */
3655 alc_write_coef_idx(codec, 0x45, 0xC429);
3656 /* Combo JD gating without LINE1-VREFO */
3657 val = alc_read_coef_idx(codec, 0x1a);
3658 alc_write_coef_idx(codec, 0x1a, (val & ~(1<<3)) | 0x0);
3659 break;
3611 case 0x10ec0668: 3660 case 0x10ec0668:
3612 alc_write_coef_idx(codec, 0x11, 0x0041); 3661 alc_write_coef_idx(codec, 0x11, 0x0041);
3613 alc_write_coef_idx(codec, 0x15, 0x0d40); 3662 alc_write_coef_idx(codec, 0x15, 0x0d40);
@@ -3620,6 +3669,8 @@ static void alc_headset_mode_default(struct hda_codec *codec)
3620/* Iphone type */ 3669/* Iphone type */
3621static void alc_headset_mode_ctia(struct hda_codec *codec) 3670static void alc_headset_mode_ctia(struct hda_codec *codec)
3622{ 3671{
3672 int val;
3673
3623 switch (codec->vendor_id) { 3674 switch (codec->vendor_id) {
3624 case 0x10ec0255: 3675 case 0x10ec0255:
3625 /* Set to CTIA type */ 3676 /* Set to CTIA type */
@@ -3627,6 +3678,7 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
3627 alc_write_coef_idx(codec, 0x1b, 0x0c2b); 3678 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3628 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6); 3679 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3629 break; 3680 break;
3681 case 0x10ec0233:
3630 case 0x10ec0283: 3682 case 0x10ec0283:
3631 alc_write_coef_idx(codec, 0x45, 0xd429); 3683 alc_write_coef_idx(codec, 0x45, 0xd429);
3632 alc_write_coef_idx(codec, 0x1b, 0x0c2b); 3684 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
@@ -3637,6 +3689,13 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
3637 alc_write_coef_idx(codec, 0x76, 0x0008); 3689 alc_write_coef_idx(codec, 0x76, 0x0008);
3638 alc_write_coef_idx(codec, 0x18, 0x7388); 3690 alc_write_coef_idx(codec, 0x18, 0x7388);
3639 break; 3691 break;
3692 case 0x10ec0293:
3693 /* Set to ctia type */
3694 alc_write_coef_idx(codec, 0x45, 0xd429);
3695 /* SET Line1 JD to 1 */
3696 val = alc_read_coef_idx(codec, 0x10);
3697 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 7<<8);
3698 break;
3640 case 0x10ec0668: 3699 case 0x10ec0668:
3641 alc_write_coef_idx(codec, 0x11, 0x0001); 3700 alc_write_coef_idx(codec, 0x11, 0x0001);
3642 alc_write_coef_idx(codec, 0x15, 0x0d60); 3701 alc_write_coef_idx(codec, 0x15, 0x0d60);
@@ -3649,6 +3708,8 @@ static void alc_headset_mode_ctia(struct hda_codec *codec)
3649/* Nokia type */ 3708/* Nokia type */
3650static void alc_headset_mode_omtp(struct hda_codec *codec) 3709static void alc_headset_mode_omtp(struct hda_codec *codec)
3651{ 3710{
3711 int val;
3712
3652 switch (codec->vendor_id) { 3713 switch (codec->vendor_id) {
3653 case 0x10ec0255: 3714 case 0x10ec0255:
3654 /* Set to OMTP Type */ 3715 /* Set to OMTP Type */
@@ -3656,6 +3717,7 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
3656 alc_write_coef_idx(codec, 0x1b, 0x0c2b); 3717 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
3657 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6); 3718 alc_write_coefex_idx(codec, 0x57, 0x03, 0x8ea6);
3658 break; 3719 break;
3720 case 0x10ec0233:
3659 case 0x10ec0283: 3721 case 0x10ec0283:
3660 alc_write_coef_idx(codec, 0x45, 0xe429); 3722 alc_write_coef_idx(codec, 0x45, 0xe429);
3661 alc_write_coef_idx(codec, 0x1b, 0x0c2b); 3723 alc_write_coef_idx(codec, 0x1b, 0x0c2b);
@@ -3666,6 +3728,13 @@ static void alc_headset_mode_omtp(struct hda_codec *codec)
3666 alc_write_coef_idx(codec, 0x76, 0x0008); 3728 alc_write_coef_idx(codec, 0x76, 0x0008);
3667 alc_write_coef_idx(codec, 0x18, 0x7388); 3729 alc_write_coef_idx(codec, 0x18, 0x7388);
3668 break; 3730 break;
3731 case 0x10ec0293:
3732 /* Set to omtp type */
3733 alc_write_coef_idx(codec, 0x45, 0xe429);
3734 /* SET Line1 JD to 1 */
3735 val = alc_read_coef_idx(codec, 0x10);
3736 alc_write_coef_idx(codec, 0x10, (val & ~(7<<8)) | 7<<8);
3737 break;
3669 case 0x10ec0668: 3738 case 0x10ec0668:
3670 alc_write_coef_idx(codec, 0x11, 0x0001); 3739 alc_write_coef_idx(codec, 0x11, 0x0001);
3671 alc_write_coef_idx(codec, 0x15, 0x0d50); 3740 alc_write_coef_idx(codec, 0x15, 0x0d50);
@@ -3691,6 +3760,7 @@ static void alc_determine_headset_type(struct hda_codec *codec)
3691 val = alc_read_coef_idx(codec, 0x46); 3760 val = alc_read_coef_idx(codec, 0x46);
3692 is_ctia = (val & 0x0070) == 0x0070; 3761 is_ctia = (val & 0x0070) == 0x0070;
3693 break; 3762 break;
3763 case 0x10ec0233:
3694 case 0x10ec0283: 3764 case 0x10ec0283:
3695 alc_write_coef_idx(codec, 0x45, 0xd029); 3765 alc_write_coef_idx(codec, 0x45, 0xd029);
3696 msleep(300); 3766 msleep(300);
@@ -3703,6 +3773,16 @@ static void alc_determine_headset_type(struct hda_codec *codec)
3703 val = alc_read_coef_idx(codec, 0x6c); 3773 val = alc_read_coef_idx(codec, 0x6c);
3704 is_ctia = (val & 0x001c) == 0x001c; 3774 is_ctia = (val & 0x001c) == 0x001c;
3705 break; 3775 break;
3776 case 0x10ec0293:
3777 /* Combo Jack auto detect */
3778 val = alc_read_coef_idx(codec, 0x4a);
3779 alc_write_coef_idx(codec, 0x4a, (val & 0xfff0) | 0x0008);
3780 /* Set to ctia type */
3781 alc_write_coef_idx(codec, 0x45, 0xD429);
3782 msleep(300);
3783 val = alc_read_coef_idx(codec, 0x46);
3784 is_ctia = (val & 0x0070) == 0x0070;
3785 break;
3706 case 0x10ec0668: 3786 case 0x10ec0668:
3707 alc_write_coef_idx(codec, 0x11, 0x0001); 3787 alc_write_coef_idx(codec, 0x11, 0x0001);
3708 alc_write_coef_idx(codec, 0xb7, 0x802b); 3788 alc_write_coef_idx(codec, 0xb7, 0x802b);
@@ -3894,6 +3974,39 @@ static void alc_fixup_no_shutup(struct hda_codec *codec,
3894 } 3974 }
3895} 3975}
3896 3976
3977static void alc_fixup_disable_aamix(struct hda_codec *codec,
3978 const struct hda_fixup *fix, int action)
3979{
3980 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3981 struct alc_spec *spec = codec->spec;
3982 /* Disable AA-loopback as it causes white noise */
3983 spec->gen.mixer_nid = 0;
3984 }
3985}
3986
3987static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
3988 hda_nid_t nid,
3989 unsigned int power_state)
3990{
3991 struct alc_spec *spec = codec->spec;
3992
3993 /* Avoid pop noises when headphones are plugged in */
3994 if (spec->gen.hp_jack_present)
3995 if (nid == codec->afg || nid == 0x02)
3996 return AC_PWRST_D0;
3997 return power_state;
3998}
3999
4000static void alc_fixup_dell_xps13(struct hda_codec *codec,
4001 const struct hda_fixup *fix, int action)
4002{
4003 if (action == HDA_FIXUP_ACT_PROBE) {
4004 struct alc_spec *spec = codec->spec;
4005 spec->shutup = alc_no_shutup;
4006 codec->power_filter = alc_power_filter_xps13;
4007 }
4008}
4009
3897static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, 4010static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
3898 const struct hda_fixup *fix, int action) 4011 const struct hda_fixup *fix, int action)
3899{ 4012{
@@ -4110,6 +4223,7 @@ enum {
4110 ALC269_FIXUP_ASUS_G73JW, 4223 ALC269_FIXUP_ASUS_G73JW,
4111 ALC269_FIXUP_LENOVO_EAPD, 4224 ALC269_FIXUP_LENOVO_EAPD,
4112 ALC275_FIXUP_SONY_HWEQ, 4225 ALC275_FIXUP_SONY_HWEQ,
4226 ALC275_FIXUP_SONY_DISABLE_AAMIX,
4113 ALC271_FIXUP_DMIC, 4227 ALC271_FIXUP_DMIC,
4114 ALC269_FIXUP_PCM_44K, 4228 ALC269_FIXUP_PCM_44K,
4115 ALC269_FIXUP_STEREO_DMIC, 4229 ALC269_FIXUP_STEREO_DMIC,
@@ -4159,6 +4273,8 @@ enum {
4159 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, 4273 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
4160 ALC255_FIXUP_HEADSET_MODE, 4274 ALC255_FIXUP_HEADSET_MODE,
4161 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC, 4275 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
4276 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
4277 ALC292_FIXUP_TPT440_DOCK,
4162}; 4278};
4163 4279
4164static const struct hda_fixup alc269_fixups[] = { 4280static const struct hda_fixup alc269_fixups[] = {
@@ -4213,6 +4329,12 @@ static const struct hda_fixup alc269_fixups[] = {
4213 .chained = true, 4329 .chained = true,
4214 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 4330 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4215 }, 4331 },
4332 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4333 .type = HDA_FIXUP_FUNC,
4334 .v.func = alc_fixup_disable_aamix,
4335 .chained = true,
4336 .chain_id = ALC269_FIXUP_SONY_VAIO
4337 },
4216 [ALC271_FIXUP_DMIC] = { 4338 [ALC271_FIXUP_DMIC] = {
4217 .type = HDA_FIXUP_FUNC, 4339 .type = HDA_FIXUP_FUNC,
4218 .v.func = alc271_fixup_dmic, 4340 .v.func = alc271_fixup_dmic,
@@ -4552,6 +4674,26 @@ static const struct hda_fixup alc269_fixups[] = {
4552 .type = HDA_FIXUP_FUNC, 4674 .type = HDA_FIXUP_FUNC,
4553 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic, 4675 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4554 }, 4676 },
4677 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4678 .type = HDA_FIXUP_PINS,
4679 .v.pins = (const struct hda_pintbl[]) {
4680 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4681 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4682 { }
4683 },
4684 .chained = true,
4685 .chain_id = ALC269_FIXUP_HEADSET_MODE
4686 },
4687 [ALC292_FIXUP_TPT440_DOCK] = {
4688 .type = HDA_FIXUP_PINS,
4689 .v.pins = (const struct hda_pintbl[]) {
4690 { 0x16, 0x21211010 }, /* dock headphone */
4691 { 0x19, 0x21a11010 }, /* dock mic */
4692 { }
4693 },
4694 .chained = true,
4695 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4696 },
4555}; 4697};
4556 4698
4557static const struct snd_pci_quirk alc269_fixup_tbl[] = { 4699static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4595,31 +4737,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4595 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4737 SND_PCI_QUIRK(0x1028, 0x0606, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4596 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4738 SND_PCI_QUIRK(0x1028, 0x0608, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4597 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4739 SND_PCI_QUIRK(0x1028, 0x0609, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4598 SND_PCI_QUIRK(0x1028, 0x060f, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE),
4599 SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE),
4600 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4740 SND_PCI_QUIRK(0x1028, 0x0613, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4601 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4741 SND_PCI_QUIRK(0x1028, 0x0614, "Dell Inspiron 3135", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4602 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), 4742 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4603 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), 4743 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4604 SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4605 SND_PCI_QUIRK(0x1028, 0x0629, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4606 SND_PCI_QUIRK(0x1028, 0x062c, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4744 SND_PCI_QUIRK(0x1028, 0x062c, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4607 SND_PCI_QUIRK(0x1028, 0x062e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4608 SND_PCI_QUIRK(0x1028, 0x0632, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4609 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), 4745 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
4610 SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4611 SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4746 SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4612 SND_PCI_QUIRK(0x1028, 0x0640, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4747 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4748 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4613 SND_PCI_QUIRK(0x1028, 0x064d, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4749 SND_PCI_QUIRK(0x1028, 0x064d, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4614 SND_PCI_QUIRK(0x1028, 0x0651, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4615 SND_PCI_QUIRK(0x1028, 0x0652, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4616 SND_PCI_QUIRK(0x1028, 0x0653, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4617 SND_PCI_QUIRK(0x1028, 0x0657, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4618 SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4619 SND_PCI_QUIRK(0x1028, 0x065c, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4620 SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4621 SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4622 SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4623 SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), 4750 SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4624 SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), 4751 SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
4625 SND_PCI_QUIRK(0x1028, 0x0674, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4752 SND_PCI_QUIRK(0x1028, 0x0674, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -4629,6 +4756,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4629 SND_PCI_QUIRK(0x1028, 0x0684, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4756 SND_PCI_QUIRK(0x1028, 0x0684, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4630 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4757 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4631 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4758 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4759 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4760 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4632 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 4761 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
4633 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), 4762 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
4634 SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), 4763 SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1),
@@ -4702,6 +4831,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4702 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), 4831 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
4703 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 4832 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4704 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 4833 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4834 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
4705 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 4835 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
4706 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), 4836 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
4707 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 4837 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
@@ -4715,7 +4845,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4715 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), 4845 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
4716 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), 4846 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
4717 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), 4847 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
4718 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4848 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
4849 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
4719 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4850 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4720 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4851 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4721 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4852 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -4793,9 +4924,215 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
4793 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, 4924 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
4794 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, 4925 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
4795 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, 4926 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
4927 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
4796 {} 4928 {}
4797}; 4929};
4798 4930
4931static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
4932 {
4933 .codec = 0x10ec0255,
4934 .subvendor = 0x1028,
4935#ifdef CONFIG_SND_DEBUG_VERBOSE
4936 .name = "Dell",
4937#endif
4938 .pins = (const struct hda_pintbl[]) {
4939 {0x12, 0x90a60140},
4940 {0x14, 0x90170110},
4941 {0x17, 0x40000000},
4942 {0x18, 0x411111f0},
4943 {0x19, 0x411111f0},
4944 {0x1a, 0x411111f0},
4945 {0x1b, 0x411111f0},
4946 {0x1d, 0x40700001},
4947 {0x1e, 0x411111f0},
4948 {0x21, 0x02211020},
4949 },
4950 .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4951 },
4952 {
4953 .codec = 0x10ec0255,
4954 .subvendor = 0x1028,
4955#ifdef CONFIG_SND_DEBUG_VERBOSE
4956 .name = "Dell",
4957#endif
4958 .pins = (const struct hda_pintbl[]) {
4959 {0x12, 0x90a60160},
4960 {0x14, 0x90170120},
4961 {0x17, 0x40000000},
4962 {0x18, 0x411111f0},
4963 {0x19, 0x411111f0},
4964 {0x1a, 0x411111f0},
4965 {0x1b, 0x411111f0},
4966 {0x1d, 0x40700001},
4967 {0x1e, 0x411111f0},
4968 {0x21, 0x02211030},
4969 },
4970 .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4971 },
4972 {
4973 .codec = 0x10ec0255,
4974 .subvendor = 0x1028,
4975#ifdef CONFIG_SND_DEBUG_VERBOSE
4976 .name = "Dell",
4977#endif
4978 .pins = (const struct hda_pintbl[]) {
4979 {0x12, 0x90a60160},
4980 {0x14, 0x90170130},
4981 {0x17, 0x40000000},
4982 {0x18, 0x411111f0},
4983 {0x19, 0x411111f0},
4984 {0x1a, 0x411111f0},
4985 {0x1b, 0x411111f0},
4986 {0x1d, 0x40700001},
4987 {0x1e, 0x411111f0},
4988 {0x21, 0x02211040},
4989 },
4990 .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
4991 },
4992 {
4993 .codec = 0x10ec0255,
4994 .subvendor = 0x1028,
4995#ifdef CONFIG_SND_DEBUG_VERBOSE
4996 .name = "Dell",
4997#endif
4998 .pins = (const struct hda_pintbl[]) {
4999 {0x12, 0x90a60160},
5000 {0x14, 0x90170140},
5001 {0x17, 0x40000000},
5002 {0x18, 0x411111f0},
5003 {0x19, 0x411111f0},
5004 {0x1a, 0x411111f0},
5005 {0x1b, 0x411111f0},
5006 {0x1d, 0x40700001},
5007 {0x1e, 0x411111f0},
5008 {0x21, 0x02211050},
5009 },
5010 .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5011 },
5012 {
5013 .codec = 0x10ec0255,
5014 .subvendor = 0x1028,
5015#ifdef CONFIG_SND_DEBUG_VERBOSE
5016 .name = "Dell",
5017#endif
5018 .pins = (const struct hda_pintbl[]) {
5019 {0x12, 0x90a60170},
5020 {0x14, 0x90170120},
5021 {0x17, 0x40000000},
5022 {0x18, 0x411111f0},
5023 {0x19, 0x411111f0},
5024 {0x1a, 0x411111f0},
5025 {0x1b, 0x411111f0},
5026 {0x1d, 0x40700001},
5027 {0x1e, 0x411111f0},
5028 {0x21, 0x02211030},
5029 },
5030 .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5031 },
5032 {
5033 .codec = 0x10ec0255,
5034 .subvendor = 0x1028,
5035#ifdef CONFIG_SND_DEBUG_VERBOSE
5036 .name = "Dell",
5037#endif
5038 .pins = (const struct hda_pintbl[]) {
5039 {0x12, 0x90a60170},
5040 {0x14, 0x90170130},
5041 {0x17, 0x40000000},
5042 {0x18, 0x411111f0},
5043 {0x19, 0x411111f0},
5044 {0x1a, 0x411111f0},
5045 {0x1b, 0x411111f0},
5046 {0x1d, 0x40700001},
5047 {0x1e, 0x411111f0},
5048 {0x21, 0x02211040},
5049 },
5050 .value = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5051 },
5052 {
5053 .codec = 0x10ec0283,
5054 .subvendor = 0x1028,
5055#ifdef CONFIG_SND_DEBUG_VERBOSE
5056 .name = "Dell",
5057#endif
5058 .pins = (const struct hda_pintbl[]) {
5059 {0x12, 0x90a60130},
5060 {0x14, 0x90170110},
5061 {0x17, 0x40020008},
5062 {0x18, 0x411111f0},
5063 {0x19, 0x411111f0},
5064 {0x1a, 0x411111f0},
5065 {0x1b, 0x411111f0},
5066 {0x1d, 0x40e00001},
5067 {0x1e, 0x411111f0},
5068 {0x21, 0x0321101f},
5069 },
5070 .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5071 },
5072 {
5073 .codec = 0x10ec0283,
5074 .subvendor = 0x1028,
5075#ifdef CONFIG_SND_DEBUG_VERBOSE
5076 .name = "Dell",
5077#endif
5078 .pins = (const struct hda_pintbl[]) {
5079 {0x12, 0x90a60160},
5080 {0x14, 0x90170120},
5081 {0x17, 0x40000000},
5082 {0x18, 0x411111f0},
5083 {0x19, 0x411111f0},
5084 {0x1a, 0x411111f0},
5085 {0x1b, 0x411111f0},
5086 {0x1d, 0x40700001},
5087 {0x1e, 0x411111f0},
5088 {0x21, 0x02211030},
5089 },
5090 .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5091 },
5092 {
5093 .codec = 0x10ec0292,
5094 .subvendor = 0x1028,
5095#ifdef CONFIG_SND_DEBUG_VERBOSE
5096 .name = "Dell",
5097#endif
5098 .pins = (const struct hda_pintbl[]) {
5099 {0x12, 0x90a60140},
5100 {0x13, 0x411111f0},
5101 {0x14, 0x90170110},
5102 {0x15, 0x0221401f},
5103 {0x16, 0x411111f0},
5104 {0x18, 0x411111f0},
5105 {0x19, 0x411111f0},
5106 {0x1a, 0x411111f0},
5107 {0x1b, 0x411111f0},
5108 {0x1d, 0x40700001},
5109 {0x1e, 0x411111f0},
5110 },
5111 .value = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5112 },
5113 {
5114 .codec = 0x10ec0293,
5115 .subvendor = 0x1028,
5116#ifdef CONFIG_SND_DEBUG_VERBOSE
5117 .name = "Dell",
5118#endif
5119 .pins = (const struct hda_pintbl[]) {
5120 {0x12, 0x40000000},
5121 {0x13, 0x90a60140},
5122 {0x14, 0x90170110},
5123 {0x15, 0x0221401f},
5124 {0x16, 0x21014020},
5125 {0x18, 0x411111f0},
5126 {0x19, 0x21a19030},
5127 {0x1a, 0x411111f0},
5128 {0x1b, 0x411111f0},
5129 {0x1d, 0x40700001},
5130 {0x1e, 0x411111f0},
5131 },
5132 .value = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5133 },
5134 {}
5135};
4799 5136
4800static void alc269_fill_coef(struct hda_codec *codec) 5137static void alc269_fill_coef(struct hda_codec *codec)
4801{ 5138{
@@ -4857,6 +5194,7 @@ static int patch_alc269(struct hda_codec *codec)
4857 5194
4858 snd_hda_pick_fixup(codec, alc269_fixup_models, 5195 snd_hda_pick_fixup(codec, alc269_fixup_models,
4859 alc269_fixup_tbl, alc269_fixups); 5196 alc269_fixup_tbl, alc269_fixups);
5197 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
4860 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 5198 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4861 5199
4862 alc_auto_parse_customize_define(codec); 5200 alc_auto_parse_customize_define(codec);
@@ -5313,6 +5651,8 @@ enum {
5313 ALC662_FIXUP_BASS_1A, 5651 ALC662_FIXUP_BASS_1A,
5314 ALC662_FIXUP_BASS_CHMAP, 5652 ALC662_FIXUP_BASS_CHMAP,
5315 ALC668_FIXUP_AUTO_MUTE, 5653 ALC668_FIXUP_AUTO_MUTE,
5654 ALC668_FIXUP_DELL_DISABLE_AAMIX,
5655 ALC668_FIXUP_DELL_XPS13,
5316}; 5656};
5317 5657
5318static const struct hda_fixup alc662_fixups[] = { 5658static const struct hda_fixup alc662_fixups[] = {
@@ -5479,6 +5819,18 @@ static const struct hda_fixup alc662_fixups[] = {
5479 .type = HDA_FIXUP_FUNC, 5819 .type = HDA_FIXUP_FUNC,
5480 .v.func = alc_fixup_inv_dmic_0x12, 5820 .v.func = alc_fixup_inv_dmic_0x12,
5481 }, 5821 },
5822 [ALC668_FIXUP_DELL_XPS13] = {
5823 .type = HDA_FIXUP_FUNC,
5824 .v.func = alc_fixup_dell_xps13,
5825 .chained = true,
5826 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
5827 },
5828 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
5829 .type = HDA_FIXUP_FUNC,
5830 .v.func = alc_fixup_disable_aamix,
5831 .chained = true,
5832 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
5833 },
5482 [ALC668_FIXUP_AUTO_MUTE] = { 5834 [ALC668_FIXUP_AUTO_MUTE] = {
5483 .type = HDA_FIXUP_FUNC, 5835 .type = HDA_FIXUP_FUNC,
5484 .v.func = alc_fixup_auto_mute_via_amp, 5836 .v.func = alc_fixup_auto_mute_via_amp,
@@ -5539,13 +5891,9 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
5539 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), 5891 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
5540 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5892 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5541 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5893 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5542 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5894 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
5543 SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_AUTO_MUTE),
5544 SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_AUTO_MUTE),
5545 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5895 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5546 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5896 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5547 SND_PCI_QUIRK(0x1028, 0x0628, "Dell", ALC668_FIXUP_AUTO_MUTE),
5548 SND_PCI_QUIRK(0x1028, 0x064e, "Dell", ALC668_FIXUP_AUTO_MUTE),
5549 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5897 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5550 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 5898 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
5551 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), 5899 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
@@ -5637,6 +5985,73 @@ static const struct hda_model_fixup alc662_fixup_models[] = {
5637 {} 5985 {}
5638}; 5986};
5639 5987
5988static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
5989 {
5990 .codec = 0x10ec0668,
5991 .subvendor = 0x1028,
5992#ifdef CONFIG_SND_DEBUG_VERBOSE
5993 .name = "Dell",
5994#endif
5995 .pins = (const struct hda_pintbl[]) {
5996 {0x12, 0x99a30130},
5997 {0x14, 0x90170110},
5998 {0x15, 0x0321101f},
5999 {0x16, 0x03011020},
6000 {0x18, 0x40000008},
6001 {0x19, 0x411111f0},
6002 {0x1a, 0x411111f0},
6003 {0x1b, 0x411111f0},
6004 {0x1d, 0x41000001},
6005 {0x1e, 0x411111f0},
6006 {0x1f, 0x411111f0},
6007 },
6008 .value = ALC668_FIXUP_AUTO_MUTE,
6009 },
6010 {
6011 .codec = 0x10ec0668,
6012 .subvendor = 0x1028,
6013#ifdef CONFIG_SND_DEBUG_VERBOSE
6014 .name = "Dell",
6015#endif
6016 .pins = (const struct hda_pintbl[]) {
6017 {0x12, 0x99a30150},
6018 {0x14, 0x90170110},
6019 {0x15, 0x0321101f},
6020 {0x16, 0x03011020},
6021 {0x18, 0x40000008},
6022 {0x19, 0x411111f0},
6023 {0x1a, 0x411111f0},
6024 {0x1b, 0x411111f0},
6025 {0x1d, 0x41000001},
6026 {0x1e, 0x411111f0},
6027 {0x1f, 0x411111f0},
6028 },
6029 .value = ALC668_FIXUP_AUTO_MUTE,
6030 },
6031 {
6032 .codec = 0x10ec0668,
6033 .subvendor = 0x1028,
6034#ifdef CONFIG_SND_DEBUG_VERBOSE
6035 .name = "Dell",
6036#endif
6037 .pins = (const struct hda_pintbl[]) {
6038 {0x12, 0x411111f0},
6039 {0x14, 0x90170110},
6040 {0x15, 0x0321101f},
6041 {0x16, 0x03011020},
6042 {0x18, 0x40000008},
6043 {0x19, 0x411111f0},
6044 {0x1a, 0x411111f0},
6045 {0x1b, 0x411111f0},
6046 {0x1d, 0x41000001},
6047 {0x1e, 0x411111f0},
6048 {0x1f, 0x411111f0},
6049 },
6050 .value = ALC668_FIXUP_AUTO_MUTE,
6051 },
6052 {}
6053};
6054
5640static void alc662_fill_coef(struct hda_codec *codec) 6055static void alc662_fill_coef(struct hda_codec *codec)
5641{ 6056{
5642 int val, coef; 6057 int val, coef;
@@ -5686,6 +6101,7 @@ static int patch_alc662(struct hda_codec *codec)
5686 6101
5687 snd_hda_pick_fixup(codec, alc662_fixup_models, 6102 snd_hda_pick_fixup(codec, alc662_fixup_models,
5688 alc662_fixup_tbl, alc662_fixups); 6103 alc662_fixup_tbl, alc662_fixups);
6104 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
5689 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 6105 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5690 6106
5691 alc_auto_parse_customize_define(codec); 6107 alc_auto_parse_customize_define(codec);
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 75515b494034..7f40a150899c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -795,7 +795,7 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
795 } 795 }
796 796
797 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { 797 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
798 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", 798 if (sscanf(dev->name, "HP_Mute_LED_%u_%x",
799 &spec->gpio_led_polarity, 799 &spec->gpio_led_polarity,
800 &spec->gpio_led) == 2) { 800 &spec->gpio_led) == 2) {
801 unsigned int max_gpio; 801 unsigned int max_gpio;
@@ -808,7 +808,7 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
808 spec->vref_mute_led_nid = spec->gpio_led; 808 spec->vref_mute_led_nid = spec->gpio_led;
809 return 1; 809 return 1;
810 } 810 }
811 if (sscanf(dev->name, "HP_Mute_LED_%d", 811 if (sscanf(dev->name, "HP_Mute_LED_%u",
812 &spec->gpio_led_polarity) == 1) { 812 &spec->gpio_led_polarity) == 1) {
813 set_hp_led_gpio(codec); 813 set_hp_led_gpio(codec);
814 return 1; 814 return 1;
diff --git a/sound/pci/lola/lola_proc.c b/sound/pci/lola/lola_proc.c
index 04df83defc09..c241dc06dd92 100644
--- a/sound/pci/lola/lola_proc.c
+++ b/sound/pci/lola/lola_proc.c
@@ -151,7 +151,7 @@ static void lola_proc_codec_rw_write(struct snd_info_entry *entry,
151 char line[64]; 151 char line[64];
152 unsigned int id, verb, data, extdata; 152 unsigned int id, verb, data, extdata;
153 while (!snd_info_get_line(buffer, line, sizeof(line))) { 153 while (!snd_info_get_line(buffer, line, sizeof(line))) {
154 if (sscanf(line, "%i %i %i %i", &id, &verb, &data, &extdata) != 4) 154 if (sscanf(line, "%u %u %u %u", &id, &verb, &data, &extdata) != 4)
155 continue; 155 continue;
156 lola_codec_read(chip, id, verb, data, extdata, 156 lola_codec_read(chip, id, verb, data, extdata,
157 &chip->debug_res, 157 &chip->debug_res,
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c
index 2d8e95e9fbe5..e8f38e5df10a 100644
--- a/sound/pci/lx6464es/lx_core.c
+++ b/sound/pci/lx6464es/lx_core.c
@@ -24,6 +24,7 @@
24 24
25/* #define RMH_DEBUG 1 */ 25/* #define RMH_DEBUG 1 */
26 26
27#include <linux/bitops.h>
27#include <linux/module.h> 28#include <linux/module.h>
28#include <linux/pci.h> 29#include <linux/pci.h>
29#include <linux/delay.h> 30#include <linux/delay.h>
@@ -429,11 +430,6 @@ int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data)
429 return ret; 430 return ret;
430} 431}
431 432
432#define CSES_TIMEOUT 100 /* microseconds */
433#define CSES_CE 0x0001
434#define CSES_BROADCAST 0x0002
435#define CSES_UPDATE_LDSV 0x0004
436
437#define PIPE_INFO_TO_CMD(capture, pipe) \ 433#define PIPE_INFO_TO_CMD(capture, pipe) \
438 ((u32)((u32)(pipe) | ((capture) ? ID_IS_CAPTURE : 0L)) << ID_OFFSET) 434 ((u32)((u32)(pipe) | ((capture) ? ID_IS_CAPTURE : 0L)) << ID_OFFSET)
439 435
@@ -519,7 +515,6 @@ int lx_buffer_ask(struct lx6464es *chip, u32 pipe, int is_capture,
519 *r_needed += 1; 515 *r_needed += 1;
520 } 516 }
521 517
522#if 0
523 dev_dbg(chip->card->dev, 518 dev_dbg(chip->card->dev,
524 "CMD_08_ASK_BUFFERS: needed %d, freed %d\n", 519 "CMD_08_ASK_BUFFERS: needed %d, freed %d\n",
525 *r_needed, *r_freed); 520 *r_needed, *r_freed);
@@ -530,7 +525,6 @@ int lx_buffer_ask(struct lx6464es *chip, u32 pipe, int is_capture,
530 chip->rmh.stat[i], 525 chip->rmh.stat[i],
531 chip->rmh.stat[i] & MASK_DATA_SIZE); 526 chip->rmh.stat[i] & MASK_DATA_SIZE);
532 } 527 }
533#endif
534 } 528 }
535 529
536 spin_unlock_irqrestore(&chip->msg_lock, flags); 530 spin_unlock_irqrestore(&chip->msg_lock, flags);
@@ -971,9 +965,9 @@ int lx_level_peaks(struct lx6464es *chip, int is_capture, int channels,
971 965
972/* interrupt handling */ 966/* interrupt handling */
973#define PCX_IRQ_NONE 0 967#define PCX_IRQ_NONE 0
974#define IRQCS_ACTIVE_PCIDB 0x00002000L /* Bit nø 13 */ 968#define IRQCS_ACTIVE_PCIDB BIT(13)
975#define IRQCS_ENABLE_PCIIRQ 0x00000100L /* Bit nø 08 */ 969#define IRQCS_ENABLE_PCIIRQ BIT(8)
976#define IRQCS_ENABLE_PCIDB 0x00000200L /* Bit nø 09 */ 970#define IRQCS_ENABLE_PCIDB BIT(9)
977 971
978static u32 lx_interrupt_test_ack(struct lx6464es *chip) 972static u32 lx_interrupt_test_ack(struct lx6464es *chip)
979{ 973{
@@ -1030,25 +1024,21 @@ static int lx_interrupt_handle_async_events(struct lx6464es *chip, u32 irqsrc,
1030 int err; 1024 int err;
1031 u32 stat[9]; /* answer from CMD_04_GET_EVENT */ 1025 u32 stat[9]; /* answer from CMD_04_GET_EVENT */
1032 1026
1033 /* On peut optimiser pour ne pas lire les evenements vides 1027 /* We can optimize this to not read dumb events.
1034 * les mots de réponse sont dans l'ordre suivant : 1028 * Answer words are in the following order:
1035 * Stat[0] mot de status général 1029 * Stat[0] general status
1036 * Stat[1] fin de buffer OUT pF 1030 * Stat[1] end of buffer OUT pF
1037 * Stat[2] fin de buffer OUT pf 1031 * Stat[2] end of buffer OUT pf
1038 * Stat[3] fin de buffer IN pF 1032 * Stat[3] end of buffer IN pF
1039 * Stat[4] fin de buffer IN pf 1033 * Stat[4] end of buffer IN pf
1040 * Stat[5] underrun poid fort 1034 * Stat[5] MSB underrun
1041 * Stat[6] underrun poid faible 1035 * Stat[6] LSB underrun
1042 * Stat[7] overrun poid fort 1036 * Stat[7] MSB overrun
1043 * Stat[8] overrun poid faible 1037 * Stat[8] LSB overrun
1044 * */ 1038 * */
1045 1039
1046 u64 orun_mask; 1040 u64 orun_mask;
1047 u64 urun_mask; 1041 u64 urun_mask;
1048#if 0
1049 int has_underrun = (irqsrc & MASK_SYS_STATUS_URUN) ? 1 : 0;
1050 int has_overrun = (irqsrc & MASK_SYS_STATUS_ORUN) ? 1 : 0;
1051#endif
1052 int eb_pending_out = (irqsrc & MASK_SYS_STATUS_EOBO) ? 1 : 0; 1042 int eb_pending_out = (irqsrc & MASK_SYS_STATUS_EOBO) ? 1 : 0;
1053 int eb_pending_in = (irqsrc & MASK_SYS_STATUS_EOBI) ? 1 : 0; 1043 int eb_pending_in = (irqsrc & MASK_SYS_STATUS_EOBI) ? 1 : 0;
1054 1044
@@ -1199,9 +1189,8 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1199 if (irqsrc & MASK_SYS_STATUS_CMD_DONE) 1189 if (irqsrc & MASK_SYS_STATUS_CMD_DONE)
1200 goto exit; 1190 goto exit;
1201 1191
1202#if 0
1203 if (irqsrc & MASK_SYS_STATUS_EOBI) 1192 if (irqsrc & MASK_SYS_STATUS_EOBI)
1204 dev_dgg(chip->card->dev, "interrupt: EOBI\n"); 1193 dev_dbg(chip->card->dev, "interrupt: EOBI\n");
1205 1194
1206 if (irqsrc & MASK_SYS_STATUS_EOBO) 1195 if (irqsrc & MASK_SYS_STATUS_EOBO)
1207 dev_dbg(chip->card->dev, "interrupt: EOBO\n"); 1196 dev_dbg(chip->card->dev, "interrupt: EOBO\n");
@@ -1211,7 +1200,6 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1211 1200
1212 if (irqsrc & MASK_SYS_STATUS_ORUN) 1201 if (irqsrc & MASK_SYS_STATUS_ORUN)
1213 dev_dbg(chip->card->dev, "interrupt: ORUN\n"); 1202 dev_dbg(chip->card->dev, "interrupt: ORUN\n");
1214#endif
1215 1203
1216 if (async_pending) { 1204 if (async_pending) {
1217 u64 notified_in_pipe_mask = 0; 1205 u64 notified_in_pipe_mask = 0;
@@ -1238,7 +1226,6 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1238 } 1226 }
1239 1227
1240 if (async_escmd) { 1228 if (async_escmd) {
1241#if 0
1242 /* backdoor for ethersound commands 1229 /* backdoor for ethersound commands
1243 * 1230 *
1244 * for now, we do not need this 1231 * for now, we do not need this
@@ -1246,7 +1233,6 @@ irqreturn_t lx_interrupt(int irq, void *dev_id)
1246 * */ 1233 * */
1247 1234
1248 dev_dbg(chip->card->dev, "interrupt requests escmd handling\n"); 1235 dev_dbg(chip->card->dev, "interrupt requests escmd handling\n");
1249#endif
1250 } 1236 }
1251 1237
1252exit: 1238exit: