Commit graph

37138 commits

Author SHA1 Message Date
Samuel Holland
d58b724708
ASoC: sun8i-codec: Sort DAPM controls, widgets, and routes
Sort the remaining pieces of the DAPM driver so that they are all in the
same order among controls/widgets/routes, and so they roughly match the
register word and bit order of the hardware. This nicely separates the
AIF-related widgets from the ADC/DAC widgets, which allows the AIF
widgets to stay in a logical order as more AIFs are added to the driver.

No widgets are renamed, to ease verification that this commit makes no
functional change.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20201001021148.15852-4-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-05 14:16:16 +01:00
Samuel Holland
ed3caa3bd4
ASoC: sun8i-codec: Swap module clock/reset dependencies
This matches the module power-up/down sequence from the vendor's driver.

While updating these widgets/routes, reorder them to match the register
and bit layout of the hardware. This puts them in the same place in the
widget and route arrays (previously they were at opposite ends), and it
makes it easier to track which parts of which registers are implemented.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20201001021148.15852-3-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-05 14:16:15 +01:00
Samuel Holland
d8f006825a
ASoC: sun8i-codec: Set up clock tree at probe time
The sun8i codec is effectively an on-die variant of the X-Powers AC100
codec. The AC100 can derive its clocks from either of two I2S master
clocks or an internal PLL. For the on-die variant, Allwinner replaced
the codec's own PLL with a connection to SoC's existing PLL_AUDIO, and
they connected both I2S MCLK inputs to the same source -- which happens
to be an integer divider from the same PLL_AUDIO.

So there's actually no clocking flexibility. To run SYSCLK at the
required rate, it must be run straight from the PLL. The only choice is
whether it goes through AIF1CLK or AIF2CLK. Since both run at the same
rate, the only effect of that choice is which field in SYS_SR_CTRL
(AIF1_FS or AIF2_FS) controls the system sample rate.

Since AIFnCLK is required to bring up the corresponding DAI, and AIF1
(connected to the CPU) is used most often, let's use AIF1CLK as the
SYSCLK parent. That means we no longer need to set AIF2_FS.

Since this clock tree never changes, we can program it from the
component probe function, instead of using DAPM widgets. The DAPM
widgets unnecessarily change clock parents when the codec goes in/out
of idle and the supply widgets are powered up/down.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20201001021148.15852-2-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-05 14:16:14 +01:00
Greg Kroah-Hartman
168ae5a74b Merge 5.9-rc8 into usb-next
We need the USB fixes in here as well for testing.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-05 08:54:36 +02:00
Mark Brown
f525facaec
Merge series "Add driver for Microchip S/PDIF RX" from Codrin Ciubotariu <codrin.ciubotariu@microchip.com>:
The Sony/Philips Digital Interface Receiver (SPDIFRX) is a serial port
compliant with the IEC-60958 standard. Among its caracteristics, we
mention the following:
 - SPDIF/AES-EBU Compatible Serial Port
 - 32 Samples FIFO
 - Data Width Configurable to 24 bits, 20 bits or 16 bits
 - Packed and Unpacked Data Support for System Memory Optimization
 - Line State Events Report and Source of Interrupt
 - Line Error Rate Report
 - Full Memory Map of 192 bits for Channel 1 and Channel 2 Status and
   User Data
 - First 32-bit Status A, Status B Change Report and Source of Interrupt
 - Line Digital Filter
 - Register Write Protection
 - Abnormal Software Access and Internal Sequencer Integrity Check Reports

This interface is available in Microchip's SAMA7G5 SoC.

Codrin Ciubotariu (2):
  dt-bindings: sound: add DT bindings for Microchip S/PDIF RX Controller
  ASoC: mchp-spdifrx: add driver for SPDIF RX

 .../bindings/sound/mchp,spdifrx.yaml          |  73 ++
 sound/soc/atmel/Kconfig                       |  13 +
 sound/soc/atmel/Makefile                      |   2 +
 sound/soc/atmel/mchp-spdifrx.c                | 954 ++++++++++++++++++
 4 files changed, 1042 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/mchp,spdifrx.yaml
 create mode 100644 sound/soc/atmel/mchp-spdifrx.c

--
2.25.1
2020-10-02 21:05:30 +01:00
Christophe JAILLET
98bd2b506a
ASoC: wm8523: Fix a typo in a comment
It is likely that this header file is about the WM8523.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201002165908.637809-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 21:05:29 +01:00
Mark Brown
1c71497bb5
ASoC: fsl_spdif: Remove unused np
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20201002172841.37344-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 21:05:28 +01:00
Brent Lu
cec6e41ce0
ASoC: hdac_hdmi: remove cancel_work_sync in runtime suspend
A deadlock is identified when there are three contexts running at the
same time:
- a HDMI jack work which is calling snd_soc_dapm_sync().
- user space is calling snd_pcm_release() to close pcm device.
- pm is calling runtime suspend function of HDMI codec driver.

By removing the clear_dapm_works() invocation in the
hdac_hdmi_runtime_suspend() function, the snd_pcm_release() could
always returns from dapm_power_widgets() function call without
blocking the hdac_hdmi_jack_dapm_work() work thread or being blocked
by the hdac_hdmi_runtime_suspend() function. The purpose of the jack
work is to enable/disable the dapm jack pin so it's not necessary to
cancel the work in runtime suspend function which is usually called
when pcm device is closed.

Signed-off-by: Brent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/1594818110-786-1-git-send-email-brent.lu@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 21:05:27 +01:00
Codrin Ciubotariu
ef265c55c1
ASoC: mchp-spdifrx: add driver for SPDIF RX
The new SPDIF RX controller is a serial port compliant with the IEC-60958
standard. It also supports programmable User Data and Channel Status
fields.

This IP is embedded in Microchip's sama7g5 SoC.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20201002160305.815523-3-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 20:45:35 +01:00
Mark Brown
1a4c450e57
Merge series "ASoC: Intel: Catpt - Lynx and Wildcat point" from Cezary Rojewski <cezary.rojewski@intel.com>:
Implement support for Lynxpoint and Wildcat Point AudioDSP. Catpt
solution deprecates existing sound/soc/intel/haswell which is removed in
the following series.

Due to high range of errors and desynchronization from recommendations
set by Windows solution, re-write came as a lower-cost solution compared
to refactoring /haswell/ with several series of patches.

Series is dependent on linux-spi change:
spi: pxa2xx: Add SSC2 and SSPSP2 SSP registers
https://www.spinics.net/lists/linux-spi/msg23885.html
which has been already merged and is now part of linux-spi tree.

Bulk of series content is device driver core code - everything up to
patch 7/14 - with fs entries and trace macros introduced right after.
While each core patch is shaped in such a way that no unavailable
members are ever called, until patch 14/14 is applied, no code
compilation can occur as no Makefile is present. Once said patch is
added, Makefile and Kconfig are implemented and driver module compiles
as expected.

Special thanks go to Marcin Barlik and Piotr Papierkowski for sharing
their LPT/WPT AudioDSP architecture expertise as well as helping
backtrack its historical background.
My thanks go to Amadeusz Slawinski for reviews and improvements proposed
on and off the internal list. Most of internal diff below is his
contribution.
Krzysztof Hejmowski helped me setup my own Xtensa environment and
recompile LPT/WPT FW binary sources what sped up the development greatly.

This would not have been possible without help from these champions,
especially considering how quickly the catpt was written: 2 weeks
features, 3 weeks optimizations. Thank you.

Userspace-exposed members are compatible with what is exposed by
deprecated solution as well as FW binary being re-used thus no harm is
done. The only visible differences are: the newly added 'Loopback Mute'
kcontrol and volume support extending to quad from stereo.

On top of fixing erros and design flows, catpt also adds module reload,
dynamic SRAM memory allocation during PCM runtime and exposes missing
userspace API: 'Loopback Mute' kcontrol, quad volume controls and sysfs
fw-version entries. Event tracing is provided to ease solution
debugging.

Following are not included in this update and are scheduled as later
addition:
- fw logging
- module (library) support

Note: LPT power up/down sequences might get aligned with WPT once enough
testing is done as capabilities are shared for both DSPs.
Note #2: Both LPT and WPT power up/down sequences may get optimized in
future updates as thanks to help from the Windows team, most of nuances
behind why/what/when in regard to hw registers have been backtracked and
reviewed again.

Link to developer's deep dive message:
https://www.spinics.net/lists/alsa-devel/msg113563.html

Changes in v10:
- reverted DUAL_MONO case relocation from v9
- indented all constants of enum catpt_module_id to the same column
- new newline appended for return path of catpt_dsp_do_send_msg()

Changes in v9:
https://www.spinics.net/lists/alsa-devel/msg116305.html
- fixed newlines in sysfs as requested by Andy, left tags as no other
  changes done
- removed volume_map and replaced by simple formulas for volume kcontrol
  calculations
- removed redundant parentheses in catpt_get_channel_map() and
  relocated DUAL_MONO case
- runtime suspend no longer called during module unload
- removed redundant size checks for catpt_dsp_send_tx() and
  catpt_dsp_copy_rx()

Changes in v8:
https://www.spinics.net/lists/alsa-devel/msg116168.html
- updated catpt_arrange_page_table() with GENMASK and U32_MAX usage
- made use of PFN_DOWN() replacing explicit right shitfs by PAGE_SIZE
- made fw hash dumping in catpt_coredump() more readable and removed
  hardcodes
- catpt_coredump() dumps fw hash now only if said segment has been found
  within fw_info
- shortened _MSECS suffixes to _MS
- IPC structs no longer contain enum members
- simplified definition of catpt_set_dspvol()

Changes in v7:
https://www.spinics.net/lists/alsa-devel/msg116019.html
- fixed licence header for fs.c
- renamed fs.c to sysfs.c to better match its purpose
- added documentation within Documentation/ABI/testing for entries
  exposed by catpt
- bin_attribute fw_build replaced by attribute fw_info:
  fw_info contains full FW information and after successful handshake,
  it's always available (stored in driver data) so no need to invoke
  GET_FW_VERSION IPC again, just dump the stored information
- rather than manually creating and removing sysfs files, now makes use
  of dev_groups member of struct device_driver
- patch: 10/14 'ASoC: Intel: Select catpt and deprecate haswell' has
  been moved to the back of the list: enable catpt after machine boards
  have been prepared for it first
- improved readability of several goto labels

Changes in v6:
https://www.spinics.net/lists/alsa-devel/msg115765.html
- reordered and reorganized code for patches 1/13 - 8/13 of v5, so each
  patches makes use of no member or function which is unavailable to it.
  Series size increased from 13 to 14 patches: addition of base members
  e.g.: registers has been split from addition of device.c file which
  describes acpi device behavior

Changes in v5:
https://www.spinics.net/lists/alsa-devel/msg115621.html
Basically everything below is result of Andy's review. Thank you Andy
for taking time into this detailed review

- catpt now makes use of common linux/pxa2xx_ssp.h header file, removing
  redundant SSP register declarations in the process. As stated in the
  opening, this is dependent upon linux-spi change:
  spi: pxa2xx: Add SSC2 and SSPSP2 SSP registers

- updated Kconfig by removing DMADEVICES and adding COMPILE_TEST
  as optional depends-on
- updated all register macros definitions to be more safe against common
  arithmetics when specifying macro's parameters
- removed CONFIG_PM and CONFIG_PM_SLEEP usage in favor of __maybe_unused
- all 'if (ret < 0)' converted to simple 'if (ret)' whenever possible
- fixed erroneous check for platform_device_register_data within
  catpt_register_board()
- _SLAVE/_MASTER replaced with more inclusive _CONSUMER/_PROVIDER for
  enum catpt_ssp_mode
- catpt_acpi_probe() is now making use of high-level wrappers for
  ioremapping and resource assignment, reducing function's code size
- due to improved catpt_acpi_probe() behavior, catpt_acpi_remove() needs
  not to cast dma_free_coherent() any longer
- DMA source and destrination maxburst now of value 16, see:
https://www.spinics.net/lists/alsa-devel/msg114394.html

- simplified catpt_dsp_update_lpclock() as list_for_each_entry() is
  empty-safe by default
- dropped '_SSP_' from all names of all CATPT_SSP_SSXXX_DEFAULT macros
- catpt_updatel_pci now makes use of linux/pci.h and uapi/linux/pci.h
  constants such as: PCI_PM_CTRL_STATE_MASK and PCI_D3hot

Changes in v4:
https://www.spinics.net/lists/alsa-devel/msg113762.html
- fixed compilation with i386 kconfig (conflicting names)
- streamlined naming for SHIM and PCI registers to match SSP ones
  (SHIM_REG -> SHIM)
- catpt_component_probe removed and kcontrols again initializzed
  statically via snd_kcontrol_new array: this is to remove
  kctl->id.device shenanigans
- renamed catpt_set_ctlvol to catpt_set_dspvol - function name wasn't
  matching its purpose

Changes in v3:
- fixed IRAM mask usage in lpt_dsp_power_up (dsp.c)
- updated dbg message formatting in catpt_restore_fwimage as suggested
  by Andy
- fixed alignment for struct catpt_ssp_device_format
- catpt_set_ctlvol now verifies all-equal scenario based on all
  channels rather than just first two as requested by Amadeo
- fixed SPDX for registers.h

Changes in v2:
https://www.spinics.net/lists/alsa-devel/msg113660.html
- fixed SPDX formatting for all header files as well as pcm.c
- fixed size provided to memcpy() in fw_build_read() as reported by Mark
- renamed struct catpt_pdata to struct catpt_spec (cosmetic)
- fixed erroneous path in catpt_load_block: region is properly released
- trace.h events for updating registers have been removed and usages
  replaced by dev_dbg (SRAMPGE/ LPCS)

- as requested by Andy, struct resource has replaced struct catpt_mbank
  and struct catpt_mregion. This change cascaded into:

  - catpt_mbank_size and catpt_mregion_size replaced by resource_size
  - catpt_mregion_intersects replaced by resource_overlaps
  - all catpt_mbank_ and catpt_mregion_ handlers found in loader.c
    (_request, _reserve, _release, _extract, _split, _join) have been
    removed
  - __request_region and __release_region have been enlisted in their
    place
  - catpt_mregion_intersecting renamed to catpt_resource_overlapping
  - catpt_request_region helper has been provided to deal with -size
    based requests
      o haven't found direct replacements in resource.c/ ioport.h for
      both functions

  - catpt_mbank_create and catpt_mbank_remove renamed to catpt_sram_init
    and catpt_sram_free respectively
  - catpt_sram_init now returns void instead of int and has been
    converted to simple initialized. This change ultimately cascaded
    into:
      o both SRAM banks initialization being moved to catpt_dev_init
        from catpt_acpi_probe (device.c)
      o catpt_dev::spec is now initialized first, with catpt_dev_init
        following it soon after
      o catpt_acpi_probe erroneous path has been simplified as SRAM
        banks no longer need to be freed

  - catpt_sram_free now frees all resources via child -> sibling
    enumeration rather than region_list iteration
  - catpt_dsp_update_srampge and catpt_dsp_set_srampge now accept new
    argument: unsigned long mask. Caused by removal of catpt_mbank -
    mask is taken directly from catpt_dev::spec::d/iram_mask
  - trace.h events for catpt_mbank and catpt_mregion have been removed

Diff against last drop on internal list:
https://www.spinics.net/lists/alsa-devel/msg113549.html
- replaced spinlock with mutex for mregion allocation and release to
  address sleeping in atomic context warnings
- fixed coredump fw_hash dumping
- kcontrol values are now always stored regardless of stream of interest
  is running or not
- kcontrol values are now applied after stream is prepared instead of
  ignoring what has been set by user initially
- catpt_pdata instances have been renamed from hsw_ and bdw_ to lpt_ and
  wpt_ respectively
- reordered Makefile .o(s) (cosmetic)

Cezary Rojewski (14):
  ASoC: Intel: Add catpt base members
  ASoC: Intel: catpt: Implement IPC protocol
  ASoC: Intel: catpt: Add IPC message handlers
  ASoC: Intel: catpt: Define DSP operations
  ASoC: Intel: catpt: Firmware loading and context restore
  ASoC: Intel: catpt: PCM operations
  ASoC: Intel: catpt: Device driver lifecycle
  ASoC: Intel: catpt: Event tracing
  ASoC: Intel: catpt: Simple sysfs attributes
  ASoC: Intel: haswell: Remove haswell-solution specific code
  ASoC: Intel: broadwell: Remove haswell-solution specific code
  ASoC: Intel: bdw-5650: Remove haswell-solution specific code
  ASoC: Intel: bdw-5677: Remove haswell-solution specific code
  ASoC: Intel: Select catpt and deprecate haswell

 .../ABI/testing/sysfs-bus-pci-devices-catpt   |   16 +
 sound/soc/intel/Kconfig                       |   24 +-
 sound/soc/intel/Makefile                      |    2 +-
 sound/soc/intel/boards/Kconfig                |    8 +-
 sound/soc/intel/boards/bdw-rt5650.c           |   36 -
 sound/soc/intel/boards/bdw-rt5677.c           |   33 -
 sound/soc/intel/boards/broadwell.c            |   33 -
 sound/soc/intel/boards/haswell.c              |   28 +-
 sound/soc/intel/catpt/Makefile                |    6 +
 sound/soc/intel/catpt/core.h                  |  188 +++
 sound/soc/intel/catpt/device.c                |  352 +++++
 sound/soc/intel/catpt/dsp.c                   |  578 ++++++++
 sound/soc/intel/catpt/ipc.c                   |  298 +++++
 sound/soc/intel/catpt/loader.c                |  671 ++++++++++
 sound/soc/intel/catpt/messages.c              |  313 +++++
 sound/soc/intel/catpt/messages.h              |  401 ++++++
 sound/soc/intel/catpt/pcm.c                   | 1175 +++++++++++++++++
 sound/soc/intel/catpt/registers.h             |  178 +++
 sound/soc/intel/catpt/sysfs.c                 |   55 +
 sound/soc/intel/catpt/trace.h                 |   83 ++
 20 files changed, 4335 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-devices-catpt
 create mode 100644 sound/soc/intel/catpt/Makefile
 create mode 100644 sound/soc/intel/catpt/core.h
 create mode 100644 sound/soc/intel/catpt/device.c
 create mode 100644 sound/soc/intel/catpt/dsp.c
 create mode 100644 sound/soc/intel/catpt/ipc.c
 create mode 100644 sound/soc/intel/catpt/loader.c
 create mode 100644 sound/soc/intel/catpt/messages.c
 create mode 100644 sound/soc/intel/catpt/messages.h
 create mode 100644 sound/soc/intel/catpt/pcm.c
 create mode 100644 sound/soc/intel/catpt/registers.h
 create mode 100644 sound/soc/intel/catpt/sysfs.c
 create mode 100644 sound/soc/intel/catpt/trace.h

--
2.17.1
2020-10-02 15:49:12 +01:00
Randy Dunlap
2bc8831b13
ASoC: qcom: fix SDM845 & QDSP6 dependencies more
Fix a build error and Kconfig warning in sound/soc/qcom/.

ld: sound/soc/qcom/qdsp6/q6afe-clocks.o: in function `q6afe_clock_dev_probe':
q6afe-clocks.c:(.text+0x182): undefined reference to `devm_clk_hw_register'
ld: q6afe-clocks.c:(.text+0x19d): undefined reference to `of_clk_add_hw_provider'

After adding "depends on COMMON_CLK" for SND_SOC_QDSP6, the Kconfig
warning appears because "select" does not honor any "depends on"
clauses, so fix the dependency for SND_SOC_SDM845 also.

WARNING: unmet direct dependencies detected for SND_SOC_QDSP6
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_QCOM [=y] && QCOM_APR [=y] && COMMON_CLK [=n]
  Selected by [y]:
  - SND_SOC_SDM845 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_QCOM [=y] && QCOM_APR [=y] && I2C [=y] && SOUNDWIRE [=y]

Fixes: 520a1c396d ("ASoC: q6afe-clocks: add q6afe clock controller")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20201001183537.5781-1-rdunlap@infradead.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:49:11 +01:00
Cezary Rojewski
6cbfa11d26
ASoC: Intel: Select catpt and deprecate haswell
Prevent sound/soc/intel/haswell code compile and select catpt instead as
a recommended solution. Userspace-exposed members are compatible with
what is exposed by deprecated solution thus no harm is done. The only
visible difference is the newly added 'Loopback Mute' kcontrol.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-15-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:39 +01:00
Cezary Rojewski
053743f0c4
ASoC: Intel: bdw-5677: Remove haswell-solution specific code
Remove code specific to sound/soc/intel/haswell. Update BE dai_link
definition to provide seamless transition to catpt solution.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-14-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:38 +01:00
Cezary Rojewski
02f2442fb3
ASoC: Intel: bdw-5650: Remove haswell-solution specific code
Remove code specific to sound/soc/intel/haswell. Update BE dai_link
definition to provide seamless transition to catpt solution.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-13-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:37 +01:00
Cezary Rojewski
e81a707a39
ASoC: Intel: broadwell: Remove haswell-solution specific code
Remove code specific to sound/soc/intel/haswell. Update BE dai_link
definition to provide seamless transition to catpt solution.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-12-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:36 +01:00
Cezary Rojewski
0ce1610578
ASoC: Intel: haswell: Remove haswell-solution specific code
Remove code specific to sound/soc/intel/haswell. Update BE dai_link
definition to provide seamless transition to catpt solution.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-11-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:35 +01:00
Cezary Rojewski
8f80a834b9
ASoC: Intel: catpt: Simple sysfs attributes
Add sysfs entries for displaying version of FW currently in use as well
as dumping full FW information including build and log-providers hashes.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:34 +01:00
Cezary Rojewski
8ba1edb9c2
ASoC: Intel: catpt: Event tracing
Define tracing macros for easy catpt debug. These cover all IPC message
types: requests, replies and notifications.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-9-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:33 +01:00
Cezary Rojewski
7a10b66a5d
ASoC: Intel: catpt: Device driver lifecycle
Implement ACPI device probing and removal functions as well as handlers
for its PM capabilities. Device probing also takes care of enumerating
ADSP subsystem components.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-8-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:32 +01:00
Cezary Rojewski
a126750fc8
ASoC: Intel: catpt: PCM operations
DSP designed for Lynxpoint and Wildcat Point offers no dynamic topology
i.e. all pipelines are already defined within firmware and host is
relegated to allocing stream for predefined pins. This is represented by
'catpt_topology' member.

Implementation covers all available pin types:
- system playback and capture
- two offload streams
- loopback (reference)
- bluetooth playback and capture

PCM DAI operations differentiate between those pins as some (mainly
offload) are to be handled differently - DSP expects wp updates on each
notify_position notification.

System playback has no volume control capability as it is routed to
mixer stream directly. Other primary streams - capture and two offloads
- offer individual volume controls.

Compared to sound/soc/intel/haswell this configures SSP device format
automatically on pcm creation.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:32 +01:00
Cezary Rojewski
a9aa6fb3eb
ASoC: Intel: catpt: Firmware loading and context restore
For Lynxpoint and Wildcat Point solution, is it host's responsibility to
allocate SRAM regions and ensure those already taken are not overwritten
with other data until released. Blocks are transferred to SRAM - either
IRAM or DRAM - via DW DMA controller. Once basefw is booted, ownership
of DMA transfer is lost in favour of DSP.

Hosts reponsibilities don't end on initial block allocation and binary
transfer. During Dx transitions host must store FW runtime context from
DRAM before putting AudioDSP subsystem into lower power state. Said
context gets flashed after D0 entry to bring DSP right where it was just
before suspending.

Load and restore procedures are finalized with SRAM power gating and
adequate clock level selection. This power gates unused EBBs and clock
speed effectively reducing power consumption.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:31 +01:00
Cezary Rojewski
ba202a7bc3
ASoC: Intel: catpt: Define DSP operations
Implement dsp lifecycle functions such as core RESET and STALL,
SRAM power control and LP clock selection. This also adds functions for
handling transport over DW DMA controller.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:30 +01:00
Cezary Rojewski
64b9b1b005
ASoC: Intel: catpt: Add IPC message handlers
Declare global and stream IPC message handlers for all known message
types.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:29 +01:00
Cezary Rojewski
92946c1d7e
ASoC: Intel: catpt: Implement IPC protocol
Implement IRQ handlers for immediate and delayed replies and
notifications. Communication is synchronous and allows for serialization
of maximum one message at a time.

DSP may respond with ADSP_PENDING status for a request - known as
delayed reply - and when situation occurs, framework keeps the lock and
awaits upcoming response through IPCD channel which is handled in
bottom-half. Immediate replies spawn no BH at all as their processing is
very short.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:28 +01:00
Cezary Rojewski
4fac9b31d0
ASoC: Intel: Add catpt base members
Declare base structures, registers and extension routines for the catpt
solution.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200929141247.8058-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-02 15:32:27 +01:00
Qiu Wenbo
08befca400 ALSA: hda/realtek - Add mute Led support for HP Elitebook 845 G7
After installing archlinux, the mute led and micmute led are not working
at all. This patch fix this issue by applying a fixup from similar
model. These mute leds are confirmed working on HP Elitebook 845 G7.

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201002124454.7240-1-qiuwenbo@kylinos.com.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-10-02 15:29:09 +02:00
Colin Ian King
716a0c2881 ALSA: usb-audio: fix spelling mistake "Frequence" -> "Frequency"
There are spelling mistakes in equalizer name fields, fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20181125231208.14350-1-colin.king@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-10-02 11:24:51 +02:00
Tang Bin
601fd3a7d8
ASoC: fsl_spdif: Fix unnecessary check in fsl_spdif_probe()
The function fsl_spdif_probe() is only called with an openfirmware
platform device. Therefore there is no need to check that the passed
in device is NULL.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200826150918.16116-1-tangbin@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 22:26:47 +01:00
Greg Kroah-Hartman
4cb1a880e7 soundwire updates for 5.10-rc1
This round of update includes:
  - Generic bandwidth allocation algorithm from Intel folks
  - PM support for Intel chipsets
  - Updates to Intel drivers which makes sdw usable on latest laptops
  - Support for MMIO SDW controllers found in QC chipsets
  - Update to subsystem to use helpers in bitfield.h to manage register
    bits
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAl91bukACgkQfBQHDyUj
 g0dllRAAsbAdqrQiWYocxm8WsC4OehwYdgv+WgAcq5820xxKI4XMRhB6TGxeFt3B
 r2fCxoxOqq/z7WCt1Ts6Ivw9dy3E9W8hPgesXIVpqHdyByYLryEllDGuOInkEruO
 Brcqx2E0ySysVyIaw0Nx5UGCwDtPUsH0nfiTXSJrLHv3eQ7SLxtn/S0immfaAMDl
 Y6Z2sa8D77UkOpLxsKBYfcGn+AS7Muc7NS1Sp+TNNZULTC6jL8+HifzqbEcH9GhK
 htBAolCjXmn/FbKCknA+3+zFEe+XKNkG6Y7KApbjViAEGu/fKh8PfghvtMjgAvzk
 xqvoOijxetlovf19Dz9r1/2l4c+O9im6dHOCZCPRQE04/Rcg5J2Oym/c8cZvMjZS
 EpWH34lDcpPgW37IuIUlGqX1crTcfhf4GW931vsJidkM8gAD8DFI90o/ynx+lkca
 SKVS1ZsHnHfP1NkXGikiTxDKtFZzcIJnjJrUFdKRjVgSBKVhRPpbUX3Wd5yOqnmW
 nrKcj6aBkjqy2rpiaV/gqQ65uVobtewqbPF4AIOl2VtwCQZrj5lLERLWz++UWVFB
 DFZhnV912kouPdeI28+UnYTyfVZZGfsmvplJ/dgiNsxixydIqPOl0bA5T+xvDwXc
 jWWTQnvPDL5IoOhmo2NNgvRlWtPmCQpIA1dOUA9b1S/SVvCfnSY=
 =ALTw
 -----END PGP SIGNATURE-----

Merge tag 'soundwire-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-next

Vinod writes:

soundwire updates for 5.10-rc1

This round of update includes:
 - Generic bandwidth allocation algorithm from Intel folks
 - PM support for Intel chipsets
 - Updates to Intel drivers which makes sdw usable on latest laptops
 - Support for MMIO SDW controllers found in QC chipsets
 - Update to subsystem to use helpers in bitfield.h to manage register
   bits

* tag 'soundwire-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: (66 commits)
  soundwire: sysfs: add slave status and device number before probe
  soundwire: bus: add enumerated Slave device to device list
  soundwire: remove an unnecessary NULL check
  soundwire: cadence: add data port test fail interrupt
  soundwire: intel: enable test modes
  soundwire: enable Data Port test modes
  soundwire: intel: use {u32|u16}p_replace_bits
  soundwire: cadence: use u32p_replace_bits
  soundwire: qcom: get max rows and cols info from compatible
  soundwire: qcom: add support to block packing mode
  soundwire: qcom: clear BIT FIELDs before value set.
  soundwire: Add generic bandwidth allocation algorithm
  soundwire: cadence: add parity error injection through debugfs
  soundwire: bus: export broadcast read/write capability for tests
  ASoC: codecs: realtek-soundwire: ignore initial PARITY errors
  soundwire: bus: use quirk to filter out invalid parity errors
  soundwire: slave: add first_interrupt_done status
  soundwire: bus: filter-out unwanted interrupt reports
  ASoC/soundwire: bus: use property to set interrupt masks
  soundwire: qcom: fix SLIBMUS/SLIMBUS typo
  ...
2020-10-01 22:59:55 +02:00
Kuninori Morimoto
8e7875ae37
ASoC: soc-pcm: add missing ret=0 at soc_pcm_open()
commit 140a4532cd ("ASoC: soc-pcm: add soc_pcm_clean() and call it
from soc_pcm_open/close()") switched to use soc_pcm_clean() at
soc_pcm_open().

But it removed "return 0", and missing "ret = 0",
because of it, it always return -EINVAL eventhough no error.
This patch adds missing "ret = 0" for success case.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/87ft6ya65z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:42:20 +01:00
Kuninori Morimoto
cb2fce94c8
ASoC: soc-pcm: ignore un-needed mutex_unlock() case on soc_pcm_open()
commit 140a4532cd ("ASoC: soc-pcm: add soc_pcm_clean() and call it
from soc_pcm_open/close()") switch to call soc_pcm_clean() on
soc_pcm_open() when rollback case.

But, it uses "goto err" (A) *before* mutex_lock() (B) when error of
snd_soc_pcm_component_pm_runtime_get().
The mutex_unlock() (C) is not needed in such case. This patch fix it.

	static int soc_pcm_open(...)
	{
		...
		ret = snd_soc_pcm_component_pm_runtime_get(rtd, substream);
		if (ret < 0)
(A)			goto err;

(B)		mutex_lock_nested(...);
		...
	err:
(C)		mutex_unlock(..);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0waag44.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:18 +01:00
Qinglang Miao
27f41dfebf
ASoC: tegra: trimslice.c: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112939.47661-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:17 +01:00
Qinglang Miao
1047bcac21
ASoC: fsl: mx27vis-aic32x4: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112932.46926-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:16 +01:00
Qinglang Miao
c859926abc
ASoC: tegra: tegra_rt5640: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112936.47441-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:15 +01:00
Zhang Qilong
31e1fc4f11
ASoC: ti: omap-mcbsp: use devm_platform_ioremap_resource_byname
Use the devm_platform_ioremap_resource_byname() helper instead of
calling platform_get_resource_byname() and devm_ioremap_resource()
separately.

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20200922015123.117489-1-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:14 +01:00
Qinglang Miao
1b59b99577
ASoC: tegra: tegra_wm8753: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112938.47599-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:13 +01:00
Qinglang Miao
f8eeca97f7
ASoC: tegra: tegra_max98090: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112935.47035-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:12 +01:00
Qinglang Miao
bc772a4612
ASoC: fsl: imx-mc13783: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112930.46848-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 20:28:11 +01:00
Adam Brickman
20441614d8
ASoC: wm_adsp: Pass full name to snd_ctl_notify
A call to wm_adsp_write_ctl() could cause a kernel crash if it
does not retrieve a valid kcontrol from snd_soc_card_get_kcontrol().
This can happen due to a missing control name prefix. Then,
snd_ctl_notify() crashes when it tries to use the id field.

Modified wm_adsp_write_ctl() to incorporate the name_prefix (if applicable)
such that it is able to retrieve a valid id field from the kcontrol
once the platform has booted.

Fixes: eb65ccdb08 ("ASoC: wm_adsp: Expose mixer control API")
Signed-off-by: Adam Brickman <Adam.Brickman@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20201001152425.8590-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-01 18:26:19 +01:00
Alexandre Belloni
62e5d77746
ASoC: atmel-pcm: remove unnecessary include
Since commit 95e0e07e71 ("ASoC: atmel-pcm: use generic dmaengine
framework"), the driver is using dmaengine and is not using any definition
from include/linux/platform_data/dma-atmel.h, stop including it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200930145330.3043528-1-alexandre.belloni@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-30 16:12:13 +01:00
Kai Vehmanen
7a2ba46f36 ASoC: hdac_hda: allow runtime pm at end of probe
Align with recent change to forbid runtime suspend during codec
init in snd_hda_codec_device_new(), with matching call to
allow suspend at end of hdac_hda_codec_probe().

In snd-hda-intel, call to snd_hda_set_power_save() at end of
controller probe does the same thing, but ASoC controller drivers
do not modify runtime settings for codecs, so this has to be done
in codec drivers, and in this case in hdac_hda.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20200930114140.3839617-3-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-30 16:53:23 +02:00
Harsha Priya
a0645daf16 ALSA: HDA: Early Forbid of runtime PM
For certain codecs (like Realtek), pm_runtime_forbid() is invoked
in the probe function after build_controls(). In a stress test,
its observed occasionally that runtime PM calls are invoked
before controls are built. This causes the codec to be
runtime suspended before probe completes. Because of this, not all
controls are enumerated correctly, and audio does not work until
system is rebooted.

This issue being common across all codecs, pm_runtime_forbid() is
called when the codec object is created to fix this issue.
A codec enables or disables runtime pm in its own probe function.

Multiple stress tests of 2000+ cycles has been done to test the fix.

Signed-off-by: Harsha Priya <harshapriya.n@intel.com>
Signed-off-by: Emmanuel Jillela <emmanuel.jillela@intel.com>
Reviewed-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200930114140.3839617-2-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-30 16:52:48 +02:00
Qinglang Miao
ad61b78ea8
ASoC: soc-core: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200929112933.46977-1-miaoqinglang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-30 12:40:30 +01:00
Hui Wang
f4794c6064 ALSA: hda - Don't register a cb func if it is registered already
If the caller of enable_callback_mst() passes a cb func, the callee
function will malloc memory and link this cb func to the list
unconditionally. This will introduce problem if caller is in the
hda_codec_ops.init() since the init() will be repeatedly called in the
codec rt_resume().

So far, the patch_hdmi.c and patch_ca0132.c call enable_callback_mst()
in the hda_codec_ops.init().

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200930055146.5665-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-30 12:56:32 +02:00
Hui Wang
13468bfa8c ALSA: hda/realtek - set mic to auto detect on a HP AIO machine
Recently we enabled a HP AIO machine, we found the mic on the machine
couldn't record any sound and it couldn't detect plugging and
unplugging as well.

Through debugging we found the mic is set to manual detect mode, after
setting it to auto detect mode, it could detect plugging and
unplugging and could record sound.

Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20200928080117.12435-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-29 09:04:58 +02:00
Mark Brown
5061e488bc
Merge series "ASoC: merge soc_pcm_open() rollback and soc_pcm_close()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

1 month past and nothing happened.
This is resend of v2 patch-set.

soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

	static int soc_pcm_open(xxx)
	{
		...
		if (ret < 0)
			goto xxx_err;
		...
		return 0;

 ^	config_err:
 |		...
 |	rtd_startup_err:
(A)		...
 |	component_err:
 |		...
 v		return ret;
	}

This kind of duplicated code can be a hotbed of bugs,
thus, this patch-set share soc_pcm_close() and rollback.

v1 -> v2
	- indicate more detail background/logic on git-log

Link: https://lore.kernel.org/r/87wo2oku0m.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87wo1kvozz.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (7):
  ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
  ASoC: soc-link: add mark for snd_soc_link_startup/shutdown()
  ASoC: soc-component: add mark for soc_pcm_components_open/close()
  ASoC: soc-component: add mark for
    snd_soc_pcm_component_pm_runtime_get/put()
  ASoC: soc-pcm: add soc_pcm_clean() and call it from
    soc_pcm_open/close()
  ASoC: soc-pcm: remove unneeded dev_err() for snd_soc_dai_startup()
  ASoC: soc-pcm: remove unneeded dev_err() for
    snd_soc_component_module/open()

 include/sound/soc-component.h |  28 +++++---
 include/sound/soc-dai.h       |   5 +-
 include/sound/soc-link.h      |   3 +-
 include/sound/soc.h           |   3 +
 sound/soc/soc-component.c     |  73 ++++++++++++++++++++-
 sound/soc/soc-compress.c      |  30 +++------
 sound/soc/soc-dai.c           |  21 +++++-
 sound/soc/soc-dapm.c          |   4 +-
 sound/soc/soc-link.c          |  21 +++++-
 sound/soc/soc-pcm.c           | 120 ++++++++++++----------------------
 10 files changed, 190 insertions(+), 118 deletions(-)

--
2.25.1
2020-09-28 20:53:10 +01:00
Srinivas Kandagatla
19895e92dd
ASoC: lpass-platform: use devm_regmap_field_bulk_alloc
use new devm_regmap_field_bulk_alloc to allocate fields as
it make the code more readable!

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Link: https://lore.kernel.org/r/20200925164856.10315-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 20:51:36 +01:00
Lucas Tanure
d4edae9c50
ASoC: cs4234: Add support for Cirrus Logic CS4234 codec
The CS4234 is a highly versatile CODEC that combines 4 channels of
high performance analog to digital conversion, 4 channels of high
performance digital to analog conversion for audio, and 1 channel of
digital to analog conversion to provide a nondelayed audio reference
signal to an external Class H tracking power supply.

DAC5 is only supported as a 5th audio channel. Tracking Power Supply
mode is not currently supported by the driver.

In DSP_A mode the slots for DAC1-4 and optionally DAC5 can be set.
The codec always claims 4 slots for DAC1-4 and these must be in the
same nibble of the mask. The codec has a fixed mapping for ADC slots.

In I2S/LJ modes the codec has a fixed mapping for DAC1-4 and ADC1-4.
DAC5 is not available in these modes.

The MCLK source must be preset to a valid frequency before probe()
because it must be running all the time the codec is out of reset.

The VA_SEL bit will be set automatically to 3.3v or 5v during probe()
based on the reported voltage of the regulator supplying VA.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200928111821.26967-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:59:06 +01:00
Oder Chiou
9fe0ec2755
ASoC: rt5682: Enable the power of "MICBIAS" and "Vref2" for the DMIC clock
The power of "MICBIAS" and "Vref2" was needed while the DMIC clcok was from
the PLL output.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Link: https://lore.kernel.org/r/20200928053912.16664-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:59:04 +01:00
Peter Ujfalusi
5ec3c854d1
ASoC: ti: j721e-evm: Fix compiler warning when CONFIG_OF=n
Remove the use of of_match_ptr() macro for of_match_table to fix compiler
warning when CONFIG_OF=n:

sound/soc/ti/j721e-evm.c:528:34: warning: unused variable 'j721e_audio_of_match' [-Wunused-const-variable]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20200928074330.13029-1-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:59:03 +01:00
Jack Yu
16346a3cf0
ASoC: rt715: Add power-up delay to fix dmic pop sound issue.
Add 400ms power-up delay recommended to fix pop noise on capture.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Jack Yu <jack.yu@realtek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200925210509.83353-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:59:02 +01:00
Kuninori Morimoto
bcae16317b
ASoC: soc-pcm: remove unneeded dev_err() for snd_soc_component_module/open()
snd_soc_component_module_get(), snd_soc_component_open() itself will
indicate error message, thus, soc_pcm_components_open() don't need to
handle it.
This patch removes these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87d026bwms.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:47 +01:00
Kuninori Morimoto
ce820145a9
ASoC: soc-pcm: remove unneeded dev_err() for snd_soc_dai_startup()
snd_soc_dai_startup() itself will indicate error message,
thus, soc_pcm_open() don't need to handle it.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eemmbwmy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:46 +01:00
Kuninori Morimoto
140a4532cd
ASoC: soc-pcm: add soc_pcm_clean() and call it from soc_pcm_open/close()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

	static int soc_pcm_open(xxx)
	{
		...
		if (ret < 0)
			goto xxx_err;
		...
		return 0;

 ^	config_err:
 |		...
 |	rtd_startup_err:
(A)		...
 |	component_err:
 |		...
 v		return ret;
	}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
	1) snd_soc_dai_startup/shutdown()
	2) snd_soc_link_startup/shutdown()
	3) snd_soc_component_module_get/put()
	4) snd_soc_component_open/close()
	5) pm_runtime_put/get()

Now, 1) to 5) are handled.
This patch adds new soc_pcm_clean() and call it from
soc_pcm_open() as rollback, and from soc_pcm_close() as
normal close handler.

One note here is that it don't need to call snd_soc_runtime_deactivate()
when rollback case, because it will be called without
snd_soc_runtime_activate().
It also don't need to call snd_soc_dapm_stream_stop() when rollback case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ft72bwn4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:45 +01:00
Kuninori Morimoto
939a5cfb2a
ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

	static int soc_pcm_open(xxx)
	{
		...
		if (ret < 0)
			goto xxx_err;
		...
		return 0;

 ^	config_err:
 |		...
 |	rtd_startup_err:
(A)		...
 |	component_err:
 |		...
 v		return ret;
	}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
	1) snd_soc_dai_startup/shutdown()
	2) snd_soc_link_startup/shutdown()
	3) snd_soc_component_module_get/put()
	4) snd_soc_component_open/close()
=>	5) pm_runtime_put/get()

This patch is for 5) pm_runtime_put/get().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when get() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* get() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ribwnb.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:44 +01:00
Kuninori Morimoto
51aff91ad1
ASoC: soc-component: add mark for soc_pcm_components_open/close()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

	static int soc_pcm_open(xxx)
	{
		...
		if (ret < 0)
			goto xxx_err;
		...
		return 0;

 ^	config_err:
 |		...
 |	rtd_startup_err:
(A)		...
 |	component_err:
 |		...
 v		return ret;
	}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
	1) snd_soc_dai_startup/shutdown()
	2) snd_soc_link_startup/shutdown()
=>	3) snd_soc_component_module_get/put()
=>	4) snd_soc_component_open/close()
	5) pm_runtime_put/get()

This patch is for 3) snd_soc_component_module_get/put()
4) snd_soc_component_open/close().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when open() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* open() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:44 +01:00
Kuninori Morimoto
6064ed73cd
ASoC: soc-link: add mark for snd_soc_link_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

	static int soc_pcm_open(xxx)
	{
		...
		if (ret < 0)
			goto xxx_err;
		...
		return 0;

 ^	config_err:
 |		...
 |	rtd_startup_err:
(A)		...
 |	component_err:
 |		...
 v		return ret;
	}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
	1) snd_soc_dai_startup/shutdown()
=>	2) snd_soc_link_startup/shutdown()
	3) snd_soc_component_module_get/put()
	4) snd_soc_component_open/close()
	5) pm_runtime_put/get()

This patch is for 2) snd_soc_link_startup/shutdown().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0webwnv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:43 +01:00
Kuninori Morimoto
00a0b46c99
ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown()
soc_pcm_open() does rollback when failed (A),
but, it is almost same as soc_pcm_close().

	static int soc_pcm_open(xxx)
	{
		...
		if (ret < 0)
			goto xxx_err;
		...
		return 0;

 ^	config_err:
 |		...
 |	rtd_startup_err:
(A)		...
 |	component_err:
 |		...
 v		return ret;
	}

The difference is
soc_pcm_close() is for all dai/component/substream,
rollback        is for succeeded part only.

This kind of duplicated code can be a hotbed of bugs,
thus, we want to share soc_pcm_close() and rollback.

Now, soc_pcm_open/close() are handling
=>	1) snd_soc_dai_startup/shutdown()
	2) snd_soc_link_startup/shutdown()
	3) snd_soc_component_module_get/put()
	4) snd_soc_component_open/close()
	5) pm_runtime_put/get()

This patch is for 1) snd_soc_dai_startup/shutdown().

The idea of having bit-flag or counter is not enough for this purpose.
For example if one DAI is used for 2xPlaybacks for some reasons,
and if 1st Playback was succeeded but 2nd Playback was failed,
2nd Playback rollback doesn't need to call shutdown.
But it has succeeded bit-flag or counter via 1st Playback,
thus, 2nd Playback rollback will call unneeded shutdown.
And 1st Playback's necessary shutdown will not be called,
because bit-flag or counter was cleared by wrong 2nd Playback rollback.

To avoid such case, this patch marks substream pointer when startup() was
succeeded. If rollback needed, it will check rollback flag and marked
substream pointer.

One note here is that it cares *current* startup() only now.
but we might want to check *whole* marked substream in the future.
This patch is using macro named "push/pop", so that it can be easily
update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lfgubwoc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 17:01:42 +01:00
Srinivas Kandagatla
d56a7ed2d8
ASoC: q6afe-clocks: Fix typo in SPDX Licence
Looks like there was a major typo in SPDX Licence version,
Not sure how it was missed.
This patch is to fix it.

Reported-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200926171844.7792-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 11:32:13 +01:00
Mark Brown
24c95ec9fb
Merge series "Enable runtime PM for SOF device" from Daniel Baluta <daniel.baluta@oss.nxp.com>
Daniel Baluta <daniel.baluta@nxp.com>:

From: Daniel Baluta <daniel.baluta@nxp.com>

This enables runtime PM for SOF device. Next patchseries will
provide PM suspend/resume handlers for i.MX8 specific devices.

Daniel Baluta (2):
  ASoC: SOF: Activate runtime PM with SOF OF device
  ASoC: SOF: Add .prepare/.complete callbacks

 sound/soc/sof/sof-of-dev.c | 6 ++++++
 1 file changed, 6 insertions(+)

--
2.17.1
2020-09-25 20:58:05 +01:00
Mark Brown
d83fa234ae
Merge series "ASoC: qdsp6: fix some warnings when build without CONFIG_OF" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
Here are fixes for two warnings types discovered while building qdsp6 drivers
without CONFIG_OF and with W=1

One of them was reported by Intel kernel test robot on q6afe-clocks patch, which
equally applies to rest of the qdsp6 drivers.

changes since v1:
	- added ifdef CONFIG_OF instead of removing of_match_ptr

Srinivas Kandagatla (2):
  ASoC: qdsp6: add ifdef CONFIG_OF around of_device_id
  ASoC: q6asm: fix kernel doc warnings

 sound/soc/qcom/qdsp6/q6adm.c        | 2 ++
 sound/soc/qcom/qdsp6/q6afe-clocks.c | 2 ++
 sound/soc/qcom/qdsp6/q6afe-dai.c    | 2 ++
 sound/soc/qcom/qdsp6/q6afe.c        | 2 ++
 sound/soc/qcom/qdsp6/q6asm-dai.c    | 2 ++
 sound/soc/qcom/qdsp6/q6asm.c        | 6 ++++++
 sound/soc/qcom/qdsp6/q6core.c       | 2 ++
 sound/soc/qcom/qdsp6/q6routing.c    | 2 ++
 8 files changed, 20 insertions(+)

--
2.21.0
2020-09-25 20:50:41 +01:00
V Sujith Kumar Reddy
7e6799d8f8
ASoC: qcom: lpass-cpu: Enable MI2S BCLK and LRCLK together
Update lpass-cpu.c to enable I2S BCLK and LRCLK together.
Remove BCLK enable in lpass_cpu_daiops_startup and
add in lpass_cpu_daiops_trigger API.

Signed-off-by: V Sujith Kumar Reddy <vsujithk@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Link: https://lore.kernel.org/r/1600448073-6709-1-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 20:50:40 +01:00
Xu Wang
f95cc5c18c
ASoC: fsl: imx-audmix: Use devm_kcalloc() instead of devm_kzalloc()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kcalloc".

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/r/20200921015918.24157-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 20:50:39 +01:00
Daniel Baluta
dd759805d6
ASoC: SOF: Add .prepare/.complete callbacks
Use SOF defined callbacks (snd_sof_prepare/snd_sof_complete)
in order to update internal SOF system suspend target.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20200924151518.15841-3-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:53:12 +01:00
Daniel Baluta
4fefc39894
ASoC: SOF: Activate runtime PM with SOF OF device
SOF boots the DSP at probe and keeps it up all the time.
With this change, after booting if no one is using the DSP
the SOF core will turn off the DSP to save power.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20200924151518.15841-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:53:11 +01:00
Srinivas Kandagatla
5d0576bba9
ASoC: q6asm: fix kernel doc warnings
This patch fixes below kernel doc warnings on not describing all the parmeters

sound/soc/qcom/qdsp6/q6asm.c:927: warning: Function parameter or member
 'stream_id' not described in 'q6asm_open_write'
sound/soc/qcom/qdsp6/q6asm.c:927: warning: Function parameter or member
 'is_gapless' not described in 'q6asm_open_write'
sound/soc/qcom/qdsp6/q6asm.c:1053: warning: Function parameter or member
 'stream_id' not described in 'q6asm_run'

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200925163552.20717-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:36:59 +01:00
Srinivas Kandagatla
156d0273f6
ASoC: qdsp6: add ifdef CONFIG_OF around of_device_id
Add ifdef CONFIG_OF around of_device_id table to fix below
W=1 compile test warning with !CONFIG_OF:

sound/soc/qcom/qdsp6/q6afe-clocks.c:254:34: warning: unused variable
 'q6afe_clock_device_id' [-Wunused-const-variable]

Fix this warning for across all qdsp6 drivers.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200925163552.20717-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:36:58 +01:00
Shengjiu Wang
22a16145af
ASoC: fsl_sai: Instantiate snd_soc_dai_driver
Instantiate snd_soc_dai_driver for independent symmetric control.
Otherwise the symmetric setting may be overwritten by other
instance.

Fixes: 08fdf65e37 ("ASoC: fsl_sai: Add asynchronous mode support")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1600424760-32071-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:18:18 +01:00
Richard Fitzgerald
b03acae25e
ASoC: cs47l35: Fix EPOUT->HPOUT1 Mono Mux routing
EPOUT is always mono so should have a permanent routing through the
HPOUT1 Mono Mux.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200925091830.7675-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:18:16 +01:00
Richard Fitzgerald
6495237754
ASoC: cs47l15: Fix EPOUT->HPOUT1 Mono Mux routing
EPOUT is always mono so should have a permanent routing through the
HPOUT1 Mono Mux.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200925091830.7675-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-25 18:18:15 +01:00
Greg Kroah-Hartman
10fbd979bd sound: hiface: move to use usb_control_msg_send()
The usb_control_msg_send() call can return an error if a "short" write
happens, so move the driver over to using that call instead.

v2: API change of use usb_control_msg_send()

Cc: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200923134348.23862-14-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:59 +02:00
Greg Kroah-Hartman
6d2d427e3b sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()
The usb_control_msg_send() and usb_control_msg_recv() calls can return
an error if a "short" write/read happens, and they can handle data off
of the stack, so move the driver over to using those calls instead,
saving some logic when dynamically allocating memory.

v2: API change of use usb_control_msg_send() and usb_control_msg_recv()

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-9-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200923134348.23862-13-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:59 +02:00
Greg Kroah-Hartman
9ad71af922 sound: 6fire: move to use usb_control_msg_send() and usb_control_msg_recv()
The usb_control_msg_send() and usb_control_msg_recv() calls can return
an error if a "short" write/read happens, so move the driver over to
using those calls instead, saving some logic in the wrapper functions
that were being used in this driver.

This also resolves a long-staging bug where data on the stack was being
sent in a USB control message, which was not allowed.

v2: API change of usb_control_msg_send()

Cc: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-8-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200923134348.23862-11-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:59 +02:00
Greg Kroah-Hartman
f246023816 sound: usx2y: move to use usb_control_msg_send()
The usb_control_msg_send() call can handle data on the stack, as well as
returning an error if a "short" write happens, so move the driver over
to using that call instead.  This ends up removing a helper function
that is no longer needed.

v2: API change in usb_control_msg_send()

Cc: Jaroslav Kysela <perex@perex.cz>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-7-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20200923134348.23862-10-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:59 +02:00
Oliver Neukum
3b7672c3eb Revert "sound: usx2y: move to use usb_control_msg_send()"
This reverts commit ec8eeceb06.
The API has to be changed.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200923134348.23862-7-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:58 +02:00
Oliver Neukum
8cc4c2ed6a Revert "sound: 6fire: move to use usb_control_msg_send() and usb_control_msg_recv()"
This reverts commit aea67cc141.
The API has to be changed.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200923134348.23862-6-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:58 +02:00
Oliver Neukum
ec4ed7dc58 Revert "sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()"
This reverts commit f7ef7614f8.
The API has to be changed.
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200923134348.23862-5-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:58 +02:00
Oliver Neukum
c31db08301 Revert "sound: hiface: move to use usb_control_msg_send()"
This reverts commit 119ae38a5c.
The API has to be changed.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200923134348.23862-4-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-25 16:33:58 +02:00
Christoph Hellwig
ed4bc1890b hal2: convert to dma_alloc_noncoherent
Use the new non-coherent DMA API including proper ownership transfers.
This also means we can allocate the buffer memory with the proper
direction instead of bidirectional.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
2020-09-25 06:20:44 +02:00
Kai Vehmanen
502f389a0f ALSA: hda - remove kerneldoc for internal hdac_i915 function
Drop the kerneldoc markup for connectivity_check() as it's an
static helper function. Fixes the following make W=1 warning:

sound/hda/hdac_i915.c:80: warning: Function parameter or member 'i915' not described in 'connectivity_check'
sound/hda/hdac_i915.c:80: warning: Function parameter or member 'hdac' not described in 'connectivity_check'

Fixes: 7b882fe3e3 ('ALSA: hda - handle multiple i915 device instances')
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200924161027.3402260-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-24 20:59:55 +02:00
Linus Torvalds
9ef7dce564 sound fixes for 5.9-rc7
Just a handful small device-specific fixes including a couple of
 reverts.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAl9sXvoOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE+5Fw/7BrxN4aFbkxO5luXwD0t0Xj1D0bln1DyAzZj6
 9Gh5IZplz1+2zkg1re1jxU18VEKfDy/TXFCFVsO+pSCFFHCTh4miyownJUmZrUwd
 w6vjoyg7XUPmWr48Og+5Xw3uNG6W2ZmkY6Qkw/cy/ywcF0TVBfFsTNnO/jaWewzY
 Y+aaii8htt4RCvHdxZTbWUs7QVrOsXT3fMJDMkAXT3IAtTIq+IzMDlk5M5KIHOGQ
 opgITUcm9Ij+To1cgm/HSa+OLsoTyr7sQ49Vi56ooqVCvjFmEVIbFlHd2FQ1iKiH
 yR2A9v1pmDTBcL7WP7lnpJXUFvJVnTIvTU4bd15hW5WnxjGOLSI3+ABz6bRdAIsy
 YkF4D/YprC3S44yaAQ8h6r0/Ea7o3UV7CUexLLykoUr+pQ5Hs0h2LlcUVEVx/134
 kVku03VMYgNZ5kzJpwc49G+q5pg6Jhc0xs7JiY9+mxFg7RCcsNNXb+IbmaDVA7xs
 l1DkWUuZxPuQpAk/Nlz0Qs+teiNKVBws+LMjP7JUDKeBzZi3D0sCInZkUefU8SP3
 IH0Wcbv6QJZTxXIc0tJdA+ydphcfknjR0YecZLHT5JnO+IIl6h8hQobIHvBggx+5
 cO0hJUF+HzDN6kfp5wqSiZvr3j7J/SST2VI4ZzdCDgPCkois1cCv0aS/sRK2zwVg
 haFUNdE=
 =PgF0
 -----END PGP SIGNATURE-----

Merge tag 'sound-5.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Just a handful small device-specific fixes including a couple of
  reverts"

* tag 'sound-5.9-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  Revert "ALSA: usb-audio: Disable Lenovo P620 Rear line-in volume control"
  Revert "ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO"
  ALSA: usb-audio: Add delay quirk for H570e USB headsets
  ALSA: hda/realtek: Enable front panel headset LED on Lenovo ThinkStation P520
  ALSA: hda/realtek - Couldn't detect Mic if booting with headset plugged
  ALSA: asihpi: fix iounmap in error handler
2020-09-24 09:00:05 -07:00
Mark Brown
bbd59df075
Merge series "ASoC: Intel: sdw machine driver updates for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:
Series including fixes and improvements for Intel SoundWire
machine drivers.

Bard Liao (1):
  ASoC: Intel: add support for new SoundWire hardware layout on TGL

Pierre-Louis Bossart (4):
  ASoC: Intel: sof_sdw: remove ternary operator
  ASoC: Intel: add codec name prefix to ACPI machine description
  ASoC: Intel: sof_sdw: remove hard-coded codec_conf table
  ASoC: Intel: sof_sdw_rt700: add codec prefix

Rander Wang (1):
  ASOC: Intel: sof_sdw: restore playback functionality with max98373
    amps

 include/sound/soc-acpi.h                      |   2 +
 sound/soc/intel/boards/sof_sdw.c              | 170 +++++++++---------
 sound/soc/intel/boards/sof_sdw_common.h       |   3 +
 sound/soc/intel/boards/sof_sdw_max98373.c     |  36 +++-
 sound/soc/intel/boards/sof_sdw_rt700.c        |   6 +-
 .../intel/common/soc-acpi-intel-cml-match.c   |  10 ++
 .../intel/common/soc-acpi-intel-cnl-match.c   |   1 +
 .../intel/common/soc-acpi-intel-icl-match.c   |   6 +
 .../intel/common/soc-acpi-intel-tgl-match.c   |  67 +++++++
 9 files changed, 216 insertions(+), 85 deletions(-)

--
2.27.0
2020-09-23 18:48:04 +01:00
Dan Murphy
3121420cf9
ASoC: tas2770: Remove unused variables
Remove unused variables in the private struct and the code as these
variables are initially set and then there is no additional code
utilizing these variables.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-6-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:48:03 +01:00
Dan Murphy
dd7d905206
ASoC: tas2770: Remove ti,asi-format code
Remove the code to support the asi-format binding property. The code
does nothing except read the property and set a variable. No additional
action is taken except to reset the variable. The property is supposed
to set the rising or falling RX edge detection of the SBCLK but this
edge detection is done by checking the DAI_FMT_INV_MASK.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-5-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:48:02 +01:00
Dan Murphy
c0a30e2e07
ASoC: tas2770: Set regcache when shutting down and waking device
Set the regcache to cache data and mark cache as dirty when the device
is shutdown when suspend is called. When the device is woken up then
sync the cache and set to not caching the data.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-3-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:48:01 +01:00
Dan Murphy
5d0b9dfe0d
ASoC: tas2770: Add shutdown capability via a GPIO
Add the hardware shutdown mechanism to shutdown and wake up the device
via a GPIO.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200923132600.10652-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:48:01 +01:00
Pierre-Louis Bossart
a3f18f82a2
ASoC: Intel: hda_dsp_common: use static function in conditional block
cppcheck reports the following warning:

sound/soc/intel/boards/hda_dsp_common.c:17:0: style: The function
'hda_dsp_hdmi_pcm_handle' is never used. [unusedFunction]

Fix by moving to static inside compilation block.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923072939.3100468-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:47:59 +01:00
Rander Wang
7cc3b56f73
ASOC: Intel: sof_sdw: restore playback functionality with max98373 amps
The Max98373 amplifier provides I/V feedback information, which keeps
a DAPM path active even when there is no playback happening. This
prevents entry in low-power mode. Rather than adding new controls and
require UCM/user interaction, the method previously applied is to
enable/disable the Speaker pin during the dailink trigger operations.

Recent changes in the SoundWire stream management moved the stream
trigger to the dailink trigger. This change removed the Maxim-specific
pin handling and resulted in a regression. This patch restores
functionality by combining the SoundWire stream trigger with the pin
enable/disable.

Fixes: ae3a3918ed ('ASoC: Intel: sof_sdw: add dailink .trigger callback')
Fixes: 06998d49bc ('ASoC: Intel: sof_sdw: add dailink .prepare and .hw_free callback')
Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:13:17 +01:00
Bard Liao
e787f5b5b1
ASoC: Intel: add support for new SoundWire hardware layout on TGL
The creativity of hardware folks is endless, with a complete
permutation of rt711 (was link0 now link1), rt1308 (was link1 now
link2) and rt715 (was link3 now link0).

Someday we will get all this information from platform firmware, for
now let's add the mapping table.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-7-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:13:16 +01:00
Pierre-Louis Bossart
fbcc27d181
ASoC: Intel: sof_sdw_rt700: add codec prefix
Somehow for this codec we never used any prefix for the controls,
likely because the test platform has a single SoundWire device.

Follow the convention and use the codec prefix across the board to
avoid possible conflicts.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:13:15 +01:00
Pierre-Louis Bossart
23c8aa3eba
ASoC: Intel: sof_sdw: remove hard-coded codec_conf table
Now that the ACPI machine params provide all the information needed,
allocate the card codec_conf dynamically and set .dlc and
.prefix_name.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:13:14 +01:00
Pierre-Louis Bossart
f93808308a
ASoC: Intel: add codec name prefix to ACPI machine description
The current SOF machine driver adds a name prefix for each codec,
mainly to differentiate ALSA controls for left and right amplifiers.

This is a good idea, but the machine driver duplicates some of the
information that already exists in ACPI descriptors, so add those
prefixes there. Follow-up patches will make use of the information
encoded in these tables and remove duplication.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:13:13 +01:00
Pierre-Louis Bossart
f1bf9a6b4e
ASoC: Intel: sof_sdw: remove ternary operator
cppcheck reports the following warning:

sound/soc/intel/boards/sof_sdw.c:866:46: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
 hdmi_num = sof_sdw_quirk & SOF_SDW_TGL_HDMI ?
                                             ^

There's no reason to use the ternary operator here, we might as well
use a regular if-else construct.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200923080514.3242858-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-23 18:13:12 +01:00
Takashi Iwai
2759caad26 ALSA: seq: oss: Avoid mutex lock for a long-time ioctl
Recently we applied a fix to cover the whole OSS sequencer ioctls with
the mutex for dealing with the possible races.  This works fine in
general, but in theory, this may lead to unexpectedly long stall if an
ioctl like SNDCTL_SEQ_SYNC is issued and an event with the far future
timestamp was queued.

For fixing such a potential stall, this patch changes the mutex lock
applied conditionally excluding such an ioctl command.  Also, change
the mutex_lock() with the interruptible version for user to allow
escaping from the big-hammer mutex.

Fixes: 80982c7e83 ("ALSA: seq: oss: Serialize ioctls")
Suggested-by: Pavel Machek <pavel@ucw.cz>
Link: https://lore.kernel.org/r/20200922083856.28572-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-23 14:45:14 +02:00
František Kučera
cdc01a1558 ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2
This patch extends support for DJM-250MK2 and allows mapping
playback and capture channels to available sources.
Configures the card through USB commands.

Signed-off-by: František Kučera <franta-linux@frantovo.cz>
Link: https://lore.kernel.org/r/20200922144206.10472-1-konference@frantovo.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-23 14:40:52 +02:00
Kai-Heng Feng
c413c31027 Revert "ALSA: usb-audio: Disable Lenovo P620 Rear line-in volume control"
This reverts commit 34dedd2a83.

According to Realtek, volume FU works for line-in.

I can confirm volume control works after device firmware is updated.

Fixes: 34dedd2a83 ("ALSA: usb-audio: Disable Lenovo P620 Rear line-in volume control")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20200915103925.12777-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-22 17:15:35 +02:00
Necip Fazil Yildiran
50b18e4a26
ASoC: cros_ec_codec: fix kconfig dependency warning for SND_SOC_CROS_EC_CODEC
When SND_SOC_CROS_EC_CODEC is enabled and CRYPTO is disabled, it results
in the following Kbuild warning:

WARNING: unmet direct dependencies detected for CRYPTO_LIB_SHA256
  Depends on [n]: CRYPTO [=n]
  Selected by [y]:
  - SND_SOC_CROS_EC_CODEC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && CROS_EC [=y]

The reason is that SND_SOC_CROS_EC_CODEC selects CRYPTO_LIB_SHA256 without
depending on or selecting CRYPTO while CRYPTO_LIB_SHA256 is subordinate to
CRYPTO.

Honor the kconfig menu hierarchy to remove kconfig dependency warnings.

Fixes: 93fa0af479 ("ASoC: cros_ec_codec: switch to library API for SHA-256")
Signed-off-by: Necip Fazil Yildiran <fazilyildiran@gmail.com>
Link: https://lore.kernel.org/r/20200917141803.92889-1-fazilyildiran@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-22 16:04:21 +01:00
Dan Murphy
90e2a588c9
ASoC: tas2562: Remove duplicate code for I/V sense
Remove duplicate code for programming the I/V sense the call to update
the register was duplicated in commit 09ed395b05 ("ASoC: tas2562:
Add voltage sense slot configuration").

Fixes: 09ed395b05 ("ASoC: tas2562: Add voltage sense slot configuration")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200922142411.10364-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-22 16:04:20 +01:00
Cheng-Yi Chiang
55c5cc63ab
ASoC: hdmi-codec: Use set_jack ops to set jack
Use set_jack ops to set jack so machine drivers do not need to include
hdmi-codec.h explicitly.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200922062316.1172935-1-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-22 12:48:03 +01:00
Takashi Iwai
6564d0ad67 ALSA: ctl: Workaround for lockdep warning wrt card->ctl_files_rwlock
The recent change in lockdep for read lock caused the deadlock
warnings in ALSA control code which uses the read_lock() for
notification and else while write_lock_irqsave() is used for adding
and removing the list entry.  Although a deadlock would practically
never hit in a real usage (the addition and the deletion can't happen
with the notification), it's better to fix the read_lock() usage in a
semantically correct way.

This patch replaces the read_lock() calls with read_lock_irqsave()
version for avoiding a reported deadlock.  The notification code path
takes the irq disablement in anyway, and other code paths are very
short execution, hence there shouldn't be any big performance hit by
this change.

Fixes: e918188611 ("locking: More accurate annotations for read_lock()")
Reported-by: syzbot+561a74f84100162990b2@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20200922084953.29018-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-22 11:07:10 +02:00
Mark Brown
376dd57d88
Merge series "ASoC: SOF: fix kcontrol size checks" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:
Series that fixes checks for 'size' in kcontrol get/put ext_bytes methods
for SOF. The gaps in these checks were discovered via cppcheck warnings
on unused variable values.

Pierre-Louis Bossart (5):
  ASoC: SOF: control: fix size checks for ext_bytes control .get()
  ASoC: SOF: control: fix size checks for volatile ext_bytes control
    .get()
  ASoC: SOF: control: add size checks for ext_bytes control .put()
  ASoC: SOF: control: remove const in sizeof()
  ASoC: SOF: topology: remove const in sizeof()

 sound/soc/sof/control.c  | 53 +++++++++++++++++++++++++++++++---------
 sound/soc/sof/topology.c |  2 +-
 2 files changed, 43 insertions(+), 12 deletions(-)

--
2.27.0
2020-09-21 23:57:25 +01:00
Kai Vehmanen
163cd1059a
ASoC: hdac: make SOF HDA codec driver probe deterministic
To provide backward compatibility to older systems, the SOF HDA driver
allows user to specify which HDMI codec driver to use at runtime via
kernel parameter. This mechanism has a subtle flaw in that it assumes
the codec drivers not to be loaded when the SOF PCI driver is loaded.

The problem is rooted in use of the hdev->type field.
snd_hdac_ext_bus_device_init() initializes this field to HDA_DEV_ASOC.
This signals the HDA core that ASoC drivers should be considered in
driver matching (hda_bus_match()). The SOF and SST drivers continue by
overriding this field to HDA_DEV_LEGACY and proceeding to load driver
modules with request_module(). Correct drivers will get loaded and
attached.

If however the codec drivers are already loaded when
snd_hdac_ext_bus_device_init() is called, the matching will not work as
expected as device type is still set to HDA_DEV_ASOC. Specifically if
hdac-hdmi is attached when machine driver is configured to use hdac-hda,
this leads to out-of-bounds memory access in
hda_dsp_hdmi_build_controls().

Fix the issue by adding codec type as a parameter to
snd_hdac_ext_bus_device_init() and ensuring type is set correctly from
the start.

Fixes: 139c7febad ("ASoC: SOF: Intel: add support for snd-hda-codec-hdmi")
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921100841.2882662-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:24 +01:00
Dan Murphy
be05ab41c6
ASoC: tas2770: Refactor sample rate function
Refactor the tas2770_set_samplerate to simplify the code and access the
I2C bus only once per rate request. The ramp rate and sample rate bits
are contained in the same register so a single call to the
snd_soc_update_bits function is all that is needed

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-9-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:23 +01:00
Dan Murphy
d3964aff73
ASoC: tas2770: Fix the spacing and new lines
Fix up the spacing for argument alignment and add new lines to separate
code. Eliminate unneccessary goto statements when the error code could
just be returned.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-8-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:22 +01:00
Dan Murphy
ec9377dca2
ASoC: tas2770: Convert bit mask to GENMASK in header
Update the hardcoded masks with the GENMASK macro. Also update some of
the hardcoded bits with the BIT macro

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-6-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:21 +01:00
Dan Murphy
d3d71c99b5
ASoC: tas2770: Fix unbalanced calls to pm_runtime
Fix the unbalanced call to the pm_runtime_disable when removing the
module.  pm_runtime_enable is not called nor is the pm_runtime setup in
the code.  Remove the i2c_remove function and the pm_runtime_disable.

Fixes: 1a476abc72 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-5-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:20 +01:00
Dan Murphy
8adcdbe63a
ASoC: tas2562: Add the TAS2110 class-D amplifier
Add the TAS2110 amplifier to the TAS2562 driver. The TAS2110 is register
and bitmap compatible. The chips differ in that the TAS2110 does not
have the I/V Sense feedback path. Since these features do not exist the
device needs to be registered without these controls.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200921153820.18357-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:57:18 +01:00
Pierre-Louis Bossart
2ca210112a
ASoC: SOF: control: add size checks for ext_bytes control .put()
Make sure the TLV header and size are consistent before copying from
userspace.

Fixes: c3078f5397 ('ASoC: SOF: Add Sound Open Firmware KControl support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:14:47 +01:00
Pierre-Louis Bossart
ec5a97624a
ASoC: SOF: control: fix size checks for volatile ext_bytes control .get()
Mirror addition of checks for regular ext_bytes controls.

Fixes: 783560d02d ('ASoC: SOF: Implement snd_sof_bytes_ext_volatile_get kcontrol IO')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:14:46 +01:00
Pierre-Louis Bossart
3331bcd6a2
ASoC: SOF: control: fix size checks for ext_bytes control .get()
cppcheck complains twice:

sound/soc/sof/control.c:436:2: style: Assignment of function parameter
has no effect outside the function. [uselessAssignmentArg]
 size -= sizeof(const struct snd_ctl_tlv);
 ^

sound/soc/sof/control.c:436:7: style: Variable 'size' is assigned a
value that is never used. [unreadVariable]
 size -= sizeof(const struct snd_ctl_tlv);

Somehow we dropped the checks for the size argument when upstreaming
the code, somewhere between v5 and v6.

Re-add a size check to avoid providing userspace with more data that
it asked for.

Also fix all error codes, we should return -ENOSPC instead of -EINVAL.

Fixes: c3078f5397 ('ASoC: SOF: Add Sound Open Firmware KControl support')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921110814.2910477-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 23:14:45 +01:00
Mark Brown
97ee967e6c
Merge branch 'asoc-5.9' into asoc-5.10 2020-09-21 22:37:14 +01:00
Miquel Raynal
ec96690de8
ASoC: tlv320aic32x4: Enable fast charge
At power-up the analog circuits may take up to one full second before
being charged with the default configuration. Using the analog blocks
before they are ready generates a *very* crappy sound.

Enable the fast charge feature, which will require a bit more power
than normal charge but will definitely speed up the starting operation
by shrinking this delay to up to 40 ms.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20200911173140.29984-4-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 22:08:36 +01:00
Miquel Raynal
40b3713628
ASoC: tlv320aic32x4: Fix bdiv clock rate derivation
Current code expects a single channel to be always used. Fix this
situation by forwarding the number of channels used. Then fix the
derivation of the bdiv clock rate.

Fixes: 96c3bb0023 ("ASoC: tlv320aic32x4: Dynamically Determine Clocking")
Suggested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20200911173140.29984-3-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 22:08:35 +01:00
Miquel Raynal
5b4458ebb4
ASoC: tlv320aic32x4: Ensure a minimum delay before clock stabilization
As indicated in the datasheet, a 10ms delay must be observed after
programming the divisors.

The lack of delay prevents the codec to work properly and the playback
appears extremely slow and totally un-audible on a custom sama5 based
board.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20200911173140.29984-2-miquel.raynal@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 22:08:34 +01:00
Shuming Fan
501ef01339
ASoC: rt711: wait for the delayed work to finish when the system suspends
To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921094308.31921-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 20:40:55 +01:00
Dan Murphy
cadab0aefc
ASoC: tas2770: Fix error handling with update_bits
snd_soc_update_bits returns a 1 when the bit was successfully updated,
returns a 0 is no update was needed and a negative if the call failed.
The code is currently failing the case of a successful update by just
checking for a non-zero number. Modify these checks and return the error
code only if there is a negative.

Fixes: 1a476abc72 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-7-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 20:40:54 +01:00
Dan Murphy
4b8ab8a776
ASoC: tas2770: Fix required DT properties in the code
The devicetree binding indicates that the ti,asi-format, ti,imon-slot-no
and ti,vmon-slot-no are not required but the driver requires them or it
fails to probe. Honor the binding and allow these entries to be optional
and set the corresponding values to the default values for each as defined
in the data sheet.

Fixes: 1a476abc72 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-4-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 20:40:53 +01:00
Dan Murphy
4272caf34a
ASoC: tas2770: Add missing bias level power states
Add the BIAS_STANDBY and BIAS_PREPARE to the set_bias_level or else the
driver will return -EINVAL which is not correct as they are valid
states.

Fixes: 1a476abc72 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 20:40:52 +01:00
Dan Murphy
b0bcbe6157
ASoC: tas2770: Fix calling reset in probe
tas2770_reset is called during i2c probe. The reset calls the
snd_soc_component_write which depends on the tas2770->component being
available. The component pointer is not set until codec_probe so move
the reset to the codec_probe after the pointer is set.

Fixes: 1a476abc72 ("tas2770: add tas2770 smart PA kernel driver")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918190548.12598-1-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 20:40:52 +01:00
Shuming Fan
5f2df2a458
ASoC: rt700: wait for the delayed work to finish when the system suspends
To avoid the IO error, we need to cancel the delayed work and wait for it to finish.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921094244.31869-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 20:40:51 +01:00
Dan Murphy
534c0f4391
ASoC: tas2562: Add the TAS2564 compatible
Add the TAS2564 as a supported amplifier.  This amplifier is register,
bitmap and feature compatible to the TAS2562.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200918150130.21015-2-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 17:28:12 +01:00
Kai Vehmanen
5b51b9221f
ASoC: SOF: imx: add missing MODULE_LICENSE() for imx-common
Fix build warning:
WARNING: modpost: missing MODULE_LICENSE() in sound/soc/sof/imx/imx-common.o

Fixes: 18ebffe4d0 ("ASoC: SOF: imx: Add debug support for imx platforms")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200921104746.2903507-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 17:28:11 +01:00
Daniel Baluta
43437d0417
ASoC: SOF: pm: Fix prepare callback behavior for OF usecase
On i.MX platforms PM is not managed via ACPI although CONFIG_ACPI
can be set. So, in order to correctly set the system target state
we introduce a flag for platforms that require to use acpi target
states.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921105038.2909899-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 17:28:10 +01:00
Guillermo Rodríguez
6410887222
ASoC: cs42l51: add additional ADC volume controls
Add volume controls for:
- Analog programmable gain amplifier (PGA) (-3 .. +12 dB)
- ADC attenuator (0 .. -96 dB)

Signed-off-by: Guillermo Rodríguez <guille.rodriguez@gmail.com>
Acked-by: David Rhodes <David.rhodes@cirrus.com>
Link: https://lore.kernel.org/r/20200918134317.22574-1-guille.rodriguez@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 17:28:09 +01:00
Keyon Jie
2263063fc4
ASoC: SOF: topology: fix the process being scheduled on core0 always
In commit 783898ce68 ("ASoC: SOF: append extended data to
sof_ipc_comp_process") the process components are set to run on the
fixed core 0, this break us from scheduling components on any other DSP
core.

Since we can get the DSP core index from swidget->core, it is duplicated
to pass the extra 'core' argument for those sof_widget_load_xx()
functions.

Here removes the duplicate 'core' argument and get component core from
swidget->core directly to fix the issue mentioned above.

Fixes: 783898ce68 ("ASoC: SOF: append extended data to sof_ipc_comp_process")
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921104544.2897112-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21 17:28:08 +01:00
Kai Vehmanen
534ad9afb1 ALSA: hda - fix CONTROLLER_IN_GPU macro name
The CONTROLLER_IN_GPU() macro has different semantics than
the similarly named macro in hda_intel.c. The name is also
misleading as the macro is used to apply a Intel HSW/BDW
programming logic for HDA controller clock configuration.
Rename macro to reflect the actual implementation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921141741.2983072-5-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 17:58:47 +02:00
Kai Vehmanen
7b882fe3e3 ALSA: hda - handle multiple i915 device instances
Currently i915_component_master_match() will return the first matching
i915 instance. This does not work in case system has multiple i915
and HDA audio controller instances.

Add a new connectivity check that handles following cases:
 - i915 and HDA controller on same PCI bus
 - discrete GPU with embedded HDA audio controller connected
   via PCI bridge

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921141741.2983072-4-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 17:57:30 +02:00
Kai Vehmanen
1bee263dfd ALSA: hda - controller is in GPU on the DG1
Add Intel DG1 to the CONTROLLER_IN_GPU list to ensure audio power is
requested whenever programming the controller.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921141741.2983072-3-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 17:57:21 +02:00
Kai Vehmanen
69b08bdfa8 ALSA: hda - add Intel DG1 PCI and HDMI ids
Add Intel DG1 PCI id to list of supported HDA controllers and
add its HDMI id as well.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200921141741.2983072-2-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 17:57:08 +02:00
Takashi Iwai
8f8bf00b1c Revert "ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO"
This reverts commit 15cbff3fbb ("ALSA: hda - Fix silent audio output
and corrupted input on MSI X570-A PRO").

A regression reported by a Fedora user for MSI X570-A PRO mobo.
Until the correct solution is found out, let's revert the quirk as a
quick workaround.

Fixes: 15cbff3fbb ("ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Cc: <stable@vger.kernel.org>
Cc: Dan Crawford <dnlcrwfrd@gmail.com>
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1879277
Link: https://lore.kernel.org/r/7efd2fe5-bf38-7f85-891a-eee3845d1493@redhat.com
Link: https://lore.kernel.org/r/20200921102632.31139-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 12:32:09 +02:00
Joakim Tjernlund
315c7ad7a7 ALSA: usb-audio: Add delay quirk for H570e USB headsets
Needs the same delay as H650e

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200910085328.19188-1-joakim.tjernlund@infinera.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 10:41:28 +02:00
Arnd Bergmann
18d122c028 ALSA: compat_ioctl: avoid compat_alloc_user_space
Using compat_alloc_user_space() tends to add complexity
to the ioctl handling, so I am trying to remove it everywhere.

The two callers in sound/core can rewritten to just call
the same code that operates on a kernel pointer as the
native handler.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200918095642.1446243-1-arnd@arndb.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 10:37:07 +02:00
Wang Qing
2b987515e1 ALSA: asihpi: fix spellint typo in comments
Change the comment typo: "ununsed" -> "unused".

Signed-off-by: Wang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1600329372-2266-1-git-send-email-wangqing@vivo.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 10:31:20 +02:00
Kai-Heng Feng
f73bbf639b ALSA: hda/realtek: Enable front panel headset LED on Lenovo ThinkStation P520
On Lenovo P520, the front panel headset LED isn't lit up right now.

Realtek states that the LED needs to be enabled by ALC233's GPIO2, so
let's do it accordingly to light the LED up.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Hui Wang <hui.wang@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200914070231.13192-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 10:27:21 +02:00
Hui Wang
3f74249057 ALSA: hda/realtek - Couldn't detect Mic if booting with headset plugged
We found a Mic detection issue on many Lenovo laptops, those laptops
belong to differnt models and they have different audio design like
internal mic connects to the codec or PCH, they all have this problem,
the problem is if plugging a headset before powerup/reboot the
machine, after booting up, the headphone could be detected but Mic
couldn't. If we plug out and plug in the headset, both headphone and
Mic could be detected then.

Through debugging we found the codec on those laptops are same, it is
alc257, and if we don't disable the 3k pulldown in alc256_shutup(),
the issue will be fixed. So far there is no pop noise or power
consumption regression on those laptops after this change.

Cc: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20200914065118.19238-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 10:25:16 +02:00
Tom Rix
472eb39103 ALSA: asihpi: fix iounmap in error handler
clang static analysis flags this problem
hpioctl.c:513:7: warning: Branch condition evaluates to
  a garbage value
                if (pci.ap_mem_base[idx]) {
                    ^~~~~~~~~~~~~~~~~~~~

If there is a failure in the middle of the memory space loop,
only some of the memory spaces need to be cleaned up.

At the error handler, idx holds the number of successful
memory spaces mapped.  So rework the handler loop to use the
old idx.

There is a second problem, the memory space loop conditionally
iomaps()/sets the mem_base so it is necessay to initize pci.

Fixes: 719f82d398 ("ALSA: Add support of AudioScience ASI boards")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20200913165230.17166-1-trix@redhat.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-21 10:22:57 +02:00
Greg Kroah-Hartman
629b911153 Merge 5.0-rc6 into usb-next
We want the USB fixes in here, and this resolves a merge issue in the
uas driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-21 09:06:42 +02:00
Linus Torvalds
343b529a00 sound fixes for 5.9-rc6
Here is a collection of fixes for 5.9.  All look small and are
 nothing scary.  The majority of changes are about ASoC driver-
 specific fixes, while there are a couple of ASoC core fixes (DAI
 lookup and lockdep stuff) and usual HD-audio quirks.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAl9k6X4OHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE/9ihAAiTQtzf4s9BkyyiCsH3vrRa7+8qX8N/vMk+8k
 vintgqMVwDr1hpkB2ZnpEOkbrcdzFAByOnLU66t42kTiKwjiTdABii8vpVUUpSdw
 MwM11+IEor5MaNdNZwt3lfBK0j30AfU3ag5lyPsw8afQpUla/nkk16AIwzOO4u1Q
 ajy+vdBz15q8IeR80geSvuTDHvNO4X+3pI381kekEbg/D5U/KlGCYe1q0Ln6RJ5B
 pguzNFiyWIKu9w6YdPI7hgGInlA3V0Eltnt7LAI6TfIL32v+gDF5V5UAYGhENsT3
 Belc3OP4iQrrYCJ/9mLyhpz4n6urQk/hZBND2I3CLybk/OyCmxZCPCkHq2nk7NaL
 dWPs+0xiJnoh60UWGeDiejUNqVgIxRcI0WA+XJA+ELg6zfOU3KDVh3Swm+SlY3c/
 OQXjZxw5XzSYvg98cTaA+CYGRO1u4vMM5iPWa0KajQcMGbu+h5ogGZLggfsuNQ6/
 0oqBvomkfEPFINupmiJgzkb6MuXSvXxE6WHPyfAD0xT2Dh8u8vrIEmKqABQDJpaJ
 8JACBYUCax+Y1OFTvWj8LZ75sXBBiL+ynzetlP9h7zDqYLwU1ZwVAeyS0CPt7E5e
 A220weSOzcJNZz4ZM4c0XSN7cvz1MpkVlKTihj4Evx2xXagMgE47/F355SQlt6C4
 Y8G85/0=
 =VuAQ
 -----END PGP SIGNATURE-----

Merge tag 'sound-5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Here is a collection of fixes for 5.9. All look small and are nothing
  scary.

  The majority of changes are about ASoC driver- specific fixes, while
  there are a couple of ASoC core fixes (DAI lookup and lockdep stuff)
  and usual HD-audio quirks"

* tag 'sound-5.9-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (23 commits)
  ALSA: hda/realtek - The Mic on a RedmiBook doesn't work
  ASoC: tlv320adcx140: Wake up codec before accessing register
  ASoC: core: Do not cleanup uninitialized dais on soc_pcm_open failure
  ALSA: hda: fixup headset for ASUS GX502 laptop
  ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN Converter9 2-in-1
  ASoC: Intel: haswell: Fix power transition refactor
  ASoC: tlv320adcx140: Fix accessing uninitialized adcx140->dev
  ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions
  ASoC: wm8994: Skip setting of the WM8994_MICBIAS register for WM1811
  ASoC: meson: axg-toddr: fix channel order on g12 platforms
  ASoC: soc-core: add snd_soc_find_dai_with_mutex()
  ASoC: qcom: common: Fix refcount imbalance on error
  ASoC: rt700: Fix return check for devm_regmap_init_sdw()
  ASoC: rt715: Fix return check for devm_regmap_init_sdw()
  ASoC: rt711: Fix return check for devm_regmap_init_sdw()
  ASoC: rt1308-sdw: Fix return check for devm_regmap_init_sdw()
  ASoC: max98373: Fix return check for devm_regmap_init_sdw()
  ASoC: ti: fixup ams_delta_mute() function name
  ASoC: pcm3168a: ignore 0 Hz settings
  ASoC: Intel: tgl_max98373: fix a runtime pm issue in multi-thread case
  ...
2020-09-18 11:38:08 -07:00
Camel Guo
d521432149
ASoC: tlv320adcx140: Add support for configuring GPIO pin
Add support to configure the GPIO pin to the specific configuration.
The GPIO pin can be configured as GPO, IRQ, SDOUT2, PDMCLK, MICBASE_EN,
GPI, MCLK, SDIN, PDMDIN1, PDMDIN2, PDMDIN3 or PDMDIN4 and the output
drive can be configured with various configuration.

Signed-off-by: Camel Guo <camelg@axis.com>
Link: https://lore.kernel.org/r/20200918114025.18205-2-camel.guo@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-18 13:09:02 +01:00
Mark Brown
41cfc734ab
Merge series "ASoC: fsl_sai: update the register list" from Shengjiu Wang <shengjiu.wang@nxp.com>:
As sai ip is upgraded, so update sai register list.

Shengjiu Wang (3):
  ASoC: fsl_sai: Add new added registers and new bit definition
  ASoC: fsl_sai: Add fsl_sai_check_version function
  ASoC: fsl_sai: Set MCLK input or output direction

changes in v2:
- update commit message for first commit
- Add acked-by Nicolin

 sound/soc/fsl/fsl_sai.c | 77 ++++++++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_sai.h | 87 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+)

--
2.27.0
2020-09-17 17:40:16 +01:00
Mark Brown
e6937b6d1a
Merge series "ASoC: SOF: small fixes for 5.10" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:
Series that adds debug support for IMX platforms, more details to
FW version information, adds missing -EACCESS handling to
pm_runtime_get_sync() calls and a set of minor cosmetic, trace
verbosity and coding style issues.

Guennadi Liakhovetski (3):
  ASoC: SOF: (cosmetic) remove redundant "ret" variable uses
  ASoC: SOF: remove several superfluous type-casts
  ASoC: SOF: fix range checks

Iulian Olaru (1):
  ASoC: SOF: imx: Add debug support for imx platforms

Karol Trzcinski (1):
  ASoC: SOF: Add `src_hash` to `sof_ipc_fw_version` structure

Pierre-Louis Bossart (3):
  ASoC: SOF: debug: update test for pm_runtime_get_sync()
  ASoC: SOF: control: update test for pm_runtime_get_sync()
  ASoC: SOF: Intel: hda: reduce verbosity of boot error logs

 include/sound/sof/info.h         |  4 +-
 sound/soc/sof/control.c          | 62 +++++++++++++--------------
 sound/soc/sof/debug.c            |  2 +-
 sound/soc/sof/imx/Kconfig        |  8 ++++
 sound/soc/sof/imx/Makefile       |  3 ++
 sound/soc/sof/imx/imx-common.c   | 72 ++++++++++++++++++++++++++++++++
 sound/soc/sof/imx/imx-common.h   | 16 +++++++
 sound/soc/sof/imx/imx8.c         | 23 +++++++++-
 sound/soc/sof/imx/imx8m.c        | 17 +++++++-
 sound/soc/sof/intel/hda-loader.c | 16 +++----
 sound/soc/sof/intel/hda.c        | 12 ++++--
 sound/soc/sof/intel/hda.h        |  2 +
 sound/soc/sof/sof-audio.c        |  6 +--
 sound/soc/sof/sof-priv.h         |  8 ++++
 sound/soc/sof/topology.c         | 44 ++++++++++---------
 15 files changed, 226 insertions(+), 69 deletions(-)
 create mode 100644 sound/soc/sof/imx/imx-common.c
 create mode 100644 sound/soc/sof/imx/imx-common.h

--
2.27.0
2020-09-17 17:40:15 +01:00
Mark Brown
4c3021f0af
Merge series "ASoC: q6afe: add clocks support" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
q6afe already exposes clocks using apis, but not as proper
clock controller driver. This patch puts those clocks
in to a proper clock controller so that other drivers that
depend on those clocks can be properly expressed.

Srinivas Kandagatla (2):
  ASoC: q6afe: dt-bindings: add q6afe clock bindings
  ASoC: q6afe-clocks: add q6afe clock controller

 .../devicetree/bindings/sound/qcom,q6afe.txt  |  23 ++
 include/dt-bindings/sound/qcom,q6afe.h        |  74 ++++-
 sound/soc/qcom/Kconfig                        |   4 +
 sound/soc/qcom/qdsp6/Makefile                 |   1 +
 sound/soc/qcom/qdsp6/q6afe-clocks.c           | 270 ++++++++++++++++++
 5 files changed, 371 insertions(+), 1 deletion(-)
 create mode 100644 sound/soc/qcom/qdsp6/q6afe-clocks.c

--
2.21.0
2020-09-17 17:40:14 +01:00
Shengjiu Wang
337d348b83
ASoC: ak4458: Add DSD support for ak4458 and ak4497
Ak4458 can't support DSD512 format, but ak4497 can, so add
a new enum variable (enum ak4458_type) in ak4458_drvdata to
distinguish these two platforms.

Ak4497 has two kinds of DSD input pin, it can be selected by
the dsd-path property from DT.

In hw_params(), bit clock is calculated according to different
DSD format (DSD64, DSD128, DSD256, DSD512), then registers
are configured.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1600178220-28973-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 17:40:13 +01:00
Dan Murphy
42d5031d3e
ASoC: tlv320adcx140: Add the config to configure Tx ASI output
Add code to allow the ASI Tx output to be placed into High-z mode
during unused ASI cycles.  This allows for other devices that may be on
the bus to drive the ASI out. By default the 320adcx140 sends 0's for
unused cycles.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200915190606.1744-4-dmurphy@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 17:40:10 +01:00
Douglas Anderson
dcde34c47d
ASoC: qcom: lpass-sc7180: Add MODULE_DEVICE_TABLE
The lpass-sc7180 driver can be built as a module but is lacking a
MODULE_DEVICE_TABLE.  This means it won't auto-load.  Fix this
oversight.

Fixes: 24caf8d9eb ("ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20200916111545.1.I4c3758817d94c433bafeac344a395e21ea6657e3@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 17:40:09 +01:00
Rander Wang
30ee3738f8
ASoC: SOF: Intel: Add support for tgl-h
SOF will support tgl-h and tgl-lp in different FW binaries due to
hardware difference, so create another dev_desc entry with FW name
of sof-tgl-h.ri and dsp_desc named tglh_chip_info for tgl-h.

Fixes: c8d2e2bfae ("ASoC: SOF: Intel: add PCI IDs for ICL-H and TGL-H")
Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200917103609.2559916-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 17:40:09 +01:00
Matthias Schiffer
df44bc16e6
ASoC: codec: tlv320aic32x4: do software reset before clock registration
To avoid the actual PLL settings to differ from the state expected by
the clock driver, the codec should only be fully reset before the clocks
are registered. But we also need to ensure that the software reset
happens at all before clock registration, as not all boards have a reset
GPIO.

Move the software reset from aic32x4_component_probe() to
aic32x4_probe() and reorder the reset and registration sequence:

1. Reset via GPIO (if available)
2. Reset via software
3. Register component
4. Register clocks

Note that aic32x4_component_probe() is only called after aic32x4_probe()
has finished, so the reset in aic32x4_component_probe() was happening too
late.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Link: https://lore.kernel.org/r/20200902133043.19504-2-matthias.schiffer@ew.tq-group.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 17:40:08 +01:00
Matthias Schiffer
251e5c8694
ASoC: codec: tlv320aic32x4: fix missing aic32x4_disable_regulators() in error path
The regulators need to be disabled in the aic32x4_register_clocks()
failure case as well.

Fixes: 9d4befff5a ("ASoC: codec: tlv3204: Moving GPIO reset and add ADC reset")
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Link: https://lore.kernel.org/r/20200902133043.19504-1-matthias.schiffer@ew.tq-group.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 17:40:07 +01:00
Mark Brown
4db68e62a0
Merge branch 'asoc-5.9' into asoc-5.10 2020-09-17 16:35:38 +01:00
Shengjiu Wang
a57d4e8730
ASoC: fsl_sai: Set MCLK input or output direction
SAI support select MCLK direction with version.major > 3
and version.minor > 1, the default direction is input,
set it to be output according to DT property.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1600323079-5317-4-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-17 16:34:01 +01:00