Commit Graph

1072746 Commits

Author SHA1 Message Date
Sascha Hauer 1d4cbdf7bf
ASoC: fsl_sai: use DIV_ROUND_CLOSEST() to calculate divider
In fsl_sai_set_bclk() we want to calculate the divider that gets us
closest to the desired frequency, so use DIV_ROUND_CLOSEST() instead of
just doing a clk_rate/freq.
Also discard invalid ratios earlier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-7-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:09 +00:00
Sascha Hauer c56359f4f2
ASoC: fsl_sai: Use better variable names
"ret" is normally used as a variable name for return values. In
fsl_sai_set_bclk() it stores the difference between the desired rate and
the rate we can archieve, so rename it to "diff". Also rename "savesub"
to "bestdiff" as that stores the best difference we have found.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-6-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:08 +00:00
Sascha Hauer 99c1e74f25
ASoC: fsl_sai: store full version instead of major/minor
The driver tests for the hardware revision being newer than 3.1
with (sai->verid.major >= 3 && sai->verid.minor >= 1). The result
is obviously wrong for hardware revision 4.0. Fix this by storing
the full version in a single variable and comparing to that one.
No practical change at the moment as there is no 4.0 ip version
currently.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-5-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:06 +00:00
Ahmad Fatoum 814c9fc46f
ASoC: fsl_sai: simplify register poking in fsl_sai_set_bclk
Depending on SAI synchronization mode, the same value is either
written to FSL_SAI_TCR2 or FSL_SAI_RCR2 or nothing is written at all.

As the computation is the same either way, factor it out to make it
clearer what the difference is. No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-4-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:05 +00:00
Sascha Hauer cb00b4c18f
ASoC: fsl_sai: simplify irq return value
Instead of using a boolean "irq_none" to describe the interrupt
handlers return value use a variable of type irqreturn_t and return
it directly. No functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-3-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:04 +00:00
Sascha Hauer bd393e2ecc
ASoC: fsl_sai: Drop unnecessary defines
The fsl_sai driver has FSL_FMT_TRANSMITTER and FSL_FMT_RECEIVER defines
which are used in a single function only then are then only translated
into a bool 'tx' variable. Drop the defines and pass the boolean value
directly to fsl_sai_set_dai_sysclk_tr(). No functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-2-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:03 +00:00
Jonathan Albrieux 6b4528b553
ASoC: codecs: Add Awinic AW8738 audio amplifier driver
The Awinic AW8738 is a simple audio amplifier using a single GPIO.
The main difference to simple-amplifier is that there is a "one-wire
pulse control" that allows configuring the amplifier to one of a few
pre-defined modes. This can be used to configure the speaker-guard
function (primarily the power limit for the amplifier).

Add a simple driver that allows setting it up in the device tree
with a specified mode number.

Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com>
Co-developed-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20220304102452.26856-3-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:01 +00:00
Stephan Gerhold b328443061
ASoC: dt-bindings: Add schema for "awinic,aw8738"
Add a DT schema for describing Awinic AW8738 audio amplifiers. They are
fairly simple and controlled using a single GPIO. The number of pulses
during power up selects one of a few pre-defined operation modes. This
can be used to configure the speaker-guard function (primarily the
power limit for the amplifier).

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20220304102452.26856-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:13:00 +00:00
Richard Fitzgerald 1e974e5b82
ASoC: audio_graph_card2: Add support for variable slot widths
Some audio hardware cannot support the same slot width for all sample
widths, or a slot width equal to the sample width for all sample widths.
This is usually due either to limitations of the audio serial port or
system clocking restrictions.
A typical example would be:

- 16-bit samples in 16-bit slots
- 24-bit samples in 32-bit slots

The new dai-tdm-slot-width-map property allows setting a mapping of
sample widths and the corresponding tdm slot widths and slot counts.
Although the slot count is usually the same for all cases this does
allow for adding padding slots to maintain the same bitclk frequency.

The property is added to each endpoint node that needs the component
DAI to be told the TDM slot width and count.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220228172754.453783-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:58 +00:00
Richard Fitzgerald 26e5366dd3
ASoC: dt-bindings: audio-graph-port: Add dai-tdm-slot-width-map
Some audio hardware cannot support a fixed slot width for all sample
widths, or a slot width equal to the sample width for all sample widths.
This is usually due either to limitations of the audio serial port or
system clocking restrictions.

This property allows setting a mapping of sample widths and the
corresponding tdm slot widths. The slot count is also provided for
each slot width - although this would almost always be the same for
all slot widths this allows for possibly adding extra padding slots
to maintain a fixed bitclock frequency.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220228172754.453783-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:57 +00:00
Pierre-Louis Bossart 0f33105bb2
ASoC: SOF: Intel: hda: clarify operator precedence
cppcheck warning

sound/soc/sof/intel/hda.c:545:46: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
 char *level = flags & SOF_DBG_DUMP_OPTIONAL ? KERN_DEBUG : KERN_ERR;

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:55 +00:00
Pierre-Louis Bossart 9188812539
ASoC: SOF: debug: clarify operator precedence
cppcheck warning:

for '&' and '?'. [clarifyCalculation]
 char *level = flags & SOF_DBG_DUMP_OPTIONAL ? KERN_DEBUG : KERN_ERR;
                                             ^

sound/soc/sof/debug.c:398:46: style: Clarify calculation precedence
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:54 +00:00
Curtis Malainey 4aaa06b227
ASoC: SOF: fix 32 signed bit overflow
Shifting in a signed 32bit container past the signed bit is technically
undefined behaviour. Fix by using unsigned types. Found via cppcheck.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:52 +00:00
Ajit Kumar Pandey 8e85cab858
ASoC: SOF: amd: Increase ACP_HW_SEM_RETRY_COUNT value
Host is trying to acquire semaphore lock based on HW_SEM_RETRY_COUNT
value which is set to 10 by default. So host will loop for 10 times
trying to acquire lock before giving error msg "Failed to acquire HW
lock". Though this loop count of 10 is good enough with most of the
times but we have observed such failure msg in very few cases(~5 %).

Increase ACP_HW_SEM_RETRY_COUNT to avoid such issue and loop for a
significant time period before throwing error. We're setting newer
loop count to quite higher value of 10K but it's very unlikely that
it will loop for this count, since for most of the cases lock will
get acquired at much lesser loop iterations.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:51 +00:00
Ajit Kumar Pandey 7cf467ac9c
ASoC: SOF: amd: Move group register configuration to acp-loader
We are using PTE_GRP1 for DMA operations to load firmware binaries
but we are enabling PTE_GRP and flushing ATU cache much before in
probe callbacks. This can cause issue if we try to load firmware
runtime during system resume as probe callback will not be invoked
hence PTE_GRP will not be enabled. Moreover it makes more sense to
flush the cache after register configuration.

Move PTE group register configuration to acp-loader within pre_fw_run
callback to avoid such issue.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:50 +00:00
Ajit Kumar Pandey dc0d4ed26d
ASoC: SOF: amd: Use semaphore register to synchronize ipc's irq
Add lock and unlock around ipc irq handling code using hw semaphore
register that exhibit special property for register read calls. As
host and DSP firmware uses few shared registers, there is a possible
race condition around those shared registers values. This lock ensure
synchronization between Firmware and host ipc interrupts.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:49 +00:00
Ajit Kumar Pandey b7485ec850
ASoC: SOF: amd: Flush cache after ATU_BASE_ADDR_GRP register update
ACP_SRAM_PTE block has cache that needs to be flushed after every
PTE updates. This patch updates ACPAXI2AXI_ATU_CTRL register to
flush cache after updating PTE with stream physical address.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:48 +00:00
Peter Ujfalusi 9c2611b2a6
ASoC: SOF: amd: Do not set ipc_pcm_params ops as it is optional
The ipc_pcm_params() ops implementation for AMD is a NOP and since the
callback is marked now as optional, it can be dropped along with the
empty function.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:47 +00:00
Peter Ujfalusi edca0623f6
ASoC: SOF: amd: acp-pcm: Take buffer information directly from runtime
Instead of using the values from ipc_params, take them directly from
substream->runtime.

This is in preparation of making the platform hw_params callback to be
IPC agnostic.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:46 +00:00
Gongjun Song d66c57c5ff
ASoC: SOF: Intel: pci-tgl: add RPL-S support
Add PCI DID for Intel Raptor Lake S.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:44 +00:00
Lucas Tanure 5e02fb590e
ASoC: cs35l41: Fix DSP mbox start command and global enable order
Global enable must happen before CSPL_MBOX_CMD_RESUME command
is sent. Move it to PRE_PMU as both events use
SND_SOC_DAPM_OUT_DRV_E macro.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220303173059.269657-4-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:38 +00:00
Lucas Tanure 16639d39bd
ASoC: cs35l41: Fix max number of TX channels
This device only has 4 TX channels.

Fixes: fe1024d504 ("ASoC: cs35l41: Combine adjacent register writes")
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220303173059.269657-3-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:37 +00:00
David Rhodes 03a7895ee7
ASoC: cs35l41: Fix GPIO2 configuration
Fix GPIO2 polarity and direction configuration

Fixes: fe1024d504 ("ASoC: cs35l41: Combine adjacent register writes")
Signed-off-by: David Rhodes <drhodes@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220303173059.269657-2-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07 13:12:36 +00:00
Takashi Iwai fc4cf4293f ALSA: x86: Use standard mmap helper for Intel HDMI LPE audio
Intel HDMI LPE audio driver has its own mmap callback that mimics with
the noncached page attributes, but this is rather superfluous and can
be replaced with the standard helper, as the device is only for
playback and the write-cache should suffice.

This patch drops the own code and just uses the standard helper.

Link: https://lore.kernel.org/r/20220305083308.15718-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-05 09:33:48 +01:00
Takashi Iwai d460975eee Merge branch 'for-linus' into for-next
Back-merge of 5.17-devel branch for further work on Intel LPE HDMI stuff

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-05 09:29:00 +01:00
Reza Jahanbakhshi cd94df1795 ALSA: usb-audio: add mapping for new Corsair Virtuoso SE
New device id for Corsair Virtuoso SE RGB Wireless that currently is not
in the mixer_map. This entry in the mixer_map is necessary in order to
label its mixer appropriately and allow userspace to pick the correct
volume controls. For instance, my own Corsair Virtuoso SE RGB Wireless
headset has this new ID and consequently, the sidetone and volume are not
 working correctly without this change.
> sudo lsusb -v | grep -i corsair
Bus 007 Device 011: ID 1b1c:0a40 Corsair CORSAIR VIRTUOSO SE Wireless Gam
  idVendor           0x1b1c Corsair
  iManufacturer           1 Corsair
  iProduct                2 CORSAIR VIRTUOSO SE Wireless Gaming Headset

Signed-off-by: Reza Jahanbakhshi <reza.jahanbakhshi@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220304212303.195949-1-reza.jahanbakhshi@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-05 09:27:22 +01:00
Tim Crawford 0c20fce13e ALSA: hda/realtek: Add quirk for Clevo NP70PNJ
Fixes headset detection on Clevo NP70PNJ.

Signed-off-by: Tim Crawford <tcrawford@system76.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220304170840.3351-1-tcrawford@system76.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-05 09:26:28 +01:00
Takashi Sakamoto bf0cd60b7e ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction
AV/C deferred transaction was supported at a commit 00a7bb81c2 ("ALSA:
firewire-lib: Add support for deferred transaction") while 'deferrable'
flag can be uninitialized for non-control/notify AV/C transactions.
UBSAN reports it:

kernel: ================================================================================
kernel: UBSAN: invalid-load in /build/linux-aa0B4d/linux-5.15.0/sound/firewire/fcp.c:363:9
kernel: load of value 158 is not a valid value for type '_Bool'
kernel: CPU: 3 PID: 182227 Comm: irq/35-firewire Tainted: P           OE     5.15.0-18-generic #18-Ubuntu
kernel: Hardware name: Gigabyte Technology Co., Ltd. AX370-Gaming 5/AX370-Gaming 5, BIOS F42b 08/01/2019
kernel: Call Trace:
kernel:  <IRQ>
kernel:  show_stack+0x52/0x58
kernel:  dump_stack_lvl+0x4a/0x5f
kernel:  dump_stack+0x10/0x12
kernel:  ubsan_epilogue+0x9/0x45
kernel:  __ubsan_handle_load_invalid_value.cold+0x44/0x49
kernel:  fcp_response.part.0.cold+0x1a/0x2b [snd_firewire_lib]
kernel:  fcp_response+0x28/0x30 [snd_firewire_lib]
kernel:  fw_core_handle_request+0x230/0x3d0 [firewire_core]
kernel:  handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? transmit_complete_callback+0x9f/0x120 [firewire_core]
kernel:  ar_context_tasklet+0xa8/0x2e0 [firewire_ohci]
kernel:  tasklet_action_common.constprop.0+0xea/0xf0
kernel:  tasklet_action+0x22/0x30
kernel:  __do_softirq+0xd9/0x2e3
kernel:  ? irq_finalize_oneshot.part.0+0xf0/0xf0
kernel:  do_softirq+0x75/0xa0
kernel:  </IRQ>
kernel:  <TASK>
kernel:  __local_bh_enable_ip+0x50/0x60
kernel:  irq_forced_thread_fn+0x7e/0x90
kernel:  irq_thread+0xba/0x190
kernel:  ? irq_thread_fn+0x60/0x60
kernel:  kthread+0x11e/0x140
kernel:  ? irq_thread_check_affinity+0xf0/0xf0
kernel:  ? set_kthread_struct+0x50/0x50
kernel:  ret_from_fork+0x22/0x30
kernel:  </TASK>
kernel: ================================================================================

This commit fixes the bug. The bug has no disadvantage for the non-
control/notify AV/C transactions since the flag has an effect for AV/C
response with INTERIM (0x0f) status which is not used for the transactions
in AV/C general specification.

Fixes: 00a7bb81c2 ("ALSA: firewire-lib: Add support for deferred transaction")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220304125647.78430-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-04 17:23:21 +01:00
Xiaoke Wang d7f15befac ALSA: lola: add a check for the return of vmalloc()
vmalloc() is a memory allocation function which can return NULL when
some internal memory errors happen. So it is better to check the return
of it to catch the error in time.

Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_4221FC4089F6DF01C48F192E5784038BA205@qq.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-04 09:51:37 +01:00
Colin Ian King 3cffb26fbb ALSA: echoaudio: remove redundant assignment to variable bytes
The variable bytes is being assigned a value that is never read, it
is being re-assigned inside a following if block. The assignment is
redundant and can be removed.

Cleans up clang scan build warning:
sound/pci/echoaudio/midi.c:211:9: warning: Although the value stored
to 'bytes' is used in the enclosing expression, the value is never
actually read from 'bytes' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220302170728.1094633-1-colin.i.king@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-04 09:50:39 +01:00
Jiaxin Yu 8f2b025abc
ASoC: bt-sco: fix bt-sco-pcm-wb dai widget don't connect to the endpoint
This patch fix the second dai driver's dai widget can't connect to the
endpoint. Because "bt-sco-pcm" and "bt-sco-pcm-wb" dai driver have the
same stream_name, so it will cause they have the same widget name.
Therefor it will just create only one route when do snd_soc_dapm_add_route
that only find the widget through the widget name.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220302013533.29068-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-03 12:48:37 +00:00
Meng Tang e94769900f
ASoC: hdac_hda: Avoid unexpected match when pcm_name is "Analog"
pcm name can be "Analog" and "Alt Analog", cpcm->name can be
"Analog Codec DAI" and "Alt Analog Codec DAI". When pcm_name
is "Analog", "Analog Codec DAI" and "Alt Analog Codec DAI" are
both satisfy the 'if (strstr(cpcm->name, pcm_name))' condition,
which may cause the returned cpcm to be "Alt Analog Codec DAI".

Even if we get the pcm name by id, and "Analog Codec DAI" goes
into the loop before "Alt Analog Codec DAI", but I still think
we'd better have multiple insurances against unexpected return
values. After, we can correctly return the expected result
even if other relevant places are changed.

Signed-off-by: Meng Tang <tangmeng@uniontech.com>
Link: https://lore.kernel.org/r/20220302094351.3487-1-tangmeng@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-03 12:48:36 +00:00
Mark Brown 227178d238
ASoC: Intel: machine driver updates for 5.18
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Two cleanups to remove an unused filename and typos, and one addition
of an ACPI matching table for a Dell SoundWire SKU without local
microphones.

The main change is the addition of a common 'sof-ssp-amp' machine
driver for devices with amplifiers only (no headset codec) and
different connections using I2S links (Bluetooth offload, HDMI
receiver). It's likely that the amplifier will be swapped out by OEMs,
this machine driver provides a relatively generic solution to avoid
copy-paste of similar solutions.
2022-03-02 16:58:51 +00:00
Dan Carpenter d5dd781bcc
ASoC: qcom: Fix error code in lpass_platform_copy()
The copy_to/from_user() functions return the number of bytes remaining
to be copied.  This function needs to return negative error codes
because snd_soc_pcm_component_copy_user() treats positive returns as
success in soc_component_ret().

Fixes: 7d7209557b ("ASoC: qcom: Add support for codec dma driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220301081104.GB17375@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:27 +00:00
Jiasheng Jiang de2c6f9881
ASoC: soc-compress: prevent the potentially use of null pointer
There is one call trace that snd_soc_register_card()
->snd_soc_bind_card()->soc_init_pcm_runtime()
->snd_soc_dai_compress_new()->snd_soc_new_compress().
In the trace the 'codec_dai' transfers from card->dai_link,
and we can see from the snd_soc_add_pcm_runtime() in
snd_soc_bind_card() that, if value of card->dai_link->num_codecs
is 0, then 'codec_dai' could be null pointer caused
by index out of bound in 'asoc_rtd_to_codec(rtd, 0)'.
And snd_soc_register_card() is called by various platforms.
Therefore, it is better to add the check in the case of misusing.
And because 'cpu_dai' has already checked in soc_init_pcm_runtime(),
there is no need to check again.
Adding the check as follow, then if 'codec_dai' is null,
snd_soc_new_compress() will not pass through the check
'if (playback + capture != 1)', avoiding the leftover use of
'codec_dai'.

Fixes: 467fece ("ASoC: soc-dai: move snd_soc_dai_stream_valid() to soc-dai.c")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1634285633-529368-1-git-send-email-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:26 +00:00
Sascha Hauer 300689fb04
ASoC: soc-generic-dmaengine-pcm: set period_bytes_min based on maxburst
In dmaengine_pcm_set_runtime_hwparams() period_bytes_min is hardcoded to
256. For some applications that may be too big. This patch changes that
to calculate the value based on dma_data->maxburst. The correct value
would be maxburst multiplied by the address width of the hardware FIFO.
Unfortunately the address width is dynamically calculated based on the
stream parameters and is not known at open time, so the worst case
is chosen here which is 8 bytes, the maximum that is supported by
dmaengine drivers.
Not all drivers may set a maxburst value, so we fall back to the
previously used hardcoded value of 256 bytes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220301113446.1053171-1-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:25 +00:00
Jiasheng Jiang 45ea97d743
ASoC: dwc-i2s: Handle errors for clk_enable
As the potential failure of the clk_enable(),
it should be better to check it, as same as clk_prepare_enable().

Fixes: c9afc1834e ("ASoC: dwc: Disallow building designware_pcm as a module")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301084742.3751939-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:24 +00:00
Zhen Ni a2253ec7ae
ASoC: amd: use asoc_substream_to_rtd()
Uses asoc_substream_to_rtd() helper.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Link: https://lore.kernel.org/r/20220302081502.25367-1-nizhen@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:23 +00:00
Jiasheng Jiang f9e2ca0640
ASoC: atmel_ssc_dai: Handle errors for clk_enable
As the potential failure of the clk_enable(),
it should be better to check it and return error if fals.

Fixes: cbaadf0f90 ("ASoC: atmel_ssc_dai: refactor the startup and shutdown")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301090637.3776558-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:22 +00:00
Jiasheng Jiang 2ecf362d22
ASoC: mxs-saif: Handle errors for clk_enable
As the potential failure of the clk_enable(),
it should be better to check it, like mxs_saif_trigger().

Fixes: d0ba4c0149 ("ASoC: mxs-saif: set a base clock rate for EXTMASTER mode work")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301081717.3727190-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:45:21 +00:00
Libin Yang c4dcd7100c
ASoC: Intel: soc-acpi: add entries in ADL match table
Support configuration with SoundWire RT1316 amplifiers on link0 and
link1, and RT711 on link2 for headphone/headset. This product does not
support local microphones.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:44 +00:00
Brent Lu 2fe14ff61b
ASoC: Intel: sof_ssp_amp: rename driver and support cs35l41 amplifier
Add support of CS35L41 amplifier to the machine driver, as well as
the support of HDMI playback and BT offload DAI Link.

Rename the driver to a generic name to support different amplifiers
from different vendors.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:43 +00:00
Brent Lu 709ec7bec6
ASoC: Intel: cirrus-common: support cs35l41 amplifier
Implement cs35l41 support code in this common module so it could be
shared between multiple SOF machine drivers.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:42 +00:00
Brent Lu 024979b67b
ASoC: Intel: sof_rt1308: move rt1308 code to common module
Move the code related to rt1308 dai link to the realtek common module.
It creates a clean base to add more amplifier support to this machine
driver in the future.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:41 +00:00
Brent Lu e1d5e13324
ASoC: Intel: boards: create sof-realtek-common module
Move sof_realtek_common.o to a dedicated module like the module to
support maxim amplifiers.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:40 +00:00
balamurugan.c da793fb0f5
ASoC: Intel: add RT1308 I2S machine driver and HDMI-in capture via I2S support.
Adding separate I2S machine driver for RT1308.

Adding support for HDMI-In capture via I2S in slave mode configuration.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: balamurugan.c <balamurugan.c@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:39 +00:00
Pierre-Louis Bossart f1eebb3bf7
ASoC: Intel: boards: fix spelling in comments
copy/paste spelling issues with platforms and buttons.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: FRED OH <fred.oh@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:38 +00:00
Pierre-Louis Bossart a6264056b3
ASoC: soc-acpi: remove sof_fw_filename
We've been using a default firmware name for each PCI/ACPI/OF platform
for a while. The machine-specific sof_fw_filename is in practice not
different from the default, and newer devices don't set this field, so
let's remove the redundant definitions.

When OEMs modify the base firmware, they can keep the same firmware
name but store the file in a separate directory.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-02 13:43:37 +00:00
Sunrisepeak 76f22f4dca Documentation: sound: fix typo in control-names.rst
change 'cannel' to 'channel'

Signed-off-by: Sunrisepeak <speakshen@163.com>
Link: https://lore.kernel.org/r/20220227145204.16600-1-speakshen@163.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-02 09:42:26 +01:00
Zhen Ni 0aa6b294b3 ALSA: intel_hdmi: Fix reference to PCM buffer address
PCM buffers might be allocated dynamically when the buffer
preallocation failed or a larger buffer is requested, and it's not
guaranteed that substream->dma_buffer points to the actually used
buffer.  The driver needs to refer to substream->runtime->dma_addr
instead for the buffer address.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220302074241.30469-1-nizhen@uniontech.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-02 09:25:37 +01:00