@@ -25,6 +25,10 @@
#define DRV_NAME "rockchip-i2s"
+#define TRCM_TXRX 0
+#define TRCM_TX 1
+#define TRCM_RX 2
+
struct rk_i2s_pins {
u32 reg_offset;
u32 shift;
@@ -321,7 +325,6 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct rk_i2s_dev *i2s = to_info(dai);
- struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
unsigned int val = 0;
unsigned int mclk_rate, bclk_rate, div_bclk, div_lrck;
@@ -421,13 +424,6 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_RDL_MASK,
I2S_DMACR_RDL(16));
- val = I2S_CKR_TRCM_TXRX;
- if (dai->driver->symmetric_rate && rtd->dai_link->symmetric_rate)
- val = I2S_CKR_TRCM_TXONLY;
-
- regmap_update_bits(i2s->regmap, I2S_CKR,
- I2S_CKR_TRCM_MASK,
- val);
return 0;
}
@@ -531,7 +527,6 @@ static struct snd_soc_dai_driver rockchip_i2s_dai = {
SNDRV_PCM_FMTBIT_S32_LE),
},
.ops = &rockchip_i2s_dai_ops,
- .symmetric_rate = 1,
};
static const struct snd_soc_component_driver rockchip_i2s_component = {
@@ -652,6 +647,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
struct snd_soc_dai_driver *soc_dai;
struct resource *res;
void __iomem *regs;
+ unsigned int clk_trcm;
int ret;
int val;
@@ -749,6 +745,22 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
else if (of_property_read_bool(node, "rockchip,capture-only"))
soc_dai->playback.channels_min = 0;
+ clk_trcm = TRCM_TXRX;
+ if (of_property_read_bool(node, "rockchip,trcm-sync-tx-only"))
+ clk_trcm = TRCM_TX;
+ if (of_property_read_bool(node, "rockchip,trcm-sync-rx-only")) {
+ if (clk_trcm) {
+ dev_err(i2s->dev, "invalid trcm-sync configuration\n");
+ return -EINVAL;
+ }
+ clk_trcm = TRCM_RX;
+ }
+ if (clk_trcm != TRCM_TXRX)
+ soc_dai->symmetric_rate = 1;
+
+ regmap_update_bits(i2s->regmap, I2S_CKR,
+ I2S_CKR_TRCM_MASK, I2S_CKR_TRCM(clk_trcm));
+
ret = devm_snd_soc_register_component(&pdev->dev,
&rockchip_i2s_component,
soc_dai, 1);