Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlay/README.rockchip-overlays
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,7 @@ Activates waveshare 3.5inch lcd(C) on ROCK Pi S V1.2
#### rockpis-dmic-8ch-pdm

Activates dmic on ROCK PI S V1.2

####rockpis-v12-spdif-out

Activates spdif on ROCK PI S V1.2
37 changes: 37 additions & 0 deletions arch/arm64/boot/dts/rockchip/overlay/rockpis-v12-spdif-out.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/dts-v1/;
/plugin/;

/ {
compatible = "radxa,rockpis", "rockchip,rk3308";

fragment@0 {
target-path = "/";
__overlay__ {
acodec: acodec {
#sound-dai-cells = <0>;
compatible = "rockchip,rk3308-codec";
status = "okay";
};
};
};

fragment@1 {
target = <&spdif_tx>;
__overlay__ {
status = "okay";
};
};

fragment@2 {
target-path = "/";
__overlay__ {
acodec-sound {
compatible = "rockchip,multicodecs-card";
rockchip,card-name = "spdif-out";
rockchip,mclk-fs = <256>;
rockchip,cpu = <&spdif_tx>;
rockchip,codec = <&acodec>;
};
};
};
};
4 changes: 4 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_HDMI_CODEC
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM1792A if SPI_MASTER
select SND_SOC_PCM5102A
select SND_SOC_PCM3008
select SND_SOC_PCM512x_I2C if I2C
select SND_SOC_PCM512x_SPI if SPI_MASTER
Expand Down Expand Up @@ -558,6 +559,9 @@ config SND_SOC_PCM1681
config SND_SOC_PCM1792A
tristate "Texas Instruments PCM1792A CODEC"
depends on SPI_MASTER

config SND_SOC_PCM5102A
tristate "Texas Instruments PCM5102A CODEC"

config SND_SOC_PCM3008
tristate
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ snd-soc-nau8825-objs := nau8825.o
snd-soc-hdmi-codec-objs := hdmi-codec.o
snd-soc-pcm1681-objs := pcm1681.o
snd-soc-pcm1792a-codec-objs := pcm1792a.o
snd-soc-pcm5102a-codec-objs := pcm5102a.o
snd-soc-pcm3008-objs := pcm3008.o
snd-soc-pcm512x-objs := pcm512x.o
snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o
Expand Down Expand Up @@ -300,6 +301,7 @@ obj-$(CONFIG_SND_SOC_NAU8825) += snd-soc-nau8825.o
obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o
obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
obj-$(CONFIG_SND_SOC_PCM5102A) += snd-soc-pcm5102a-codec.o
obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o
obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o
Expand Down
58 changes: 58 additions & 0 deletions sound/soc/codecs/pcm5102a.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Driver for the PCM5102A codec
*
* Author: Florian Meier <florian.meier@koalo.de>
* Copyright 2013
*/

#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>

#include <sound/soc.h>

static struct snd_soc_dai_driver pcm5102a_dai = {
.name = "pcm5102a-hifi",
.playback = {
.channels_min = 2,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000,
.formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE
},
};

static struct snd_soc_component_driver soc_component_dev_pcm5102a = {
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
};

static int pcm5102a_probe(struct platform_device *pdev)
{
return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_pcm5102a,
&pcm5102a_dai, 1);
}

static const struct of_device_id pcm5102a_of_match[] = {
{ .compatible = "ti,pcm5102a", },
{ }
};
MODULE_DEVICE_TABLE(of, pcm5102a_of_match);

static struct platform_driver pcm5102a_codec_driver = {
.probe = pcm5102a_probe,
.driver = {
.name = "pcm5102a-codec",
.of_match_table = pcm5102a_of_match,
},
};

module_platform_driver(pcm5102a_codec_driver);

MODULE_DESCRIPTION("ASoC PCM5102A codec driver");
MODULE_AUTHOR("Florian Meier <florian.meier@koalo.de>");
MODULE_LICENSE("GPL v2");
39 changes: 18 additions & 21 deletions sound/soc/rockchip/rockchip_i2s_tdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static int i2s_tdm_runtime_suspend(struct device *dev)

regcache_cache_only(i2s_tdm->regmap, true);
if (!IS_ERR(i2s_tdm->mclk_tx))
clk_disable_unprepare(i2s_tdm->mclk_tx);
clk_prepare_enable(i2s_tdm->mclk_tx);
if (!IS_ERR(i2s_tdm->mclk_rx))
clk_disable_unprepare(i2s_tdm->mclk_rx);

Expand Down Expand Up @@ -345,8 +345,7 @@ static void rockchip_snd_txrxctrl(struct snd_pcm_substream *substream,
regmap_read(i2s_tdm->regmap, I2S_CLR, &val);
retry--;
if (!retry) {
dev_info(i2s_tdm->dev, "reset txrx\n");
rockchip_snd_xfer_sync_reset(i2s_tdm);
dev_info(i2s_tdm->dev, "fail to clear\n");
break;
}
}
Expand All @@ -361,19 +360,21 @@ static void rockchip_snd_txctrl(struct rk_i2s_tdm_dev *i2s_tdm, int on)
int retry = 10;

if (on) {
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR,
I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE);
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR,
I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_ENABLE);

regmap_update_bits(i2s_tdm->regmap, I2S_XFER,
I2S_XFER_TXS_START,
I2S_XFER_TXS_START);

regmap_update_bits(i2s_tdm->regmap, I2S_XFER,
I2S_XFER_TXS_START,
I2S_XFER_TXS_START);
} else {
regmap_update_bits(i2s_tdm->regmap, I2S_DMACR,
I2S_DMACR_TDE_ENABLE, I2S_DMACR_TDE_DISABLE);

regmap_update_bits(i2s_tdm->regmap, I2S_XFER,
I2S_XFER_TXS_START,
I2S_XFER_TXS_STOP);

regmap_update_bits(i2s_tdm->regmap, I2S_XFER,
I2S_XFER_TXS_START,
I2S_XFER_TXS_STOP);

udelay(150);
regmap_update_bits(i2s_tdm->regmap, I2S_CLR,
Expand All @@ -387,13 +388,13 @@ static void rockchip_snd_txctrl(struct rk_i2s_tdm_dev *i2s_tdm, int on)
regmap_read(i2s_tdm->regmap, I2S_CLR, &val);
retry--;
if (!retry) {
dev_warn(i2s_tdm->dev, "reset tx\n");
reset_control_assert(i2s_tdm->tx_reset);
udelay(1);
reset_control_deassert(i2s_tdm->tx_reset);
dev_warn(i2s_tdm->dev, "fail to clear\n");
break;
}
}
regmap_update_bits(i2s_tdm->regmap, I2S_XFER,
I2S_XFER_TXS_START,
I2S_XFER_TXS_START);
}
}

Expand Down Expand Up @@ -429,10 +430,7 @@ static void rockchip_snd_rxctrl(struct rk_i2s_tdm_dev *i2s_tdm, int on)
regmap_read(i2s_tdm->regmap, I2S_CLR, &val);
retry--;
if (!retry) {
dev_warn(i2s_tdm->dev, "reset rx\n");
reset_control_assert(i2s_tdm->rx_reset);
udelay(1);
reset_control_deassert(i2s_tdm->rx_reset);
dev_warn(i2s_tdm->dev, "fail to clear\n");
break;
}
}
Expand Down Expand Up @@ -612,8 +610,7 @@ static void rockchip_i2s_tdm_xfer_pause(struct snd_pcm_substream *substream,
regmap_read(i2s_tdm->regmap, I2S_CLR, &val);
retry--;
if (!retry) {
dev_info(i2s_tdm->dev, "reset txrx\n");
rockchip_snd_xfer_sync_reset(i2s_tdm);
dev_info(i2s_tdm->dev, "fail to clear\n");
break;
}
}
Expand Down