[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221025124132.399729-3-frattaroli.nicolas@gmail.com>
Date: Tue, 25 Oct 2022 14:41:30 +0200
From: Nicolas Frattaroli <frattaroli.nicolas@...il.com>
To: Nicolas Frattaroli <frattaroli.nicolas@...il.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Heiko Stuebner <heiko@...ech.de>
Cc: linux-rockchip@...ts.infradead.org, alsa-devel@...a-project.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/4] ASoC: rockchip: i2s_tdm: Make the grf property optional
Only IO Multiplex and two TRCM modes need access to the GRF, so
making it a hard requirement is not a wise idea, as it complicates
support for newer SoCs which do not do these things.
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@...il.com>
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 2550bd2a5e78..917f17107891 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -756,6 +756,12 @@ static int rockchip_i2s_io_multiplex(struct snd_pcm_substream *substream,
if (!i2s_tdm->io_multiplex)
return 0;
+ if (IS_ERR_OR_NULL(i2s_tdm->grf)) {
+ dev_err(i2s_tdm->dev,
+ "io multiplex not supported for this device\n");
+ return -EINVAL;
+ }
+
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
struct snd_pcm_str *playback_str =
&substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -1222,6 +1228,12 @@ static int common_soc_init(struct device *dev, u32 addr)
if (trcm == TRCM_TXRX)
return 0;
+ if (IS_ERR_OR_NULL(i2s_tdm->grf)) {
+ dev_err(i2s_tdm->dev,
+ "no grf present but non-txrx TRCM specified\n");
+ return -EINVAL;
+ }
+
for (i = 0; i < i2s_tdm->soc_data->config_count; i++) {
if (addr != configs[i].addr)
continue;
@@ -1568,10 +1580,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
return ret;
i2s_tdm->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
- if (IS_ERR(i2s_tdm->grf))
- return dev_err_probe(i2s_tdm->dev, PTR_ERR(i2s_tdm->grf),
- "Error in rockchip,grf\n");
-
i2s_tdm->tx_reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
"tx-m");
if (IS_ERR(i2s_tdm->tx_reset)) {
--
2.38.1
Powered by blists - more mailing lists