ALSA: hda: Set fifo_size for both playback and capture streams
authorTakashi Iwai <tiwai@suse.de>
Mon, 12 Aug 2019 16:01:47 +0000 (18:01 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Aug 2019 16:01:47 +0000 (18:01 +0200)
Currently we set hdac_stream.fifo_size field only for the playback
stream by some odd reason I forgot, while this field isn't referred in
any places.  Actually this fifo_size field would have been required in
the position report correction for VIA chipset, but due to the lack of
the fifo_size set for capture streams, snd-hda-intel driver fetches
the register by itself.

This patch straightens and simplifies the code by setting the
fifo_size field for both playback and capture streams, and use it in
the HD-audio controller driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/hdac_stream.c
sound/pci/hda/hda_intel.c

index fc68d4ce0a373c759558bbddaeb8b0ec3ab0f3d0..d8fe7ff0cd58c35c5eaf8efc90af122d8c70f3e5 100644 (file)
@@ -229,11 +229,7 @@ int snd_hdac_stream_setup(struct hdac_stream *azx_dev)
        /* set the interrupt enable bits in the descriptor control register */
        snd_hdac_stream_updatel(azx_dev, SD_CTL, 0, SD_INT_MASK);
 
-       if (azx_dev->direction == SNDRV_PCM_STREAM_PLAYBACK)
-               azx_dev->fifo_size =
-                       snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE) + 1;
-       else
-               azx_dev->fifo_size = 0;
+       azx_dev->fifo_size = snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE) + 1;
 
        /* when LPIB delay correction gives a small negative value,
         * we ignore it; currently set the threshold statically to
index 3a209e07d5d87be11bf52e22f464fddf899ed895..dc8a83cb739341166d66ca0ebd439ed70e1430f2 100644 (file)
@@ -84,8 +84,6 @@ enum {
 #define INTEL_SCH_HDA_DEVC      0x78
 #define INTEL_SCH_HDA_DEVC_NOSNOOP       (0x1<<11)
 
-/* Define IN stream 0 FIFO size offset in VIA controller */
-#define VIA_IN_STREAM0_FIFO_SIZE_OFFSET        0x90
 /* Define VIA HD Audio Device ID*/
 #define VIA_HDAC_DEVICE_ID             0x3288
 
@@ -811,11 +809,7 @@ static unsigned int azx_via_get_position(struct azx *chip,
        mod_dma_pos = le32_to_cpu(*azx_dev->core.posbuf);
        mod_dma_pos %= azx_dev->core.period_bytes;
 
-       /* azx_dev->fifo_size can't get FIFO size of in stream.
-        * Get from base address + offset.
-        */
-       fifo_size = readw(azx_bus(chip)->remap_addr +
-                         VIA_IN_STREAM0_FIFO_SIZE_OFFSET);
+       fifo_size = azx_stream(azx_dev)->fifo_size - 1;
 
        if (azx_dev->insufficient) {
                /* Link position never gather than FIFO size */