ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm
authorShengjiu Wang <shengjiu.wang@nxp.com>
Thu, 9 Mar 2023 07:13:37 +0000 (15:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:02:57 +0000 (23:02 +0900)
commit5c7648e96d9065b4ee768eecfd64a94ef60bc1ec
tree8c41880379a1c080add1a54e8dbedaecc0430dfd
parenta89c7b86b5e2780f42598600ddb712365e22c846
ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm

[ Upstream commit 083a25b18d6ad9f1f540e629909aa3eaaaf01823 ]

The hw->formats may be set by snd_dmaengine_pcm_refine_runtime_hwparams()
in component's startup()/open(), but soc_pcm_hw_init() will init
hw->formats in dpcm_runtime_setup_fe() after component's startup()/open(),
which causes the valuable hw->formats to be cleared.

So need to store the hw->formats before initialization, then restore
it after initialization.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1678346017-3660-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/soc-pcm.c