1. 18 May, 2020 1 commit
    • Brent Lu's avatar
      ALSA: pcm: fix incorrect hw_base increase · e7513c57
      Brent Lu authored
      There is a corner case that ALSA keeps increasing the hw_ptr but DMA
      already stop working/updating the position for a long time.
      
      In following log we can see the position returned from DMA driver does
      not move at all but the hw_ptr got increased at some point of time so
      snd_pcm_avail() will return a large number which seems to be a buffer
      underrun event from user space program point of view. The program
      thinks there is space in the buffer and fill more data.
      
      [  418.510086] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368
      [  418.510149] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6910 avail 9554
      ...
      [  418.681052] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362
      [  418.681130] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
      [  418.726515] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368
      
      This is because the hw_base will be increased by runtime->buffer_size
      frames unconditionally if the hw_ptr is not updated for over half of
      buffer time. As the hw_base increases, so does the hw_ptr increased
      by the same number.
      
      The avail value returned from snd_pcm_avail() could exceed the limit
      (buffer_size) easily becase the hw_ptr itself got increased by same
      buffer_size samples when the corner case happens. In following log,
      the buffer_size is 16368 samples but the avail is 21810 samples so
      CRAS server complains about it.
      
      [  418.851755] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 27390 avail 5442
      [  418.926491] sound pcmC0D5p: pos 96 hw_ptr 32832 appl_ptr 27390 avail 21810
      
      cras_server[1907]: pcm_avail returned frames larger than buf_size:
      sof-glkda7219max: :0,5: 21810 > 16368
      
      By updating runtime->hw_ptr_jiffies each time the HWSYNC is called,
      the hw_base will keep the same when buffer stall happens at long as
      the interval between each HWSYNC call is shorter than half of buffer
      time.
      
      Following is a log captured by a patched kernel. The hw_base/hw_ptr
      value is fixed in this corner case and user space program should be
      aware of the buffer stall and handle it.
      
      [  293.525543] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368
      [  293.525606] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6880 avail 9584
      [  293.525975] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 10976 avail 5488
      [  293.611178] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15072 avail 1392
      [  293.696429] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
      ...
      [  381.139517] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
      Signed-off-by: default avatarBrent Lu <brent.lu@intel.com>
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/1589776238-23877-1-git-send-email-brent.lu@intel.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e7513c57
  2. 14 May, 2020 1 commit
  3. 12 May, 2020 4 commits
  4. 10 May, 2020 1 commit
  5. 07 May, 2020 1 commit
  6. 04 May, 2020 1 commit
  7. 03 May, 2020 3 commits
  8. 01 May, 2020 1 commit
  9. 30 Apr, 2020 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Correct a typo of NuPrime DAC-10 USB ID · 547d2c9c
      Takashi Iwai authored
      The USB vendor ID of NuPrime DAC-10 is not 16b0 but 16d0.
      
      Fixes: f656891c ("ALSA: usb-audio: add more quirks for DSD interfaces")
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200430124755.15940-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      547d2c9c
    • Arnd Bergmann's avatar
      ALSA: opti9xx: shut up gcc-10 range warning · 5ce00760
      Arnd Bergmann authored
      gcc-10 points out a few instances of suspicious integer arithmetic
      leading to value truncation:
      
      sound/isa/opti9xx/opti92x-ad1848.c: In function 'snd_opti9xx_configure':
      sound/isa/opti9xx/opti92x-ad1848.c:322:43: error: overflow in conversion from 'int' to 'unsigned char' changes value from '(int)snd_opti9xx_read(chip, 3) & -256 | 240' to '240' [-Werror=overflow]
        322 |   (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
            |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/opti92x-ad1848.c:351:3: note: in expansion of macro 'snd_opti9xx_write_mask'
        351 |   snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
            |   ^~~~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/miro.c: In function 'snd_miro_configure':
      sound/isa/opti9xx/miro.c:873:40: error: overflow in conversion from 'int' to 'unsigned char' changes value from '(int)snd_miro_read(chip, 3) & -256 | 240' to '240' [-Werror=overflow]
        873 |   (snd_miro_read(chip, reg) & ~(mask)) | ((value) & (mask)))
            |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      sound/isa/opti9xx/miro.c:1010:3: note: in expansion of macro 'snd_miro_write_mask'
       1010 |   snd_miro_write_mask(chip, OPTi9XX_MC_REG(3), 0xf0, 0xff);
            |   ^~~~~~~~~~~~~~~~~~~
      
      These are all harmless here as only the low 8 bit are passed down
      anyway. Change the macros to inline functions to make the code
      more readable and also avoid the warning.
      
      Strictly speaking those functions also need locking to make the
      read/write pair atomic, but it seems unlikely that anyone would
      still run into that issue.
      
      Fixes: 1841f613 ("[ALSA] Add snd-miro driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20200429190216.85919-1-arnd@arndb.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5ce00760
  10. 29 Apr, 2020 1 commit
  11. 28 Apr, 2020 1 commit
  12. 27 Apr, 2020 1 commit
  13. 26 Apr, 2020 1 commit
  14. 24 Apr, 2020 4 commits
  15. 23 Apr, 2020 3 commits
  16. 22 Apr, 2020 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add connector notifier delegation · fef66ae7
      Takashi Iwai authored
      It turned out that ALC1220-VB USB-audio device gives the interrupt
      event to some PCM terminals while those don't allow the connector
      state request but only the actual I/O terminals return the request.
      The recent commit 7dc3c5a0 ("ALSA: usb-audio: Don't create jack
      controls for PCM terminals") excluded those phantom terminals, so
      those events are ignored, too.
      
      My first thought was that this could be easily deduced from the
      associated terminals, but some of them have even no associate terminal
      ID, hence it's not too trivial to figure out.
      
      Since the number of such terminals are small and limited, this patch
      implements another quirk table for the simple mapping of the
      connectors.  It's not really scalable, but let's hope that there will
      be not many such funky devices in future.
      
      Fixes: 7dc3c5a0 ("ALSA: usb-audio: Don't create jack controls for PCM terminals")
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206873
      Link: https://lore.kernel.org/r/20200422113320.26664-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fef66ae7
  17. 21 Apr, 2020 5 commits
  18. 20 Apr, 2020 8 commits
    • YueHaibing's avatar
      ASoC: wm89xx: Add missing dependency · 9bff3d30
      YueHaibing authored
      sound/soc/codecs/wm8900.o: In function `wm8900_i2c_probe':
      wm8900.c:(.text+0xa36): undefined reference to `__devm_regmap_init_i2c'
      sound/soc/codecs/wm8900.o: In function `wm8900_modinit':
      wm8900.c:(.init.text+0xb): undefined reference to `i2c_register_driver'
      sound/soc/codecs/wm8900.o: In function `wm8900_exit':
      wm8900.c:(.exit.text+0x8): undefined reference to `i2c_del_driver'
      sound/soc/codecs/wm8988.o: In function `wm8988_i2c_probe':
      wm8988.c:(.text+0x857): undefined reference to `__devm_regmap_init_i2c'
      sound/soc/codecs/wm8988.o: In function `wm8988_modinit':
      wm8988.c:(.init.text+0xb): undefined reference to `i2c_register_driver'
      sound/soc/codecs/wm8988.o: In function `wm8988_exit':
      wm8988.c:(.exit.text+0x8): undefined reference to `i2c_del_driver'
      sound/soc/codecs/wm8995.o: In function `wm8995_i2c_probe':
      wm8995.c:(.text+0x1c4f): undefined reference to `__devm_regmap_init_i2c'
      sound/soc/codecs/wm8995.o: In function `wm8995_modinit':
      wm8995.c:(.init.text+0xb): undefined reference to `i2c_register_driver'
      sound/soc/codecs/wm8995.o: In function `wm8995_exit':
      wm8995.c:(.exit.text+0x8): undefined reference to `i2c_del_driver'
      
      Add SND_SOC_I2C_AND_SPI dependency to fix this.
      
      Fixes: ea00d952 ("ASoC: Use imply for SND_SOC_ALL_CODECS")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Link: https://lore.kernel.org/r/20200420125343.20920-1-yuehaibing@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      9bff3d30
    • Mark Brown's avatar
      Merge series "ASoC: rsnd: multi-SSI setup fixes" from Matthias Blankertz... · bce32169
      Mark Brown authored
      Merge series "ASoC: rsnd: multi-SSI setup fixes" from Matthias Blankertz <matthias.blankertz@cetitec.com>:
      
      Fix rsnd_dai_call() operations being performed twice for the master SSI
      in multi-SSI setups, and fix the rsnd_ssi_stop operation for multi-SSI
      setups.
      The only visible effect of these issues was some "status check failed"
      spam when the rsnd_ssi_stop was called, but overall the code is cleaner
      now, and some questionable writes to the SSICR register which did not
      lead to any observable misbehaviour but were contrary to the datasheet
      are fixed.
      
      Mark:
      The first patch kind of reverts my "ASoC: rsnd: Fix parent SSI
      start/stop in multi-SSI mode" from a few days ago and achieves the same
      effect in a simpler fashion, if you would prefer a clean patch series
      based on v5.6 drop me a note.
      
      Greetings,
      	Matthias
      
      Matthias Blankertz (2):
        ASoC: rsnd: Don't treat master SSI in multi SSI setup as parent
        ASoC: rsnd: Fix "status check failed" spam for multi-SSI
      
       sound/soc/sh/rcar/ssi.c | 18 +++++++++++++-----
       1 file changed, 13 insertions(+), 5 deletions(-)
      
      base-commit: 15a5760c
      --
      2.26.1
      bce32169
    • Mark Brown's avatar
      Merge series "ASoC: meson: fix codec-to-codec link setup" from Jerome Brunet... · 036889b2
      Mark Brown authored
      Merge series "ASoC: meson: fix codec-to-codec link setup" from Jerome Brunet <jbrunet@baylibre.com>:
      
      This patchset fixes the problem reported by Marc in this thread [0]
      The problem was due to an error in the meson card drivers which had
      the "no_pcm" dai_link property set on codec-to-codec links
      
      [0]: https://lore.kernel.org/r/20200417122732.GC5315@sirena.org.uk
      
      Jerome Brunet (2):
        ASoC: meson: axg-card: fix codec-to-codec link setup
        ASoC: meson: gx-card: fix codec-to-codec link setup
      
       sound/soc/meson/axg-card.c | 4 +++-
       sound/soc/meson/gx-card.c  | 4 +++-
       2 files changed, 6 insertions(+), 2 deletions(-)
      
      --
      2.25.2
      036889b2
    • Gyeongtaek Lee's avatar
      ASoC: dapm: fixup dapm kcontrol widget · ebf14747
      Gyeongtaek Lee authored
      snd_soc_dapm_kcontrol widget which is created by autodisable control
      should contain correct on_val, mask and shift because it is set when the
      widget is powered and changed value is applied on registers by following
      code in dapm_seq_run_coalesced().
      
      		mask |= w->mask << w->shift;
      		if (w->power)
      			value |= w->on_val << w->shift;
      		else
      			value |= w->off_val << w->shift;
      
      Shift on the mask in dapm_kcontrol_data_alloc() is removed to prevent
      double shift.
      And, on_val in dapm_kcontrol_set_value() is modified to get correct
      value in the dapm_seq_run_coalesced().
      Signed-off-by: default avatarGyeongtaek Lee <gt82.lee@samsung.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/000001d61537$b212f620$1638e260$@samsung.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      ebf14747
    • Matthias Blankertz's avatar
      ASoC: rsnd: Fix "status check failed" spam for multi-SSI · 54cb6221
      Matthias Blankertz authored
      Fix the rsnd_ssi_stop function to skip disabling the individual SSIs of
      a multi-SSI setup, as the actual stop is performed by rsnd_ssiu_stop_gen2
      - the same logic as in rsnd_ssi_start. The attempt to disable these SSIs
      was harmless, but caused a "status check failed" message to be printed
      for every SSI in the multi-SSI setup.
      The disabling of interrupts is still performed, as they are enabled for
      all SSIs in rsnd_ssi_init, but care is taken to not accidentally set the
      EN bit for an SSI where it was not set by rsnd_ssi_start.
      Signed-off-by: default avatarMatthias Blankertz <matthias.blankertz@cetitec.com>
      Acked-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/20200417153017.1744454-3-matthias.blankertz@cetitec.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      54cb6221
    • Matthias Blankertz's avatar
      ASoC: rsnd: Don't treat master SSI in multi SSI setup as parent · 0c258657
      Matthias Blankertz authored
      The master SSI of a multi-SSI setup was attached both to the
      RSND_MOD_SSI slot and the RSND_MOD_SSIP slot of the rsnd_dai_stream.
      This is not correct wrt. the meaning of being "parent" in the rest of
      the SSI code, where it seems to indicate an SSI that provides clock and
      word sync but is not transmitting/receiving audio data.
      
      Not treating the multi-SSI master as parent allows removal of various
      special cases to the rsnd_ssi_is_parent conditions introduced in commit
      a09fb3f2 ("ASoC: rsnd: Fix parent SSI start/stop in multi-SSI mode").
      It also fixes the issue that operations performed via rsnd_dai_call()
      were performed twice for the master SSI. This caused some "status check
      failed" spam when stopping a multi-SSI stream as the driver attempted to
      stop the master SSI twice.
      Signed-off-by: default avatarMatthias Blankertz <matthias.blankertz@cetitec.com>
      Acked-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/20200417153017.1744454-2-matthias.blankertz@cetitec.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      0c258657
    • Jerome Brunet's avatar
      ASoC: meson: gx-card: fix codec-to-codec link setup · de911b4e
      Jerome Brunet authored
      Since the addition of commit 9b5db059 ("ASoC: soc-pcm: dpcm: Only allow
      playback/capture if supported"), meson-axg cards which have codec-to-codec
      links fail to init and Oops.
      
        Unable to handle kernel NULL pointer dereference at virtual address 0000000000000128
        Internal error: Oops: 96000044 [#1] PREEMPT SMP
        CPU: 3 PID: 1582 Comm: arecord Not tainted 5.7.0-rc1
        pc : invalidate_paths_ep+0x30/0xe0
        lr : snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
        Call trace:
         invalidate_paths_ep+0x30/0xe0
         snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
         dpcm_path_get+0x38/0xd0
         dpcm_fe_dai_open+0x70/0x920
         snd_pcm_open_substream+0x564/0x840
         snd_pcm_open+0xfc/0x228
         snd_pcm_capture_open+0x4c/0x78
         snd_open+0xac/0x1a8
         ...
      
      While this error was initially reported the axg-card type, it also applies
      to the gx-card type.
      
      While initiliazing the links, ASoC treats the codec-to-codec links of this
      card type as a DPCM backend. This error eventually leads to the Oops.
      
      Most of the card driver code is shared between DPCM backends and
      codec-to-codec links. The property "no_pcm" marking DCPM BE was left set on
      codec-to-codec links, leading to this problem. This commit fixes that.
      
      Fixes: e37a0c31 ("ASoC: meson: gx: add sound card support")
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Link: https://lore.kernel.org/r/20200420114511.450560-3-jbrunet@baylibre.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      de911b4e
    • Jerome Brunet's avatar
      ASoC: meson: axg-card: fix codec-to-codec link setup · 11642842
      Jerome Brunet authored
      Since the addition of commit 9b5db059 ("ASoC: soc-pcm: dpcm: Only allow
      playback/capture if supported"), meson-axg cards which have codec-to-codec
      links fail to init and Oops:
      
        Unable to handle kernel NULL pointer dereference at virtual address 0000000000000128
        Internal error: Oops: 96000044 [#1] PREEMPT SMP
        CPU: 3 PID: 1582 Comm: arecord Not tainted 5.7.0-rc1
        pc : invalidate_paths_ep+0x30/0xe0
        lr : snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
        Call trace:
         invalidate_paths_ep+0x30/0xe0
         snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
         dpcm_path_get+0x38/0xd0
         dpcm_fe_dai_open+0x70/0x920
         snd_pcm_open_substream+0x564/0x840
         snd_pcm_open+0xfc/0x228
         snd_pcm_capture_open+0x4c/0x78
         snd_open+0xac/0x1a8
         ...
      
      While initiliazing the links, ASoC treats the codec-to-codec links of this
      card type as a DPCM backend. This error eventually leads to the Oops.
      
      Most of the card driver code is shared between DPCM backends and
      codec-to-codec links. The property "no_pcm" marking DCPM BE was left set on
      codec-to-codec links, leading to this problem. This commit fixes that.
      
      Fixes: 0a8f1117 ("ASoC: meson: axg-card: add basic codec-to-codec link support")
      Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Link: https://lore.kernel.org/r/20200420114511.450560-2-jbrunet@baylibre.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      11642842