Commit graph

2929 commits

Author SHA1 Message Date
Takashi Iwai
7318234c8d ASoC: Updates for v5.8
This has been another very active release with a bunch of new drivers,
 lots of fixes everywhere and continued core improvements from
 Morimoto-san:
 
  - Lots of core cleanups and refactorings from Morimoto-san, factoring
    out common operations and making the card abstraction more solid.
  - Continued work on cleaning up and improving the Intel drivers, along
    with some new platform support for them.
  - Fixes to make the Marvell SSPA driver work upstream.
  - Support for AMD Renoir ACP, Dialog DA7212, Freescale EASRC and
    i.MX8M, Intel Elkhard Lake, Maxim MAX98390, Nuvoton NAU8812 and
    NAU8814 and Realtek RT1016.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl7U8IoTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0PkwB/0UF8YoNrLFb9wqo62sUAPYp2d9t6AW
 qDmRdNoULlT+diyr3ufQOaW7yMgVfSN1ek2btl/IDhuy96lIVb1tVPs7mJvxDOqk
 P/a5jxl0mWn0bmuMaajShtPc/IL2GAnYoLGIWZS+2U5CCQonKUL95DdlMcWn44lt
 lMa6jK9KfCMMbaocic24XmZDYfyxhRBpKWQC7Mq/i6pw3yZgOTSUCkS42Koy6NXs
 aDMHgCZKutigzEEZEDWDJ9LWqplALAQAiEUoKDWXBDBQ94nWbKkwjig4WDtC8Wao
 sgCubdWM4fvLf102PcAkn0xYDC68zNSS3NuZTp7k5gyXzkepoyCfKviX
 =8UOT
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v5.8

This has been another very active release with a bunch of new drivers,
lots of fixes everywhere and continued core improvements from
Morimoto-san:

 - Lots of core cleanups and refactorings from Morimoto-san, factoring
   out common operations and making the card abstraction more solid.
 - Continued work on cleaning up and improving the Intel drivers, along
   with some new platform support for them.
 - Fixes to make the Marvell SSPA driver work upstream.
 - Support for AMD Renoir ACP, Dialog DA7212, Freescale EASRC and
   i.MX8M, Intel Elkhard Lake, Maxim MAX98390, Nuvoton NAU8812 and
   NAU8814 and Realtek RT1016.
2020-06-01 20:26:07 +02:00
Mark Brown
358c7c61fd
Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus 2020-06-01 13:01:15 +01:00
Mark Brown
a72ff08faf
Merge remote-tracking branch 'asoc/for-5.7' into asoc-linus 2020-06-01 13:01:13 +01:00
Kuninori Morimoto
fcbbcc325b
ASoC: soc-card: add snd_soc_card_remove_dai_link()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87mu5szv2h.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:42 +01:00
Kuninori Morimoto
cbc7a6b5a8
ASoC: soc-card: add snd_soc_card_add_dai_link()
Card related function should be implemented at soc-card now.
This patch adds it.

This patch adds missing return when error case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87o8q8zv2m.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:41 +01:00
Kuninori Morimoto
d41278ea05
ASoC: soc-card: add snd_soc_card_set_bias_level_post()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87pnaozv2s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:40 +01:00
Kuninori Morimoto
39caefda0a
ASoC: soc-card: add snd_soc_card_set_bias_level()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87sgfkzv4g.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:39 +01:00
Kuninori Morimoto
b0275d956f
ASoC: soc-card: add snd_soc_card_remove()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87tv00zv4p.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:38 +01:00
Kuninori Morimoto
5c0eac036d
ASoC: soc-card: add snd_soc_card_late_probe()
Card related function should be implemented at soc-card now.
This patch adds it.

card has "card->probe" and "card->late_probe" callbacks,
and "late_probe" callback is called after "probe".
This means, we can set "card->probed" flag afer "late_probe"
for all cases.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87v9kgzv4w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:37 +01:00
Kuninori Morimoto
73de4b0268
ASoC: soc-card: add snd_soc_card_probe()
Card related function should be implemented at soc-card now.
This patch adds it.

One note here is that card has "card->probe" and "card->late_probe"
callbacks.
Because it needs to care "late_probe", "card->probed" flag is set
under if (card->probe) at snd_soc_card_probe().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87wo4wzv54.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:36 +01:00
Kuninori Morimoto
27f07cacc9
ASoC: soc-card: add probed bit field to snd_soc_card
We already have bit field to control snd_soc_card.
Let's add "probed" field on it instead of local variable.

One note here is that soc_cleanup_card_resources()
will be called as (A) formal cleanup or as (B) error handling,
thus, it needs to distinguish these.

In (A) case, card will have "instantiated" flag if all probe
callback functions were called without error.
Thus, snd_soc_unbind_card() is using it to judging card was probed.
But this this patch removes it, because it is no longer needed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87r1v4zv36.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:36 +01:00
Kuninori Morimoto
739443d1f1
ASoC: soc-card: add snd_soc_card_resume_post()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87y2pczv5d.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:35 +01:00
Kuninori Morimoto
934c752c38
ASoC: soc-card: add snd_soc_card_resume_pre()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87zh9szv5k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:34 +01:00
Kuninori Morimoto
d17b60b2c4
ASoC: soc-card: add snd_soc_card_suspend_post()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/871rn425j3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:33 +01:00
Kuninori Morimoto
130dc08c82
ASoC: soc-card: add snd_soc_card_suspend_pre()
Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87367k25jc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:32 +01:00
Kuninori Morimoto
bf5bb8db5b
ASoC: soc-card: move snd_soc_card_subclass to soc-card
Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874ks025jn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:31 +01:00
Kuninori Morimoto
65a75718d6
ASoC: soc-card: move snd_soc_card_get_codec_dai() to soc-card
Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/875zcg25jv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:30 +01:00
Kuninori Morimoto
63efed582c
ASoC: soc-card: move snd_soc_card_set/get_drvdata() to soc-card
Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/877dww25k4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:29 +01:00
Kuninori Morimoto
3359e9b6fa
ASoC: soc-card: move snd_soc_card_jack_new() to soc-card
Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/878shc25kc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:28 +01:00
Kuninori Morimoto
209c6cdfd2
ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card
Card related function should be implemented at soc-card now.
This patch moves it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a71s25kj.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:27 +01:00
Kuninori Morimoto
1793936bc9
ASoC: add soc-card.c
Current ALSA SoC has some snd_soc_card_xxx() functions,
and card->xxx() callbacks.
But, it is implemented randomly at random place.

To collect all card related functions into one place,
this patch creats new soc-card.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87blm825kt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:27 +01:00
Kuninori Morimoto
317ec67593
ASoC: soc.h: convert bool to bit field for snd_soc_card
snd_soc_card has many bool, but it can be bit field.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87d06o25l2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-30 02:11:26 +01:00
Takashi Iwai
6d28484026 Merge branch 'for-linus' into for-next
Back-merge 5.7-devel branch for further development.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-28 10:08:50 +02:00
Charles Keepax
f4aa5e214e
ASoC: dapm: Move dai_link widgets to runtime to fix use after free
The newly added CODEC to CODEC DAI link widget pointers in
snd_soc_dai_link are better placed in snd_soc_pcm_runtime.
snd_soc_dai_link is really intended for static configuration of
the DAI, and the runtime for dynamic data.  The snd_soc_dai_link
structures are not destroyed if the card is unbound. The widgets
are cleared up on unbind, however if the card is rebound as the
snd_soc_dai_link structures are reused these pointers will be left at
their old values, causing access to freed memory.

Fixes: 595571cca4 ("ASoC: dapm: Fix regression introducing multiple copies of DAI widgets")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200526161930.30759-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-27 13:24:13 +01:00
Mark Brown
f202272cab
Merge series "ASoC: add soc-link" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

Current ALSA SoC is handling dai_link related operation,
but it is implmemented directly without using function/macro,
and at random place.

This v4 patch-set creates new snd_soc_link_xxx() functions
which handles dai_link related operation,
and implmement these at new soc-link.c.

v3 -> v4

	- add Reviewed-by from Ranjani and Pierre-Louis
	- fix bisection error at [2/7]

v2 -> v3

	- add missing #include <sound/soc-link.h> in soc-link.c

v1 -> v2
	- #include <sound/soc-link.h> is added on each c source file
	  instead of soc.h
	- not have extra error message after snd_soc_link_xxx(),
	  because it already indicate it via snc_link_ret()
	- snd_soc_link_compr_xxx() doesn't have rtd parameter,
	  because it can be created from cstream

Link: https://lore.kernel.org/r/87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/874ksa59wc.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/877dx868op.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (7):
  ASoC: add soc-link.c
  ASoC: soc-link: move soc_rtd_xxx()
  ASoC: soc-link: remove unneeded parameter from snd_soc_link_xxx()
  ASoC: soc-link: add snd_soc_link_be_hw_params_fixup()
  ASoC: soc-link: add snd_soc_link_compr_startup()
  ASoC: soc-link: add snd_soc_link_compr_shutdown()
  ASoC: soc-link: add snd_soc_link_compr_set_params()

 include/sound/soc-link.h |  27 +++++++
 sound/soc/Makefile       |   2 +-
 sound/soc/soc-compress.c |  46 ++++--------
 sound/soc/soc-core.c     |  18 ++---
 sound/soc/soc-dai.c      |   9 ++-
 sound/soc/soc-link.c     | 150 +++++++++++++++++++++++++++++++++++++++
 sound/soc/soc-pcm.c      |  86 ++++------------------
 7 files changed, 219 insertions(+), 119 deletions(-)
 create mode 100644 include/sound/soc-link.h
 create mode 100644 sound/soc/soc-link.c

--
2.17.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto
2020-05-25 15:31:13 +01:00
Karol Trzcinski
4c4a975178
ASoC: SOF: ext_manifest: parse compiler version
The compiler version and description can be extracted from the
extended manifest content. This information known at build time
does not need to be provided in a mailbox.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-6-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:59:37 +01:00
Karol Trzcinski
8d809c15ac
ASoC: SOF: ext_manifest: parse windows
The window description can be extracted from the extended manifest
content. This information known at build time does not need to be
provided in a mailbox.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:59:36 +01:00
Karol Trzcinski
3e2a89d3ee
ASoC: SOF: ext_manifest: parse firmware version
The firmware version can be extracted from the extended
manifest content. This information known at build time
does not need to be provided in a mailbox.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-4-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:59:35 +01:00
Karol Trzcinski
a80cf1987a
ASoC: SOF: Introduce extended manifest
Extended manifest is a place to store build time known firmware
metadata, for example firmware version or used compiler description.
Given information is read on host side before firmware startup.
This part of output binary is located as a first structure in binary
file.
Extended manifest should be skipped in firmware loading routine.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200520165911.21696-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:59:34 +01:00
Kuninori Morimoto
eab810f37f
ASoC: soc-link: add snd_soc_link_compr_set_params()
dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_compr_set_params().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87sgfo3k6q.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:14 +01:00
Kuninori Morimoto
0e532c99b4
ASoC: soc-link: add snd_soc_link_compr_shutdown()
dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_compr_shutdown().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87tv043k6u.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:13 +01:00
Kuninori Morimoto
9ab711cb84
ASoC: soc-link: add snd_soc_link_compr_startup()
dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_compr_startup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87v9kk3k6y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:12 +01:00
Kuninori Morimoto
0cbbf8a039
ASoC: soc-link: add snd_soc_link_be_hw_params_fixup()
dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_be_hw_params_fixup().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87wo503k73.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:11 +01:00
Kuninori Morimoto
7cf3c5b4a0
ASoC: soc-link: remove unneeded parameter from snd_soc_link_xxx()
"rtd" can be created from "substream".
Let's cleanup snd_soc_link_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87y2pg3k78.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:10 +01:00
Kuninori Morimoto
a5e6c10900
ASoC: soc-link: move soc_rtd_xxx()
dai_link related function should be implemented at
soc-link.c.
This patch moves soc-pcm soc_rtd_xxx()
to soc-link as snd_soc_link_xxx()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87zh9w3k7k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:09 +01:00
Kuninori Morimoto
02e756363f
ASoC: add soc-link.c
Current ALSA SoC has many dai_link->xxx() functions.
But, it is implemented randomly at random place.

This patch creats new soc-link.c and collect dai_link related
operation into it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/871rn84ys5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-25 14:22:08 +01:00
Mark Brown
4ace9a0ec7
Merge series "ASoC: SOF: Intel and IMX updates for 5.8" from Kai Vehmanen <kai.vehmanen@linux.intel.com>:
Hi,

here's a series of minor fixes and improvements to SOF. Add support
for smart amplifier component type. Cover more systems by relaxing
match rules for the generic Soundwire machine driver. Fix issues with
driver unload and address a few compiler warnings.

Daniel Baluta (2):
  ASoC: SOF: Do nothing when DSP PM callbacks are not set
  ASoC: SOF: define INFO_ flags in dsp_ops

Keyon Jie (1):
  ASoC: SOF: topology: add support to smart amplifier

Marcin Rajwa (2):
  ASoC: SOF: add a power_down_notify method
  ASoC: SOF: inform DSP that driver is going to be removed

Pierre-Louis Bossart (2):
  ASoC: SOF: imx: make dsp_ops static
  ASoC: SOF: imx: make imx8m_dsp_ops static

randerwang (1):
  ASoC: SOF: Intel: sdw: relax sdw machine select constraints

 include/sound/sof/topology.h |  2 ++
 sound/soc/sof/core.c         |  6 ++++++
 sound/soc/sof/imx/imx8.c     |  2 +-
 sound/soc/sof/imx/imx8m.c    |  8 +++++++-
 sound/soc/sof/intel/hda.c    | 10 +++++++++-
 sound/soc/sof/pm.c           | 19 +++++++++++++++++--
 sound/soc/sof/sof-priv.h     |  1 +
 sound/soc/sof/topology.c     |  1 +
 8 files changed, 44 insertions(+), 5 deletions(-)

--
2.26.0
2020-05-18 16:43:50 +01:00
Kuninori Morimoto
0812a08ac8
ASoC: cleanup dai / component active code
No one is using dai->active, snd_soc_component_is_active().
Let's remove these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87imgy58hp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 16:15:16 +01:00
Kuninori Morimoto
5552f8d728
ASoC: soc-dai: add snd_soc_dai_stream_active()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874ksi6n48.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 16:15:02 +01:00
Kuninori Morimoto
488b2ca599
ASoC: soc-component: add snd_soc_component_active()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/875zcy6n4d.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 16:15:02 +01:00
Kuninori Morimoto
efffd9b344
ASoC: soc-dai: add snd_soc_dai_active()
Current snd_soc_dai_action() is updating
dai->stream_active for Playback/Capture (A),
dai->active        for DAI (B)

        void snd_soc_dai_action(struct snd_soc_dai *dai,
                                int stream, int action)
        {
(A)             dai->stream_active[stream]      += action;
(B)             dai->active                     += action;
                dai->component->active          += action;
        }

But, these are very verbose, because we can calculate
DAI active from stream_active.

This patch adds snd_soc_dai_active() which calculate
DAI active from DAI stream_active.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/877dxe6n4i.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 16:15:01 +01:00
Kuninori Morimoto
dc82910682
ASoC: soc-dai: add snd_soc_dai_action()
snd_soc_runtime_action() updates DAI's xxx_active.
We should update these in the same time, and
it can be implemented at soc-dai.c.
This patch adds snd_soc_dai_action() for it.
This is prepare for xxx_active cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a72a6n4s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 16:14:59 +01:00
Kuninori Morimoto
d9051d86ad
ASoC: soc-pcm: replace snd_soc_runtime_activate()/deactivate() to macro
snd_soc_runtime_activate()/deactivate() are implemented by global function
which are just calling snd_soc_runtime_action().
We can replace it to macro, and this patch do it.
This patch is prepare for xxx_active cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87blmq6n4y.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 16:14:58 +01:00
Keyon Jie
82e8c00fa1
ASoC: SOF: topology: add support to smart amplifier
Add smart amplifier component support, which is designed as another new
type of process component and used for speaker protection algorithm
integration.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200515135958.17511-5-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18 13:24:56 +01:00
Takashi Iwai
b9f2d35f05 ALSA: hda: Unexport some local helper functions
snd_hdac_bus_queue_event() and snd_hdac_bus_exec_verb() are used only
internally in HD-audio core.  Let's drop the exports and move the
declarations into local.h.

Link: https://lore.kernel.org/r/20200516062854.22141-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-16 08:29:49 +02:00
Takashi Iwai
6325c7fade ALSA: hda: Drop unused snd_hda_queue_unsol_event()
The inline function is nowhere used.  Drop it.

Link: https://lore.kernel.org/r/20200516062854.22141-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-16 08:29:35 +02:00
Gustavo A. R. Silva
2d6201ee11
ASoC: soc-core: Replace zero-length array with flexible-array
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507192228.GA16355@embeddedor
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-08 11:28:48 +01:00
Gustavo A. R. Silva
9ad06ebb9a ALSA: Replace zero-length array with flexible-array
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member conversions) will also
help to get completely rid of those sorts of issues.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20200507192223.GA16335@embeddedor
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-07 22:30:36 +02:00
Takashi Iwai
c1f6e3c818 ALSA: rawmidi: Fix racy buffer resize under concurrent accesses
The rawmidi core allows user to resize the runtime buffer via ioctl,
and this may lead to UAF when performed during concurrent reads or
writes: the read/write functions unlock the runtime lock temporarily
during copying form/to user-space, and that's the race window.

This patch fixes the hole by introducing a reference counter for the
runtime buffer read/write access and returns -EBUSY error when the
resize is performed concurrently against read/write.

Note that the ref count field is a simple integer instead of
refcount_t here, since the all contexts accessing the buffer is
basically protected with a spinlock, hence we need no expensive atomic
ops.  Also, note that this busy check is needed only against read /
write functions, and not in receive/transmit callbacks; the race can
happen only at the spinlock hole mentioned in the above, while the
whole function is protected for receive / transmit callbacks.

Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CAFcO6XMWpUVK_yzzCpp8_XP7+=oUpQvuBeCbMffEDkpe8jWrfg@mail.gmail.com
Link: https://lore.kernel.org/r/s5heerw3r5z.wl-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-07 22:29:14 +02:00
Jason Yan
79263c3bce ALSA: hda: Return true,false for return type bool
Fix the following coccicheck warning:

include/sound/hdaudio.h:210:73-74: WARNING: return of 0/1 in function
'snd_hdac_is_in_pm' with return type bool
include/sound/hdaudio.h:211:76-77: WARNING: return of 0/1 in function
'snd_hdac_is_power_on' with return type bool

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Link: https://lore.kernel.org/r/20200506061716.19209-1-yanaijie@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-06 08:37:13 +02:00
Kai-Heng Feng
8c11827bba ALSA: hda: Use hdac_to_hda_codec macro
Use hdac_to_hda_codec() instead of container_of().

No functional change intended.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20200505030357.28004-2-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-05 08:59:02 +02:00
Sameer Pujar
67ae482a59 ALSA: hda: add member to store ratio for stripe control
Stripe control programming is governed by following formula, which is
referenced from the HD Audio specification(Revision 1.0a).
  { ((num_channels * bits_per_sample) / number of SDOs) >= 8 }

Currently above is implemented in snd_hdac_get_stream_stripe_ctl().
This patch introduces a structure member to store the default factor
of '8'. If any HW wants to use a different value, this member can be
easily updated.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1588580176-2801-3-git-send-email-spujar@nvidia.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-04 11:51:23 +02:00
Pierre-Louis Bossart
e149ca29f3
ASoC: SOF/Intel: clarify SPDX license with GPL-2.0-only
Remove the ambiguity with GPL-2.0 and use an explicit GPL-2.0-only
tag.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200501145850.15178-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-01 17:45:24 +01:00
Mark Brown
79ca782533
Merge series "ASoC: soc-dai: add snd_soc_dai_xxx()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

We have soc-dai.c today. DAI related functions
should be implemented in it.
These patches are v2 of doing it.

Link: https://lore.kernel.org/r/871rofunaq.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (17):
  ASoC: soc-dai: add soc_dai_err()
  ASoC: soc-dai: don't overwide dai->driver->ops
  ASoC: soc-dai: add snd_soc_pcm_dai_new()
  ASoC: soc-dai: add snd_soc_pcm_dai_prepare()
  ASoC: soc-dai: add snd_soc_pcm_dai_trigger()
  ASoC: soc-dai: add snd_soc_pcm_dai_bespoke_trigger()
  ASoC: soc-dai: add snd_soc_pcm_dai_probe()
  ASoC: soc-dai: add snd_soc_pcm_dai_remove()
  ASoC: soc-dai: add snd_soc_dai_compr_start()
  ASoC: soc-dai: add snd_soc_dai_compr_shutdown()
  ASoC: soc-dai: add snd_soc_dai_compr_trigger()
  ASoC: soc-dai: add snd_soc_dai_compr_set_params()
  ASoC: soc-dai: add snd_soc_dai_compr_get_params()
  ASoC: soc-dai: add snd_soc_dai_compr_ack()
  ASoC: soc-dai: add snd_soc_dai_compr_pointer()
  ASoC: soc-dai: add snd_soc_dai_compr_set_metadata()
  ASoC: soc-dai: add snd_soc_dai_compr_get_metadata()

 include/sound/soc-dai.h  |  41 +++-
 sound/soc/soc-compress.c | 104 ++++-----
 sound/soc/soc-core.c     |  85 +-------
 sound/soc/soc-dai.c      | 453 +++++++++++++++++++++++++++++----------
 sound/soc/soc-pcm.c      |  50 +----
 5 files changed, 434 insertions(+), 299 deletions(-)

--
2.17.1
2020-04-29 17:21:35 +01:00
Arnd Bergmann
be16a0f0dc
ASoC: component: suppress uninitialized-variable warning
Old versions of gcc (tested on gcc-4.8) produce a warning for
correct code:

sound/soc/soc-compress.c: In function 'soc_compr_open':
sound/soc/soc-compress.c:75:28: error: 'component' is used uninitialized in this function [-Werror=uninitialized]
  struct snd_soc_component *component, *save = NULL;

Change the for_each_rtd_components() macro to ensure 'component'
gets initialized to a value the compiler does not complain about.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200428214754.3925368-1-arnd@arndb.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 14:23:16 +01:00
Kuninori Morimoto
94d7281993
ASoC: soc-dai: add snd_soc_dai_compr_get_metadata()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_get_metadata().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87eesdssi8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:50 +01:00
Kuninori Morimoto
88b3a7dfe9
ASoC: soc-dai: add snd_soc_dai_compr_set_metadata()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_set_metadata().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87ftctssid.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:49 +01:00
Kuninori Morimoto
ed38cc5909
ASoC: soc-dai: add snd_soc_dai_compr_pointer()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_pointer().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87h7x9ssii.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:48 +01:00
Kuninori Morimoto
53294353a0
ASoC: soc-dai: add snd_soc_dai_compr_ack()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_ack().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87imhpssim.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:47 +01:00
Kuninori Morimoto
adbef54326
ASoC: soc-dai: add snd_soc_dai_compr_get_params()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_get_params().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87k125ssir.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:46 +01:00
Kuninori Morimoto
8dfedafb5c
ASoC: soc-dai: add snd_soc_dai_compr_set_params()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_set_params().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87lfmlssiv.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:45 +01:00
Kuninori Morimoto
eb08411bdf
ASoC: soc-dai: add snd_soc_dai_compr_trigger()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_trigger().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87mu71ssiz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:44 +01:00
Kuninori Morimoto
2b25f81d43
ASoC: soc-dai: add snd_soc_dai_compr_shutdown()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_shutdown().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87o8rhssj3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:43 +01:00
Kuninori Morimoto
b5ae4ccea5
ASoC: soc-dai: add snd_soc_dai_compr_start()
dai related function should be implemented at soc-dai.c.
This patch adds snd_soc_dai_compr_start().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87pnbxssj7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:42 +01:00
Kuninori Morimoto
7eaa313bde
ASoC: soc-dai: add snd_soc_pcm_dai_remove()
We have 2 type of component functions
snd_soc_dai_xxx()     is focusing to dai itself,
snd_soc_pcm_dai_xxx() is focusing to rtd related dai.

Now we can update snd_soc_dai_remove() to
snd_soc_pcm_dai_remove(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87r1wdssjc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:41 +01:00
Kuninori Morimoto
51801aeafd
ASoC: soc-dai: add snd_soc_pcm_dai_probe()
We have 2 type of component functions
snd_soc_dai_xxx()     is focusing to dai itself,
snd_soc_pcm_dai_xxx() is focusing to rtd related dai.

Now we can update snd_soc_dai_probe() to
snd_soc_pcm_dai_probe(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87sggtssjg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:40 +01:00
Kuninori Morimoto
30819358ae
ASoC: soc-dai: add snd_soc_pcm_dai_bespoke_trigger()
We have 2 type of component functions
snd_soc_dai_xxx()     is focusing to dai itself,
snd_soc_pcm_dai_xxx() is focusing to rtd related dai.

Now we can update soc_pcm_bespoke_trigger() to
snd_soc_pcm_dai_bespoke_trigger(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87tv19ssjm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:39 +01:00
Kuninori Morimoto
42f2472d46
ASoC: soc-dai: add snd_soc_pcm_dai_trigger()
We have 2 type of component functions
snd_soc_dai_xxx()     is focusing to dai itself,
snd_soc_pcm_dai_xxx() is focusing to rtd related dai.

Now we can update snd_soc_dai_trigger() to
snd_soc_pcm_dai_trigger(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87v9lpssjr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:38 +01:00
Kuninori Morimoto
d108c7fd0b
ASoC: soc-dai: add snd_soc_pcm_dai_prepare()
We have 2 type of component functions
snd_soc_dai_xxx()     is focusing to dai itself,
snd_soc_pcm_dai_xxx() is focusing to rtd related dai.

Now we can update snd_soc_dai_prepare() to
snd_soc_pcm_dai_prepare(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87wo65ssk2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:37 +01:00
Kuninori Morimoto
0b73ba550c
ASoC: soc-dai: add snd_soc_pcm_dai_new()
We have 2 type of component functions
snd_soc_dai_xxx()     is focusing to dai itself,
snd_soc_pcm_dai_xxx() is focusing to rtd related dai.

Now we can update soc_dai_pcm_new() to
snd_soc_pcm_dai_new(). This patch do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87y2qlssk7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-29 13:27:36 +01:00
Jason Yan
4aa86e05be
ASoC: soc-core: return true, false in snd_soc_volsw_is_stereo()
Fix the following coccicheck warning:

include/sound/soc.h:1271:9-10: WARNING: return of 0/1 in function
'snd_soc_volsw_is_stereo' with return type bool

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Link: https://lore.kernel.org/r/20200422071805.48793-1-yanaijie@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-22 13:15:56 +01:00
Mark Brown
41d91ec3de ASoC: tegra: Fixes for v5.7-rc3
This contains a couple of fixes that are needed to properly reconfigure
 the audio clocks on older Tegra devices.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCAAxFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl6fYTwTHHRyZWRpbmdA
 bnZpZGlhLmNvbQAKCRDdI6zXfz6zoXKqEACrHTSOY6ul9mCyjdcJnfLVOoU4iV76
 OTC8u+3mGhwglU7SnSyJAFXHGVGkJL6VUptkpO6rA0qURisFh3L5ZoozioR1SHYW
 yGvjGVW8tjvgBv9hXunWGfz0soTr+gB8V+WB5Wlw47Oifmu0oeB0BG0Nb68hfJL3
 u2cUc+2FUZTnP9cangD0gaPF9zybjpxGZH74KCN7AVs/nWBZqnGA+Rw0EE5kEAeP
 a4fd1KHQpmfFoOIv2HKqjQTpa3F+7R6AUpuvm0D+ipFNxV2b4Ka4lbKgbMbMiuUb
 l3sFo017gV5DF1aUl/0Zz7YGDf8mOZnABuGuItLwo5/PQFO7mftFodBQuxjofkX1
 DdRyzt3HNT0RCzu8CC2ZLi6e5ukSLJK9khR7kCcAL8eNHScvRGz5RO+h3s/1gmk9
 +grVPIwDIZLqmm7a6Cgld8GBPfWmPYlDUcoUR751Wn2bxnwwk2lcWrA50txkznbl
 yWokE9OHQ4EHtKJarpbN7mvW2SgGnyLkOESWLCk8J8bqSF0mKfIcK2SAUdWR1JHI
 J3hp8oBgVgZHtoh5ZroENk/KVTiZK56+ECcMdfO7/m+jBV66bsxi1Cs7aKSSF9rI
 3IZYg9BC3Y8uk8Z6u695R86HcVIN7eSANmTkWHldphfQDN3Vn9LFGkXTD1zdZliR
 irt3V2BdadMIJg==
 =XTzg
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl6f95oTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0GkGB/0X/amUL/B6lXjZky3rjkLP9uewLZls
 Q0NsGdhkpX/2ixnaWMJO3eRj1RFT59JEKmU91nBmwh93i+CJ6UzDrGOU7LURu6e/
 tRG4KWiqDaHNsKTHUE8wBSfEAeny9FlxQcWmtngb1hQCfcprqheMLQRGB8pXNz3C
 Cg28+FcEjXENFeNRxxVe5+Ld8odO7YhSnNj4NjwrVrpVuAfjtU9RumqOA0gZRj+i
 vhg8C83mlmBZO1RmKmtHOaCqGVoNUz2wW6+lxyC6DO+v4SxgGP0pcrbrBG1m61Bg
 gFmXV9SlWgQUf7khOp1EDW4TQ023zz0evXAxVlKtQeBwRn+aOYDenYy7
 =Aeww
 -----END PGP SIGNATURE-----

Merge tag 'tegra-for-5.7-asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into asoc-5.7

ASoC: tegra: Fixes for v5.7-rc3

This contains a couple of fixes that are needed to properly reconfigure
the audio clocks on older Tegra devices.
2020-04-22 08:51:44 +01:00
Takashi Iwai
e7b6b3ec01 ASoC: Fixes for v5.7
Quite a lot of fixes here, a lot of driver specific ones but the biggest
 one is the revert of changes to the startup and shutdown sequence for
 DAIs that went in during the merge window - they broke some older x86
 platforms and attempts to fix them didn't succeed so it's safer to just
 roll them back and try to make sure those platforms are handled properly
 in any future attempt.
 
 The rockchip S/PDIF DT stuff was IIRC for validation issues.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl6fSlITHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0ODsB/4whz1ppFUJ4+XLaLoOTCJjKPnQEg6N
 lZRhPS1/gQVL/qUpwOIS3vr3Z+8Zsm9F3VXOEGmMFfPR1f4+Fejz1OJkg0mUuhzr
 Xx+LHOGyaabj9zvoNxZDS1eE00t8dLrkoRx6vce3dRZluZ5DATN6L/4EB3RIhuny
 4ckuQAf6KEGLYpqzAVAJyUp8Q6pBl15vHyH+KMXHZJ4qxQjZaBPA7tPabdzRqStM
 Lq+xKkBkJepDet3vQZvvmwNPhS0pU1aqqcopVxj03zivpMwQRftcSYTpdT2SpIF1
 GM1FGiRV1lbNUsQNnhkImE9V6X+I3zmQR4dLUbGTT+Le/0e8CtKRXYCQ
 =D8Su
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v5.7

Quite a lot of fixes here, a lot of driver specific ones but the biggest
one is the revert of changes to the startup and shutdown sequence for
DAIs that went in during the merge window - they broke some older x86
platforms and attempts to fix them didn't succeed so it's safer to just
roll them back and try to make sure those platforms are handled properly
in any future attempt.

The rockchip S/PDIF DT stuff was IIRC for validation issues.
2020-04-21 21:41:36 +02:00
Kuninori Morimoto
e7cbe52839
ASoC: soc-compress: remove snd_compr_ops
snd_compr_ops couldn't care called component,
but now we can care it via snd_compress_ops.
All drivers switched to it.
This patch removes snd_compr_ops.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87lfmqvdig.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-21 19:02:00 +01:00
Kuninori Morimoto
c6cb522c14
ASoC: soc-compress: add snd_compress_ops
Current snd_soc_component_driver has compr_ops, and each driver can
have callback via it. But, it is mainly created for ALSA, thus, it
doesn't have "component" as parameter.
Thus, each callback can't know it is called for which component.
Each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name.

	--- ALSA SoC  ---
	...
	if (component->driver->compr_ops &&
	    component->driver->compr_ops->open)
=>		return component->driver->compr_ops->open(stream);
	...

	--- driver ---
	static int xxx_open(struct snd_compr_stream *stream)
	{
		struct snd_soc_pcm_runtime *rtd = stream->private_data;
=>		struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
		...
	}

It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple same driver
name component.

To solve this issue, each callback need to be called with component.
We already have many component driver callbacks.
This patch adds new snd_compress_ops, and call it with "component".

	--- ALSA SoC  ---
	...
	if (component->driver->compress_ops->open)
=>		return component->driver->compress_ops->open(
			component, substream);
			~~~~~~~~~
	...

	--- driver ---
	static int xxx_open(struct snd_soc_component *component,
			    struct snd_compr_stream *stream)
	{
=>		/* it don't need to use snd_soc_rtdcom_lookup() */
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87v9luvdmh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-21 19:01:54 +01:00
Mark Brown
217a5879e1
Merge series "ASoC: SOF: topology and firmware IPC updates for 5.8" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
Long series made of a relatively small changes from multiple SOF
contributors. I didn't find a good way to split this series since it
tracks SOF minor ABI changes (backwards-compatible with older firmware
files) and needs to be kept in-order. Future series should be much
shorter.

The main addition is support for an extended firmware manifest, which
helps retrieve capabilities directly from the firmware file instead of
the current IPC mechanism (still supported but will be deprecated).

The IPC is realigned with the firmware, along with type cleanups, and
the DMIC interface is simplified.

The topology changes are mainly about a multi-cpu DAI fix, a new DC
blocking component, better parsing of tuples and new parameters for
ALH (SoundWire) and HDaudio DAIs. New tokens are also added to clarify
the firmware behavior in the case of dependent pipelines, e.g. for
echo reference generation.

Artur Kloniecki (1):
  ASoC: SOF: Add XRUN flags field to struct sof_ipc_buffer.

Bard Liao (5):
  ASoC: SOF: topology: fix: handle DAI widget connections properly with
    multiple CPU DAI's
  ASoC: SOF: align sof_ipc_dai_alh_params with FW
  ASoC: SOF: topology: Get ALH rate amd channels from topology
  ASoC: SOF: topology: fix: parse hda_tokens to &config->hda
  ASoC: SOF: topology: Get HDA rate and channels from topology

Jaska Uimonen (2):
  ASoC: SOF: topology: stop parsing when all tokens have been found
  ASoC: SOF: topology: handle multiple sets of tuple arrays

Karol Trzcinski (6):
  ASoC: SOF: Mark get_ext* function ext_hdr arguments as const
  ASoC: SOF: Introduce offset in firmware data
  ASoC: SOF: Introduce extended manifest
  ASoC: SOF: ext_manifest: parse firmware version
  ASoC: SOF: ext_manifest: parse windows
  ASoC: SOF: ext_manifest: parse compiler version

Pan Xiuli (6):
  ASoC: SOF: add probe support extend data
  ASoC: SOF: add debug ABI version
  ASoC: SOF: change type char to uint8_t in info.h
  ASoC: SOF: change type char to uint8_t in trace.h
  ASoC: SOF: change type char to uint8_t in topology.h
  ASoC: SOF: make sof_ipc_cc_version to fixed length

Sebastiano Carlucci (1):
  ASoC: SOF: topology: Add support for DC Blocker

Seppo Ingalsuo (3):
  ASoC: SOF: Intel: Fix typo in header file comment text
  ASoC: SOF: Intel: Change DMIC load IPC to fixed length
  ASoC: SOF: Intel: Rename deprecated DMIC IPC struct field

 include/sound/sof.h                   |   3 +
 include/sound/sof/dai-intel.h         |  20 +-
 include/sound/sof/info.h              |  26 ++-
 include/sound/sof/topology.h          |  16 +-
 include/sound/sof/trace.h             |   2 +-
 include/uapi/sound/sof/abi.h          |   2 +-
 include/uapi/sound/sof/ext_manifest.h |  91 ++++++++
 include/uapi/sound/sof/tokens.h       |   8 +
 sound/soc/sof/intel/hda-loader.c      |   9 +-
 sound/soc/sof/loader.c                | 226 ++++++++++++++++--
 sound/soc/sof/topology.c              | 323 ++++++++++++++++----------
 11 files changed, 568 insertions(+), 158 deletions(-)
 create mode 100644 include/uapi/sound/sof/ext_manifest.h

base-commit: 83b35f4586
--
2.20.1
2020-04-16 00:23:22 +01:00
Mark Brown
72161e0eea
Merge series "Add support for SOF on i.MX8M" from Daniel Baluta <daniel.baluta@oss.nxp.com>
Daniel Baluta <daniel.baluta@nxp.com>:

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

This patch series adds support for SOF on i.MX8M family. First board
from this family that has a DSP is i.MX8MP.

First 2 patches are trying to fix some compilation issues, the next two
are adding the imx8m support and the last one adds the devicetree
binding.

Changes since v2:
 - add reviewed by from Rob to DT patch
 - fix ownership for patch 2

Daniel Baluta (3):
  ASoC: SOF: imx: Add i.MX8M HW support
  ASoC: SOF: Add i.MX8MP device descriptor
  dt-bindings: dsp: fsl: Add fsl,imx8mp-dsp entry

Pierre-Louis Bossart (1):
  ASoC: SOF: imx: fix undefined reference issue

YueHaibing (1):
  ASoC: SOF: imx8: Fix randbuild error

 .../devicetree/bindings/dsp/fsl,dsp.yaml      |   2 +
 sound/soc/sof/imx/Kconfig                     |  32 +-
 sound/soc/sof/imx/Makefile                    |   2 +
 sound/soc/sof/imx/imx8m.c                     | 279 ++++++++++++++++++
 sound/soc/sof/sof-of-dev.c                    |  14 +
 5 files changed, 325 insertions(+), 4 deletions(-)
 create mode 100644 sound/soc/sof/imx/imx8m.c

--
2.17.1
2020-04-16 00:23:20 +01:00
Bard Liao
18aaab64fb
ASoC: SOF: topology: Get HDA rate and channels from topology
FW interface for HDA DAI parameters was extended with information on
sampling rate and channel count in version 3.16. Align kernel header
with the FW change. This change is backwards compatible. Old firmware
will ignore the values.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:17 +01:00
Bard Liao
1f846505b3
ASoC: SOF: align sof_ipc_dai_alh_params with FW
Aligned with FW change. The rate and channel values are needed in
case of a connection with a demux for synchronize playback over
multiple ALH DAIs.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Sławomir Błauciak <slawomir.blauciak@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:14 +01:00
Seppo Ingalsuo
1993ba26cc
ASoC: SOF: Intel: Rename deprecated DMIC IPC struct field
This patch restores the field name to fifo_bits_b since the
legacy firmware compatibility code (for firmware ABI 3.0.0 or earlier)
sets it in sof_link_dmic_load() function in topology.c. Setting of
reserved_2 didn't look appropriate.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:13 +01:00
Seppo Ingalsuo
31be5337ac
ASoC: SOF: Intel: Change DMIC load IPC to fixed length
This patch changes the flexible array member pdm[] into a fixed
array of four that is the max. number of stereo PDM controllers
in the current Intel platforms. The change simplifies DMIC DAI
load code and aligns the IPC with other DAI types.

The change is compatible with old and new firmware with similar
change. The ABI minor version is increased due to change in
IPC headers.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:13 +01:00
Seppo Ingalsuo
79a4ff94a3
ASoC: SOF: Intel: Fix typo in header file comment text
This patch fixes the typo in word "microphone".

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:12 +01:00
Artur Kloniecki
7893df67e9
ASoC: SOF: Add XRUN flags field to struct sof_ipc_buffer.
Currently if a component source buffer underruns or a component sink
buffer overruns the pipeline will enter an XRUN status and attempt
recovery. This is desired in most pipelines but some topologies need to
support use cases where we expect buffers to underrun or overrun.

Host ---> Proc----> Selector0 --> Buf0 ---- > DAI Playback
                      |
                      v
                     Buf1
                      |
                      v
Host <---------------Selector1 <----- Buf2 <----- Echo Ref DAI

In the example above we two host PCMs that can be independently
started/stopped thereby causing buf1 to either underrun or overrun
(and stop the pipelines). Buf1 should be permitted to underrun or overrun
without invoking pipeline XRUN logic and should over write oldest data
(for overrun) and readback 0s (for underrun).

2 flags have been added for use during buffer instantiation:
SOF_BUF_OVERRUN_PERMITTED and SOF_BUF_UNDERRUN_PERMITTED,
along with struct sof_ipc_buffer member fields: flags and reserved.
Flags field is supposed to hold the above-mentioned flags to allow
some control over XRUN behaviour.
Also added reserved field to the structure in case it comes in handy
some time in the future.

This is an incremental ABI change as the new fields are ignored by older
versions of the firmware.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:11 +01:00
Pan Xiuli
a9a9cbf081
ASoC: SOF: make sof_ipc_cc_version to fixed length
Align struct sof_ipc_cc_version to firmware definition in SOF ABI 3.15.0.

The struct definition was changed due to errors in FW build.
The Cadence XCC compiler produces incorrect linkage section sizes, when a
variable length array is used in the compiler version struct. The firmware
definition was changed to a fixed 32 byte compiler description string.
This length covers all released firmware binaries and thus only a minor
ABI change is needed.

As the same structure is used in IPC messages between driver and firmware,
the kernel needs to be aligned to firmware change.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:10 +01:00
Pan Xiuli
60829341aa
ASoC: SOF: change type char to uint8_t in topology.h
Use uint8_t to replace char in packed ABI structs
to have fixed length for struct.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:09 +01:00
Pan Xiuli
f480f804f2
ASoC: SOF: change type char to uint8_t in trace.h
Use uint8_t to replace char in packed ABI structs
to have fixed length for struct.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:08 +01:00
Pan Xiuli
e622448445
ASoC: SOF: change type char to uint8_t in info.h
Use uint8_t to replace char in packed ABI structs
to have fixed length for struct.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:07 +01:00
Pan Xiuli
2014185eba
ASoC: SOF: add debug ABI version
Add new debug ABI version to be increased when changing user space debug
interfaces while the the main FW ABI is not affected.

The abi_dbg_version share same definition with SOF_ABI_VER

This change main ABI to 3.14.0

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:06 +01:00
Pan Xiuli
786d651687
ASoC: SOF: add probe support extend data
Share how many injection probe DMAs and how many probe points
driver can request from FW.
injection_dmas_max 0 means injection is not supported
probe_points_max 0 means whole probes subsystem in FW is not enabled
and not compiled in.

ABI version change to 3.14.0

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:05 +01:00
Sebastiano Carlucci
542adb2a46
ASoC: SOF: topology: Add support for DC Blocker
This commit adds the enumerations to support the dc blocker component
from SOF.

Signed-off-by: Sebastiano Carlucci <scarlucci@google.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Curtis Malainey <curtis@malainey.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:05 +01:00
Karol Trzcinski
92be17a559
ASoC: SOF: Introduce offset in firmware data
It makes possible to provide extra information to host
before downloading firmware. Extra data should be put
at the beginning of firmware binary.
Exchange is done without any effort on DSP side.
This mechanism will be used in extended manifest.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-16 00:23:00 +01:00
Pierre-Louis Bossart
5bd70440cb
ASoC: soc-dai: revert all changes to DAI startup/shutdown sequence
On Baytrail/Cherrytrail, the Atom/SST driver fails miserably:

[    9.741953] intel_sst_acpi 80860F28:00: FW Version 01.0c.00.01
[    9.832992] intel_sst_acpi 80860F28:00: FW sent error response 0x40034
[    9.833019] intel_sst_acpi 80860F28:00: FW alloc failed ret -4
[    9.833028] intel_sst_acpi 80860F28:00: sst_get_stream returned err -5
[    9.833033] sst-mfld-platform sst-mfld-platform: ASoC: DAI prepare error: -5
[    9.833037]  Baytrail Audio Port: ASoC: prepare FE Baytrail Audio Port failed
[    9.853942] intel_sst_acpi 80860F28:00: FW sent error response 0x40034
[    9.853974] intel_sst_acpi 80860F28:00: FW alloc failed ret -4
[    9.853984] intel_sst_acpi 80860F28:00: sst_get_stream returned err -5
[    9.853990] sst-mfld-platform sst-mfld-platform: ASoC: DAI prepare error: -5
[    9.853994]  Baytrail Audio Port: ASoC: prepare FE Baytrail Audio Port failed

Commit b56be800f1 ("ASoC: soc-pcm: call
snd_soc_dai_startup()/shutdown() once") was the initial problematic
commit.

Commit 1ba616bd1a ("ASoC: soc-dai: fix DAI startup/shutdown sequence")
was an attempt to fix things but it does not work on Baytrail,
reverting all changes seems necessary for now.

Fixes: 1ba616bd1a ("ASoC: soc-dai: fix DAI startup/shutdown sequence")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200415030437.23803-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-15 23:06:01 +01:00
Mark Brown
39400f34a2
Merge branch 'asoc-5.7' into asoc-5.8 2020-04-14 18:04:08 +01:00
Kuninori Morimoto
1729025b04
ASoC: soc-core: remove cpu_dai/codec_dai/cpu_dais/codec_dais
No-one is using cpu_dai/codec_dai/cpu_dais/codec_dais.
Let's remove these from snd_soc_pcm_runtime

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87eetabok4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-14 14:00:46 +01:00
Kuninori Morimoto
c2233a2661
ASoC: soc: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87imimboli.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-14 14:00:44 +01:00
Charles Keepax
595571cca4
ASoC: dapm: Fix regression introducing multiple copies of DAI widgets
Refactoring was done to factor out the linking of DAI widgets into
a helper function, dapm_add_valid_dai_widget. However when this was
done, a regression was introduced for CODEC to CODEC links. It was
over looked that the playback and capture variables persisted across
all CODEC DAIs being processed, which ensured that the special DAI
widget that is added for CODEC to CODEC links was only created once.
This bug causes kernel panics during DAPM shutdown.

To stick with the spirit of the original refactoring whilst fixing the
issue, variables to hold the DAI widgets are added to snd_soc_dai_link.
Furthermore the dapm_add_valid_dai_widget function is renamed to
dapm_connect_dai_pair, the function only adds DAI widgets in the CODEC
to CODEC case and its primary job is to add routes connecting two DAI
widgets, making the original name quite misleading.

Fixes: 6c4b13b51a ("ASoC: Add dapm_add_valid_dai_widget helper")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200409181209.30130-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-14 12:16:23 +01:00
Takashi Iwai
c4c8dd6ef8 ALSA: hda: Skip controller resume if not needed
The HD-audio controller does system-suspend and resume operations by
directly calling its helpers __azx_runtime_suspend() and
__azx_runtime_resume().  However, in general, we don't have to resume
always the device fully at the system resume; typically, if a device
has been runtime-suspended, we can leave it to runtime resume.

Usually for achieving this, the driver would call
pm_runtime_force_suspend() and pm_runtime_force_resume() pairs in the
system suspend and resume ops.  Unfortunately, this doesn't work for
the resume path in our case.  For handling the jack detection at the
system resume, a child codec device may need the (literally) forcibly
resume even if it's been runtime-suspended, and for that, the
controller device must be also resumed even if it's been suspended.

This patch is an attempt to improve the situation.  It replaces the
direct __azx_runtime_suspend()/_resume() calls with with
pm_runtime_force_suspend() and pm_runtime_force_resume() with a slight
trick as we've done for the codec side.  More exactly:

- azx_has_pm_runtime() check is dropped from azx_runtime_suspend() and
  azx_runtime_resume(), so that it can be properly executed from the
  system-suspend/resume path

- The WAKEEN handling depends on the card's power state now; it's set
  and cleared only for the runtime-suspend

- azx_resume() checks whether any codec may need the forcible resume
  beforehand.  If the forcible resume is required, it does temporary
  PM refcount up/down for actually triggering the runtime resume.

- A new helper function, hda_codec_need_resume(), is introduced for
  checking whether the codec needs a forcible runtime-resume, and the
  existing code is rewritten with that.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207043
Link: https://lore.kernel.org/r/20200413082034.25166-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-13 18:03:16 +02:00
Takashi Iwai
ddd5609fe8 ASoC: Fixes for v5.7
A collection of fixes that have been accumilated since the merge window,
 mainly relating to x86 platform support.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl6N8tITHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0PEcB/9uSF5cBy7917NwXCJ6NuyVpKlytJPx
 Abqf4bZ3WbhhONBBZ0VWvCqfW9KpiOsSiU3pngmNAGy/9DCirvhX5GUrHaiPHVN8
 PeKqy4eGbB1Pj4qZ00HT12bDx3imPKHGmR+LCOXusnEn4vhW1gkfkLFWksiGM35d
 lrmNCBKl90fRJC81dm3RUpH6gwnR5cosu15XhTKpKBqDQPraDWyjfmMNtQhKDpvB
 /r+qmOYMCz0UM51yfsjEqAz88BYVmR6xjh3+tkaXU6hg6nacnBYy70ycGmDSoUpd
 31WmjCZ6wZ74I0Fltybg6S3zuMYHoJfI19b8Z6rrGE2MiSFZKlohALes
 =NRG8
 -----END PGP SIGNATURE-----

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

ASoC: Fixes for v5.7

A collection of fixes that have been accumilated since the merge window,
mainly relating to x86 platform support.
2020-04-08 18:08:09 +02:00
Pierre-Louis Bossart
1ba616bd1a
ASoC: soc-dai: fix DAI startup/shutdown sequence
The addition of a single flag to track the DAI status prevents the DAI
startup sequence from being called on capture if the DAI is already
used for playback.

Fix by extending the existing code with one flag per direction.

Fixes: b56be800f1 ("ASoC: soc-pcm: call snd_soc_dai_startup()/shutdown() once")
Reported-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20200330160602.10180-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-30 18:22:37 +01:00
Takashi Iwai
3c22baeab4 ASoC: Updates for v5.7
This is a very big update for the core since Morimoto-san has been
 rather busy continuing his refactorings to clean up a lot of the cruft
 that we have accumilated over the years.  We've also gained several new
 drivers, including initial (but still not complete) parts of the Intel
 SoundWire support.
 
  - Lots of refactorings to modernize the code from Morimoto-san.
  - Conversion of SND_SOC_ALL_CODECS to use imply from Geert Uytterhoeven.
  - Continued refactoring and fixing of the Intel support.
  - Soundwire and more advanced clocking support for Realtek RT5682.
  - Support for amlogic GX, Meson 8, Meson 8B and T9015 DAC, Broadcom
    DSL/PON, Ingenic JZ4760 and JZ4770, Realtek RL6231, and TI TAS2563 and
    TLV320ADCX140.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl6B03sTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0Jm5B/4pb6Hz1ifM+ikR4qB7BOdm/UGzxWlD
 Mng+qN3kh6Tx+x8/xnQRmfOnhFoKnDSTnlxcDr6ujAtz3bH+CKXbo2jjfvmagQrW
 j87tYGdh6T38E6mf6543Eth3zJGphZYUY70REXt0HsaQ8bA912nrs5H8LTFiD2i+
 lBJd/MmlCYL3gb/ftN9dpTfYYdxLy9HH9j5tR5zpLN3AD3Hew9jHqqX+ioAk+6lA
 Nisbx5grP10pWFklYXyJlUFQOqMOYMtPMblLRA9bjqcEtL3quIXPXKkPNtTh+0Kf
 5t7Q39RtVXJAk0DcatjMJUGAGQyM9r5g1Nk8WLB1LLv+NfLcO6cUpLAc
 =+z/q
 -----END PGP SIGNATURE-----

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

ASoC: Updates for v5.7

This is a very big update for the core since Morimoto-san has been
rather busy continuing his refactorings to clean up a lot of the cruft
that we have accumilated over the years.  We've also gained several new
drivers, including initial (but still not complete) parts of the Intel
SoundWire support.

 - Lots of refactorings to modernize the code from Morimoto-san.
 - Conversion of SND_SOC_ALL_CODECS to use imply from Geert Uytterhoeven.
 - Continued refactoring and fixing of the Intel support.
 - Soundwire and more advanced clocking support for Realtek RT5682.
 - Support for amlogic GX, Meson 8, Meson 8B and T9015 DAC, Broadcom
   DSL/PON, Ingenic JZ4760 and JZ4770, Realtek RL6231, and TI TAS2563 and
   TLV320ADCX140.
2020-03-30 13:43:00 +02:00