Commit Graph

42488 Commits

Author SHA1 Message Date
Uwe Kleine-König d6f8168e43
ASoC: Intel: avs: Fix build error on arc, m68k and sparc
On some platforms (i.e. arc, m68k and sparc) __fls returns an int (while
on most platforms it returns an unsigned long). This triggers a format
warning on these few platforms as the driver uses %ld to print a warning.

So explicitly cast the return value to unsigned long to make the warning
go away (and so fix allmodconfig build on the affected architectures).

Fixes: beed983621 ("ASoC: Intel: avs: Machine board registration")
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220529141250.1979827-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-30 16:08:33 +02:00
Marios Levogiannis 9bfa7b3634 ALSA: hda/realtek - Fix microphone noise on ASUS TUF B550M-PLUS
Set microphone pins 0x18 (rear) and 0x19 (front) to VREF_50 to fix the
microphone noise on ASUS TUF B550M-PLUS which uses the ALCS1200A codec.
The initial value was VREF_80.

The same issue is also present on Windows using both the default Windows
driver and all tested Realtek drivers before version 6.0.9049.1. Comparing
Realtek driver 6.0.9049.1 (the first one without the microphone noise) to
Realtek driver 6.0.9047.1 (the last one with the microphone noise)
revealed that the fix is the result of setting pins 0x18 and 0x19 to
VREF_50.

This fix may also work for other boards that have been reported to have
the same microphone issue and use the ALC1150 and ALCS1200A codecs, since
these codecs are similar and the fix in the Realtek driver on Windows is
common for both. However, it is currently enabled only for ASUS TUF
B550M-PLUS as this is the only board that could be tested.

Signed-off-by: Marios Levogiannis <marios.levogiannis@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220530074131.12258-1-marios.levogiannis@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-30 14:09:57 +02:00
Xiang wangx 4dd9989164 ALSA: hda/via: Delete does not require return
Void function return statements are not generally useful.

Signed-off-by: Xiang wangx <wangxiang@cdjrlc.com>
Link: https://lore.kernel.org/r/20220527121059.25221-1-wangxiang@cdjrlc.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-27 16:57:10 +02:00
Rik van der Kemp 15dad62f4b ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9520 laptop
The 2022-model XPS 15 appears to use the same 4-speakers-on-ALC289
audio setup as the Dell XPS 15 9510, so requires the same quirk to
enable woofer output. Tested on my own 9520.

[ Move the entry to the right position in the SSID order -- tiwai ]

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216035
Cc: <stable@vger.kernel.org>
Signed-off-by: Rik van der Kemp <rik@upto11.nl>
Link: https://lore.kernel.org/r/181056a137b.d14baf90133058.8425453735588429828@upto11.nl
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-27 16:55:26 +02:00
David Lin 5fa66f2993
ASoC: Intel: common: fix typo for tplg naming
Correct typo form sof-adl-mx98360a-nau8825.tplg to
sof-adl-max98360a-nau8825.tplg. The reason is tplg naming without naming
limitaion of length. It will be consistency with sof topology generation.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220526121301.1819541-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-26 14:43:26 +01:00
Linus Torvalds d7227785e3 sound updates for 5.19-rc1
Not much dramatic changes at this time, but we've received quite
 a lot of changes for ASoC, while there are still a few fixes and
 quirks for usual HD- and USB-auido.  Here are some highlights.
 
 * ASoC:
 - Overhaul of endianness specification for data formats, avoiding
   needless restrictions due to CODECs
 - Initial stages of Intel AVS driver merge
 - Introduction of v4 IPC mechanism for SOF
 - TDM mode support for AK4613
 - Support for Analog Devices ADAU1361, Cirrus Logic CS35L45, Maxim
   MAX98396, MediaTek MT8186, NXP i.MX8 micfil and SAI interfaces,
   nVidia Tegra186 ASRC, and Texas Instruments TAS2764 and TAS2780
 
 * Others
 - A few regression fixes after the USB-audio endpoint management
   refactoring
 - More enhancements for Cirrus HD-audio codec support (still ongoing)
 - Addition of generic serial MIDI driver
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmKOEiAOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE96FxAAnoVCecFK955fWInCULe15xYpi9kqngDSLAQk
 k6TkbP8AFyX+3PbIb9YVK9u+fLBaZzdK/ZIRqZNfb5T4q8tVTHphg2P+SNB36qaD
 nTTaEQ6dr6VUJO3fwwVBa3NJ+rGPr8KMKLlQGCg/I8HKdFeW2t/mV1YZI/ZxM7Or
 MXu3F5dt3yVXXMgUb33if+atYCXOwJ9YIqe1WHE4oPTtfOhbwiIdFeHgg88Kq7vJ
 ep7PCbyJ0rqfA9BIAnBfQuD9ZoaS7mKlo9xgyauNBzWnbRVd7dYyUnaxH++XLPPS
 GS0MEgftJfmUay6o++I7qrhoTyMKMHN/CU+6RlR1GD6WBpBhQ6T+poLkFDvKqbL8
 kvFEBFrEf0soeAKkUinzl1wCJnzWvpq2PF0EewQp03A3vOL5MOzGdId1wLKLmbCw
 Z0e0HAKTP4/AQeBluLo/SjiNoeSEU76xYYv8tFGv531ybIhvsF0nm/Suv4VZcy0V
 9tr2gLSORDLTBqSJqCf1JgN8oJht0QLirzgSekk8HUvx1JnIwwAaH1Dvy1DMrjyu
 TQ6oRyDS2giHKh7FItv3+U+HE1CkA89dzDvGrIbKrT6xkodHGzLNr0DxaDGuR11w
 H9f9oFEnGBpBxWmfLkGTa8+oBenTz8YRm4Ti8xhZkJkD1ys/4fjasAYoIKJqdnxH
 iG1DWic=
 =5qBk
 -----END PGP SIGNATURE-----

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

Pull sound updates from Takashi Iwai:
 "Not much dramatic changes at this time, but we've received quite a lot
  of changes for ASoC, while there are still a few fixes and quirks for
  usual HD- and USB-auido. Here are some highlights.

  ASoC:

   - Overhaul of endianness specification for data formats, avoiding
     needless restrictions due to CODECs

   - Initial stages of Intel AVS driver merge

   - Introduction of v4 IPC mechanism for SOF

   - TDM mode support for AK4613

   - Support for Analog Devices ADAU1361, Cirrus Logic CS35L45, Maxim
     MAX98396, MediaTek MT8186, NXP i.MX8 micfil and SAI interfaces,
     nVidia Tegra186 ASRC, and Texas Instruments TAS2764 and TAS2780

  Others:

   - A few regression fixes after the USB-audio endpoint management
     refactoring

   - More enhancements for Cirrus HD-audio codec support (still ongoing)

   - Addition of generic serial MIDI driver"

* tag 'sound-5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (504 commits)
  ALSA: hda/realtek - Add new type for ALC245
  ALSA: usb-audio: Configure sync endpoints before data
  ALSA: ctxfi: fix typo in comment
  ALSA: cs5535audio: fix typo in comment
  ALSA: ctxfi: Add SB046x PCI ID
  ALSA: usb-audio: Add missing ep_idx in fixed EP quirks
  ALSA: usb-audio: Workaround for clock setup on TEAC devices
  ALSA: lola: Bounds check loop iterator against streams array size
  ASoC: max98090: Move check for invalid values before casting in max98090_put_enab_tlv()
  ASoC: rt1308-sdw: add the default value of register 0xc320
  ASoC: rt9120: Use pm_runtime and regcache to optimize 'pwdnn' logic
  ASoC: rt9120: Fix 3byte read, valule offset typo
  ASoC: amd: acp: Set Speaker enable/disable pin through rt1019 codec driver.
  ASoC: amd: acp: Set Speaker enable/disable pin through rt1019 codec driver
  ASoC: wm2000: fix missing clk_disable_unprepare() on error in wm2000_anc_transition()
  ASoC: codecs: lpass: Fix passing zero to 'PTR_ERR'
  ASoC: SOF: sof-client-ipc-flood-test: use pm_runtime_resume_and_get()
  ASoC: SOF: mediatek: remove duplicate include in mt8195.c
  ASoC: SOF: mediatek: Add mt8195 debug dump
  ASoC: SOF: mediatek: Add mediatek common debug dump
  ...
2022-05-25 16:55:16 -07:00
Takashi Iwai 0125de3812 ALSA: usb-audio: Cancel pending work at closing a MIDI substream
At closing a USB MIDI output substream, there might be still a pending
work, which would eventually access the rawmidi runtime object that is
being released.  For fixing the race, make sure to cancel the pending
work at closing.

Reported-by: syzbot+6912c9592caca7ca0e7d@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/000000000000e7e75005dfd07cf6@google.com
Link: https://lore.kernel.org/r/20220525131203.11299-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-25 15:13:29 +02:00
Takashi Iwai 4c691a287d ALSA: usb-audio: Add mixer mapping for Gigabyte B450/550 Mobos
This patch implements a static mapping for Gigabyte B450/550 Mobos so
that the mixer elements appear reasonably and jack detections work
properly.

Reported-and-tested-by: Brock Szuszczewicz <brock@system76.com>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215988
Link: https://lore.kernel.org/r/20220525122018.3299-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-25 15:13:14 +02:00
Oder Chiou 832296804b
ASoC: rt5640: Do not manipulate pin "Platform Clock" if the "Platform Clock" is not in the DAPM
The pin "Platform Clock" was only used by the Intel Byt CR platform. In the
others, the error log will be informed. The patch will set the flag to
avoid the pin "Platform Clock" manipulated by the other platforms.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Reported-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20220516103055.20003-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-24 12:35:08 +01:00
Kailang Yang 60571929d0 ALSA: hda/realtek - Add new type for ALC245
Add new type for ALC245.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/cef26a7cd3d146eb96a3994ce79e34d2@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-24 11:00:15 +02:00
Craig McLure 0e85a22d01 ALSA: usb-audio: Configure sync endpoints before data
Devices such as the TC-Helicon GoXLR require the sync endpoint to be
configured in advance of the data endpoint in order for sound output
to work.

This patch simply changes the ordering of EP configuration to resolve
this.

Fixes: bf6313a0ff ("ALSA: usb-audio: Refactor endpoint management")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215079
Signed-off-by: Craig McLure <craig@mclure.net>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220524062115.25968-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-24 09:08:39 +02:00
Linus Torvalds d613060475 xen: branch for v5.19-rc1
-----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRTLbB6QfY48x44uB6AXGG7T9hjvgUCYosaQAAKCRCAXGG7T9hj
 vil9AP9b4C+f9LTG0kAinjxLPyWE0Mo/iq3gO60MteZ2HyeI+AD/eSzJioJA0vyH
 4pnU/UaGLJSp/B1LitLdjwoWIvwcEws=
 =pDcW
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.19-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross:

 - decouple the PV interface from kernel internals in the Xen
   scsifront/scsiback pv drivers

 - harden the Xen scsifront PV driver against a malicious backend driver

 - simplify Xen PV frontend driver ring page setup

 - support Xen setups with multiple domains created at boot time to
   tolerate Xenstore coming up late

 - two small cleanup patches

* tag 'for-linus-5.19-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (29 commits)
  xen: add support for initializing xenstore later as HVM domain
  xen: sync xs_wire.h header with upstream xen
  x86: xen: remove STACK_FRAME_NON_STANDARD from xen_cpuid
  xen-blk{back,front}: Update contact points for buffer_squeeze_duration_ms and feature_persistent
  xen/xenbus: eliminate xenbus_grant_ring()
  xen/sndfront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/usbfront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/scsifront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/pcifront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/drmfront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/tpmfront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/netfront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/blkfront: use xenbus_setup_ring() and xenbus_teardown_ring()
  xen/xenbus: add xenbus_setup_ring() service function
  xen: update ring.h
  xen/shbuf: switch xen-front-pgdir-shbuf to use INVALID_GRANT_REF
  xen/dmabuf: switch gntdev-dmabuf to use INVALID_GRANT_REF
  xen/sound: switch xen_snd_front to use INVALID_GRANT_REF
  xen/drm: switch xen_drm_front to use INVALID_GRANT_REF
  xen/usb: switch xen-hcd to use INVALID_GRANT_REF
  ...
2022-05-23 20:49:45 -07:00
Syed Saba kareem 803a1f7272
ASoC: SOF: amd: Fixed Build error
Add linux/module.h in acp-pci.c to solve the below dependency

All error/warnings (new ones prefixed by >>):

>> sound/soc/amd/acp/acp-pci.c:148:1: warning: data definition has no type or storage class
148 | MODULE_DEVICE_TABLE(pci, acp_pci_ids);
| ^~~~~~~~~~~~~~~~~~~
>> sound/soc/amd/acp/acp-pci.c:148:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
...

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Syed Saba Kareem<ssabakar@amd.com>
Link: https://lore.kernel.org/r/20220523112956.3087604-1-ssabakar@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-23 18:33:13 +01:00
Takashi Iwai 0163717ed5 ASoC: Updates for v5.19
This is quite a big update, partly due to the addition of some larger
 drivers (more of which is to follow since at least the AVS driver is
 still a work in progress) and partly due to Charles' work sorting out
 our handling of endianness.  As has been the case recently it's much
 more about drivers than the core.
 
  - Overhaul of endianness specification for data formats, avoiding
    needless restrictions due to CODECs.
  - Initial stages of Intel AVS driver merge.
  - Introduction of v4 IPC mechanism for SOF.
  - TDM mode support for AK4613.
  - Support for Analog Devices ADAU1361, Cirrus Logic CS35L45, Maxim
    MAX98396, MediaTek MT8186, NXP i.MX8 micfil and SAI interfaces,
    nVidia Tegra186 ASRC, and Texas Instruments TAS2764 and TAS2780
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKLf5EACgkQJNaLcl1U
 h9ASqAf/YnwbFP919ree/DEKUDCNc4klUH5M4JOexXbZlZDqxKYRGZjoLuiwX/PQ
 Au/xOjGEvm3Yg5/g5c8YFVNcIkv1O8VclRkV59oIxlBwKmQeTKvq+lOmlel2l1wZ
 XOmvHjE46wxH1N1cLwL6KkX0YDn59orSZGYZRpfLjL61y6LQWsLNU0tY6AWCRATB
 Llnrbu+DYgCsYNTEOOOY5s4V+4LkQm8TLdft91Va7mBdkPPRFoXRO0HGcVBqbkoN
 7pf2mrjrLAWL9yuA8FlrgJbHq58DF9WGe5uEU7qlVL1zw46ClgIM0ABxPOdNdjV2
 Wzb1jI7GmztgQNxlR9BcJB0kxAj9vA==
 =oD5l
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v5.19' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v5.19

This is quite a big update, partly due to the addition of some larger
drivers (more of which is to follow since at least the AVS driver is
still a work in progress) and partly due to Charles' work sorting out
our handling of endianness.  As has been the case recently it's much
more about drivers than the core.

 - Overhaul of endianness specification for data formats, avoiding
   needless restrictions due to CODECs.
 - Initial stages of Intel AVS driver merge.
 - Introduction of v4 IPC mechanism for SOF.
 - TDM mode support for AK4613.
 - Support for Analog Devices ADAU1361, Cirrus Logic CS35L45, Maxim
   MAX98396, MediaTek MT8186, NXP i.MX8 micfil and SAI interfaces,
   nVidia Tegra186 ASRC, and Texas Instruments TAS2764 and TAS2780
2022-05-23 16:03:04 +02:00
Shengjiu Wang e4dd748dc8
ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition
There are multiple xDR and xFR registers, the index is
from 0 to 7. FSL_SAI_xDR and FSL_SAI_xFR is abandoned,
replace them with FSL_SAI_xDR0 and FSL_SAI_xFR0.

Fixes: 4f7a0728b5 ("ASoC: fsl_sai: Add support for SAI new version")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1653284661-18964-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-23 14:53:01 +01:00
Pierre-Louis Bossart f4d6aca0c8
ASoC: soc-pcm: fix BE transition for TRIGGER_START
A obvious editing mistake caught with a cppcheck warning

sound/soc/soc-pcm.c:2132:8: style: Variable 'ret' is reassigned a
value before the old one has been used. [redundantAssignment]
   ret = soc_pcm_trigger(be_substream, cmd);
       ^
sound/soc/soc-pcm.c:2126:9: note: ret is assigned
    ret = soc_pcm_trigger(be_substream,
        ^
sound/soc/soc-pcm.c:2129:9: note: ret is assigned
    ret = soc_pcm_trigger(be_substream,
        ^

Fixes: 374b50e234 ('ASoC: soc-pcm: improve BE transition for TRIGGER_START')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220520210615.607229-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-23 14:52:59 +01:00
Julia Lawall 1693e265e0 ALSA: ctxfi: fix typo in comment
Spelling mistake (triple letters) in comment.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/20220521111145.81697-44-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-23 09:48:29 +02:00
Julia Lawall e9ff88c327 ALSA: cs5535audio: fix typo in comment
Spelling mistake (triple letters) in comment.
Detected with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/20220521111145.81697-1-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-23 09:47:45 +02:00
Edward Matijevic 1b073ebb17 ALSA: ctxfi: Add SB046x PCI ID
Adds the PCI ID for X-Fi cards sold under the Platnum and XtremeMusic names

Before: snd_ctxfi 0000:05:05.0: chip 20K1 model Unknown (1102:0021) is found
After: snd_ctxfi 0000:05:05.0: chip 20K1 model SB046x (1102:0021) is found

[ This is only about defining the model name string, and the rest is
  handled just like before, as a default unknown device. 
  Edward confirmed that the stuff has been working fine -- tiwai ]

Signed-off-by: Edward Matijevic <motolav@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/cae7d1a4-8bd9-7dfe-7427-db7e766f7272@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-23 09:47:07 +02:00
Takashi Iwai 1212fa1b48 Merge branch 'for-linus' into for-next
Merge for 5.18-rc1

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-23 07:48:27 +02:00
Takashi Iwai 7b0efea4ba ALSA: usb-audio: Add missing ep_idx in fixed EP quirks
The quirk entry for Focusrite Saffire 6 had no proper ep_idx for the
capture endpoint, and this confused the driver, resulting in the
broken sound.  This patch adds the missing ep_idx in the entry.

While we are at it, a couple of other entries (for Digidesign MBox and
MOTU MicroBook II) seem to have the same problem, and those are
covered as well.

Fixes: bf6313a0ff ("ALSA: usb-audio: Refactor endpoint management")
Reported-by: André Kapelrud <a.kapelrud@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220521065325.426-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-21 08:54:08 +02:00
Takashi Iwai 5ce0b06ae5 ALSA: usb-audio: Workaround for clock setup on TEAC devices
Maris reported that TEAC UD-501 (0644:8043) doesn't work with the
typical "clock source 41 is not valid, cannot use" errors on the
recent kernels.  The currently known workaround so far is to restore
(partially) what we've done unconditionally at the clock setup;
namely, re-setup the USB interface immediately after the clock is
changed.  This patch re-introduces the behavior conditionally for TEAC
devices.

Further notes:
- The USB interface shall be set later in
  snd_usb_endpoint_configure(), but this seems to be too late.
- Even calling  usb_set_interface() right after
  sne_usb_init_sample_rate() doesn't help; so this must be related
  with the clock validation, too.
- The device may still spew the "clock source 41 is not valid" error
  at the first clock setup.  This seems happening at the very first
  try of clock setup, but it disappears at later attempts.
  The error is likely harmless because the driver retries the clock
  setup (such an error is more or less expected on some devices).

Fixes: bf6313a0ff ("ALSA: usb-audio: Refactor endpoint management")
Reported-and-tested-by: Maris Abele <maris7abele@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220521064627.29292-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-21 08:49:44 +02:00
Kees Cook 12626530de ALSA: lola: Bounds check loop iterator against streams array size
GCC 12 sees that it's technically possible for num_streams to be larger
than ARRAY_SIZE(pcm->streams). Bounds-check the iterator.

../sound/pci/lola/lola_pcm.c: In function 'lola_pcm_update':
../sound/pci/lola/lola_pcm.c:567:64: warning: array subscript [0, 31] is outside array bounds of 'struct lola_stream[16]' [-Warray-bounds]
  567 |                         struct lola_stream *str = &pcm->streams[i];
      |                                                    ~~~~~~~~~~~~^~~
In file included from ../sound/pci/lola/lola_pcm.c:15:
../sound/pci/lola/lola.h:307:28: note: while referencing 'streams'
  307 |         struct lola_stream streams[MAX_STREAM_COUNT];
      |                            ^~~~~~~

Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220520165537.2139826-1-keescook@chromium.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-21 08:48:57 +02:00
Takashi Iwai 15ad333269 ASoC: Fix for v5.17
This is rather late and at this point I'm expecting it to get merged in
 the merge window rather than as a fix but if we get a -rc8 it's a small,
 driver specific fix which should be fine to send.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKHo04ACgkQJNaLcl1U
 h9Ag3Qf8DodKNfpEaYOYfgnE/+VojHwnqLQlvedk9iA6Jzfo+3VwH9fI4ZGUVkdR
 L/F8lkF6uQEyW4tcIdVylMejrItcuxQ2x3Ov7xmRcrZlpUueoI79DcDerR5kQTXE
 f/rPXFKFwfuznPpZvs9maQ7YvLxnA88ZhLq/b0bLvkaL3FFtpI8+KOcslUph5/9X
 uGBGaYj8AzAJVZIT0jG4R4iXD0DWyATcoS/vLIU3r3pkO1fw5R8IgG0UggMNJ/mW
 G2iU/wO/QXHdX4OwO0wxojbrjCSLJBq5rbtwWIFCg2chz05gEgXNebzBAm2sijt4
 fhPheCABCFfY5lIUtcpvxiLzJKbE+w==
 =OBCV
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.18-rc7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fix for v5.17

This is rather late and at this point I'm expecting it to get merged in
the merge window rather than as a fix but if we get a -rc8 it's a small,
driver specific fix which should be fine to send.
2022-05-21 08:47:40 +02:00
Mark Brown e5cd20e0d6
ASoC: SOF: Introduce generic (in)firmware tracing infrastructure
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
From the kernel point of view there are only few ops that needs to be exposed:

Hi,

SOF is using dma-trace (or dtrace) as a firmware tracing method, which is only
supported with IPC3 and it is not applicable for IPC4.

Currently the dtrace is 'open managed' regardless of IPC version (we do force
disable it for IPC4, but the dtrace calls remain in place).

From the kernel point of view there are only few ops that needs to be exposed
by the firmware tracing support and everything else is IPC private, should not
be known by the core.

This series converts the current dma-trace as ipc3 specific firmware tracing
sub-component and moves all private data out from generic code.

Regards,
Peter
---
Peter Ujfalusi (8):
  ASoC: SOF: Introduce IPC independent ops for firmware tracing support
  ASoC: SOF: Rename dtrace_is_supported flag to fw_trace_is_supported
  ASoC: SOF: Clone the trace code to ipc3-dtrace as fw_tracing
    implementation
  ASoC: SOF: Switch to IPC generic firmware tracing
  ASoC: SOF: ipc3-dtrace: Move host ops wrappers from generic header to
    private
  ASoC: SOF: Modify the host trace_init parameter list to include dmab
  ASoC: SOF: Introduce opaque storage of private data for firmware
    tracing
  ASoC: SOF: ipc3-dtrace: Move dtrace related variables local from
    sof_dev

 sound/soc/sof/Makefile          |   1 +
 sound/soc/sof/amd/acp-trace.c   |   4 +-
 sound/soc/sof/amd/acp.h         |   2 +-
 sound/soc/sof/core.c            |  13 +-
 sound/soc/sof/debug.c           |   2 +-
 sound/soc/sof/intel/hda-dsp.c   |   2 +-
 sound/soc/sof/intel/hda-trace.c |   4 +-
 sound/soc/sof/intel/hda.h       |   2 +-
 sound/soc/sof/ipc.c             |   6 +
 sound/soc/sof/ipc3-dtrace.c     | 649 ++++++++++++++++++++++++++++++++
 sound/soc/sof/ipc3-priv.h       |  38 ++
 sound/soc/sof/ipc3.c            |   3 +-
 sound/soc/sof/ops.c             |   2 +-
 sound/soc/sof/ops.h             |  26 --
 sound/soc/sof/pm.c              |   8 +-
 sound/soc/sof/sof-priv.h        |  53 +--
 sound/soc/sof/trace.c           | 621 ++----------------------------
 17 files changed, 767 insertions(+), 669 deletions(-)
 create mode 100644 sound/soc/sof/ipc3-dtrace.c

--
2.36.1
2022-05-20 14:56:35 +01:00
Alexey Khoroshilov f7a3444681
ASoC: max98090: Move check for invalid values before casting in max98090_put_enab_tlv()
Validation of signed input should be done before casting to unsigned int.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Suggested-by: Mark Brown <broonie@kernel.org>
Fixes: 2fbe467bcb ("ASoC: max98090: Reject invalid values in custom control put()")
Link: https://lore.kernel.org/r/1652999486-29653-1-git-send-email-khoroshilov@ispras.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-20 13:43:10 +01:00
Shuming Fan affa9983e7
ASoC: rt1308-sdw: add the default value of register 0xc320
The driver missed the default value of register 0xc320.
This patch adds that default value to avoid the error messages
when the driver went to suspend mode already.

BugLink: https://github.com/thesofproject/linux/issues/3651
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20220520090205.25857-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-20 13:43:09 +01:00
Mark Brown b4ce6dd4de
ASoC: SOF: mediatek: add debug dump
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Add the ability to generate debug dumps on MediaTek SOF implementations.
2022-05-20 12:17:53 +01:00
Mark Brown bb94bb8628
ASoC: remove two unnecessary gpiolib dependencies
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Remove two dependencies - issues reported by Intel kernel test bot.
2022-05-20 12:17:51 +01:00
ChiYuan Huang 80b949f332
ASoC: rt9120: Use pm_runtime and regcache to optimize 'pwdnn' logic
From the datasheet, the only way to meet the lowest power consumption is
to pull low the 'pwdnn' gpio. But if it is low, IC will keep in
reset state, all registers reset to default.

And the power consumption is listed below
1. amp off and 'pwdnn' high => idle state, PVDD = 1mA, DVDD = 7mA
2. amp off and 'pwdnn' low  => shutdown state, PVDD < 20uA, DVDD < 15uA

It's the large difference for the consumption current

This fix is to use pm_runtime and regcache to handle 'pwdnn' gpio
control.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1652926418-8519-3-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:47:12 +01:00
ChiYuan Huang 57f68f2168
ASoC: rt9120: Fix 3byte read, valule offset typo
For RG 3byte read, the value order is  offset [0], [1], and [2].

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1652926418-8519-2-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:47:11 +01:00
V sujith kumar Reddy 17572892e3
ASoC: amd: acp: Set Speaker enable/disable pin through rt1019 codec driver.
RT1019 codec has two ways of controlling the en_spkr.  one way is
controlling through gpio pin method the another way is through codec
register update through driver.

Now Speaker enable/disable is controlled  through codec register updated
by codec driver.  This patch reverts gpio logic.

This reverts commit 5c5f08f7fc ("ASoC:
amd: acp: Power on/off the speaker enable gpio pin based on DAPM
callback.")

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
Link: https://lore.kernel.org/r/20220516160619.17832-2-Vsujithkumar.Reddy@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:46:43 +01:00
V sujith kumar Reddy 6107fb6607
ASoC: amd: acp: Set Speaker enable/disable pin through rt1019 codec driver
RT1019 codec has two ways of controlling the en_spkr.  one way is
controlling through gpio pin method the another way is through codec
register update through driver.

Now Speaker enable/disable is controlled  through codec register updated
by codec driver.  This patch reverts gpio logic.

This reverts commit 7fa5c33d04 ("ASoC:
amd: acp: Set gpio_spkr_en to None for max speaker amplifer in machine
driver").

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
Link: https://lore.kernel.org/r/20220516160619.17832-1-Vsujithkumar.Reddy@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:52 +01:00
Yang Yingliang be2af740e2
ASoC: wm2000: fix missing clk_disable_unprepare() on error in wm2000_anc_transition()
Fix the missing clk_disable_unprepare() before return
from wm2000_anc_transition() in the error handling case.

Fixes: 514cfd6dd7 ("ASoC: wm2000: Integrate with clock API")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220514091053.686416-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:31 +01:00
YueHaibing 81e7b165c4
ASoC: codecs: lpass: Fix passing zero to 'PTR_ERR'
sound/soc/codecs/lpass-macro-common.c:28 lpass_macro_pds_init() warn: passing zero to 'PTR_ERR'
sound/soc/codecs/lpass-macro-common.c:38 lpass_macro_pds_init() warn: passing zero to 'PTR_ERR'
sound/soc/codecs/lpass-macro-common.c:54 lpass_macro_pds_init() warn: passing zero to 'ERR_PTR'

dev_pm_domain_attach_by_name() may return NULL, set 'ret' as
-ENODATA to fix this warning.

Fixes: 1a8ee4cf84 ("ASoC: codecs: Fix error handling in power domain init and exit handlers")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20220516120909.36356-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:30 +01:00
Pierre-Louis Bossart b1378b259c
ASoC: SOF: sof-client-ipc-flood-test: use pm_runtime_resume_and_get()
Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_noidle() pattern.

No functional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220517173715.468894-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:29 +01:00
Wan Jiabing 0f653c95c4
ASoC: SOF: mediatek: remove duplicate include in mt8195.c
Fix following checkincludes.pl warning:
sound/soc/sof/mediatek/mt8195/mt8195.c: linux/of_platform.h is included more than once.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20220518125902.13407-1-wanjiabing@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:28 +01:00
YC Hung 3a054f90e9
ASoC: SOF: mediatek: Add mt8195 debug dump
Add mt8195_adsp_dump in mt8195.c for debug_dump callback to dump
mt8195 debug registers and call mtk_adsp_dump.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220517173109.468568-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:26 +01:00
YC Hung 698c1e99a0
ASoC: SOF: mediatek: Add mediatek common debug dump
1.Add mtk-adsp-common.c file for mediatek platforms common usage.
2.Add mtk_adsp_dump implementation in mtk-adsp-common.c for general
  debug dump.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220517173109.468568-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:25 +01:00
Pierre-Louis Bossart b390c25c67
ASoC: rt1015p: remove dependency on GPIOLIB
commit dcc2c012c7 ("ASoC: Fix gpiolib dependencies") removed a
series of unnecessary dependencies on GPIOLIB when the gpio was
optional.

A similar simplification seems valid for rt1015p, so remove the
dependency as well. This will avoid the following warning

  WARNING: unmet direct dependencies detected for SND_SOC_RT1015P

     Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
     GPIOLIB [=n]

     Selected by [y]:

     - SND_SOC_INTEL_SOF_RT5682_MACH [=y] && SOUND [=y] && !UML && SND
       [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
       (SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
       [=y] && ACPI [=y] && (SND_HDA_CODEC_HDMI [=y] &&
       SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
       COMPILE_TEST [=y]) || SND_SOC_SOF_BAYTRAIL [=n] &&
       (X86_INTEL_LPSS [=n] || COMPILE_TEST [=y]))

Reported-by: kernel test robot <yujie.liu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220517172647.468244-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:23 +01:00
Pierre-Louis Bossart 21ca327433
ASoC: max98357a: remove dependency on GPIOLIB
commit dcc2c012c7 ("ASoC: Fix gpiolib dependencies") removed a
series of unnecessary dependencies on GPIOLIB when the gpio was
optional.

A similar simplification seems valid for max98357a, so remove the
dependency as well. This will avoid the following warning

   WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A
     Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
     Selected by [y]:
     - SND_SOC_INTEL_SOF_CS42L42_MACH [=y] && SOUND [=y] && !UML &&
       SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
       (SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
       [=y] && ACPI [=y] && SND_HDA_CODEC_HDMI [=y] &&
       SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
       COMPILE_TEST [=n])

Reported-by: kernel test robot <yujie.liu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220517172647.468244-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:22 +01:00
Peter Ujfalusi 0683532999
ASoC: SOF: ipc3-dtrace: Move dtrace related variables local from sof_dev
The variables and structs for DMA trace can be moved local to ipc3-dtrace.c
and the storage can be allocated dynamically, stored behind the
fw_trace_data pointer.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:19 +01:00
Peter Ujfalusi 08341b27bd
ASoC: SOF: Introduce opaque storage of private data for firmware tracing
Firmware tracing implementations can allocate and store their privately
used data behind the fw_trace_pdata pointer instead of adding more
members to struct snd_sof_dev.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:18 +01:00
Peter Ujfalusi 4b49cbd1e7
ASoC: SOF: Modify the host trace_init parameter list to include dmab
Stop host code (AMD, Intel) to access sdev->dmatb directly.
Modify the trace_init prototype to include the pointer to a
struct snd_dma_buffer. The ipc3-dtrace passes for now the pointer to
sdev->dmatb, but the aim is to move all tracing related runtime information
local to a trace implementation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:17 +01:00
Peter Ujfalusi b69979a1ec
ASoC: SOF: ipc3-dtrace: Move host ops wrappers from generic header to private
Move the snd_sof_dma_trace_* ops wrappers from ops.h to ipc3-priv.h since
they are not used outside of IPC3 code.
While moving, rename them to sof_dtrace_host_*

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:16 +01:00
Peter Ujfalusi 1dedbe4f22
ASoC: SOF: Switch to IPC generic firmware tracing
Introduce new, generic API for firmware tracing with sof_fw_trace_ prefix
and switch to use it.
At the same time the old IPC3 code can be dropped from trace.c, which is
now a generic wrapper for the firmware tracing ops.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:15 +01:00
Peter Ujfalusi 671e0b9005
ASoC: SOF: Clone the trace code to ipc3-dtrace as fw_tracing implementation
The existing trace.c file is implementing the IPC3 dma-trace support.

Clone the existing code with prefix fixes as ipc3 fw_tracing
implementation to be used when the core is converted to use generic ops
for firmware tracing.

Drop the dual licensing of the content as the implementation is based on
debugfs.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:14 +01:00
Peter Ujfalusi 25b17da691
ASoC: SOF: Rename dtrace_is_supported flag to fw_trace_is_supported
Rename the internal flag to not limit it's use for dma-trace, but to be
used for generic firmware tracing functionality.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:12 +01:00
Peter Ujfalusi 0cfbaee21f
ASoC: SOF: Introduce IPC independent ops for firmware tracing support
The current (dma-)trace is only supported with IPC3, it is not available
when IPC4 is used.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220516104711.26115-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-19 16:44:11 +01:00
Juergen Gross 360dc89d12 xen/sndfront: use xenbus_setup_ring() and xenbus_teardown_ring()
Simplify sndfront's ring creation and removal via xenbus_setup_ring()
and xenbus_teardown_ring().

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # Arm64 only
Signed-off-by: Juergen Gross <jgross@suse.com>
2022-05-19 14:22:08 +02:00
Juergen Gross 297ce02669 xen/sound: switch xen_snd_front to use INVALID_GRANT_REF
Instead of using a private macro for an invalid grant reference use
the common one.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # Arm64 only
Signed-off-by: Juergen Gross <jgross@suse.com>
2022-05-19 14:21:46 +02:00
Wan Jiabing 03a8b0df75 ALSA: usb-audio: Fix wrong kfree issue in snd_usb_endpoint_free_all
Fix following coccicheck error:
./sound/usb/endpoint.c:1671:8-10: ERROR: reference preceded by free on line 1671.

Here should be 'cp' rather than 'ip'.

Fixes: c11117b634 ("ALSA: usb-audio: Refcount multiple accesses on the single clock")
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20220518021617.10114-1-wanjiabing@vivo.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-18 06:59:48 +02:00
Mark Brown ec432e2a51
ASoC: Intel: avs: Driver core and PCM operations
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Part three of main AVS driver series. This series was originally part of
the initial series which was later divided [1] into smaller,
easier-to-review chunks. Thus, many patches found here were already
present on the list.

This series consists of code typical to many drivers - PCI driver
operations, trace ability, PM operations - as well as PCM handlers for
all standard audio interfaces, that is, HDA, I2S and DMIC are found
here.

Series starts with updating firmware boot flow - libraries are no longer
ignored. This change is dependent on already merged topology code [2]
and because of that could not be part of the initial series [1].

PCM operations are split into four changes. First component operations
alone i.e. operations which are usually agnostic towards path position
(FE/BE). Then it continues with "generic" FE operations - there is no
interface split here as from Intel ADSP point of view, FE, or HOST side
as it's called in the specs, involves HD-Audio operations only.
BE (also known as LINK) side on the other hand is divided into
"non-HD-Audio" and HD-Audio part. The former represents transfer over
DMIC and I2S interfaces both.

While patches implementing standard PCI driver operations along (again
standard) HD-Audio initialization routines followed up by power
management handlers are two major ones, series covers also other
important subjects such as:

While patches implementing standard PCI driver operations along (again
standard) HD-Audio initialization routines followed up by power
management handlers are two major ones, series covers also other
important subjects such as:

- event tracing
- preparation for firmware tracing (debugability)
- coredump (debugability)
- recovery flow (attempt recovery after IPC timeout or exception)
- D0ix (D0 device substate, complements standard power management)

Series is finalized by actual addition of supported platforms: SKL and
APL-based. Platform-specific files are limited to firmware-specific
bits, that is, bits that are specific to given firmware generation.
Everything else is shared and is part of already upstream messaging
code found in ipc.c, messages.c and messages.h files.

Changes in v3:
- addressed (hopefully) trace-code compilation under .configs with
  CONFIG_FTRACE dropped

Changes in v2:
- usage of avs_releast_last_firmware() dropped in error path for library
  loading procedure as suggested by Pierre
- 'link_mask' usage replaced with 'i2s_link_mask' as requested by
  Pierre. Existing code addressed with new patch:
  "ASoC: Intel: avs: Replace link_mask usage with i2s_link_mask"
- fixed possible race during recovery flow (->recovering flag is now
  atomic and tested in single location only).
- dropped platform prefixes for basically all i2s board descriptors
- 'ssp_test' renamed to 'i2s_test' to match naming convention of other
  boards
- simplified PM implementation for current series, 'low_power' bits
  moved to future series
- replaced SND_INTEL_DSP_DRIVER_SST with _AVS as suggested by Mark.
  Required changes to intel-dspcfg will be added in future series
- number of typos across commit messages addressed

[1]: https://lore.kernel.org/all/20220311153544.136854-1-cezary.rojewski@intel.com/
[2]: https://lore.kernel.org/all/20220331135246.993089-1-cezary.rojewski@intel.com/

Cezary Rojewski (14):
  ASoC: Intel: avs: Account for libraries when booting basefw
  ASoC: Intel: avs: Generic soc component driver
  ASoC: Intel: avs: Generic PCM FE operations
  ASoC: Intel: avs: non-HDA PCM BE operations
  ASoC: Intel: avs: HDA PCM BE operations
  ASoC: Intel: avs: Coredump and recovery flow
  ASoC: Intel: avs: Prepare for firmware tracing
  ASoC: Intel: avs: D0ix power state support
  ASoC: Intel: avs: Event tracing
  ASoC: Intel: avs: Machine board registration
  ASoC: Intel: avs: PCI driver implementation
  ASoC: Intel: avs: Power management
  ASoC: Intel: avs: SKL-based platforms support
  ASoC: Intel: avs: APL-based platforms support

Piotr Maziarz (1):
  ASoC: Intel: avs: Replace link_mask usage with i2s_link_mask

 include/sound/intel-dsp-config.h      |    3 +-
 include/sound/soc-acpi.h              |    2 +
 sound/soc/intel/Kconfig               |    2 +
 sound/soc/intel/avs/Makefile          |    7 +-
 sound/soc/intel/avs/apl.c             |  250 ++++++
 sound/soc/intel/avs/avs.h             |   79 ++
 sound/soc/intel/avs/board_selection.c |  501 +++++++++++
 sound/soc/intel/avs/core.c            |  631 +++++++++++++
 sound/soc/intel/avs/dsp.c             |   27 +-
 sound/soc/intel/avs/ipc.c             |  253 +++++-
 sound/soc/intel/avs/loader.c          |   84 ++
 sound/soc/intel/avs/messages.c        |   35 +-
 sound/soc/intel/avs/messages.h        |   51 ++
 sound/soc/intel/avs/pcm.c             | 1182 +++++++++++++++++++++++++
 sound/soc/intel/avs/registers.h       |    8 +
 sound/soc/intel/avs/skl.c             |  125 +++
 sound/soc/intel/avs/topology.c        |   14 +-
 sound/soc/intel/avs/trace.c           |   33 +
 sound/soc/intel/avs/trace.h           |  154 ++++
 sound/soc/intel/avs/utils.c           |   23 +
 20 files changed, 3443 insertions(+), 21 deletions(-)
 create mode 100644 sound/soc/intel/avs/apl.c
 create mode 100644 sound/soc/intel/avs/board_selection.c
 create mode 100644 sound/soc/intel/avs/pcm.c
 create mode 100644 sound/soc/intel/avs/skl.c
 create mode 100644 sound/soc/intel/avs/trace.c
 create mode 100644 sound/soc/intel/avs/trace.h

--
2.25.1
2022-05-17 18:19:35 +01:00
Yihao Han 37a86b32bf
ASoC: ux500: mop500: Check before clk_put() not needed
clk_put() already checks the clk ptr using !clk and IS_ERR()
so there is no need to check it again before calling it.

Signed-off-by: Yihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220517033050.5191-1-hanyihao@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:54 +01:00
Peter Ujfalusi c5003f08fe
ASoC: SOF: ipc-msg-injector: Cap the rmaining to count in IPC4 mode
If user space provides smaller buffer than the IPC4 reply then it is
possible that we corrupt user space memory since the IPC4 dfs_read function
is not using the count directly in copy_to_user() due to the nature of
an IPC4 message.

Cap the remaining counter to make sure that we are not writing too much to
the user space provided buffer.

Add a check also to make sure that the buffer is at least the size of the
IPC4 header.

Fixes: 066c67624d8c: "ASoC: SOF: ipc-msg-injector: Add support for IPC4 messages"
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220516092442.17027-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:11 +01:00
Cezary Rojewski c8c960c109
ASoC: Intel: avs: APL-based platforms support
Define handlers specific to cAVS 1.5+ platforms, that is, APL and
similar platforms. These differ from SKL-alike ones in terms of AudioDSP
firmware generation and thus the '+' suffix. Introduciton of IMR,
removal of CLDMA, D0IX support and monolithic-ation of library/module
code are most impactful but are not the only changes brought with this
newer generation. Some generic and 1.5 operations are being re-used to
reduce code size.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-16-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:08 +01:00
Cezary Rojewski b3e29075b2
ASoC: Intel: avs: SKL-based platforms support
Define handlers specific to cAVS 1.5 platforms, that is SKL, KBL, AML
and all other variants based on this very version of AudioDSP
architecture. Most are specific to SKL-alike platforms with only
skl_log_buffer_offset() being exposed and used later by younger
equivalents.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-15-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:07 +01:00
Cezary Rojewski cfbc100e6b
ASoC: Intel: avs: Power management
To preserve power during sleep operations, handle suspend (S3),
hibernation (S4) and runtime (RTD3) transitions. As flow for all of
is shared, define common handlers to reduce code size.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-14-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:06 +01:00
Cezary Rojewski 1affc44ea5
ASoC: Intel: avs: PCI driver implementation
HD-Audio bus is a PCI device. Add all functions necessary to probe such
device along with its removal sequence. Behaviour implemented for all
standard operations is similar to existing solutions: sound/pci/hda and
sound/soc/intel/skylake.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-13-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:04 +01:00
Cezary Rojewski beed983621
ASoC: Intel: avs: Machine board registration
AVS driver operates with granular audio card division in mind.
Super-card approach (e.g.: I2S, DMIC and HDA DAIs combined) is
deprecated in favour of individual cards - one per each device. This
provides necessary dynamism, especially for configurations with number
of codecs present and makes it easier to survive auxiliary devices
failures - one card failing to probe does not prevent others from
succeeding.

All boards spawned by AVS are unregistered on ->remove(). This includes
dummy codecs such as DMIC.

As all machine boards found in sound/soc/intel/boards are irreversibly
tied to 'super-card' approach, new boards are going to be introduced.
This temporarily increases number of boards available under /intel
directory until skylake-driver becomes deprecated and removed.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-12-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:03 +01:00
Piotr Maziarz 25b552f192
ASoC: Intel: avs: Replace link_mask usage with i2s_link_mask
'link_mask' field is intended for SoundWire, I2S should use
'i2s_link_mask' instead.

Signed-off-by: Piotr Maziarz <piotrx.maziarz@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-11-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:02 +01:00
Cezary Rojewski 69b23b3937
ASoC: Intel: avs: Event tracing
Define tracing macros for easy avs debug. These cover all IPC message
types: requests, replies and notifications as well as DSP-core
operations and d0ix toggling.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:01 +01:00
Cezary Rojewski 335c4cbd20
ASoC: Intel: avs: D0ix power state support
Audio DSP device supports D0 substates in form of D0ix, allowing for
preserving more power even when device is still considered active (D0).
When entered, certain domains which are not being currently used become
power gated. Entering and leaving D0ix is a complex process and differs
between firmware generations.

Conditions that disallow D0i3 and require immediate D0i0 transition
include but may not be limited to: IPC traffic, firmware tracing and
SRAM I/O. To make D0ix toggling sane, delay D0i3 transition and refresh
the timer each time an IPC is requested.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-9-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:58:00 +01:00
Cezary Rojewski 4b86115cb9
ASoC: Intel: avs: Prepare for firmware tracing
Firmware provides its own debug functionality. While coredump is one of
these, traces are the main area of interest. kfifo is enlisted to cache
log data that is being pumped to driver through SRAM. Separate DSP
operations are declared as actual feature implementation differs between
firmware generations.

As log gathering involves usage of IPCs, add all necessary: ENABLE_LOGS
and SYSTEM_TIME.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-8-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:59 +01:00
Cezary Rojewski 2f1f570cd7
ASoC: Intel: avs: Coredump and recovery flow
In rare occasions, under stress conditions or hardware malfunction, DSP
firmware may fail. Software is notified about such situation with
EXCEPTION_CAUGHT notification. IPC timeout is also counted as critical
device failure. More often than not, driver can recover from such
situations by performing full reset: killing and restarting ADSP.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:58 +01:00
Cezary Rojewski d070002a20
ASoC: Intel: avs: HDA PCM BE operations
HDA streaming in DSP world means enlisting HDAudio links as BE
interfaces. Another difference when compared to its DMIC and I2S friends
is lack of NHLT blob usage - no additional hardware configuration is
needed.

Similarly to I2S component, HDA populates its DAIs dynamically, here by
the means of codec->pcm_list_head. Allows for cutting the number of soc
components required to support the interface.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:57 +01:00
Cezary Rojewski b9062f9867
ASoC: Intel: avs: non-HDA PCM BE operations
DMIC and I2S interfaces differ in DMA operations from the HDAudio
interface. With that in mind, implement all DAI operations to handle
non-HDA BE interfaces.

To prevent code duplication in newly added code, I2S platform
registering is dynamic - makes use of specified port_mask and TDMs
array to populate as many DAIs as required.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:56 +01:00
Cezary Rojewski 9114700b49
ASoC: Intel: avs: Generic PCM FE operations
Each stream in AVS is represented by FE and BE domain. FE path stands
for HOST part of the stream while BE stands for LINK (hardware) one.
While BE portion is interface specific, FE is not. Handle all standard
DAI operations to implement FE part of the stream.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:54 +01:00
Cezary Rojewski f1b3b320bd
ASoC: Intel: avs: Generic soc component driver
Prepare for concrete PCM operations over HDA, DMIC and I2S interfaces by
providing generic soc component implementation. Interface-specific
components re-use this code as majority of flow is shared.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:53 +01:00
Cezary Rojewski 81a299105d
ASoC: Intel: avs: Account for libraries when booting basefw
Not all modules are part of base firmware. Some are part of loadable
libraries. These need to be loaded after base firmware reports ready
status through FW_READY notification.

Their loading process is similar to the base firmware's one. Request the
binary file, verify and strip the manifest and load the actual code into
DSP memory with help of CLDMA or HD-Audio render stream, depending on
audio device generation.

List of libraries needed for loading is obtained through the topology -
vendor sections specifying the name of firmware files to request.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220516101116.190192-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-17 11:57:52 +01:00
Guo Zhengkui 44d30762cd ALSA: seq: replace ternary operator with max()
Fix the following coccicheck warning:

sound/core/seq/seq_ports.c:142:12-14: WARNING opportunity for max()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
Link: https://lore.kernel.org/r/20220517062518.123292-1-guozhengkui@vivo.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-17 08:49:42 +02:00
Mark Brown dba2d5ae4c
ASoC: fsl_sai: Add support for i.MX8MM, MP, ULP
Merge series from Shengjiu Wang <shengjiu.wang@nxp.com>:

ASoC: fsl_sai: Add support for i.MX8MM, MP, ULP platforms
2022-05-16 19:50:53 +01:00
Mark Brown 0af9de0ea8
firmware: mtk: add adsp ipc protocol for SOF
Merge series from Tinghan Shen <tinghan.shen@mediatek.com>:

This patch provides mediatek adsp ipc support for SOF.
ADSP IPC protocol offers (send/recv) interfaces using
mediatek-mailbox APIs.

This patch was tested and confirmed to work with SOF fw on
MT8195 cherry board and MT8186 krabby board.

changes since v8:
- fix patchset 2 and 3.
  move "depends on MTK_ADSP_IPC" from SND_SOC_SOF_MTK_COMMON
  to SND_SOC_SOF_MT8195/MT8186 to prevent generating wrong
  config.

changes since v7:
- rebase to linux-next/next-22020504
- use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL in mtk-adsp-ipc.c
- move mtk-adsp-ipc.c out from driver/firmware/mediatek
- add user of mtk-adsp-ipc.h in patchset 2 and 3.

changes since v6:
- rebase to matthias.bgg/linux.git, v5.18-next/soc
- Prefer "GPL" over "GPL v2" for MODULE_LICENSE

changes since v5:
- fix WARNING: modpost: missing MODULE_LICENSE() in drivers/mailbox
  /mtk-adsp-mailbox.o. Add MODULE_LICENSE in the last line.
- Due to WARNING: Missing or malformed SPDX-License-Identifier tag
  in line 1 in checkpatch, we don't remove SPDX-License in line 1.

changes since v4:
- add error message for wrong mbox chan

changes since v3:
- rebase on v5.16-rc8
- update reviewers

changes since v2:
- add out tag for two memory free phases

changes since v1:
- add comments for mtk_adsp_ipc_send and mtk_adsp_ipc_recv
- remove useless MODULE_LICENSE
- change label name to out_free

Allen-KH Cheng (1):
  ASoC: SOF: mediatek: Add ipc support for mt8195

TingHan Shen (1):
  firmware: mediatek: add adsp ipc protocol interface

Tinghan Shen (1):
  ASoC: SOF: mediatek: Add mt8186 ipc support

 drivers/firmware/Kconfig                      |   9 +
 drivers/firmware/Makefile                     |   1 +
 drivers/firmware/mtk-adsp-ipc.c               | 157 ++++++++++++++++++
 .../linux/firmware/mediatek/mtk-adsp-ipc.h    |  65 ++++++++
 sound/soc/sof/mediatek/Kconfig                |   2 +
 sound/soc/sof/mediatek/adsp_helper.h          |  12 +-
 sound/soc/sof/mediatek/mt8186/mt8186-loader.c |   5 +
 sound/soc/sof/mediatek/mt8186/mt8186.c        | 141 ++++++++++++++++
 sound/soc/sof/mediatek/mt8195/mt8195.c        | 138 ++++++++++++++-
 9 files changed, 519 insertions(+), 11 deletions(-)
 create mode 100644 drivers/firmware/mtk-adsp-ipc.c
 create mode 100644 include/linux/firmware/mediatek/mtk-adsp-ipc.h

--
2.18.0
2022-05-16 19:50:51 +01:00
Lin Ma 2def44d3ae
ASoC: rt5645: Fix errorenous cleanup order
There is a logic error when removing rt5645 device as the function
rt5645_i2c_remove() first cancel the &rt5645->jack_detect_work and
delete the &rt5645->btn_check_timer latter. However, since the timer
handler rt5645_btn_check_callback() will re-queue the jack_detect_work,
this cleanup order is buggy.

That is, once the del_timer_sync in rt5645_i2c_remove is concurrently
run with the rt5645_btn_check_callback, the canceled jack_detect_work
will be rescheduled again, leading to possible use-after-free.

This patch fix the issue by placing the del_timer_sync function before
the cancel_delayed_work_sync.

Signed-off-by: Lin Ma <linma@zju.edu.cn>
Link: https://lore.kernel.org/r/20220516092035.28283-1-linma@zju.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:42 +01:00
Charles Keepax 232213bd73
ASoC: soc-component: Update handling to component delays
Currently the checking for if a component sits on the CPU or CODEC side
of the DAI link is done with a helper function that checks if the
component defines legacy_dai_naming. However, there are already a couple
of CPU side components that explicitly opt in to non-legacy DAI naming
and it doesn't seem like a very robust solution. Rather than looking for
the flag check if the component is attached to any of the CODEC DAIs on
the DAI link. This is more robust and helps to bring the core further in
the direction of a component being a generic block rather than being
classified as platform or CODEC drivers.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220513090532.1450944-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:41 +01:00
Charles Keepax 8c8a0f01c7
ASoC: core: Pass legacy_dai_naming flag directly
Passing the result of the helper function snd_soc_component_is_codec
to snd_soc_register_dai is less clear than just passing the DAI
naming flag directly. snd_soc_register_dai wants to know if it
should use the legacy DAI naming. The CODEC distinction is more
of a historical thing and not obviously directly related, and there
are already a couple of CPU side components that explicitly opt in
to non-legacy DAI naming.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220513090532.1450944-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:40 +01:00
Charles Keepax 64c917d1cf
ASoC: core: Correct spelling fliped -> flipped
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220513090532.1450944-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:39 +01:00
Miaoqian Lin a34840c4eb
ASoC: ti: j721e-evm: Fix refcount leak in j721e_soc_probe_*
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not needed anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: 6748d05590 ("ASoC: ti: Add custom machine driver for j721e EVM (CPB and IVI)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220512111331.44774-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:38 +01:00
YueHaibing d91835655c
ASoC: amd: vangogh: Remove duplicate include files
Remove duplicated includes.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20220514023806.34768-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:37 +01:00
Tinghan Shen e0100bfd38
ASoC: SOF: mediatek: Add mt8186 ipc support
mt8186 DSP uses two hardware mailbox IP to communicate with AP.
One mailbox is used for requests coming from AP, and the other
one is for requests from DSP.

Signed-off-by: Allen-KH Cheng <Allen-KH.Cheng@mediatek.com>
Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Link: https://lore.kernel.org/r/20220512082215.3018-4-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:13 +01:00
Allen-KH Cheng aea9350108
ASoC: SOF: mediatek: Add ipc support for mt8195
This patch adds mt8195 IPC support by using mailbox.

On mt8195 resource, there are two mboxes used to handle ipc request
and reply. We create a mtk-adsp-ipc client device to request mbox
controllers.

Signed-off-by: Allen-KH Cheng <Allen-KH.Cheng@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20220512082215.3018-3-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:12 +01:00
Shengjiu Wang af0bd3c0ff
ASoC: fsl_sai: Add support for i.MX8ULP
Add i.MX8ULP specific soc data, the max register is FSL_SAI_RTCAP
the IP version is also 0x0301, So version can't be used for the
condition of register FSL_SAI_MCTL setting.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1652688372-10274-4-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:08 +01:00
Shengjiu Wang 2530c5e875
ASoC: fsl_sai: Add support for i.MX8M Plus
Add i.MX8M Plus specific soc data, the max register is FSL_SAI_MDIV.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1652688372-10274-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:07 +01:00
Shengjiu Wang 9e71bc33ae
ASoC: fsl_sai: Add support for i.MX8MM
On i.MX8MM the max register is FSL_SAI_MCTL, which is
different with previous platform, so add max_register in
soc data to distinguish platforms.
And add specific soc data for i.MX8MM

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1652688372-10274-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-16 12:58:06 +01:00
Takashi Iwai c11117b634 ALSA: usb-audio: Refcount multiple accesses on the single clock
When a clock source is connected to multiple nodes / endpoints, the
current USB-audio driver tries to set up at each time one of them is
configured.  Although it reads the current rate and updates only if it
differs, some devices seem unhappy with this behavior and spew the
errors when reading/updating the rate unnecessarily.

This patch tries to reduce the redundant clock setup by introducing a
refcount for each clock source.  When the stream is actually running,
a clock rate is "locked", and it bypasses the clock and/or refuse to
change any longer.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215934
Link: https://lore.kernel.org/r/20220516104807.16482-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 12:49:03 +02:00
Takashi Iwai 5c62383c06 ALSA: usb-audio: Restore Rane SL-1 quirk
At cleaning up and moving the device rename from the quirk table to
its own table, we removed the entry for Rane SL-1 as we thought it's
only for renaming.  It turned out, however, that the quirk is required
for matching with the device that declares itself as no standard
audio but only as vendor-specific.

Restore the quirk entry for Rane SL-1 to fix the regression.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215887
Fixes: 5436f59bc5 ("ALSA: usb-audio: Move device rename and profile quirks to an internal table")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220516103112.12950-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 12:41:13 +02:00
Stefan Binding 00f87ec74c ALSA: hda: cs35l41: Add Amp Name based on channel and index
This will be used to identify ALSA controls and firmware.
The Amp Name will be a channel identifier (L or R), and an
index, which identifies which amp for that channel.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-10-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:55:39 +02:00
Stefan Binding 0db99577c4 ASoC: cs35l41: Move cs_dsp config struct into shared code
This can then be used by HDA code to configure cs_dsp.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-9-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:55:08 +02:00
Stefan Binding ff8aad072e ASoC: cs35l41: Move cs35l41 fs errata into shared code
This sequence is required to setup firmware, and will
be needed for hda driver.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-8-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:54:22 +02:00
Stefan Binding caf7c1f1de ASoC: cs35l41: Move cs35l41_set_cspl_mbox_cmd to shared code
This function is used to control the DSP Firmware for cs35l41,
and will be needed by the cs35l41 hda driver, when firmware
support is added.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-7-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:54:14 +02:00
Stefan Binding de8cab7b38 ALSA: hda: cs35l41: Enable GPIO2 Interrupt for CLSA0100 laptops
CLSA0100 Laptop does not contain configuration inside ACPI,
instead the hardware configuration needs to be hardcoded.
Hardcode GPIO2 Interrupt in the driver for CSLA0100.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-6-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:52:28 +02:00
Stefan Binding aa4a38af97 ALSA: hda: cs35l41: Add Support for Interrupts
The CS35L41 can produce interrupts on error.

When the interrupts occur, the driver will report
the error, but errors will only be fixed after playback
finishes.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-5-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:51:21 +02:00
Stefan Binding 14e42ceec8 ALSA: hda: cs35l41: Remove Set Channel Map api from binding
This API was required for CLSA0100 laptop, which did not
have correct properties inside ACPI. The required values
are now hardcoded inside the driver so this is no longer
needed.
Without this api, there CLSA0100 can now use the generic
cs35l41 fixup, like the other laptops.
All other laptops will read the Speaker Position from
ACPI and set the channel map from within the driver.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-4-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:51:00 +02:00
Stefan Binding 775d667539 ALSA: hda: cs35l41: Set Speaker Position for CLSA0100 Laptop
This laptop does not contain required properties inside ACPI,
instead the values are be hardcoded inside the driver.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-3-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:50:31 +02:00
Stefan Binding c960aa6aa3 ALSA: hda: cs35l41: Fix error in spi cs35l41 hda driver name
For consistency, rename spi cs35l41 hda driver name so that
it matches i2c.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220509214703.4482-2-vitalyr@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:50:21 +02:00
Andy Chi 024a7ad9eb ALSA: hda/realtek: fix right sounds and mute/micmute LEDs for HP machine
The HP EliteBook 630 is using ALC236 codec which used 0x02 to control mute LED
and 0x01 to control micmute LED. Therefore, add a quirk to make it works.

Signed-off-by: Andy Chi <andy.chi@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220513121648.28584-1-andy.chi@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-16 09:43:15 +02:00
Arnd Bergmann f95a387cde m68k: coldfire: drop ISA_DMA_API support
After a build regression report, I took a look at possible users of
CONFIG_ISA_DMA_API on m68k and found none, which Greg confirmed. The
CONFIG_GENERIC_ISA_DMA option in turn is only needed to implement
ISA_DMA_API, and is clearly not used on the platforms with ISA support.

The CONFIG_ISA support for AMIGA_PCMCIA is probably also unneeded,
but this is less clear. Unlike other PCMCIA implementations, this one
does not use the drivers/pcmcia subsystem at all and just supports
the "apne" network driver. When it was first added, one could use
ISA drivers on it as well, but this probably broke at some point.

With no reason to keep this, let's just drop the corresponding files
and prevent the remaining ISA drivers that use this from getting built.

The remaining definitions in asm/dma.h are used for PCI support.

Link: https://lore.kernel.org/lkml/9e5ee1c3-ca80-f343-a1f5-66f3dd1c0727@linux-m68k.org/
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
2022-05-16 13:18:30 +10:00
Werner Sembach 8b3b2392ed ALSA: hda/realtek: Add quirk for TongFang devices with pop noise
When audio stops playing there is an audible "pop"-noise when using
headphones on the TongFang GMxMRxx, GKxNRxx, GMxZGxx, GMxTGxx and GMxAGxx.

This quirk fixes this mostly.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220512180956.281804-1-wse@tuxedocomputers.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-05-13 08:23:40 +02:00
Mark Brown fd4b80044b
ASoC: SOF: Add IPC4 FW loader support
Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>:

The patches in this series add support for FW loading for IPC4 in the SOF
driver.
2022-05-12 15:18:23 +01:00
Hui Tang 0b7f644f52
ASoC: max98396: Fix build error for implicit function declaration
sound/soc/codecs/max98396.c: In function ‘max98396_i2c_probe’:
sound/soc/codecs/max98396.c:1555:25: error: implicit declaration of function ‘devm_gpiod_get_optional’; did you mean ‘devm_regulator_get_optional’? [-Werror=implicit-function-declaration]
  max98396->reset_gpio = devm_gpiod_get_optional(&i2c->dev,
                         ^~~~~~~~~~~~~~~~~~~~~~~
                         devm_regulator_get_optional
sound/soc/codecs/max98396.c:1556:23: error: ‘GPIOD_OUT_HIGH’ undeclared (first use in this function); did you mean ‘GPIOF_INIT_HIGH’?
              "reset", GPIOD_OUT_HIGH);
                       ^~~~~~~~~~~~~~
                       GPIOF_INIT_HIGH
sound/soc/codecs/max98396.c:1556:23: note: each undeclared identifier is reported only once for each function it appears in
sound/soc/codecs/max98396.c:1565:3: error: implicit declaration of function ‘gpiod_set_value_cansleep’; did you mean ‘gpio_set_value_cansleep’? [-Werror=implicit-function-declaration]
   gpiod_set_value_cansleep(max98396->reset_gpio, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~
   gpio_set_value_cansleep
cc1: all warnings being treated as errors

Include header file <linux/gpio/consumer.h>

Fixes: b585811367 ("ASoC: max98396: add amplifier driver")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
Link: https://lore.kernel.org/r/20220512074640.75550-2-tanghui20@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-12 11:43:35 +01:00