aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-04-07 06:57:53 -0400
committerTakashi Iwai <tiwai@suse.de>2011-04-07 06:57:53 -0400
commit8e28e3b29fdbb2b94bb279700114b5963fe1d4e8 (patch)
tree51c34b9267c7ccad0f7c8efa7d3d300530434d45 /sound
parentad93ffe6e4fc02993987008e4a5dcdcf4c926cd5 (diff)
parent262ac22d21ee2bf3e1655b2e5e45cc94b356e62f (diff)
Merge branch 'fix/hda' into topic/hda
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm_lib.c4
-rw-r--r--sound/firewire/speakers.c3
-rw-r--r--sound/pci/ens1370.c23
-rw-r--r--sound/pci/hda/patch_conexant.c2
-rw-r--r--sound/pci/hda/patch_hdmi.c70
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/usb/midi.c1
7 files changed, 71 insertions, 34 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index a82e3756a72d..64449cb8f873 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -375,6 +375,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
375 } 375 }
376 376
377 if (runtime->no_period_wakeup) { 377 if (runtime->no_period_wakeup) {
378 snd_pcm_sframes_t xrun_threshold;
378 /* 379 /*
379 * Without regular period interrupts, we have to check 380 * Without regular period interrupts, we have to check
380 * the elapsed time to detect xruns. 381 * the elapsed time to detect xruns.
@@ -383,7 +384,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
383 if (jdelta < runtime->hw_ptr_buffer_jiffies / 2) 384 if (jdelta < runtime->hw_ptr_buffer_jiffies / 2)
384 goto no_delta_check; 385 goto no_delta_check;
385 hdelta = jdelta - delta * HZ / runtime->rate; 386 hdelta = jdelta - delta * HZ / runtime->rate;
386 while (hdelta > runtime->hw_ptr_buffer_jiffies / 2 + 1) { 387 xrun_threshold = runtime->hw_ptr_buffer_jiffies / 2 + 1;
388 while (hdelta > xrun_threshold) {
387 delta += runtime->buffer_size; 389 delta += runtime->buffer_size;
388 hw_base += runtime->buffer_size; 390 hw_base += runtime->buffer_size;
389 if (hw_base >= runtime->boundary) 391 if (hw_base >= runtime->boundary)
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c
index 0fce9218abb1..5466de8527bd 100644
--- a/sound/firewire/speakers.c
+++ b/sound/firewire/speakers.c
@@ -778,10 +778,9 @@ static int __devexit fwspk_remove(struct device *dev)
778{ 778{
779 struct fwspk *fwspk = dev_get_drvdata(dev); 779 struct fwspk *fwspk = dev_get_drvdata(dev);
780 780
781 snd_card_disconnect(fwspk->card);
782
783 mutex_lock(&fwspk->mutex); 781 mutex_lock(&fwspk->mutex);
784 amdtp_out_stream_pcm_abort(&fwspk->stream); 782 amdtp_out_stream_pcm_abort(&fwspk->stream);
783 snd_card_disconnect(fwspk->card);
785 fwspk_stop_stream(fwspk); 784 fwspk_stop_stream(fwspk);
786 mutex_unlock(&fwspk->mutex); 785 mutex_unlock(&fwspk->mutex);
787 786
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 537cfba829a5..863eafea691f 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -229,6 +229,7 @@ MODULE_PARM_DESC(lineio, "Line In to Rear Out (0 = auto, 1 = force).");
229#define ES_REG_1371_CODEC 0x14 /* W/R: Codec Read/Write register address */ 229#define ES_REG_1371_CODEC 0x14 /* W/R: Codec Read/Write register address */
230#define ES_1371_CODEC_RDY (1<<31) /* codec ready */ 230#define ES_1371_CODEC_RDY (1<<31) /* codec ready */
231#define ES_1371_CODEC_WIP (1<<30) /* codec register access in progress */ 231#define ES_1371_CODEC_WIP (1<<30) /* codec register access in progress */
232#define EV_1938_CODEC_MAGIC (1<<26)
232#define ES_1371_CODEC_PIRD (1<<23) /* codec read/write select register */ 233#define ES_1371_CODEC_PIRD (1<<23) /* codec read/write select register */
233#define ES_1371_CODEC_WRITE(a,d) ((((a)&0x7f)<<16)|(((d)&0xffff)<<0)) 234#define ES_1371_CODEC_WRITE(a,d) ((((a)&0x7f)<<16)|(((d)&0xffff)<<0))
234#define ES_1371_CODEC_READS(a) ((((a)&0x7f)<<16)|ES_1371_CODEC_PIRD) 235#define ES_1371_CODEC_READS(a) ((((a)&0x7f)<<16)|ES_1371_CODEC_PIRD)
@@ -603,12 +604,18 @@ static void snd_es1370_codec_write(struct snd_ak4531 *ak4531,
603 604
604#ifdef CHIP1371 605#ifdef CHIP1371
605 606
607static inline bool is_ev1938(struct ensoniq *ensoniq)
608{
609 return ensoniq->pci->device == 0x8938;
610}
611
606static void snd_es1371_codec_write(struct snd_ac97 *ac97, 612static void snd_es1371_codec_write(struct snd_ac97 *ac97,
607 unsigned short reg, unsigned short val) 613 unsigned short reg, unsigned short val)
608{ 614{
609 struct ensoniq *ensoniq = ac97->private_data; 615 struct ensoniq *ensoniq = ac97->private_data;
610 unsigned int t, x; 616 unsigned int t, x, flag;
611 617
618 flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0;
612 mutex_lock(&ensoniq->src_mutex); 619 mutex_lock(&ensoniq->src_mutex);
613 for (t = 0; t < POLL_COUNT; t++) { 620 for (t = 0; t < POLL_COUNT; t++) {
614 if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { 621 if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) {
@@ -630,7 +637,8 @@ static void snd_es1371_codec_write(struct snd_ac97 *ac97,
630 0x00010000) 637 0x00010000)
631 break; 638 break;
632 } 639 }
633 outl(ES_1371_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1371_CODEC)); 640 outl(ES_1371_CODEC_WRITE(reg, val) | flag,
641 ES_REG(ensoniq, 1371_CODEC));
634 /* restore SRC reg */ 642 /* restore SRC reg */
635 snd_es1371_wait_src_ready(ensoniq); 643 snd_es1371_wait_src_ready(ensoniq);
636 outl(x, ES_REG(ensoniq, 1371_SMPRATE)); 644 outl(x, ES_REG(ensoniq, 1371_SMPRATE));
@@ -647,8 +655,9 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
647 unsigned short reg) 655 unsigned short reg)
648{ 656{
649 struct ensoniq *ensoniq = ac97->private_data; 657 struct ensoniq *ensoniq = ac97->private_data;
650 unsigned int t, x, fail = 0; 658 unsigned int t, x, flag, fail = 0;
651 659
660 flag = is_ev1938(ensoniq) ? EV_1938_CODEC_MAGIC : 0;
652 __again: 661 __again:
653 mutex_lock(&ensoniq->src_mutex); 662 mutex_lock(&ensoniq->src_mutex);
654 for (t = 0; t < POLL_COUNT; t++) { 663 for (t = 0; t < POLL_COUNT; t++) {
@@ -671,7 +680,8 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
671 0x00010000) 680 0x00010000)
672 break; 681 break;
673 } 682 }
674 outl(ES_1371_CODEC_READS(reg), ES_REG(ensoniq, 1371_CODEC)); 683 outl(ES_1371_CODEC_READS(reg) | flag,
684 ES_REG(ensoniq, 1371_CODEC));
675 /* restore SRC reg */ 685 /* restore SRC reg */
676 snd_es1371_wait_src_ready(ensoniq); 686 snd_es1371_wait_src_ready(ensoniq);
677 outl(x, ES_REG(ensoniq, 1371_SMPRATE)); 687 outl(x, ES_REG(ensoniq, 1371_SMPRATE));
@@ -683,6 +693,11 @@ static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97,
683 /* now wait for the stinkin' data (RDY) */ 693 /* now wait for the stinkin' data (RDY) */
684 for (t = 0; t < POLL_COUNT; t++) { 694 for (t = 0; t < POLL_COUNT; t++) {
685 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { 695 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) {
696 if (is_ev1938(ensoniq)) {
697 for (t = 0; t < 100; t++)
698 inl(ES_REG(ensoniq, CONTROL));
699 x = inl(ES_REG(ensoniq, 1371_CODEC));
700 }
686 mutex_unlock(&ensoniq->src_mutex); 701 mutex_unlock(&ensoniq->src_mutex);
687 return ES_1371_CODEC_READ(x); 702 return ES_1371_CODEC_READ(x);
688 } 703 }
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index d08cf31596f3..ad97d937d3a8 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3034,6 +3034,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3034 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), 3034 SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
3035 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS), 3035 SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
3036 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 3036 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
3037 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD),
3038 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD),
3037 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS), 3039 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS),
3038 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */ 3040 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */
3039 {} 3041 {}
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 251773e45f61..715615a88a8d 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1280,6 +1280,39 @@ static int simple_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1280 stream_tag, format, substream); 1280 stream_tag, format, substream);
1281} 1281}
1282 1282
1283static void nvhdmi_8ch_7x_set_info_frame_parameters(struct hda_codec *codec,
1284 int channels)
1285{
1286 unsigned int chanmask;
1287 int chan = channels ? (channels - 1) : 1;
1288
1289 switch (channels) {
1290 default:
1291 case 0:
1292 case 2:
1293 chanmask = 0x00;
1294 break;
1295 case 4:
1296 chanmask = 0x08;
1297 break;
1298 case 6:
1299 chanmask = 0x0b;
1300 break;
1301 case 8:
1302 chanmask = 0x13;
1303 break;
1304 }
1305
1306 /* Set the audio infoframe channel allocation and checksum fields. The
1307 * channel count is computed implicitly by the hardware. */
1308 snd_hda_codec_write(codec, 0x1, 0,
1309 Nv_VERB_SET_Channel_Allocation, chanmask);
1310
1311 snd_hda_codec_write(codec, 0x1, 0,
1312 Nv_VERB_SET_Info_Frame_Checksum,
1313 (0x71 - chan - chanmask));
1314}
1315
1283static int nvhdmi_8ch_7x_pcm_close(struct hda_pcm_stream *hinfo, 1316static int nvhdmi_8ch_7x_pcm_close(struct hda_pcm_stream *hinfo,
1284 struct hda_codec *codec, 1317 struct hda_codec *codec,
1285 struct snd_pcm_substream *substream) 1318 struct snd_pcm_substream *substream)
@@ -1298,6 +1331,10 @@ static int nvhdmi_8ch_7x_pcm_close(struct hda_pcm_stream *hinfo,
1298 AC_VERB_SET_STREAM_FORMAT, 0); 1331 AC_VERB_SET_STREAM_FORMAT, 0);
1299 } 1332 }
1300 1333
1334 /* The audio hardware sends a channel count of 0x7 (8ch) when all the
1335 * streams are disabled. */
1336 nvhdmi_8ch_7x_set_info_frame_parameters(codec, 8);
1337
1301 return snd_hda_multi_out_dig_close(codec, &spec->multiout); 1338 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
1302} 1339}
1303 1340
@@ -1308,37 +1345,16 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1308 struct snd_pcm_substream *substream) 1345 struct snd_pcm_substream *substream)
1309{ 1346{
1310 int chs; 1347 int chs;
1311 unsigned int dataDCC1, dataDCC2, chan, chanmask, channel_id; 1348 unsigned int dataDCC1, dataDCC2, channel_id;
1312 int i; 1349 int i;
1313 1350
1314 mutex_lock(&codec->spdif_mutex); 1351 mutex_lock(&codec->spdif_mutex);
1315 1352
1316 chs = substream->runtime->channels; 1353 chs = substream->runtime->channels;
1317 chan = chs ? (chs - 1) : 1;
1318 1354
1319 switch (chs) {
1320 default:
1321 case 0:
1322 case 2:
1323 chanmask = 0x00;
1324 break;
1325 case 4:
1326 chanmask = 0x08;
1327 break;
1328 case 6:
1329 chanmask = 0x0b;
1330 break;
1331 case 8:
1332 chanmask = 0x13;
1333 break;
1334 }
1335 dataDCC1 = AC_DIG1_ENABLE | AC_DIG1_COPYRIGHT; 1355 dataDCC1 = AC_DIG1_ENABLE | AC_DIG1_COPYRIGHT;
1336 dataDCC2 = 0x2; 1356 dataDCC2 = 0x2;
1337 1357
1338 /* set the Audio InforFrame Channel Allocation */
1339 snd_hda_codec_write(codec, 0x1, 0,
1340 Nv_VERB_SET_Channel_Allocation, chanmask);
1341
1342 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ 1358 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */
1343 if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE)) 1359 if (codec->spdif_status_reset && (codec->spdif_ctls & AC_DIG1_ENABLE))
1344 snd_hda_codec_write(codec, 1360 snd_hda_codec_write(codec,
@@ -1413,10 +1429,7 @@ static int nvhdmi_8ch_7x_pcm_prepare(struct hda_pcm_stream *hinfo,
1413 } 1429 }
1414 } 1430 }
1415 1431
1416 /* set the Audio Info Frame Checksum */ 1432 nvhdmi_8ch_7x_set_info_frame_parameters(codec, chs);
1417 snd_hda_codec_write(codec, 0x1, 0,
1418 Nv_VERB_SET_Info_Frame_Checksum,
1419 (0x71 - chan - chanmask));
1420 1433
1421 mutex_unlock(&codec->spdif_mutex); 1434 mutex_unlock(&codec->spdif_mutex);
1422 return 0; 1435 return 0;
@@ -1512,6 +1525,11 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
1512 spec->multiout.max_channels = 8; 1525 spec->multiout.max_channels = 8;
1513 spec->pcm_playback = &nvhdmi_pcm_playback_8ch_7x; 1526 spec->pcm_playback = &nvhdmi_pcm_playback_8ch_7x;
1514 codec->patch_ops = nvhdmi_patch_ops_8ch_7x; 1527 codec->patch_ops = nvhdmi_patch_ops_8ch_7x;
1528
1529 /* Initialize the audio infoframe channel mask and checksum to something
1530 * valid */
1531 nvhdmi_8ch_7x_set_info_frame_parameters(codec, 8);
1532
1515 return 0; 1533 return 0;
1516} 1534}
1517 1535
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b1e5eb17f1bc..81f0c5c401b5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -14134,7 +14134,7 @@ static hda_nid_t alc269vb_capsrc_nids[1] = {
14134}; 14134};
14135 14135
14136static hda_nid_t alc269_adc_candidates[] = { 14136static hda_nid_t alc269_adc_candidates[] = {
14137 0x08, 0x09, 0x07, 14137 0x08, 0x09, 0x07, 0x11,
14138}; 14138};
14139 14139
14140#define alc269_modes alc260_modes 14140#define alc269_modes alc260_modes
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index b4b39c0b6c9e..f9289102886a 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -1301,6 +1301,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,
1301 case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */ 1301 case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */
1302 case USB_ID(0x15ca, 0x1806): /* Textech USB Midi Cable */ 1302 case USB_ID(0x15ca, 0x1806): /* Textech USB Midi Cable */
1303 case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */ 1303 case USB_ID(0x1a86, 0x752d): /* QinHeng CH345 "USB2.0-MIDI" */
1304 case USB_ID(0xfc08, 0x0101): /* Unknown vendor Cable */
1304 ep->max_transfer = 4; 1305 ep->max_transfer = 4;
1305 break; 1306 break;
1306 /* 1307 /*