Commit cd895842 authored by Mark Brown's avatar Mark Brown

RK3588 Audio Support

Merge series from Nicolas Frattaroli <frattaroli.nicolas@gmail.com>:

This patchset refactors the Rockchip I2S/TDM driver in order to
support the RK3588 SoC, and then adds the necessary compatible
string to load the driver for it.

Patch 1 rectifies a problem with the bindings where we were too
strict about requiring the rockchip,grf property. Most features
of this audio device don't need access to the GRF to function.

Patch 2 modifies the driver to adjust its behaviour to what the
changed bindings now allow, namely using most things without the
GRF.

Patch 3 and 4 are boring compatible string stuff that enables
RK3588 support. No special data is needed to initialise the
driver for this instance of the I2S/TDM IP.
parents 79dfd9d5 c619bd42
...@@ -21,6 +21,7 @@ properties: ...@@ -21,6 +21,7 @@ properties:
- rockchip,rk1808-i2s-tdm - rockchip,rk1808-i2s-tdm
- rockchip,rk3308-i2s-tdm - rockchip,rk3308-i2s-tdm
- rockchip,rk3568-i2s-tdm - rockchip,rk3568-i2s-tdm
- rockchip,rk3588-i2s-tdm
- rockchip,rv1126-i2s-tdm - rockchip,rv1126-i2s-tdm
reg: reg:
...@@ -135,7 +136,6 @@ required: ...@@ -135,7 +136,6 @@ required:
- clock-names - clock-names
- resets - resets
- reset-names - reset-names
- rockchip,grf
- "#sound-dai-cells" - "#sound-dai-cells"
additionalProperties: false additionalProperties: false
......
...@@ -756,6 +756,12 @@ static int rockchip_i2s_io_multiplex(struct snd_pcm_substream *substream, ...@@ -756,6 +756,12 @@ static int rockchip_i2s_io_multiplex(struct snd_pcm_substream *substream,
if (!i2s_tdm->io_multiplex) if (!i2s_tdm->io_multiplex)
return 0; 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) { if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
struct snd_pcm_str *playback_str = struct snd_pcm_str *playback_str =
&substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]; &substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
...@@ -1222,6 +1228,12 @@ static int common_soc_init(struct device *dev, u32 addr) ...@@ -1222,6 +1228,12 @@ static int common_soc_init(struct device *dev, u32 addr)
if (trcm == TRCM_TXRX) if (trcm == TRCM_TXRX)
return 0; 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++) { for (i = 0; i < i2s_tdm->soc_data->config_count; i++) {
if (addr != configs[i].addr) if (addr != configs[i].addr)
continue; continue;
...@@ -1306,6 +1318,7 @@ static const struct of_device_id rockchip_i2s_tdm_match[] = { ...@@ -1306,6 +1318,7 @@ static const struct of_device_id rockchip_i2s_tdm_match[] = {
{ .compatible = "rockchip,rk1808-i2s-tdm", .data = &rk1808_i2s_soc_data }, { .compatible = "rockchip,rk1808-i2s-tdm", .data = &rk1808_i2s_soc_data },
{ .compatible = "rockchip,rk3308-i2s-tdm", .data = &rk3308_i2s_soc_data }, { .compatible = "rockchip,rk3308-i2s-tdm", .data = &rk3308_i2s_soc_data },
{ .compatible = "rockchip,rk3568-i2s-tdm", .data = &rk3568_i2s_soc_data }, { .compatible = "rockchip,rk3568-i2s-tdm", .data = &rk3568_i2s_soc_data },
{ .compatible = "rockchip,rk3588-i2s-tdm" },
{ .compatible = "rockchip,rv1126-i2s-tdm", .data = &rv1126_i2s_soc_data }, { .compatible = "rockchip,rv1126-i2s-tdm", .data = &rv1126_i2s_soc_data },
{}, {},
}; };
...@@ -1544,7 +1557,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) ...@@ -1544,7 +1557,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
i2s_tdm->dev = &pdev->dev; i2s_tdm->dev = &pdev->dev;
of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev); of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev);
if (!of_id || !of_id->data) if (!of_id)
return -EINVAL; return -EINVAL;
spin_lock_init(&i2s_tdm->lock); spin_lock_init(&i2s_tdm->lock);
...@@ -1568,10 +1581,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) ...@@ -1568,10 +1581,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
return ret; return ret;
i2s_tdm->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf"); 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, i2s_tdm->tx_reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
"tx-m"); "tx-m");
if (IS_ERR(i2s_tdm->tx_reset)) { if (IS_ERR(i2s_tdm->tx_reset)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment