ASoC: meson: spdifin: start hw on dai probe
For spdif input to report the locked rate correctly, even when no capture
is running, the HW and reference clock must be started as soon as
the dai is probed.
Fixes: 5ce5658375
("ASoC: meson: add axg spdif input")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20230907090504.12700-1-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ec03804552
commit
aedf323b66
|
@ -112,34 +112,6 @@ static int axg_spdifin_prepare(struct snd_pcm_substream *substream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int axg_spdifin_startup(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct axg_spdifin *priv = snd_soc_dai_get_drvdata(dai);
|
||||
int ret;
|
||||
|
||||
ret = clk_prepare_enable(priv->refclk);
|
||||
if (ret) {
|
||||
dev_err(dai->dev,
|
||||
"failed to enable spdifin reference clock\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN,
|
||||
SPDIFIN_CTRL0_EN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void axg_spdifin_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct axg_spdifin *priv = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN, 0);
|
||||
clk_disable_unprepare(priv->refclk);
|
||||
}
|
||||
|
||||
static void axg_spdifin_write_mode_param(struct regmap *map, int mode,
|
||||
unsigned int val,
|
||||
unsigned int num_per_reg,
|
||||
|
@ -251,17 +223,32 @@ static int axg_spdifin_dai_probe(struct snd_soc_dai *dai)
|
|||
ret = axg_spdifin_sample_mode_config(dai, priv);
|
||||
if (ret) {
|
||||
dev_err(dai->dev, "mode configuration failed\n");
|
||||
clk_disable_unprepare(priv->pclk);
|
||||
return ret;
|
||||
goto pclk_err;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(priv->refclk);
|
||||
if (ret) {
|
||||
dev_err(dai->dev,
|
||||
"failed to enable spdifin reference clock\n");
|
||||
goto pclk_err;
|
||||
}
|
||||
|
||||
regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN,
|
||||
SPDIFIN_CTRL0_EN);
|
||||
|
||||
return 0;
|
||||
|
||||
pclk_err:
|
||||
clk_disable_unprepare(priv->pclk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int axg_spdifin_dai_remove(struct snd_soc_dai *dai)
|
||||
{
|
||||
struct axg_spdifin *priv = snd_soc_dai_get_drvdata(dai);
|
||||
|
||||
regmap_update_bits(priv->map, SPDIFIN_CTRL0, SPDIFIN_CTRL0_EN, 0);
|
||||
clk_disable_unprepare(priv->refclk);
|
||||
clk_disable_unprepare(priv->pclk);
|
||||
return 0;
|
||||
}
|
||||
|
@ -270,8 +257,6 @@ static const struct snd_soc_dai_ops axg_spdifin_ops = {
|
|||
.probe = axg_spdifin_dai_probe,
|
||||
.remove = axg_spdifin_dai_remove,
|
||||
.prepare = axg_spdifin_prepare,
|
||||
.startup = axg_spdifin_startup,
|
||||
.shutdown = axg_spdifin_shutdown,
|
||||
};
|
||||
|
||||
static int axg_spdifin_iec958_info(struct snd_kcontrol *kcontrol,
|
||||
|
|
Loading…
Reference in New Issue