linux-2.6-block.git
4 years agoASoC: hdac_hda: fix race in device removal
Kai Vehmanen [Fri, 1 Nov 2019 17:06:35 +0000 (12:06 -0500)]
ASoC: hdac_hda: fix race in device removal

When ASoC card instance is removed containing a HDA codec,
hdac_hda_codec_remove() may run in parallel with codec resume.
This will cause problems if the HDA link is freed with
snd_hdac_ext_bus_link_put() while the codec is still in
middle of its resume process.

To fix this, change the order such that pm_runtime_disable()
is called before the link is freed. This will ensure any
pending runtime PM action is completed before proceeding
to free the link.

This issue can be easily hit with e.g. SOF driver by loading and
unloading the drivers.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191101170635.26389-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: pcm: Fix missing check of the new non-cached buffer type
Takashi Iwai [Mon, 4 Nov 2019 10:11:15 +0000 (11:11 +0100)]
ALSA: pcm: Fix missing check of the new non-cached buffer type

The check for the mmap support via hw_support_mmap() function misses
the case where the device is with SNDRV_DMA_TYPE_DEV_UC, which should
have been treated equally as SNDRV_DMA_TYPE_DEV.  Let's fix it.

Note that this bug doesn't hit any practical problem, because
SNDRV_DMA_TYPE_DEV_UC is used only for x86-specific drivers
(snd-hda-intel and snd-intel8x0) for the specific platforms that need
the non-cached buffers.  And, on such platforms, hw_support_mmap()
already returns true in anyway.  That's the reason I didn't put
Cc-to-stable mark here.  This is only for any theoretical future
extension.

Fixes: 425da159707b ("ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_*")
Fixes: 42e748a0b325 ("ALSA: memalloc: Add non-cached buffer type")
Link: https://lore.kernel.org/r/20191104101115.27311-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire...
Takashi Sakamoto [Sat, 2 Nov 2019 15:09:20 +0000 (00:09 +0900)]
ALSA: bebob: fix to detect configured source of sampling clock for Focusrite Saffire Pro i/o series

For Focusrite Saffire Pro i/o, the lowest 8 bits of register represents
configured source of sampling clock. The next lowest 8 bits represents
whether the configured source is actually detected or not just after
the register is changed for the source.

Current implementation evaluates whole the register to detect configured
source. This results in failure due to the next lowest 8 bits when the
source is connected in advance.

This commit fixes the bug.

Fixes: 25784ec2d034 ("ALSA: bebob: Add support for Focusrite Saffire/SaffirePro series")
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191102150920.20367-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bebob: link the order of establishing connections and Syt-match clock mode
Takashi Sakamoto [Fri, 1 Nov 2019 13:13:23 +0000 (22:13 +0900)]
ALSA: bebob: link the order of establishing connections and Syt-match clock mode

Originally BeBeB ASICs and firmware supports clock mode to synchronizing
to syt field of received isoc packet. This mode is known as 'SYT Match'
slightly described in IEC 61883-6 (but no detail mechanisms). In this
mode, drivers can control sampling clock in device. Driver for Windows
and macOS uses this feature to perform synchronization for devices
on the same bus.

In this mode, a plug of Music subunit for synchronization is connected
to a plug of isoc unit for incoming packet streaming, then the order to
establish connections is INPUT_PLUG first, OUTPUT_PLUG second.

This commit implements the above.

Actually each device works with its own clock for sampling, therefore
the original design is hardly implemented to vendor's products.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191101131323.17300-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bebob: expand delay of start for IR context just for version 3 firmware
Takashi Sakamoto [Fri, 1 Nov 2019 13:13:22 +0000 (22:13 +0900)]
ALSA: bebob: expand delay of start for IR context just for version 3 firmware

As long as I investigated, there's some cases about the delay for device
between establishing OUTPUT_PLUG and transmitting first isoc packet. For
devices which support BeBoB protocol version 1 can transmit the packet
within several hundred milliseconds, while for devices which support
BeBoB protocol version 3 can transmit the packet within 2 seconds.

Devices with protocol version 1:
 * Edirol FA-66
 * Yamaha GO46
 * Terratec Phase x24 FW
 * M-Audio FireWire AudioPhile
 * M-Audio FireWire Solo
 * M-Audio FireWire 1814
 * M-Audio FireWire 410
 * Focusrite Saffire Pro 26 I/O

Devices with protocol version 3:
 * M-Audio Profire Lightbridge
 * Behringer FCA610
 * Phonic Firefly 202

At present ALSA bebob driver postpones starting IR context during
1.5 sec for all of supported devices. The delay is too long for
devices with protocol version 1, while it's not enough for devices with
protocol version 3.

This commit improves the delay for these protocols.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191101131323.17300-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bebob: expand sleep just after breaking connections for protocol version 1
Takashi Sakamoto [Fri, 1 Nov 2019 13:13:21 +0000 (22:13 +0900)]
ALSA: bebob: expand sleep just after breaking connections for protocol version 1

As long as I investigated, some devices with BeBoB protocol version 1
can be freezed during several hundreds milliseconds after breaking
connections. When accessing during the freezed time, any transaction
is corrupted. In the worst case, the device is going to reboot.

I can see this issue in:
 * Roland FA-66
 * M-Audio FireWire Solo

This commit expands sleep just after breaking connections to avoid
the freezed time as much as possible. I note that the freeze/reboot
behaviour is similar to below models:
 * Focusrite Saffire Pro 10 I/O
 * Focusrite Saffire Pro 26 I/O

The above models certainly reboot after breaking connections.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191101131323.17300-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: rt1011: some minor changes to improve readability
Shuming Fan [Thu, 31 Oct 2019 11:54:46 +0000 (19:54 +0800)]
ASoC: rt1011: some minor changes to improve readability

There is no other code use the RT1011_INIT_REG_LEN definition,
except rt1011_reg_init().
Hence, we remove it and fix the typo.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115446.21108-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1011: add the range check for temperature_calib from device property
Shuming Fan [Thu, 31 Oct 2019 11:54:36 +0000 (19:54 +0800)]
ASoC: rt1011: add the range check for temperature_calib from device property

The driver will check the range for temperature_calib.
It should be from 1 to 255.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115436.21055-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1011: remove unnecessary tabs using spaces instead
Shuming Fan [Thu, 31 Oct 2019 11:54:25 +0000 (19:54 +0800)]
ASoC: rt1011: remove unnecessary tabs using spaces instead

There are unnecessary tabs inside some statements.
It uses sapces instead.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115425.21003-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1011: improve the rt1011_set_dai_fmt() function
Shuming Fan [Thu, 31 Oct 2019 11:54:14 +0000 (19:54 +0800)]
ASoC: rt1011: improve the rt1011_set_dai_fmt() function

If there is a wrong format setting,
the driver will goto the end of the function directly.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115414.20951-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt1011: remove redundant code in kcontrol
Shuming Fan [Thu, 31 Oct 2019 11:54:01 +0000 (19:54 +0800)]
ASoC: rt1011: remove redundant code in kcontrol

The !component->card->instantiated statement should remove in kcontrol.
It is no need to check the card->instantiated in kcontrol.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191031115401.20898-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: timer: Fix mutex deadlock at releasing card
Takashi Iwai [Wed, 30 Oct 2019 21:42:57 +0000 (22:42 +0100)]
ALSA: timer: Fix mutex deadlock at releasing card

When a card is disconnected while in use, the system waits until all
opened files are closed then releases the card.  This is done via
put_device() of the card device in each device release code.

The recently reported mutex deadlock bug happens in this code path;
snd_timer_close() for the timer device deals with the global
register_mutex and it calls put_device() there.  When this timer
device is the last one, the card gets freed and it eventually calls
snd_timer_free(), which has again the protection with the global
register_mutex -- boom.

Basically put_device() call itself is race-free, so a relative simple
workaround is to move this put_device() call out of the mutex.  For
achieving that, in this patch, snd_timer_close_locked() got a new
argument to store the card device pointer in return, and each caller
invokes put_device() with the returned object after the mutex unlock.

Reported-and-tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda - Fix mutex deadlock in HDMI codec driver
Takashi Iwai [Tue, 29 Oct 2019 20:41:20 +0000 (21:41 +0100)]
ALSA: hda - Fix mutex deadlock in HDMI codec driver

The commit ade49db337a9 ("ALSA: hda/hdmi - Allow audio component for
AMD/ATI and Nvidia HDMI") introduced the spec->pcm_lock mutex lock to
the whole generic_hdmi_init() function for avoiding the race with the
audio component registration.  However, this caused a dead lock when
the unsolicited event is handled without the audio component, as the
codec gets runtime-resumed in hdmi_present_sense() which is already
inside the spec->pcm_lock in its caller.

For avoiding this deadlock, add a new mutex only for the audio
component binding that is used in both generic_hdmi_init() and the
audio notifier registration where the jack callbacks are handled /
re-registered.

Fixes: ade49db337a9 ("ALSA: hda/hdmi - Allow audio component for AMD/ATI and Nvidia HDMI")
Reported-and-tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/s5himo7i89i.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: dt-bindings: rt5682: add button delay device property
Shuming Fan [Wed, 30 Oct 2019 08:55:56 +0000 (16:55 +0800)]
ASoC: dt-bindings: rt5682: add button delay device property

The btndet-delay device property could control the HW debounce time.
It is easy to adjust the sensitivity of push button.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191030085556.14351-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5682: improve the sensitivity of push button
Shuming Fan [Wed, 30 Oct 2019 08:55:33 +0000 (16:55 +0800)]
ASoC: rt5682: improve the sensitivity of push button

The sensitivity could improve by decreasing the HW debounce time
and reduce the delay time of workequeue.
This patch added a device property for HW debounce time control.
We could change this value to tune the sensitivity of push button.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20191030085533.14299-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-core: remove unneeded snd_soc_tplg_component_remove()
Kuninori Morimoto [Wed, 30 Oct 2019 01:26:10 +0000 (10:26 +0900)]
ASoC: soc-core: remove unneeded snd_soc_tplg_component_remove()

snd_soc_tplg_component_remove() is pair of snd_soc_tplg_component_load(),
and it is topology related cleanup function.

The driver which called _load() needs to call _remove() by its responsibility.
Today, skl-pcm and topology are the user, and these are calling both
_load() and _remove().

soc-core doesn't need to call it.
This patch remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8736fbdnwt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5677-spi: fixup compile warning
Kuninori Morimoto [Wed, 30 Oct 2019 06:14:58 +0000 (15:14 +0900)]
ASoC: rt5677-spi: fixup compile warning

This patch fixup this warning

LINUX/sound/soc/codecs/rt5677-spi.c: In function ‘rt5677_spi_pcm_close’:
LINUX/sound/soc/codecs/rt5677-spi.c:114:30: warning: unused variable ‘rtd’ [-Wunused-variable]
  struct snd_soc_pcm_runtime *rtd = substream->private_data;
                              ^~~

Fixes: a0e0d135427c ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a79idajh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: firewire-motu: Correct a typo in the clock proc string
Takashi Iwai [Wed, 30 Oct 2019 10:09:21 +0000 (11:09 +0100)]
ALSA: firewire-motu: Correct a typo in the clock proc string

Just fix a typo of "S/PDIF" in the clock name string.

Fixes: 4638ec6ede08 ("ALSA: firewire-motu: add proc node to show current statuc of clock and packet formats")
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030100921.3826-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-motu: add support for MOTU UltraLite
Takashi Sakamoto [Wed, 30 Oct 2019 08:06:44 +0000 (17:06 +0900)]
ALSA: firewire-motu: add support for MOTU UltraLite

UltraLite was shipped in 2005 by MOTU, and already discontinued. This
model consists of below ICs:

- Texus Instruments TSB41AB2 for physical layer of IEEE 1394 bus
- Xilinx Spartan XC35S200 for link layer of IEEE 1394 bus, protocol layer
  and signal processing

This commit adds support for this model. Like the other MOTU models,
ALSA firewire MOTU driver fails to drive the device for stable sampling
clock and generate noisy sound.

$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04107574  bus_info_length 4, crc_length 16, crc 30068
404  31333934  bus_name "1394"
408  20001000  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4)
40c  0001f200  company_id 0001f2     |
410  0007b82d  device_id 000007b82d  | EUI-64 0001f2000007b82d

               root directory
               -----------------------------------------------------------------
414  0004c65c  directory_length 4, crc 50780
418  030001f2  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  8d000006  --> eui-64 leaf at 438
424  d1000001  --> unit directory at 428

               unit directory at 428
               -----------------------------------------------------------------
428  0003d80a  directory_length 3, crc 55306
42c  120001f2  specifier id
430  1300000d  version
434  17100800  model

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  00024566  leaf_length 2, crc 17766
43c  0001f200  company_id 0001f2     |
440  0007b82d  device_id 000007b82d  | EUI-64 0001f2000007b82d

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-motu: code refactoring to handle model specific switch for protocol v2
Takashi Sakamoto [Wed, 30 Oct 2019 08:06:43 +0000 (17:06 +0900)]
ALSA: firewire-motu: code refactoring to handle model specific switch for protocol v2

In MOTU FireWire series, devices which support protocol version 2 have
several types of hardware design to process audio data frames for isoc
packet. Roughly devices are categorized into three groups:
 - 828mkII
 - Traveler/896HD
 - UltraLite/8pre FireWire

Some bit flags in register addressed by 0x'ffff'f000'0b14
includes device-specific effects.

This commit cleanups implementation of protocol v2 in this point.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-motu: minor code refactoring for protocol version 2
Takashi Sakamoto [Wed, 30 Oct 2019 08:06:42 +0000 (17:06 +0900)]
ALSA: firewire-motu: minor code refactoring for protocol version 2

This commit adds some helper functions to parse register value for
source of sampling clock and nominal sampling transmission frequency.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-motu: detect SPH source of sampling clock
Takashi Sakamoto [Wed, 30 Oct 2019 08:06:41 +0000 (17:06 +0900)]
ALSA: firewire-motu: detect SPH source of sampling clock

In MOTU FireWire series, devices have a mode to generate sampling clock
from a sequence of source packet header (SPH) included in each data block
of received packet. This mode is used for several purposes such as mode
for SMPTE time code, sync to the other sound cards and so on.

This commit adds support for the SPH mode.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-motu: print for unknown source of sampling clock
Takashi Sakamoto [Wed, 30 Oct 2019 08:06:40 +0000 (17:06 +0900)]
ALSA: firewire-motu: print for unknown source of sampling clock

When unknown source is detected for sampling clock, corresponding label
was not added for node on procfs.

This commit adds it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-motu: fix wrong spelling for macro
Takashi Sakamoto [Wed, 30 Oct 2019 08:06:39 +0000 (17:06 +0900)]
ALSA: firewire-motu: fix wrong spelling for macro

Just replace 'SEPARETED' with 'SEPARATED' for macro.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191030080644.1704-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: sound: usb: usb true/false for bool return type
Saurav Girepunje [Tue, 29 Oct 2019 17:52:00 +0000 (23:22 +0530)]
ALSA: usb-audio: sound: usb: usb true/false for bool return type

Use true/false for bool type return in uac_clock_source_is_valid().

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
Link: https://lore.kernel.org/r/20191029175200.GA7320@saurav
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: Intel: bxt_rt298: common hdmi codec support
Kai Vehmanen [Tue, 29 Oct 2019 13:40:17 +0000 (15:40 +0200)]
ASoC: Intel: bxt_rt298: common hdmi codec support

Add support for using snd-hda-codec-hdmi driver for HDMI/DP
instead of ASoC hdac-hdmi. This is aligned with how other
HDA codecs are already handled.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-10-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: intel: sof_rt5682: common hdmi codec support
Kai Vehmanen [Tue, 29 Oct 2019 13:40:16 +0000 (15:40 +0200)]
ASoC: intel: sof_rt5682: common hdmi codec support

Add support for using snd-hda-codec-hdmi driver for HDMI/DP
instead of ASoC hdac-hdmi. This is aligned with how other
HDA codecs are already handled.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-9-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: glk_rt5682_max98357a: common hdmi codec support
Kai Vehmanen [Tue, 29 Oct 2019 13:40:15 +0000 (15:40 +0200)]
ASoC: Intel: glk_rt5682_max98357a: common hdmi codec support

Add support for using snd-hda-codec-hdmi driver for HDMI/DP
instead of ASoC hdac-hdmi. This is aligned with how other
HDA codecs are already handled.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-8-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: bxt-da7219-max98357a: common hdmi codec support
Kai Vehmanen [Tue, 29 Oct 2019 13:40:14 +0000 (15:40 +0200)]
ASoC: Intel: bxt-da7219-max98357a: common hdmi codec support

Add support for using snd-hda-codec-hdmi driver for HDMI/DP
instead of ASoC hdac-hdmi. This is aligned with how other
HDA codecs are already handled.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-7-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: add support for snd-hda-codec-hdmi
Kai Vehmanen [Tue, 29 Oct 2019 13:40:13 +0000 (15:40 +0200)]
ASoC: SOF: Intel: add support for snd-hda-codec-hdmi

Add support to implement HDMI/DP audio by using the common
snd-hda-codec-hdmi driver.

Change of codec driver affects user-space as the two
drivers expose different mixer controls. A new kernel
module option "use_common_hdmi" is added to user-space
to indicate which interface should be used. The default
driver can be selected via a Kconfig option.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: skl-hda-dsp-generic: fix include guard name
Kai Vehmanen [Tue, 29 Oct 2019 13:40:12 +0000 (15:40 +0200)]
ASoC: Intel: skl-hda-dsp-generic: fix include guard name

Match the include guard define to actual filename. The source
directory now has an actual hda_dsp_common.h header, so the old
include guard may cause confusion.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: skl-hda-dsp-generic: use snd-hda-codec-hdmi
Kai Vehmanen [Tue, 29 Oct 2019 13:40:11 +0000 (15:40 +0200)]
ASoC: Intel: skl-hda-dsp-generic: use snd-hda-codec-hdmi

Add support for using snd-hda-codec-hdmi driver for HDMI/DP
instead of ASoC hdac-hdmi. This is aligned with how other
HDA codecs are already handled.

When snd-hda-codec-hdmi is used, the PCM device numbers are
parsed from card topology and passed to the codec driver.
This needs to be done at runtime as topology changes may
affect PCM device allocation.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: hdac_hda: add support for HDMI/DP as a HDA codec
Kai Vehmanen [Tue, 29 Oct 2019 13:40:10 +0000 (15:40 +0200)]
ASoC: hdac_hda: add support for HDMI/DP as a HDA codec

Handle all HDA codecs using same logic, including HDMI/DP.

Call to snd_hda_codec_build_controls() is delayed for HDMI/DP HDA
devices. This is needed to discover the PCM device numbers as
defined in topology.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda/hdmi - implement mst_no_extra_pcms flag
Kai Vehmanen [Tue, 29 Oct 2019 13:40:09 +0000 (15:40 +0200)]
ALSA: hda/hdmi - implement mst_no_extra_pcms flag

To support the DP-MST multiple streams via single connector feature,
the HDMI driver was extended with the concept of backup PCMs. See
commit 9152085defb6 ("ALSA: hda - add DP MST audio support").

This implementation works fine with snd_hda_intel.c as PCM topology
is fully managed within the single driver.

When the HDA codec driver is used from ASoC components, the concept
of backup PCMs no longer fits. For ASoC topologies, the physical
HDMI converters are presented as backend DAIs and these should match
with hardware capabilities. The ASoC topology may define arbitrary
PCMs (i.e. frontend DAIs) and have processing elements before eventual
routing to the HDMI BE DAIs. With backup PCMs, the link between
FE and BE DAIs would become dynamic and change when monitors are
(un)plugged. This would lead to modifying the topology every time
hotplug events happen, which is not currently possible in ASoC and
there does not seem to be any obvious benefits from this design.

To overcome above problems and enable the HDMI driver to be used
from ASoC, this patch adds a new mode (mst_no_extra_pcms flags) to
patch_hdmi.c. In this mode, the codec driver does not assume
the backup PCMs to be created.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191029134017.18901-2-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rockchip_max98090: Add HDMI jack support
Cheng-Yi Chiang [Mon, 28 Oct 2019 07:19:28 +0000 (15:19 +0800)]
ASoC: rockchip_max98090: Add HDMI jack support

In machine driver, create a jack and let hdmi-codec report jack status.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20191028071930.145899-5-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rockchip_max98090: Optionally support HDMI use case
Cheng-Yi Chiang [Mon, 28 Oct 2019 07:19:27 +0000 (15:19 +0800)]
ASoC: rockchip_max98090: Optionally support HDMI use case

Support three different use cases with rockchip_max98090 driver.

The three use cases:
- max98090 only: Current usage, where HDMI link is missing.
- HDMI only: Needed use case for veyron_mickey board.
- max98090 + HDMI: Ideal use case for veyron_jerry, veyron_minnie..etc.

The presence of max98090 is determined by the presence of
rockchip,audio-codec device property.

The presence of HDMI is determined by the presence of
rockchip,hdmi-codec device property.

Create different sound card based on the configuration.
Note that we keep max98090 only usage for backward compatibility.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20191028071930.145899-4-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rockchip-max98090: Support usage with and without HDMI
Cheng-Yi Chiang [Mon, 28 Oct 2019 07:19:26 +0000 (15:19 +0800)]
ASoC: rockchip-max98090: Support usage with and without HDMI

Add one optional property "rockchip,hdmi-codec" to let user specify HDMI
device node in DTS so machine driver can find hdmi-codec device node for
HDMI codec DAI.

Use the presence of rockchip,audio-codec and rockchip,hdmi-codec to
specify the use case.

Use max98090 only : specify rockchip,audio-codec.
Use HDMI only: specify rockchip,hdmi-codec.
Use both max98090 and HDMI: specify rockchip,audio-codec and
rockchip,hdmi-codec.

Move these properties to optional because they are not needed for
HDMI-only use case.
"rockchip,audio-codec": The phandle of the MAX98090 audio codec
"rockchip,headset-codec": The phandle of Ext chip for jack detection

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20191028071930.145899-3-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agodrm: bridge: dw-hdmi: Report connector status using callback
Cheng-Yi Chiang [Mon, 28 Oct 2019 07:19:25 +0000 (15:19 +0800)]
drm: bridge: dw-hdmi: Report connector status using callback

Allow codec driver register callback function for plug event.

The callback registration flow:
dw-hdmi <--- hw-hdmi-i2s-audio <--- hdmi-codec

dw-hdmi-i2s-audio implements hook_plugged_cb op
so codec driver can register the callback.

dw-hdmi exports a function dw_hdmi_set_plugged_cb so platform device
can register the callback.

When connector plug/unplug event happens, report this event using the
callback.

Make sure that audio and drm are using the single source of truth for
connector status.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20191028071930.145899-2-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF - remove the dead code (skylake/kabylake)
Jaroslav Kysela [Mon, 28 Oct 2019 17:33:29 +0000 (18:33 +0100)]
ASoC: SOF - remove the dead code (skylake/kabylake)

Appearently the CONFIG_SND_SOC_SOF_KABYLAKE and CONFIG_SND_SOC_SOF_SKYLAKE
options are not present in Kconfig and 'struct snd_sof_dsp_ops sof_skl_ops'
is not declared in the code, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20191028173329.29538-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: intel - fix the card names
Jaroslav Kysela [Mon, 28 Oct 2019 16:46:24 +0000 (17:46 +0100)]
ASoC: intel - fix the card names

Those strings are exposed to the user space as the
card name thus used in the GUIs. The common
standard is to avoid '_' here. The worst case
is 'sof-skl_hda_card' string.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191028164624.14334-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda: Allow non-Intel device probe gracefully
Takashi Iwai [Mon, 28 Oct 2019 13:06:34 +0000 (14:06 +0100)]
ALSA: hda: Allow non-Intel device probe gracefully

The recent addition of snd_intel_dsp_driver_probe() check caused a
spurious kernel warning when the driver is loaded for a non-Intel
hardware due to snd_BUG_ON().  Moreover, for such a hardware, we
should always return SND_INTEL_DSP_DRIVER_ANY, not check the
dsp_driver option at all.

This patch fixes these issues for non-Intel devices.

Fixes: 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20191028130634.3501-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: SOF: pci: Add prepare/complete PM callbacks
Keyon Jie [Fri, 25 Oct 2019 22:41:22 +0000 (17:41 -0500)]
ASoC: SOF: pci: Add prepare/complete PM callbacks

Use the new implemented snd_sof_prepare() and snd_sof_complete() as the
power management callbacks for pci probing platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-27-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix
Keyon Jie [Fri, 25 Oct 2019 22:41:21 +0000 (17:41 -0500)]
ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix

When system is entering into S0ix, the PCI device may transition to the
D0i3 substate instead of D3. In D0i3, some always-on functionality can
be enabled, such as acoustic event detection, voice activity detection
or hotwording. When an event is detected, the DSP firmware can wake-up
the device for a transition to D0 with an interrupt.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-26-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: return -ENOTSUPP if D0I3 is not supported
Keyon Jie [Fri, 25 Oct 2019 22:41:20 +0000 (17:41 -0500)]
ASoC: SOF: return -ENOTSUPP if D0I3 is not supported

No set_power_state ops means that the platform doesn't support D0i3,
return -ENOTSUPP for the case.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-25-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition
Keyon Jie [Fri, 25 Oct 2019 22:41:19 +0000 (17:41 -0500)]
ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition

Enable system wake up via IPC interrupt from DSP when the system is
suspending to the S0ix state, and disable it in the corresponding
resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: ignore suspend/resume for D0ix compatible streams
Keyon Jie [Fri, 25 Oct 2019 22:41:18 +0000 (17:41 -0500)]
ASoC: SOF: ignore suspend/resume for D0ix compatible streams

During system suspend, the PM framework will freeze all applications and
the ALSA/ASoC core will suspend all RUNNING PCM streams.

However, D0ix-compatible PCM streams should keep the related pipelines
active in the DSP when the system is entering S0ix. The TRIGGER_SUSPEND
event is trapped in such cases to prevent the pipelines from being
stopped. Likewise, the TRIGGER_RESUME/START events should not affect the
pipeline state.

The SOF driver also triggers some DSP Firmware pipelines based on the
DAPM widgets power events. In such cases, we also ignore PRE_PMU and
POST_PMD events to keep the pipelines active.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: PM: implement prepare/complete callbacks
Keyon Jie [Fri, 25 Oct 2019 22:41:17 +0000 (17:41 -0500)]
ASoC: SOF: PM: implement prepare/complete callbacks

Implement the prepare() and complete() callbacks for power management,
initialize s0_suspend flag at prepare(), and reset it at complete().

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: add a flag suspend_ignored for sof stream
Keyon Jie [Fri, 25 Oct 2019 22:41:16 +0000 (17:41 -0500)]
ASoC: SOF: add a flag suspend_ignored for sof stream

Add a suspend_ignored flag to snd_sof_pcm_stream that will be used to
decide if the corresponding FW pipeline should be kept active to perform
always on tasks when the system is entering the S0ix state.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: add a flag to indicate the system suspend target
Keyon Jie [Fri, 25 Oct 2019 22:41:15 +0000 (17:41 -0500)]
ASoC: SOF: add a flag to indicate the system suspend target

Add flag 's0_suspend' to indicate if the system is entering S0ix or
not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: CNL: add support for sending compact IPC
Keyon Jie [Fri, 25 Oct 2019 22:41:14 +0000 (17:41 -0500)]
ASoC: SOF: Intel: CNL: add support for sending compact IPC

For compact IPCs, we will send the IPC header/command via the HIPCIDR
register and the first 32bit payload via the HIPCIDD register, no
mailbox will be used.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: PM: add helpers for setting D0 substate for ADSP
Keyon Jie [Fri, 25 Oct 2019 22:41:13 +0000 (17:41 -0500)]
ASoC: SOF: PM: add helpers for setting D0 substate for ADSP

Add snd_sof_set_d0_substate() helper for setting ADSP to a specific D0
substate, it will call into the platform specific implementation, and
update the d0_substate at success.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: configure D0ix IPC flags in set_power_state
Keyon Jie [Fri, 25 Oct 2019 22:41:12 +0000 (17:41 -0500)]
ASoC: SOF: configure D0ix IPC flags in set_power_state

The configuration for D0ix in FW is platform specific, let's do this and
send IPC in the platform set_power_state() ops.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file
Keyon Jie [Fri, 25 Oct 2019 22:41:11 +0000 (17:41 -0500)]
ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file

On cAVS platforms, some IPCs are required to be sent via IPC registers
only(e.g. when in D0i3, mailbox is unaccessible), add hda-ipc.h to hold
definition of those compact IPCs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply
Keyon Jie [Fri, 25 Oct 2019 22:41:10 +0000 (17:41 -0500)]
ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply

Memory windows could be powered off before receiving PM_GATE IPC reply
from FW, we can't read the mailbox to get reply.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: ipc: introduce message for DSP power gating
Keyon Jie [Fri, 25 Oct 2019 22:41:09 +0000 (17:41 -0500)]
ASoC: SOF: ipc: introduce message for DSP power gating

Add new ipc messages which will be sent from driver to FW, to ask FW to
enter specific power saving state.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc
Keyon Jie [Fri, 25 Oct 2019 22:41:08 +0000 (17:41 -0500)]
ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc

The helper sof_send_pm_ipc() is only suitable for context save/restore
IPCs' sending, so rename it to sof_send_pm_ctx_ipc here.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: HDA: use macro for register polling retry count
Keyon Jie [Fri, 25 Oct 2019 22:41:07 +0000 (17:41 -0500)]
ASoC: SOF: Intel: HDA: use macro for register polling retry count

Define macro and use it for the register polling retry count.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update
Keyon Jie [Fri, 25 Oct 2019 22:41:06 +0000 (17:41 -0500)]
ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update

Align the logs for CIP timeout at D0I3C.I3 updating.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: topology: parse and store d0i3_compatible flag
Keyon Jie [Fri, 25 Oct 2019 22:41:05 +0000 (17:41 -0500)]
ASoC: SOF: topology: parse and store d0i3_compatible flag

Parses the token from tplg file and store it to snd_sof_pcm_stream
d0i3_compatible flag, which can be used later for d0ix transition
management.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: token: add tokens for PCM compatible with D0i3 substate
Keyon Jie [Fri, 25 Oct 2019 22:41:04 +0000 (17:41 -0500)]
ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate

Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be
opened at low power d0i3 status or not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream
Keyon Jie [Fri, 25 Oct 2019 22:41:03 +0000 (17:41 -0500)]
ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream

Add flag d0i3_compatible to struct snd_sof_pcm_stream to denote if the
stream can tolerate a transition to the D0i3 substate while opened (thus
seen as 'active' by pm_runtime).

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: APL: add set_power_state() ops
Keyon Jie [Fri, 25 Oct 2019 22:41:02 +0000 (17:41 -0500)]
ASoC: SOF: Intel: APL: add set_power_state() ops

Using hda_dsp_set_power_state() as set_power_state() ops for apl to do
d0ix platform configuration updates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: CNL: add set_power_state() ops
Keyon Jie [Fri, 25 Oct 2019 22:41:01 +0000 (17:41 -0500)]
ASoC: SOF: Intel: CNL: add set_power_state() ops

Using hda_dsp_set_power_state() as set_power_state() ops for cnl to do
d0ix platform configuration updates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate
Keyon Jie [Fri, 25 Oct 2019 22:41:00 +0000 (17:41 -0500)]
ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate

Adding helper to implement setting dsp to d0i3 or d0i0 status, this will
be needed for driver D0ix support.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: add set_power_state() to dsp_ops for power state update
Keyon Jie [Fri, 25 Oct 2019 22:40:59 +0000 (17:40 -0500)]
ASoC: SOF: add set_power_state() to dsp_ops for power state update

D0i3 is a platform-defined substate of D0, so we need a
platform-specific callback in dsp_ops to handle the relevant
configurations.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: reset default d0_substate at probe() and resume()
Keyon Jie [Fri, 25 Oct 2019 22:40:58 +0000 (17:40 -0500)]
ASoC: SOF: reset default d0_substate at probe() and resume()

We initialize/reset d0_substate to default d0i0 value when doing
transition D3-->D0, e.g. at success of probing and resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: add a field to store the current D0 substate of DSP
Keyon Jie [Fri, 25 Oct 2019 22:40:57 +0000 (17:40 -0500)]
ASoC: SOF: add a field to store the current D0 substate of DSP

Add field d0_substate to struct snd_sof_dev to store the current DSP
D0 sub-state(only meaningful when DSP in D0), which could be D0I0 or
D0I3.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rsnd: core.c: add WARN_ON() on rsnd_channel_normalization()
Kuninori Morimoto [Mon, 28 Oct 2019 05:29:55 +0000 (14:29 +0900)]
ASoC: rsnd: core.c: add WARN_ON() on rsnd_channel_normalization()

chan > 8 or chan < 0 shouldn't happen.
This patch uses WARN_ON() for such case.

Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2x530a4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl_esai: Add spin lock to protect reset, stop and start
Shengjiu Wang [Mon, 28 Oct 2019 09:11:05 +0000 (17:11 +0800)]
ASoC: fsl_esai: Add spin lock to protect reset, stop and start

xrun may happen at the end of stream, the
trigger->fsl_esai_trigger_stop maybe called in the middle of
fsl_esai_hw_reset, this may cause esai in wrong state
after stop, and there may be endless xrun interrupt.

This issue may also happen with trigger->fsl_esai_trigger_start.

So Add spin lock to lock those functions.

Fixes: 7ccafa2b3879 ("ASoC: fsl_esai: recover the channel swap after xrun")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/52e92c4221a83e39a84a6cd92fc3d5479b44894c.1572252321.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl_asrc: refine the setting of internal clock divider
Shengjiu Wang [Mon, 28 Oct 2019 09:10:29 +0000 (17:10 +0800)]
ASoC: fsl_asrc: refine the setting of internal clock divider

The output divider should align with the output sample
rate, if use ideal sample rate, there will be a lot of overload,
which would cause underrun.

The maximum divider of asrc clock is 1024, but there is no
judgement for this limitation in driver, which may cause the divider
setting not correct.

For non-ideal ratio mode, the clock rate should divide the sample
rate with no remainder, and the quotient should be less than 1024.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/23c634e4bf58afce5b3ae67f5f42e8d1cae2639a.1572252307.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: eve: implement set_bias_level function for rt5514
Brent Lu [Fri, 25 Oct 2019 09:11:31 +0000 (17:11 +0800)]
ASoC: eve: implement set_bias_level function for rt5514

The first DMIC capture always fail (zero sequence data from PCM port)
after using DSP hotwording function (i.e. Google assistant).

This rt5514 codec requires to control mclk directly in the set_bias_level
function. Implement this function in machine driver to control the
ssp1_mclk clock explicitly could fix this issue.

Signed-off-by: Brent Lu <brent.lu@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/1571994691-20199-1-git-send-email-brent.lu@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: sunxi: sun4i-codec: remove unneeded semicolon
YueHaibing [Fri, 25 Oct 2019 12:08:01 +0000 (20:08 +0800)]
ASoC: sunxi: sun4i-codec: remove unneeded semicolon

remove unneeded semicolon.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191025120801.16236-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: fsl: fsl_dma: fix build failure
Michael Ellerman [Fri, 25 Oct 2019 05:13:53 +0000 (16:13 +1100)]
ASoC: fsl: fsl_dma: fix build failure

Commit 4ac85de9977e ("ASoC: fsl: fsl_dma: remove snd_pcm_ops") removed
fsl_dma_ops but left a usage, leading to a build error for some
configs, eg. mpc85xx_defconfig:

  sound/soc/fsl/fsl_dma.c: In function ‘fsl_soc_dma_probe’:
  sound/soc/fsl/fsl_dma.c:905:18: error: ‘fsl_dma_ops’ undeclared (first use in this function)
    dma->dai.ops = &fsl_dma_ops;
                    ^~~~~~~~~~~

Remove the usage to fix the build.

Fixes: 4ac85de9977e ("ASoC: fsl: fsl_dma: remove snd_pcm_ops")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191025051353.2878-1-mpe@ellerman.id.au
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rockchip: rockchip_max98090: Enable SHDN to fix headset detection
Cheng-Yi Chiang [Mon, 28 Oct 2019 09:52:29 +0000 (17:52 +0800)]
ASoC: rockchip: rockchip_max98090: Enable SHDN to fix headset detection

max98090 spec states that chip needs to be in turned-on state to supply
mic bias. Enable SHDN dapm widget along with MICBIAS widget to
actually turn on mic bias for proper headset button detection.
This is similar to cht_ti_jack_event in
sound/soc/intel/boards/cht_bsw_max98090_ti.c.

Note that due to ts3a227e reports the jack event right away before the
notifier is registered, if headset is plugged on boot, headset button
will not get detected until headset is unplugged and plugged. This is
still an issue to be fixed.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Link: https://lore.kernel.org/r/20191028095229.99438-1-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: ti: sdma-pcm: Add back the flags parameter for non standard dma names
Peter Ujfalusi [Mon, 28 Oct 2019 11:52:07 +0000 (13:52 +0200)]
ASoC: ti: sdma-pcm: Add back the flags parameter for non standard dma names

When non standard names are used it is possible that one of the directions
are not provided, thus the flags needs to be present to tell the core that
we have half duplex setup.

Fixes: 642aafea8889 ("ASoC: ti: remove compat dma probing")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20191028115207.5142-1-peter.ujfalusi@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: ipc: Fix memory leak in sof_set_get_large_ctrl_data
Navid Emamdoost [Sun, 27 Oct 2019 21:53:24 +0000 (16:53 -0500)]
ASoC: SOF: ipc: Fix memory leak in sof_set_get_large_ctrl_data

In the implementation of sof_set_get_large_ctrl_data() there is a memory
leak in case an error. Release partdata if sof_get_ctrl_copy_params()
fails.

Fixes: 54d198d5019d ("ASoC: SOF: Propagate sof_get_ctrl_copy_params() error properly")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20191027215330.12729-1-navid.emamdoost@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Fix memory leak in sof_dfsentry_write
Navid Emamdoost [Sun, 27 Oct 2019 19:48:47 +0000 (14:48 -0500)]
ASoC: SOF: Fix memory leak in sof_dfsentry_write

In the implementation of sof_dfsentry_write() memory allocated for
string is leaked in case of an error. Go to error handling path if the
d_name.name is not valid.

Fixes: 091c12e1f50c ("ASoC: SOF: debug: add new debugfs entries for IPC flood test")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Link: https://lore.kernel.org/r/20191027194856.4056-1-navid.emamdoost@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: hda-stream: fix the CONFIG_ prefix missing
Keyon Jie [Fri, 25 Oct 2019 22:15:38 +0000 (17:15 -0500)]
ASoC: SOF: Intel: hda-stream: fix the CONFIG_ prefix missing

We are missing the 'CONFIG_' prefix when using the kernel configure item
SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1, here correct them.

Fixes: 43b2ab9009b13b ('ASoC: SOF: Intel: hda: Disable DMI L1 entry during capture')
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025221538.6668-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda - Fix pending unsol events at shutdown
Takashi Iwai [Mon, 28 Oct 2019 10:58:03 +0000 (11:58 +0100)]
ALSA: hda - Fix pending unsol events at shutdown

This is an alternative fix attemp for the issue reported in the commit
caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling") that was
reverted later due to regressions.  Instead of tweaking the hardware
disablement order and the enforced irq flushing, do calling
cancel_work_sync() of the unsol work early enough, and explicitly
ignore the unsol events during the shutdown by checking the
bus->shutdown flag.

Fixes: caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://lore.kernel.org/r/s5h1ruxt9cz.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Mon, 28 Oct 2019 11:43:29 +0000 (12:43 +0100)]
Merge branch 'for-linus' into for-next

Back-merge the development process for catching up the HD-audio fix
(and apply a new one on top of that).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoRevert "ALSA: hda: Flush interrupts on disabling"
Takashi Iwai [Mon, 28 Oct 2019 08:10:56 +0000 (09:10 +0100)]
Revert "ALSA: hda: Flush interrupts on disabling"

This reverts commit caa8422d01e983782548648e125fd617cadcec3f.

It turned out that this commit caused a regression at shutdown /
reboot, as the synchronize_irq() calls seems blocking the whole
shutdown.  Also another part of the change about shuffling the call
order looks suspicious; the azx_stop_chip() call disables the CORB /
RIRB while the others may still need the CORB/RIRB update.

Since the original commit itself was a cargo-fix, let's revert the
whole patch.

Fixes: caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205333
BugLinK: https://bugs.freedesktop.org/show_bug.cgi?id=111174
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://lore.kernel.org/r/20191028081056.22010-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bebob: Fix prototype of helper function to return negative value
Takashi Sakamoto [Sat, 26 Oct 2019 03:06:20 +0000 (12:06 +0900)]
ALSA: bebob: Fix prototype of helper function to return negative value

A helper function of ALSA bebob driver returns negative value in a
function which has a prototype to return unsigned value.

This commit fixes it by changing the prototype.

Fixes: eb7b3a056cd8 ("ALSA: bebob: Add commands and connections/streams management")
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191026030620.12077-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: intel_hdmi: Remove dev_err() on platform_get_irq() failure
YueHaibing [Fri, 25 Oct 2019 09:39:05 +0000 (17:39 +0800)]
ALSA: intel_hdmi: Remove dev_err() on platform_get_irq() failure

platform_get_irq() will call dev_err() itself on failure,
so there is no need for the driver to also do this.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191025093905.14888-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: SOF: Intel: only support INFO_BATCH for legacy platforms
Pierre-Louis Bossart [Thu, 24 Oct 2019 21:03:18 +0000 (16:03 -0500)]
ASoC: SOF: Intel: only support INFO_BATCH for legacy platforms

The current position update is not precise enough for PulseAudio to
work reliably with the timer-based scheduling on Baytrail,
Cherrytrail, Broadwell.

Disable the NO_PERIOD_WAKEUP capability and use BATCH to signal that
the position is only reliable and updated during period_elapsed
events.

This will be reverted when the firmware provides a more accurate
position for those platforms.

Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191024210318.30068-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: define INFO_ flags in dsp_ops
Pierre-Louis Bossart [Thu, 24 Oct 2019 21:03:17 +0000 (16:03 -0500)]
ASoC: SOF: define INFO_ flags in dsp_ops

Currently the INFO_ flags such as PAUSE/NO_PERIOD_WAKEUP are defined
in the SOF PCM core, which doesn't scale. To account for platform
variations, these flags need to be set in DSP ops.

This patch only moves the definitions and does not change any
functionality.

Reviewed-by: Jaska Uimonen <jaska.uimonen@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191024210318.30068-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: disable rx_fifo after disable stream
Ben Dooks [Fri, 18 Oct 2019 15:48:30 +0000 (16:48 +0100)]
ASoC: tegra: disable rx_fifo after disable stream

We see odd FIFO overruns with this, we assume the best thing to do is
to disable the RX I2S frontend first, and then disable the FIFO that
is using it.

This also fixes an issue where using multi-word frames (TDM) have
partial samples stuck in the FIFO which then get read out when the
next capture is started.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20191018154833.7560-5-ben.dooks@codethink.co.uk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: add a TDM configuration callback
Edward Cragg [Fri, 18 Oct 2019 15:48:27 +0000 (16:48 +0100)]
ASoC: tegra: add a TDM configuration callback

Add a callback to configure TDM settings for the Tegra30 I2S ASoC 'platform'
driver.

Signed-off-by: Edward Cragg <edward.cragg@codethink.co.uk>
[ben.dooks@codethink.co.uk: merge fix for power management]
[ben.dooks@codethink.co.uk: add review change for fsync of 1 clock]
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20191018154833.7560-2-ben.dooks@codethink.co.uk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: pxa: poodle: Spelling s/enpoints/endpoints/, s/connetion/connection/
Geert Uytterhoeven [Thu, 24 Oct 2019 15:31:30 +0000 (17:31 +0200)]
ASoC: pxa: poodle: Spelling s/enpoints/endpoints/, s/connetion/connection/

Fix misspelling of "endpoints" and "connection".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20191024153130.31082-1-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Spelling s/configr/configur/
Geert Uytterhoeven [Thu, 24 Oct 2019 15:16:03 +0000 (17:16 +0200)]
ASoC: Spelling s/configr/configur/

Fix misspellings of "configuration" and "configure".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20191024151603.29043-1-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: soc-dpcm: tidyup for_each_dpcm_xx() macro
Kuninori Morimoto [Fri, 25 Oct 2019 00:56:10 +0000 (09:56 +0900)]
ASoC: soc-dpcm: tidyup for_each_dpcm_xx() macro

for_each_dpcm_xx() macro is using "dpcm" as parameter (1),
but, it is also struct member (2).

#define for_each_dpcm_fe(be, stream, dpcm) \
list_for_each_entry(dpcm, &(be)->dpcm[stream]...)
                    ^^^^(1)      ^^^^(2)

Thus, it will be compile error if user not used "dpcm" as parameter

for_each_dpcm_fe(be, stream, dp)
                             ^^
This patch fixup it.

Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv7x7idx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: tegra: Allow 24bit and 32bit samples
Edward Cragg [Fri, 18 Oct 2019 15:48:28 +0000 (16:48 +0100)]
ASoC: tegra: Allow 24bit and 32bit samples

The tegra3 audio can support 24 and 32 bit sample sizes so add the
option to the tegra30_i2s_hw_params to configure the S24_LE or S32_LE
formats when requested.

Signed-off-by: Edward Cragg <edward.cragg@codethink.co.uk>
[ben.dooks@codethink.co.uk: fixup merge of 24 and 32bit]
[ben.dooks@codethink.co.uk: add pm calls around ytdm config]
[ben.dooks@codethink.co.uk: drop debug printing to dev_dbg]
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20191018154833.7560-3-ben.dooks@codethink.co.uk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5677-spi: fix sparse warnings
Curtis Malainey [Thu, 24 Oct 2019 18:40:26 +0000 (11:40 -0700)]
ASoC: rt5677-spi: fix sparse warnings

Fix bugs reported by kbuild test robot

Fixes: a0e0d135427c ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191024184026.183913-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5677: Add missing null check for failed allocation of rt5677_dsp
Colin Ian King [Thu, 24 Oct 2019 12:46:10 +0000 (13:46 +0100)]
ASoC: rt5677: Add missing null check for failed allocation of rt5677_dsp

The allocation of rt5677_dsp can potentially fail and return null, so add
a null check and return -ENOMEM on a memory allocation failure.

Addresses-Coverity: ("Dereference null return")
Fixes: a0e0d135427c ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20191024124610.18182-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda/realtek - Fix 2 front mics of codec 0x623
Aaron Ma [Thu, 24 Oct 2019 11:44:39 +0000 (19:44 +0800)]
ALSA: hda/realtek - Fix 2 front mics of codec 0x623

These 2 ThinkCentres installed a new realtek codec ID 0x623,
it has 2 front mics with the same location on pin 0x18 and 0x19.

Apply fixup ALC283_FIXUP_HEADSET_MIC to change 1 front mic
location to right, then pulseaudio can handle them.
One "Front Mic" and one "Mic" will be shown, and audio output works
fine.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191024114439.31522-1-aaron.ma@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: rt5650: Add Kahlee platform specfic changes
Akshu Agrawal [Wed, 23 Oct 2019 21:29:47 +0000 (14:29 -0700)]
ASoC: rt5650: Add Kahlee platform specfic changes

Add platform specific data for Kahlee project.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Shirish S <shirish.s@amd.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191023212948.92246-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda/realtek - Add support for ALC623
Kailang Yang [Thu, 24 Oct 2019 07:13:32 +0000 (15:13 +0800)]
ALSA: hda/realtek - Add support for ALC623

Support new codec ALC623.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/ed97b6a8bd9445ecb48bc763d9aaba7a@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: Add DSD support for Gustard U16/X26 USB Interface
Justin Song [Thu, 24 Oct 2019 10:27:14 +0000 (12:27 +0200)]
ALSA: usb-audio: Add DSD support for Gustard U16/X26 USB Interface

This patch adds native DSD support for Gustard U16/X26 USB Interface.
Tested using VID and fp->dsd_raw method.

Signed-off-by: Justin Song <flyingecar@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CA+9XP1ipsFn+r3bCBKRinQv-JrJ+EHOGBdZWZoMwxFv0R8Y1MQ@mail.gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: kirkwood: fix device remove ordering
Russell King [Wed, 23 Oct 2019 13:46:49 +0000 (14:46 +0100)]
ASoC: kirkwood: fix device remove ordering

The devm conversion of kirkwood was incorrect; on removal, devm takes
effect after the "remove" function has returned.  So, the effect of
the conversion was to change the order during remove from:

  - snd_soc_unregister_component() (unpublishes interfaces)
  - clk_disable_unprepare()
  - cleanup resources

After the conversion, this became:

  - clk_disable_unprepare() - while the device may still be active
  - snd_soc_unregister_component()
  - cleanup resources

Hence, it introduces a bug, where the internal clock for the device
may be shut down before the device itself has been shut down.  It is
known that Marvell SoCs, including Dove, locks up if registers for a
peripheral that has its clocks disabled are accessed.

Fixes: f98fc0f8154e ("ASoC: kirkwood: replace platform to component")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Link: https://lore.kernel.org/r/E1iNGyP-0004oN-BA@rmk-PC.armlinux.org.uk
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rsnd: dma: fix SSI9 4/5/6/7 busif dma address
Jiada Wang [Tue, 22 Oct 2019 18:54:29 +0000 (20:54 +0200)]
ASoC: rsnd: dma: fix SSI9 4/5/6/7 busif dma address

Currently each SSI unit's busif dma address is calculated by
following calculation formula:
0xec540000 + 0x1000 * id + busif / 4 * 0xA000 + busif % 4 * 0x400

But according to R-Car3 HW manual 41.1.4 Register Configuration,
ssi9 4/5/6/7 busif data register address
(SSI9_4_BUSIF/SSI9_5_BUSIF/SSI9_6_BUSIF/SSI9_7_BUSIF)
are out of this rule.

This patch updates the calculation formula to correct
ssi9 4/5/6/7 busif data register address.

Fixes: 5e45a6fab3b9 ("ASoc: rsnd: dma: Calculate dma address with consider of BUSIF")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[erosca: minor improvements in commit description]
Cc: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Cc: stable@vger.kernel.org # v4.20+
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191022185429.12769-1-erosca@de.adit-jv.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: hdmi-codec: drop mutex locking again
Jerome Brunet [Wed, 23 Oct 2019 16:12:02 +0000 (18:12 +0200)]
ASoC: hdmi-codec: drop mutex locking again

This reverts commit eb1ecadb7f67dde94ef0efd3ddaed5cb6c9a65ed.

This fixes the following warning reported by lockdep and a potential
issue with hibernation

====================================
WARNING: pulseaudio/1297 still has locks held!
5.3.0+ #1826 Not tainted
------------------------------------
1 lock held by pulseaudio/1297:
 #0: ee815308 (&hcp->lock){....}, at: hdmi_codec_startup+0x20/0x130

stack backtrace:
CPU: 0 PID: 1297 Comm: pulseaudio Not tainted 5.3.0+ #1826
Hardware name: Marvell Dove (Cubox)
[<c0017b4c>] (unwind_backtrace) from [<c0014d10>] (show_stack+0x10/0x14)
[<c0014d10>] (show_stack) from [<c00a2d18>] (futex_wait_queue_me+0x13c/0x19c)
[<c00a2d18>] (futex_wait_queue_me) from [<c00a3630>] (futex_wait+0x184/0x24c)
[<c00a3630>] (futex_wait) from [<c00a5e1c>] (do_futex+0x334/0x598)
[<c00a5e1c>] (do_futex) from [<c00a62e8>] (sys_futex_time32+0x118/0x180)
[<c00a62e8>] (sys_futex_time32) from [<c0009000>] (ret_fast_syscall+0x0/0x54)
Exception stack(0xebd31fa8 to 0xebd31ff0)
1fa0:                   00000000 ffffffff 000c8748 00000189 00000001 00000000
1fc0: 00000000 ffffffff 00000000 000000f0 00000000 00000000 00000000 00056200
1fe0: 000000f0 beac03a8 b6d6c835 b6d6f456

Fixes: eb1ecadb7f67 ("ASoC: hdmi-codec: re-introduce mutex locking")
Reported-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20191023161203.28955-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>