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.
This commit is contained in:
Mark Brown 2022-11-25 21:39:20 +00:00
commit cd8958420d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 15 additions and 6 deletions

View File

@ -21,6 +21,7 @@ properties:
- rockchip,rk1808-i2s-tdm
- rockchip,rk3308-i2s-tdm
- rockchip,rk3568-i2s-tdm
- rockchip,rk3588-i2s-tdm
- rockchip,rv1126-i2s-tdm
reg:
@ -135,7 +136,6 @@ required:
- clock-names
- resets
- reset-names
- rockchip,grf
- "#sound-dai-cells"
additionalProperties: false

View File

@ -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;
@ -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,rk3308-i2s-tdm", .data = &rk3308_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 },
{},
};
@ -1544,7 +1557,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
i2s_tdm->dev = &pdev->dev;
of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev);
if (!of_id || !of_id->data)
if (!of_id)
return -EINVAL;
spin_lock_init(&i2s_tdm->lock);
@ -1568,10 +1581,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)) {