1. 28 Nov, 2017 1 commit
  2. 23 Nov, 2017 2 commits
  3. 22 Nov, 2017 2 commits
    • Takashi Iwai's avatar
      ALSA: hda - Fix yet remaining issue with vmaster 0dB initialization · d6c0615f
      Takashi Iwai authored
      The previous fix for addressing the breakage in vmaster slave
      initialization, commit a91d6612 ("ALSA: hda - Fix incorrect TLV
      callback check introduced during set_fs() removal"), introduced a new
      helper to process over each slave kctl.  However, this helper passes
      only the original kctl, not the virtual slave kctl.  As a result,
      HD-audio driver (which is the only user so far) couldn't initialize
      the slave correctly because it's trying to update the value directly
      with the original kctl, not with the mapped kctl.
      This patch fixes the situation again by passing both the mapped slaved
      and original slave kctls to the function.  Luckily there is a single
      caller as of now, so changing the call signature is no big matter.
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=197959
      Fixes: a91d6612 ("ALSA: hda - Fix incorrect TLV callback check introduced during set_fs() removal")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Kees Cook's avatar
      treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts · 841b86f3
      Kees Cook authored
      With all callbacks converted, and the timer callback prototype
      switched over, the TIMER_FUNC_TYPE cast is no longer needed,
      so remove it. Conversion was done with the following scripts:
          perl -pi -e 's|\(TIMER_FUNC_TYPE\)||g' \
              $(git grep TIMER_FUNC_TYPE | cut -d: -f1 | sort -u)
          perl -pi -e 's|\(TIMER_DATA_TYPE\)||g' \
              $(git grep TIMER_DATA_TYPE | cut -d: -f1 | sort -u)
      The now unused macros are also dropped from include/linux/timer.h.
      Signed-off-by: 's avatarKees Cook <keescook@chromium.org>
  4. 21 Nov, 2017 6 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add sanity checks in v2 clock parsers · 0a62d6c9
      Takashi Iwai authored
      The helper functions to parse and look for the clock source, selector
      and multiplier unit may return the descriptor with a too short length
      than required, while there is no sanity check in the caller side.
      Add some sanity checks in the parsers, at least, to guarantee the
      given descriptor size, for avoiding the potential crashes.
      Fixes: 79f920fb ("ALSA: usb-audio: parse clock topology of UAC2 devices")
      Reported-by: 's avatarAndrey Konovalov <andreyknvl@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix potential zero-division at parsing FU · 8428a8eb
      Takashi Iwai authored
      parse_audio_feature_unit() contains a code dividing potentially with
      zero when a malformed FU descriptor is passed.  Although there is
      already a sanity check, it checks only the value zero, hence it can
      still lead to a zero-division when a value 1 is passed there.
      Fix it by correcting the sanity check (and the error message
      Fixes: 23caaf19 ("ALSA: usb-mixer: Add support for Audio Class v2.0")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix potential out-of-bound access at parsing SU · f658f17b
      Takashi Iwai authored
      The usb-audio driver may trigger an out-of-bound access at parsing a
      malformed selector unit, as it checks the header length only after
      evaluating bNrInPins field, which can be already above the given
      length.  Fix it by adding the length check beforehand.
      Fixes: 99fc8645 ("ALSA: usb-mixer: parse descriptors with structs")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add sanity checks to FE parser · d937cd67
      Takashi Iwai authored
      When the usb-audio descriptor contains the malformed feature unit
      description with a too short length, the driver may access
      out-of-bounds.  Add a sanity check of the header size at the beginning
      of parse_audio_feature_unit().
      Fixes: 23caaf19 ("ALSA: usb-mixer: Add support for Audio Class v2.0")
      Reported-by: 's avatarAndrey Konovalov <andreyknvl@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Takashi Iwai's avatar
      ALSA: timer: Remove kernel warning at compat ioctl error paths · 3d4e8303
      Takashi Iwai authored
      Some timer compat ioctls have NULL checks of timer instance with
      snd_BUG_ON() that bring up WARN_ON() when the debug option is set.
      Actually the condition can be met in the normal situation and it's
      confusing and bad to spew kernel warnings with stack trace there.
      Let's remove snd_BUG_ON() invocation and replace with the simple
      checks.  Also, correct the error code to EBADFD to follow the native
      ioctl error handling.
      Reported-by: 's avatarsyzbot <syzkaller@googlegroups.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Henrik Eriksson's avatar
      ALSA: pcm: update tstamp only if audio_tstamp changed · 20e3f985
      Henrik Eriksson authored
      commit 3179f620 ("ALSA: core: add .get_time_info") had a side effect
      of changing the behaviour of the PCM runtime tstamp.  Prior to this
      change tstamp was not updated by snd_pcm_update_hw_ptr0() unless the
      hw_ptr had moved, after this change tstamp was always updated.
      For an application using alsa-lib, doing snd_pcm_readi() followed by
      snd_pcm_status() to estimate the age of the read samples by subtracting
      status->avail * [sample rate] from status->tstamp this change degraded
      the accuracy of the estimate on devices where the pcm hw does not
      provide a granular hw_ptr, e.g., devices using
      soc-generic-dmaengine-pcm.c and a dma-engine with residue_granularity
      DMA_RESIDUE_GRANULARITY_DESCRIPTOR.  The accuracy of the estimate
      depended on the latency between the PCM hw completing a period and the
      driver called snd_pcm_period_elapsed() to notify ALSA core, typically
      determined by interrupt handling latency.  After the change the accuracy
      of the estimate depended on the latency between the PCM hw completing a
      period and the application calling snd_pcm_status(), determined by the
      scheduling of the application process.  The maximum error of the
      estimate is one period length in both cases, but the error average and
      variance is smaller when it depends on interrupt latency.
      Instead of always updating tstamp, update it only if audio_tstamp
      Fixes: 3179f620 ("ALSA: core: add .get_time_info")
      Suggested-by: 's avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: 's avatarHenrik Eriksson <henrik.eriksson@axis.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
  5. 20 Nov, 2017 1 commit
  6. 17 Nov, 2017 2 commits
    • Takashi Iwai's avatar
      ALSA: hda: Fix too short HDMI/DP chmap reporting · c2432466
      Takashi Iwai authored
      We got a regression report about the HD-audio HDMI chmap, where some
      surround channels are reported as UNKNOWN.  The git bisection pointed
      the culprit at the commit 9b3dc8aa ("ALSA: hda - Register chmap
      obj as priv data instead of codec").  The story behind scene is like
      - While moving the code out of the legacy HDA to the HDA common place,
        the patch modifies the code to obtain the chmap array indirectly in
        a byte array, and it expands it to kctl value array.
      - At the latter operation, the size of the array is wrongly passed by
        sizeof() to the pointer.
      - It can be 4 on 32bit arch, thus too short for 6+ channels.
        (And that's the reason why it didn't hit other persons; it's 8 on
        64bit arch, thus it's usually enough.)
      The code was further changed meanwhile, but the problem persisted.
      Let's fix it by correctly evaluating the array size.
      Fixes: 9b3dc8aa ("ALSA: hda - Register chmap obj as priv data instead of codec")
      Reported-by: 's avatarVDR User <user.vdr@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
    • Julian Scheel's avatar
      ALSA: usb-audio: uac1: Invalidate ctl on interrupt · b2500b58
      Julian Scheel authored
      When an interrupt occurs, the value of at least one of the belonging
      controls should have changed. To make sure they get re-read from device
      on the next read, invalidate the cache. This was correctly implemented
      for uac2 already, but missing for uac1.
      Signed-off-by: 's avatarJulian Scheel <julian@jusst.de>
      Signed-off-by: 's avatarTakashi Iwai <tiwai@suse.de>
  7. 15 Nov, 2017 2 commits
  8. 10 Nov, 2017 8 commits
    • Matthias Reichl's avatar
      ASoC: bcm2835: Support left/right justified and DSP modes · abd4f0e1
      Matthias Reichl authored
      DSP modes and left/right justified modes can be supported
      on bcm2835 by configuring the frame sync polarity and
      frame sync length registers and by adjusting the
      channel data position registers.
      Clock and frame sync polarity handling in hw_params has
      been refactored to make the interaction between logical
      rising/falling edge frame start and physical configuration
      (changed by normal/inverted polarity modes) clearer.
      Modes where the first active data bit is transmitted immediately
      after frame start (eg DSP mode B with slot 0 active)
      only work reliable if bcm2835 is configured as frame master.
      In frame slave mode channel swap (or shift, this isn't quite
      clear yet) can occur.
      Currently the driver only warns if an unstable configuration
      is detected but doensn't prevent using them.
      Signed-off-by: 's avatarMatthias Reichl <hias@horus.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • Matthias Reichl's avatar
      ASoC: bcm2835: Enforce full symmetry · 3d2b3c70
      Matthias Reichl authored
      bcm2835's configuration registers can't be changed when a stream
      is running, which means asymmetric configurations aren't supported.
      Channel and rate symmetry are already enforced by constraints
      but samplebits had been missed.
      As hw_params doesn't check for symmetry constraints by itself
      and just returns success if a stream is running this led to
      situations where asymmetric configurations were seeming to
      succeed but of course didn't work because the hardware wasn't
      configured at all.
      Fix this by adding the missing samplerate symmetry constraint.
      Signed-off-by: 's avatarMatthias Reichl <hias@horus.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • Matthias Reichl's avatar
      ASoC: bcm2835: Support additional samplerates up to 384kHz · 675c0ee5
      Matthias Reichl authored
      Sample rates are only restricted by the capabilities of the
      clock driver, so use SNDRV_PCM_RATE_CONTINUOUS instead of
      Tests (eg with pcm5122) have shown that bcm2835 works fine
      in 384kHz/32bit stereo mode, so change the maximum allowed
      rate from 192kHz to 384kHz.
      Signed-off-by: 's avatarMatthias Reichl <hias@horus.com>
      Reviewed-by: 's avatarEric Anholt <eric@anholt.net>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • Matthias Reichl's avatar
      ASoC: bcm2835: Add support for TDM modes · 9448572d
      Matthias Reichl authored
      bcm2835 supports arbitrary positioning of channel data within
      a frame and thus is capable of supporting TDM modes. Since
      the driver is limited to 2-channel operations only TDM setups
      with exactly 2 active slots are supported.
      Logical TDM slot numbering follows the usual convention:
      For I2S-like modes, with a 50% duty-cycle frame clock,
      slots 0, 2, ... are transmitted in the first half of a frame,
      slots 1, 3, ... are transmitted in the second half.
      For DSP modes slot numbering is ascending: 0, 1, 2, 3, ...
      Channel position calculation has been refactored to use
      TDM info and moved out of hw_params.
      set_tdm_slot, set_bclk_ratio and hw_params now check more
      strictly if the configuration is valid. Illegal configurations
      like odd number of slots in I2S mode, data lengths exceeding
      slot width or frame sizes larger than the hardware limit of
      1024 are rejected. Also hw_params now properly checks for
      errors from clk_set_rate.
      Allowed PCM formats are already guarded by stream constraints,
      thus the formats check in hw_params has been removed and
      data_length is now retrieved via params_width().
      Also standard functions like snd_soc_params_to_bclk are now
      being used instead of manual calculations to make the code
      more readable.
      Special care has been taken to ensure that set_bclk_ratio works
      as before. The bclk ratio is mapped to a 2-channel TDM config
      with a slot width of half the ratio. In order to support odd ratios,
      which can't be expressed via a TDM config, the ratio (frame length)
      is stored and used by hw_params.
      Signed-off-by: 's avatarMatthias Reichl <hias@horus.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • Olivier Moysan's avatar
      ASoC: add mclk-fs support to audio graph card · 757652dd
      Olivier Moysan authored
      Add mclk-fs support to audio graph card
      as it was previously implemented in simple card.
      Signed-off-by: 's avatarOlivier Moysan <olivier.moysan@st.com>
      Acked-by: 's avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • Arnd Bergmann's avatar
      ASoC: rt5514: work around link error · c5630877
      Arnd Bergmann authored
      The main rt5514 driver optionally calls into the SPI back-end to load
      the firmware. This causes a link error when one driver selects rt5514
      as built-in and another driver selects rt5514-spi as a loadable module:
      sound/soc/codecs/rt5514.o: In function `rt5514_dsp_voice_wake_up_put':
      rt5514.c:(.text+0xac8): undefined reference to `rt5514_spi_burst_write'
      As a workaround, this adds another silent symbol, to force rt5514-spi
      to be built-in for that configuration. I'm not overly happy with
      that solution, but couldn't come up with anything better. Using
      'IS_REACHABLE()' would break the case that relies on the loadable
      module, and all other ideas would result in more complexity.
      Signed-off-by: 's avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • Arnd Bergmann's avatar
      ASoC: rt5514: mark PM functions as __maybe_unused · 7e6358ec
      Arnd Bergmann authored
      The new functions are only used when CONFIG_PM is enabled,
      leading to a harmless warning:
      sound/soc/codecs/rt5514-spi.c:474:12: error: 'rt5514_resume' defined but not used [-Werror=unused-function]
      sound/soc/codecs/rt5514-spi.c:464:12: error: 'rt5514_suspend' defined but not used [-Werror=unused-function]
      This marks them as __maybe_unused to make the build silent
      Fixes: 58f1c07d ("ASoC: rt5514: Voice wakeup support.")
      Signed-off-by: 's avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
    • oder_chiou@realtek.com's avatar
      ASoC: rt5663: Check the JD status in the button pushing · de6ae8af
      oder_chiou@realtek.com authored
      Check the JD status in the button pushing to prevent the IRQ that is locked
      by button pushing event while the jack unpluging.
      Signed-off-by: 's avatarOder Chiou <oder_chiou@realtek.com>
      Signed-off-by: 's avatarMark Brown <broonie@kernel.org>
  9. 09 Nov, 2017 8 commits
  10. 08 Nov, 2017 8 commits