Merge branch 'for-linus' into topic/virmidi

Pull the latest ALSA sequencer fixes for the further development of
virmidi.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2018-07-29 22:38:54 +02:00
commit 16c796e8fa
10 changed files with 32 additions and 23 deletions

View File

@ -242,16 +242,12 @@ int snd_dma_alloc_pages_fallback(int type, struct device *device, size_t size,
int err; int err;
while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) { while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) {
size_t aligned_size;
if (err != -ENOMEM) if (err != -ENOMEM)
return err; return err;
if (size <= PAGE_SIZE) if (size <= PAGE_SIZE)
return -ENOMEM; return -ENOMEM;
aligned_size = PAGE_SIZE << get_order(size);
if (size != aligned_size)
size = aligned_size;
else
size >>= 1; size >>= 1;
size = PAGE_SIZE << get_order(size);
} }
if (! dmab->area) if (! dmab->area)
return -ENOMEM; return -ENOMEM;

View File

@ -203,7 +203,7 @@ odev_poll(struct file *file, poll_table * wait)
struct seq_oss_devinfo *dp; struct seq_oss_devinfo *dp;
dp = file->private_data; dp = file->private_data;
if (snd_BUG_ON(!dp)) if (snd_BUG_ON(!dp))
return -ENXIO; return EPOLLERR;
return snd_seq_oss_poll(dp, file, wait); return snd_seq_oss_poll(dp, file, wait);
} }

View File

@ -1101,7 +1101,7 @@ static __poll_t snd_seq_poll(struct file *file, poll_table * wait)
/* check client structures are in place */ /* check client structures are in place */
if (snd_BUG_ON(!client)) if (snd_BUG_ON(!client))
return -ENXIO; return EPOLLERR;
if ((snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT) && if ((snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT) &&
client->data.user.fifo) { client->data.user.fifo) {

View File

@ -163,6 +163,7 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
int count, res; int count, res;
unsigned char buf[32], *pbuf; unsigned char buf[32], *pbuf;
unsigned long flags; unsigned long flags;
bool check_resched = !in_atomic();
if (up) { if (up) {
vmidi->trigger = 1; vmidi->trigger = 1;
@ -200,6 +201,15 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
vmidi->event.type = SNDRV_SEQ_EVENT_NONE; vmidi->event.type = SNDRV_SEQ_EVENT_NONE;
} }
} }
if (!check_resched)
continue;
/* do temporary unlock & cond_resched() for avoiding
* CPU soft lockup, which may happen via a write from
* a huge rawmidi buffer
*/
spin_unlock_irqrestore(&substream->runtime->lock, flags);
cond_resched();
spin_lock_irqsave(&substream->runtime->lock, flags);
} }
out: out:
spin_unlock_irqrestore(&substream->runtime->lock, flags); spin_unlock_irqrestore(&substream->runtime->lock, flags);

View File

@ -67,9 +67,9 @@ struct cs5535audio_dma_ops {
}; };
struct cs5535audio_dma_desc { struct cs5535audio_dma_desc {
u32 addr; __le32 addr;
u16 size; __le16 size;
u16 ctlreserved; __le16 ctlreserved;
}; };
struct cs5535audio_dma { struct cs5535audio_dma {

View File

@ -158,8 +158,8 @@ static int cs5535audio_build_dma_packets(struct cs5535audio *cs5535au,
lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr); lastdesc->addr = cpu_to_le32((u32) dma->desc_buf.addr);
lastdesc->size = 0; lastdesc->size = 0;
lastdesc->ctlreserved = cpu_to_le16(PRD_JMP); lastdesc->ctlreserved = cpu_to_le16(PRD_JMP);
jmpprd_addr = cpu_to_le32(lastdesc->addr + jmpprd_addr = (u32)dma->desc_buf.addr +
(sizeof(struct cs5535audio_dma_desc)*periods)); sizeof(struct cs5535audio_dma_desc) * periods;
dma->substream = substream; dma->substream = substream;
dma->period_bytes = period_bytes; dma->period_bytes = period_bytes;

View File

@ -177,6 +177,7 @@ static void cx_auto_reboot_notify(struct hda_codec *codec)
struct conexant_spec *spec = codec->spec; struct conexant_spec *spec = codec->spec;
switch (codec->core.vendor_id) { switch (codec->core.vendor_id) {
case 0x14f12008: /* CX8200 */
case 0x14f150f2: /* CX20722 */ case 0x14f150f2: /* CX20722 */
case 0x14f150f4: /* CX20724 */ case 0x14f150f4: /* CX20724 */
break; break;
@ -184,13 +185,14 @@ static void cx_auto_reboot_notify(struct hda_codec *codec)
return; return;
} }
/* Turn the CX20722 codec into D3 to avoid spurious noises /* Turn the problematic codec into D3 to avoid spurious noises
from the internal speaker during (and after) reboot */ from the internal speaker during (and after) reboot */
cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
snd_hda_codec_write(codec, codec->core.afg, 0, snd_hda_codec_write(codec, codec->core.afg, 0,
AC_VERB_SET_POWER_STATE, AC_PWRST_D3); AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
msleep(10);
} }
static void cx_auto_free(struct hda_codec *codec) static void cx_auto_free(struct hda_codec *codec)

View File

@ -2365,6 +2365,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950), SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),

View File

@ -275,7 +275,7 @@ static void vx2_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
length >>= 2; /* in 32bit words */ length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; length > 0; length--) { for (; length > 0; length--) {
outl(cpu_to_le32(*addr), port); outl(*addr, port);
addr++; addr++;
} }
addr = (u32 *)runtime->dma_area; addr = (u32 *)runtime->dma_area;
@ -285,7 +285,7 @@ static void vx2_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
count >>= 2; /* in 32bit words */ count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; count > 0; count--) { for (; count > 0; count--) {
outl(cpu_to_le32(*addr), port); outl(*addr, port);
addr++; addr++;
} }
@ -313,7 +313,7 @@ static void vx2_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
length >>= 2; /* in 32bit words */ length >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; length > 0; length--) for (; length > 0; length--)
*addr++ = le32_to_cpu(inl(port)); *addr++ = inl(port);
addr = (u32 *)runtime->dma_area; addr = (u32 *)runtime->dma_area;
pipe->hw_ptr = 0; pipe->hw_ptr = 0;
} }
@ -321,7 +321,7 @@ static void vx2_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
count >>= 2; /* in 32bit words */ count >>= 2; /* in 32bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; count > 0; count--) for (; count > 0; count--)
*addr++ = le32_to_cpu(inl(port)); *addr++ = inl(port);
vx2_release_pseudo_dma(chip); vx2_release_pseudo_dma(chip);
} }

View File

@ -375,7 +375,7 @@ static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
length >>= 1; /* in 16bit words */ length >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; length > 0; length--) { for (; length > 0; length--) {
outw(cpu_to_le16(*addr), port); outw(*addr, port);
addr++; addr++;
} }
addr = (unsigned short *)runtime->dma_area; addr = (unsigned short *)runtime->dma_area;
@ -385,7 +385,7 @@ static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
count >>= 1; /* in 16bit words */ count >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; count > 0; count--) { for (; count > 0; count--) {
outw(cpu_to_le16(*addr), port); outw(*addr, port);
addr++; addr++;
} }
vx_release_pseudo_dma(chip); vx_release_pseudo_dma(chip);
@ -417,7 +417,7 @@ static void vxp_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
length >>= 1; /* in 16bit words */ length >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; length > 0; length--) for (; length > 0; length--)
*addr++ = le16_to_cpu(inw(port)); *addr++ = inw(port);
addr = (unsigned short *)runtime->dma_area; addr = (unsigned short *)runtime->dma_area;
pipe->hw_ptr = 0; pipe->hw_ptr = 0;
} }
@ -425,12 +425,12 @@ static void vxp_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
count >>= 1; /* in 16bit words */ count >>= 1; /* in 16bit words */
/* Transfer using pseudo-dma. */ /* Transfer using pseudo-dma. */
for (; count > 1; count--) for (; count > 1; count--)
*addr++ = le16_to_cpu(inw(port)); *addr++ = inw(port);
/* Disable DMA */ /* Disable DMA */
pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK; pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK;
vx_outb(chip, DIALOG, pchip->regDIALOG); vx_outb(chip, DIALOG, pchip->regDIALOG);
/* Read the last word (16 bits) */ /* Read the last word (16 bits) */
*addr = le16_to_cpu(inw(port)); *addr = inw(port);
/* Disable 16-bit accesses */ /* Disable 16-bit accesses */
pchip->regDIALOG &= ~VXP_DLG_DMA16_SEL_MASK; pchip->regDIALOG &= ~VXP_DLG_DMA16_SEL_MASK;
vx_outb(chip, DIALOG, pchip->regDIALOG); vx_outb(chip, DIALOG, pchip->regDIALOG);