Commit graph

291 commits

Author SHA1 Message Date
Trevor Wu
b05cfb1215
ASoC: mediatek: mt8195: add missing of_node_put in probe
dp node and hdmi node are retrieved from of_parse_phandle(), so using
of_node_put() on them before return.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210928063520.23927-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-28 13:16:25 +01:00
Colin Ian King
ce3f935763
ASoC: mediatek: mt8195: make array adda_dai_list static const
Don't populate the array adda_dai_list on the stack but instead it
static const. Also makes the object code smaller by 33 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  28271	  11640	      0	  39911	   9be7	mt8195/mt8195-dai-adda.o

After:
   text	   data	    bss	    dec	    hex	filename
  28142	  11736	      0	  39878	   9bc6	mt8195/mt8195-dai-adda.o

(gcc version 11.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210915105027.10805-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-15 13:12:27 +01:00
Bixuan Cui
b2fc2c92d2
ASoC: mediatek: mt8195: Add missing of_node_put()
The platform_node is returned by of_parse_phandle() should have
of_node_put() before return.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Link: https://lore.kernel.org/r/20210911081246.33867-1-cuibixuan@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-15 13:12:26 +01:00
Trevor Wu
2b9b42c847
ASoC: mt8195: remove unnecessary CONFIG_PM
The unnecessary conditional inclusion caused the following warning.

>> sound/soc/mediatek/mt8195/mt8195-afe-pcm.c:3260:32: warning: unused
>> variable 'mt8195_afe_pm_ops' [-Wunused-const-variable]
   static const struct dev_pm_ops mt8195_afe_pm_ops = {
                                  ^
   1 warning generated.

Because runtime_pm already handles the case without CONFIG_PM, we
can remove CONFIG_PM condition.

Fixes: 6746cc8582 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210902071440.6087-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:16 +01:00
Colin Ian King
d67bbdda25
ASoC: mediatek: mt8195: Fix unused initialization of pointer etdm_data
The pointer etdm_data is being inintialized with a value that is never
read, it is later being re-assigned a new value. Remove the redundant
initialization.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210903114928.11743-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:08 +01:00
Cai Huoqing
c6b1b57469
ASoC: mediatek: mt8195: Make use of the helper function devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210901132742.31714-1-caihuoqing@baidu.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:05 +01:00
Sebastian Andrzej Siewior
c3815f8bc7
ASoC: mediatek: mt8195: Remove unsued irqs_lock.
irqs_lock is not used, never was.

Remove irqs_lock.

Fixes: 283b612429 ("ASoC: mediatek: implement mediatek common structure")
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20210910094847.3430413-1-bigeasy@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:02 +01:00
Trevor Wu
1dd0385226
ASoC: mediatek: common: handle NULL case in suspend/resume function
When memory allocation for afe->reg_back_up fails, reg_back_up can't
be used.
Keep the suspend/resume flow but skip register backup when
afe->reg_back_up is NULL, in case illegal memory access happens.

Fixes: 283b612429 ("ASoC: mediatek: implement mediatek common structure")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210910092613.30188-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-10 15:08:26 +01:00
Trevor Wu
5a80dea931
ASoC: mediatek: add required config dependency
Because SND_SOC_MT8195 depends on COMPILE_TEST, it's possible to build
MT8195 driver in many different config combinations.
Add all dependent config for SND_SOC_MT8195 in case some errors happen
when COMPILE_TEST is enabled.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20210909065533.2114-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-09 14:16:25 +01:00
Trevor Wu
7eac1e24fb
ASoC: mt8195: correct the dts parsing logic about DPTX and HDMITX
According to the description in dt-bindings, phandle assignment of
HDMI TX and DP TX are not required properties, but driver regards them
as required properties.
In real use case, it's expected that DP TX and HDMI TX are optional
features, so correct the behavior in driver.

Fixes: 40d605df0a ("ASoC: mediatek: mt8195: add machine driver with mt6359, rt1019 and rt5682")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210903060049.20764-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-03 13:31:46 +01:00
Mark Brown
0f2ef911de ASoC: Updates for v5.15
Quite a quiet release this time, mostly a combination of cleanups
 and a good set of new drivers.
 
  - Lots of cleanups and improvements to the Intel drivers,
    including some new systems support.
  - New support for AMD Vangoh, CUI CMM-4030D-261, Mediatek
    Mt8195, Renesas RZ/G2L Mediatek Mt8195, RealTek RT101P,
    Renesas RZ/G2L,, Rockchip RK3568 S/PDIF.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmEsxhYTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0Py1B/0dVvB5iLx7t7Vp3EbxIbAQ/4URpmfV
 A/yIWY6fii6vhVsdsqU+8FN7D5m5ZpVUx+3kH//oCsPL7VLem3sjh64lge1lQz4A
 9G9FU63nSCY8X0dL4cfZTNEd+FYrCHZDqU8y7oJg+v3U7D42MVLhTwySaCuP6W56
 KZhxOUIuyfIrhmkfBEAUCA6jyPSbVAy7Aw9B5WhJhX07yw0vToxnycbTnjwMzMYn
 3Bvfycyg9pqpxAdCuJVPVs3S8+CM5/+QjKb0J6vy1Zuw49jNSUdkvuyRWXZsAoAF
 zepXWEKXvclKNZDR0N1AO4H+9fUeSvkc/IX7XEHZ0Zk8w2eMico0ceAz
 =BHW1
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmEvqq8ACgkQJNaLcl1U
 h9DCWgf+MNGZqiPqneyDMVnZ/ZrjZGy+6o0Zs7NDeD0hDF4t5MAu0meRpyHgfW4N
 vw/AP26M6OQPg/FQpqHySCuVrsEWFABP3jVUl6QBMIsyGS7FKdU7I20awGzn1+fE
 TK2forDsQvxTFA/X9y4JqZIBNCU2FT1WEwamgvFIUh0qR1ZJfHLogN1E8ch7Y17u
 EhDgEiwiD3jWtW5E/6KStwpyEo2zEomN0vN6iLp/DjZRQy/B02F3RtKdH4HIom6n
 kFs6yOyqBAxzi6uUYC4TfIEywWUrxSUtekeo2Sn7ViSbA0QiN44QdXbN43GFUUHq
 c3rzV1+z80mcyYtCAhpjgtbU9nJpUg==
 =Zo3t
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v5.15' into asoc-5.15

ASoC: Updates for v5.15

Quite a quiet release this time, mostly a combination of cleanups
and a good set of new drivers.

 - Lots of cleanups and improvements to the Intel drivers,
   including some new systems support.
 - New support for AMD Vangoh, CUI CMM-4030D-261, Mediatek
   Mt8195, Renesas RZ/G2L Mediatek Mt8195, RealTek RT101P,
   Renesas RZ/G2L,, Rockchip RK3568 S/PDIF.
2021-09-01 17:30:37 +01:00
Geert Uytterhoeven
940ffa1945
ASoC: mediatek: SND_SOC_MT8195 should depend on ARCH_MEDIATEK
The Mediatek MT8195 sound hardware is only present on Mediatek MT8195
SoCs.  Hence add a dependency on ARCH_MEDIATEK, to prevent asking the
user about this driver when configuring a kernel without Mediatek SoC
support.

Fixes: 6746cc8582 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/7e628e359bde04ceb9ddd74a45931059b4a4623c.1630415860.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-01 16:46:49 +01:00
Trevor Wu
cd5e4efde2
ASoC: mediatek: mt8195: add MTK_PMIC_WRAP dependency
randconfig builds show the warning below,

WARNING: unmet direct dependencies detected for SND_SOC_MT6359
   Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && MTK_PMIC_WRAP [=n]
   Selected by [y]:
   - SND_SOC_MT8195_MT6359_RT1019_RT5682 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8195 [=y]

Add a dependency to avoid it.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Link: https://lore.kernel.org/r/20210831021303.5230-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-01 16:26:34 +01:00
Mark Brown
38b7673000
Merge remote-tracking branch 'asoc/for-5.15' into asoc-linus 2021-08-30 12:30:33 +01:00
Colin Ian King
11a08e0507
ASoC: mediatek: mt8195: Fix spelling mistake "bitwiedh" -> "bitwidth"
There is a spelling mistake in a dev_dbg message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210826112611.10356-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-26 13:42:42 +01:00
Trevor Wu
ef46cd42ec
ASoC: mediatek: mt8195: add HDMITX audio support
This patch adds HDMITX audio support on mt8195-mt6359-rt1019-rt5682 board.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-11-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:14:00 +01:00
Trevor Wu
e581e3014c
ASoC: mediatek: mt8195: add DPTX audio support
This patch adds DPTX audio support on mt8195-mt6359-rt1019-rt5682 board.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-10-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:59 +01:00
Trevor Wu
40d605df0a
ASoC: mediatek: mt8195: add machine driver with mt6359, rt1019 and rt5682
This patch adds support for mt8195 board with mt6359, rt1019 and rt5682.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210819084144.18483-9-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:58 +01:00
Trevor Wu
6746cc8582
ASoC: mediatek: mt8195: add platform driver
This patch adds mt8195 platform and affiliated driver.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210819084144.18483-7-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:56 +01:00
Trevor Wu
1f95c01911
ASoC: mediatek: mt8195: support pcm in platform driver
This patch adds mt8195 pcm dai driver.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-6-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:55 +01:00
Trevor Wu
3de3eba588
ASoC: mediatek: mt8195: support adda in platform driver
This patch adds mt8195 adda dai driver.

audio_h clock is used by ADSP bus and ADDA module.
When ADDA requires audio_h clock, it is switched to APLL1, otherwise
it is switched to Xtal_26m so that APLL1 can be turned off when audio
feature is not used.
ADSP bus only requires that the clock is on, so dynamic reparenting
is used for the purpose of lowering power consumption.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-5-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:54 +01:00
Trevor Wu
1de9a54aca
ASoC: mediatek: mt8195: support etdm in platform driver
This patch adds mt8195 tdm/i2s dai driver.

MCLK clock tree is as follows.
PLL -> MUX -> DIVIDER -> MCLK

For PLL source of MCLK, driver only supports APLL1 and APLL2 now.
APLL3 and APLL4 are used to track external clock source, so they are
only used when slave input is connected.

For example,
case 1: (HDMI RX connected)
DL memif (a1sys) -> etdm out2 (clk from apll1/apll2) -> codec
case 2: (HDMI RX disconnected)
HDMI RX -> a3sys -> UL memif (a3sys) -> DL memif (a3sys) -> .... ->
etdm out2 (clk from apll3) -> codec

We keep all modules in the pipeline working on the same clock domain.
MCLK is expected to output the clock generated from the same clock
source as the pipeline, so dynamic reparenting is required for MCLK
configuration.

As a result, clk_set_parent() is used to select PLL source,
and clk_set_rate() is used to configure divider to get MCLK output rate.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:53 +01:00
Trevor Wu
d62ad762f6
ASoC: mediatek: mt8195: support audsys clock control
This patch adds mt8195 audio cg control.
Audio clock gates are registered to CCF for reference count and
clock parent management.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:52 +01:00
Trevor Wu
cab2b9e5fc
ASoC: mediatek: mt8195: update mediatek common driver
Update mediatek common driver to support MT8195

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210819084144.18483-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:51 +01:00
Gustavo A. R. Silva
4796372e7c ASoC: Mediatek: MT8183: Fix fall-through warning for Clang
Fix the following fallthrough warning:

sound/soc/mediatek/mt8183/mt8183-dai-adda.c:342:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]

Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2021-07-13 14:58:18 -05:00
Zhang Qilong
19f479c37f
ASoC: mediatek: mt8183: Fix Unbalanced pm_runtime_enable in mt8183_afe_pcm_dev_probe
Add missing pm_runtime_disable() when probe error out. It could
avoid pm_runtime implementation complains when removing and probing
again the driver.

Fixes:a94aec035a122 ("ASoC: mediatek: mt8183: add platform driver")

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20210618141104.105047-3-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-11 23:47:35 +01:00
Zhang Qilong
2af2f861ed
ASoC: mediatek: mt8192:Fix Unbalanced pm_runtime_enable in mt8192_afe_pcm_dev_probe
Add missing pm_runtime_disable() when probe error out. It could
avoid pm_runtime implementation complains when removing and probing
again the driver.

Fixes:125ab5d588b0b ("ASoC: mediatek: mt8192: add platform driver")

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20210618141104.105047-2-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-11 23:47:34 +01:00
Christophe JAILLET
b6052c3c7a
ASoC: mediatek: mtk-btcvsd: Fix an error handling path in 'mtk_btcvsd_snd_probe()'
If an error occurs after a successful 'of_iomap()' call, it must be undone
by a corresponding 'iounmap()' call, as already done in the remove
function.

While at it, remove the useless initialization of 'ret' at the beginning of
the function.

Fixes: 4bd8597dc3 ("ASoC: mediatek: add btcvsd driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/0c2ba562c3364e61bfbd5b3013a99dfa0d9045d7.1622989685.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-08 13:36:46 +01:00
Zhen Lei
85c966dc97
ASoC: mediatek: mt8192: Delete a redundant condition branch
The statement of the "if (afe_priv->mtkaif_protocol == MTKAIF_PROTOCOL_2)"
branch is the same as the "else" branch. Delete it to simplify code.

No functional change.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210510083640.3368-1-thunder.leizhen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10 13:05:33 +01:00
Mark Brown
ad858508fd ALSA: control - add generic LED API
This patchset tries to resolve the diversity in the audio LED
 control among the ALSA drivers. A new control layer registration
 is introduced which allows to run additional operations on
 top of the elementary ALSA sound controls.
 
 A new control access group (three bits in the access flags)
 was introduced to carry the LED group information for
 the sound controls. The low-level sound drivers can just
 mark those controls using this access group. This information
 is not exported to the user space, but user space can
 manage the LED sound control associations through sysfs
 (last patch) per Mark's request. It makes things fully
 configurable in the kernel and user space (UCM).
 
 The actual state ('route') evaluation is really easy
 (the minimal value check for all channels / controls / cards).
 If there's more complicated logic for a given hardware,
 the card driver may eventually export a new read-only
 sound control for the LED group and do the logic itself.
 
 The new LED trigger control code is completely separated
 and possibly optional (there's no symbol dependency).
 The full code separation allows eventually to move this
 LED trigger control to the user space in future.
 Actually it replaces the already present functionality
 in the kernel space (HDA drivers) and allows a quick adoption
 for the recent hardware (ASoC codecs including SoundWire).
 
 snd_ctl_led            24576  0
 
 The sound driver implementation is really easy:
 
 1) call snd_ctl_led_request() when control LED layer should be
    automatically activated
    / it calls module_request("snd-ctl-led") on demand /
 2) mark all related kcontrols with
         SNDRV_CTL_ELEM_ACCESS_SPK_LED or
         SNDRV_CTL_ELEM_ACCESS_MIC_LED
 
 Link: https://lore.kernel.org/r/20210317172945.842280-1-perex@perex.cz
 Signed-off-by: Takashi Iwai <tiwai@suse.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmBjRuQOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9ZQw/6Ao2X1io4TVnyO/gO8HtwmnZ6TWcrLUlySaep
 H6Suf0RHsOQO9VOaMcUarA3Wnz1vZ44qJ/fkdLTslnIPGSRJDUx15bbb+n2N6pQJ
 gS7Umxy6n73rQyEoDjd3ZorvDGjFSVFpjM+RYjk/Ohq+yziz7nQ/SZuHPPeqm1GU
 C5d9SxyXGdqlJJ6yFCHzbtjSmIey+l1TZ+j3rSSww/CzDKxB2l5J6JZAMUjVdL9b
 J80Mcw0XLdG9iTtEnkUt3TwvLMcMl95UPeQHIkVQlwsRRb3BtHNIwJLPQ/n+Cou7
 Hre3y2miUYHrNICEzMdMlpDzQBqu5wvpXgbgIV0CwAwCXPZBVWE1hVJ9gG0l+r1G
 fy1a75OmEin4V9g8w+wNTWDEgjwAOkWhA67WVjpbvHtd6kEbISzt4JHFksG1rjU2
 vXOIj2VBmQN6zHtxfcZqY8Ge4A7XGo7tAM/3NsUxin+2y7ZXI6sDvv+0esYmqrYr
 9as/tD84L5LTrbUYewaUgEdauQXluQI1egRi7pSeg7hZyLeYYkmszk54Ra3zdlmM
 m7Hr6u+Y/G7yeFdn/WdeG3VzdmxhC2ZFfk3gq0vneBS3WrATbf6nAORp2bwzGSz4
 pUsVLSv+vhpZdSF+IxpUuMnsLkkbUCvFivXLjQ6irSWvp7uts1HWdRowdg7Pe2lC
 FVbFRuA=
 =1uM7
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmBkoFEACgkQJNaLcl1U
 h9BqTgf5AUfR5NbQgJIUMtdMsuz+bthKGuPnpYhYzNUH0io9i3Sjpt0Mbw21dLp2
 nXW+70BH0tJZBGR4DNGpmcpBLH5WPdOR9WIv4vCYy9Pr0uCGGKF/JkGeZAg7/llF
 C3+yDfTnF0AvR+74xbf/LTjBPGja/08PED1ZC00NAkLhE3C0Pa/VQ0NaEtPUULWE
 ZOWboF7hfQUeGzGPTqNp4Cy0/Pzokk6Fvl4kgfrxjNWO7ojIv9mCAvmYbusLW7NU
 3Ph5VGsIuyMeorEoAVOFaBY2nrYG/mFZyzTNWJMgvF1MdeigMPNfbbffrUK0sn6k
 e81zgWbwxboEujQ91/EZU7glIqtb6A==
 =rr4V
 -----END PGP SIGNATURE-----

Merge tag 'mute-led-rework' of https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into asoc-5.13

ALSA: control - add generic LED API

This patchset tries to resolve the diversity in the audio LED
control among the ALSA drivers. A new control layer registration
is introduced which allows to run additional operations on
top of the elementary ALSA sound controls.

A new control access group (three bits in the access flags)
was introduced to carry the LED group information for
the sound controls. The low-level sound drivers can just
mark those controls using this access group. This information
is not exported to the user space, but user space can
manage the LED sound control associations through sysfs
(last patch) per Mark's request. It makes things fully
configurable in the kernel and user space (UCM).

The actual state ('route') evaluation is really easy
(the minimal value check for all channels / controls / cards).
If there's more complicated logic for a given hardware,
the card driver may eventually export a new read-only
sound control for the LED group and do the logic itself.

The new LED trigger control code is completely separated
and possibly optional (there's no symbol dependency).
The full code separation allows eventually to move this
LED trigger control to the user space in future.
Actually it replaces the already present functionality
in the kernel space (HDA drivers) and allows a quick adoption
for the recent hardware (ASoC codecs including SoundWire).

snd_ctl_led            24576  0

The sound driver implementation is really easy:

1) call snd_ctl_led_request() when control LED layer should be
   automatically activated
   / it calls module_request("snd-ctl-led") on demand /
2) mark all related kcontrols with
        SNDRV_CTL_ELEM_ACCESS_SPK_LED or
        SNDRV_CTL_ELEM_ACCESS_MIC_LED

Link: https://lore.kernel.org/r/20210317172945.842280-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-31 17:16:14 +01:00
Pierre-Louis Bossart
14667403a5
ASoC: mediatek: mt8173: rename local irq variable
cppcheck warning:

sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:929:28: style: Local
variable 'irq' shadows outer argument [shadowArgument]
  struct mtk_base_afe_irq *irq;
                           ^
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:914:47: note: Shadowed
declaration
static irqreturn_t mt8173_afe_irq_handler(int irq, void *dev_id)
                                              ^
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:929:28: note: Shadow
variable
  struct mtk_base_afe_irq *irq;
                           ^

Not a great idea to have two 'irq' variables in the same function...

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:54 +00:00
Pierre-Louis Bossart
d9cdc13356
ASoC: mediatek: mt2701: rename shadowed array
cppcheck warning:

sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:406:36: style: Local
variable 'memif_data' shadows outer variable [shadowVariable]
 const struct mtk_base_memif_data *memif_data;
                                   ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:977:41: note: Shadowed
declaration
static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = {
                                        ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:406:36: note: Shadow
variable
 const struct mtk_base_memif_data *memif_data;
                                   ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:431:36: style: Local
variable 'memif_data' shadows outer variable [shadowVariable]
 const struct mtk_base_memif_data *memif_data;
                                   ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:977:41: note: Shadowed
declaration
static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = {
                                        ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:431:36: note: Shadow
variable
 const struct mtk_base_memif_data *memif_data;
                                   ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:53 +00:00
Pierre-Louis Bossart
57f1379e77
ASoC: mediatek: mt2701: align function prototype
cppcheck warnings:

sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:102:30:
style:inconclusive: Function 'mt2701_afe_enable_i2s' argument 2 names
different: declaration 'path' definition
'i2s_path'. [funcArgNamesDifferent]
     struct mt2701_i2s_path *i2s_path,
                             ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.h:21:30: note:
Function 'mt2701_afe_enable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.
     struct mt2701_i2s_path *path,
                             ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:102:30: note:
Function 'mt2701_afe_enable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.

     struct mt2701_i2s_path *i2s_path,
                             ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:128:32:
style:inconclusive: Function 'mt2701_afe_disable_i2s' argument 2 names
different: declaration 'path' definition
'i2s_path'. [funcArgNamesDifferent]
       struct mt2701_i2s_path *i2s_path,
                               ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.h:24:32: note:
Function 'mt2701_afe_disable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.
       struct mt2701_i2s_path *path,
                               ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:128:32: note:
Function 'mt2701_afe_disable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.
       struct mt2701_i2s_path *i2s_path,
                               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:52 +00:00
Pierre-Louis Bossart
2e5e57f085
ASoC: mediatek: mtk-btcvsd: remove useless assignment
cppcheck warning:

sound/soc/mediatek/common/mtk-btcvsd.c:783:34: style: Variable 'avail'
is assigned a value that is never used. [unreadVariable]
 int written_size = count, avail = 0, cur_write_idx, write_size, cont;
                                 ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:51 +00:00
Jiaxin Yu
8d06b9633a
ASoC: mediatek: mt8192: fix tdm out data is valid on rising edge
This patch correct tdm out bck inverse register to AUDIO_TOP_CON3[3].

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1615516005-781-1-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:25:32 +00:00
Tzung-Bi Shih
9dc21a066b
ASoC: mediatek: mt8183: support machine driver with rt1015p
Supports machine driver with rt1015p ("mt8183_mt6358_ts3a227_rt1015p").
Embeds in the existing mt8183-mt6358-ts3a227-max98357.c because they
share most of the code.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210311033151.1818603-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-11 13:25:07 +00:00
Jiaxin Yu
19657a609b
ASoC: mediatek: mt8183-mt6358: set playback and capture constraints
Sets playback and capture constraints to S16_LE, stereo, 48kHz.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1612513012-27688-1-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-05 15:03:04 +00:00
Mark Brown
2927e6d398
Merge branch 'asoc-5.11' into asoc-5.12 2021-02-05 15:01:21 +00:00
Tzung-Bi Shih
4cceb42f4f
ASoC: mediatek: mt8192-mt6359: simplify ops for Capture1 DAI link
1. Uses rtd->dev to get the device.
2. Generalizes the variable name.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210203032201.2882158-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-04 18:45:18 +00:00
Tzung-Bi Shih
0840706d6c
ASoC: mediatek: mt8192: use asoc_substream_to_rtd()
Uses asoc_substream_to_rtd() helper.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210203032201.2882158-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-04 18:45:17 +00:00
Tzung-Bi Shih
8e59cf943f
ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd()
Uses asoc_substream_to_rtd() helper.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210203032201.2882158-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-04 18:45:16 +00:00
Tzung-Bi Shih
339f6c73d5
ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682
MT8192 determines the I2S clock rates according to the sampling rates.

There is only 1 set of I2S in between MT8192 and RT5682.  If playing and
capturing via RT5682 in different sampling rates, the I2S data will be
corrupted.

Adds format constraints to the corresponding DAI links to make sure the
sampling rates are symmetric.

Fixes: 18b13ff23f ("ASoC: mediatek: mt8192: add machine driver with mt6359, rt1015 and rt5682")
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210125061453.1056535-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-25 12:53:44 +00:00
Kuninori Morimoto
4b7ead032e
ASoC: mediatek: sync parameter naming (rate/sample_bits)
This patch syncs naming rule.

 - xxx_rates;
 + xxx_rate;

 - xxx_samplebits;
 + xxx_sample_bits;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ft32olha.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21 12:37:55 +00:00
Tzung-Bi Shih
0d80c48c84
ASoC: mediatek: mt8192-mt6359: support audio over DP
If the DTS property is specified, the DP bridge should populate a
"hdmi-codec" platform device (sound/soc/codecs/hdmi-codec.c).

The "hdmi-codec" device is the communication relayer between the ASoC
machine driver and the DP bridge.  For example:
- Notifies DP bridge when setting hw_param.
- Notifies ASoC when jack detection events.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-6-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:51 +00:00
Tzung-Bi Shih
df369921d7
ASoC: mediatek: mt8192: change mclk_multiple of TDM from 128 to 512
mclk = rate * mclk_multiple
bclk = rate * channel * sample_width

If TDM outputs 8 channels and 32 bits, bclk will be greater than mclk.

Changes the ratio from 128 to 512.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:50 +00:00
Tzung-Bi Shih
12295ef970
ASoC: mediatek: mt8192-mt6359: simplify mt8192_rt5682_init
Returns snd_soc_component_set_jack() directly in mt8192_rt5682_init.
No need to have another block to check the return value.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:49 +00:00
Tzung-Bi Shih
4e37528a97
ASoC: mediatek: mt8192-mt6359: move headset_jack to card specific data
Moves headset_jack to card specific data.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:48 +00:00
Tzung-Bi Shih
4d36ed8eb0
ASoC: mediatek: mt8183-da7219: ignore TDM DAI link by default
hdmi-codec is an optional property.  Ignore to bind TDM DAI link
if the property isn't specified.

Fixes: 5bdbe97711 ("ASoC: mediatek: mt8183-da7219: use hdmi-codec")
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120092237.1553938-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:45:34 +00:00
Tzung-Bi Shih
5ac154443e
ASoC: mediatek: mt8183-mt6358: ignore TDM DAI link by default
hdmi-codec is an optional property.  Ignore to bind TDM DAI link
if the property isn't specified.

Fixes: f2024dc55f ("ASoC: mediatek: mt8183: use hdmi-codec")
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120092237.1553938-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:45:33 +00:00
Tzung-Bi Shih
81a6320da7
ASoC: rt1015: remove bclk_ratio
bclk_ratio is unused.  Removes bclk_ratio and .set_bclk_ratio callback.

Removes snd_soc_dai_set_bclk_ratio() in a few machine drivers which are
obviously using rt1015.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224101854.3024823-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-05 14:34:18 +00:00