ASoC: wm8524: enable constraints when sysclk is configured.
authorShengjiu Wang <shengjiu.wang@nxp.com>
Fri, 20 Jun 2025 02:14:03 +0000 (10:14 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 23 Jun 2025 16:12:54 +0000 (17:12 +0100)
commit17cc308b183308bf5ada36e164284fff7eb064ba
tree1064dd831a7a1478ace08e1197f012e887d25710
parentc4ca928a6db1593802cd945f075a7e21dd0430c1
ASoC: wm8524: enable constraints when sysclk is configured.

In some cases, the sysclk won't be configured on init, and sysclk can be
changed in hw_params() according to different sample rate, for example,
for 44kHz sample rate, the sysclk is 11.2896MHz, for 48kHz sample rate,
the sysclk is 12.288MHz.

In order to support the above case, only enable constraints when sysclk
is configured, and check the rate in hw_params.

So overall there are three cases that need to be considered:
- call set_sysclk() on init, then constraints will be initialized.
- don't call set_sysclk() on init, but call it after startup(), then
  constraints will be configured, the constraints can be cleared with
  call set_sysclk() again in shutdown().
- don't call set_sysclk() in the whole flow, then there are no any
  constraints. The clocks depend on cpu dai.

Enlarge the WM8524_NUM_RATES to 12, as the supported rate range is 8kHz
to 192kHz.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250620021403.624303-1-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wm8524.c