Merge branch 'for-linus' into topic/virmidi
authorTakashi Iwai <tiwai@suse.de>
Sun, 29 Jul 2018 20:38:54 +0000 (22:38 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sun, 29 Jul 2018 20:39:29 +0000 (22:39 +0200)
Pull the latest ALSA sequencer fixes for the further development of
virmidi.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/memalloc.c
sound/core/seq/oss/seq_oss.c
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_virmidi.c
sound/pci/cs5535audio/cs5535audio.h
sound/pci/cs5535audio/cs5535audio_pcm.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_realtek.c
sound/pci/vx222/vx222_ops.c
sound/pcmcia/vx/vxp_ops.c

index 7f89d3c..753d5fc 100644 (file)
@@ -242,16 +242,12 @@ int snd_dma_alloc_pages_fallback(int type, struct device *device, size_t size,
        int err;
 
        while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) {
-               size_t aligned_size;
                if (err != -ENOMEM)
                        return err;
                if (size <= PAGE_SIZE)
                        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)
                return -ENOMEM;
index 5f64d0d..e1f44fc 100644 (file)
@@ -203,7 +203,7 @@ odev_poll(struct file *file, poll_table * wait)
        struct seq_oss_devinfo *dp;
        dp = file->private_data;
        if (snd_BUG_ON(!dp))
-               return -ENXIO;
+               return EPOLLERR;
        return snd_seq_oss_poll(dp, file, wait);
 }
 
index 56ca784..6fd4b07 100644 (file)
@@ -1101,7 +1101,7 @@ static __poll_t snd_seq_poll(struct file *file, poll_table * wait)
 
        /* check client structures are in place */
        if (snd_BUG_ON(!client))
-               return -ENXIO;
+               return EPOLLERR;
 
        if ((snd_seq_file_flags(file) & SNDRV_SEQ_LFLG_INPUT) &&
            client->data.user.fifo) {
index 289ae6b..8ebbca5 100644 (file)
@@ -163,6 +163,7 @@ static void snd_virmidi_output_trigger(struct snd_rawmidi_substream *substream,
        int count, res;
        unsigned char buf[32], *pbuf;
        unsigned long flags;
+       bool check_resched = !in_atomic();
 
        if (up) {
                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;
                                }
                        }
+                       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:
                spin_unlock_irqrestore(&substream->runtime->lock, flags);
index f4fcdf9..d84620a 100644 (file)
@@ -67,9 +67,9 @@ struct cs5535audio_dma_ops {
 };
 
 struct cs5535audio_dma_desc {
-       u32 addr;
-       u16 size;
-       u16 ctlreserved;
+       __le32 addr;
+       __le16 size;
+       __le16 ctlreserved;
 };
 
 struct cs5535audio_dma {
index ee7065f..326caec 100644 (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->size = 0;
        lastdesc->ctlreserved = cpu_to_le16(PRD_JMP);
-       jmpprd_addr = cpu_to_le32(lastdesc->addr +
-                                 (sizeof(struct cs5535audio_dma_desc)*periods));
+       jmpprd_addr = (u32)dma->desc_buf.addr +
+               sizeof(struct cs5535audio_dma_desc) * periods;
 
        dma->substream = substream;
        dma->period_bytes = period_bytes;
index 08e32be..cfd4e4f 100644 (file)
@@ -177,6 +177,7 @@ static void cx_auto_reboot_notify(struct hda_codec *codec)
        struct conexant_spec *spec = codec->spec;
 
        switch (codec->core.vendor_id) {
+       case 0x14f12008: /* CX8200 */
        case 0x14f150f2: /* CX20722 */
        case 0x14f150f4: /* CX20724 */
                break;
@@ -184,13 +185,14 @@ static void cx_auto_reboot_notify(struct hda_codec *codec)
                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 */
        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_write(codec, codec->core.afg, 0,
                            AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
+       msleep(10);
 }
 
 static void cx_auto_free(struct hda_codec *codec)
index db625d0..e2d0b2f 100644 (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(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, 0x95e1, "Clevo P95xER", 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(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
index d4298af..c0d0bf4 100644 (file)
@@ -275,7 +275,7 @@ static void vx2_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
                length >>= 2; /* in 32bit words */
                /* Transfer using pseudo-dma. */
                for (; length > 0; length--) {
-                       outl(cpu_to_le32(*addr), port);
+                       outl(*addr, port);
                        addr++;
                }
                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 */
        /* Transfer using pseudo-dma. */
        for (; count > 0; count--) {
-               outl(cpu_to_le32(*addr), port);
+               outl(*addr, port);
                addr++;
        }
 
@@ -313,7 +313,7 @@ static void vx2_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
                length >>= 2; /* in 32bit words */
                /* Transfer using pseudo-dma. */
                for (; length > 0; length--)
-                       *addr++ = le32_to_cpu(inl(port));
+                       *addr++ = inl(port);
                addr = (u32 *)runtime->dma_area;
                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 */
        /* Transfer using pseudo-dma. */
        for (; count > 0; count--)
-               *addr++ = le32_to_cpu(inl(port));
+               *addr++ = inl(port);
 
        vx2_release_pseudo_dma(chip);
 }
index 8cde402..4c4ef1f 100644 (file)
@@ -375,7 +375,7 @@ static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
                length >>= 1; /* in 16bit words */
                /* Transfer using pseudo-dma. */
                for (; length > 0; length--) {
-                       outw(cpu_to_le16(*addr), port);
+                       outw(*addr, port);
                        addr++;
                }
                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 */
        /* Transfer using pseudo-dma. */
        for (; count > 0; count--) {
-               outw(cpu_to_le16(*addr), port);
+               outw(*addr, port);
                addr++;
        }
        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 */
                /* Transfer using pseudo-dma. */
                for (; length > 0; length--)
-                       *addr++ = le16_to_cpu(inw(port));
+                       *addr++ = inw(port);
                addr = (unsigned short *)runtime->dma_area;
                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 */
        /* Transfer using pseudo-dma. */
        for (; count > 1; count--)
-               *addr++ = le16_to_cpu(inw(port));
+               *addr++ = inw(port);
        /* Disable DMA */
        pchip->regDIALOG &= ~VXP_DLG_DMAREAD_SEL_MASK;
        vx_outb(chip, DIALOG, pchip->regDIALOG);
        /* Read the last word (16 bits) */
-       *addr = le16_to_cpu(inw(port));
+       *addr = inw(port);
        /* Disable 16-bit accesses */
        pchip->regDIALOG &= ~VXP_DLG_DMA16_SEL_MASK;
        vx_outb(chip, DIALOG, pchip->regDIALOG);