RK3288][Android6.0] 调试笔记 --- 关闭按键音后无法录音问题【转】
本文转载自:http://blog.csdn.net/kris_fei/article/details/70052413
Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92
这个问题蛮奇怪的,现象是:
1. 默认系统按键音是打开的,然后去录音,是正常的.
2. 当把按键音关闭之后再去录音,虽然录音有在工作,但是不能录制到声音.
理论上说播放和录音是两条不相干的通路,可以同时工作,也可以独立工作,
可事实上播放的配置影响到了录音.
有通过系统自带的tinyplay以及tinycap工具去测试,现象也是一样,
说明是驱动层的问题.
最终发现是和codec rt5631硬件有关,root cause么有深究.
解决方法:
diff --git a/sound/soc/rockchip/rk_i2s.c b/sound/soc/rockchip/rk_i2s.c
index 6b2e91d..2b1f5ee 100644
--- a/sound/soc/rockchip/rk_i2s.c
+++ b/sound/soc/rockchip/rk_i2s.c
@@ -722,7 +722,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
I2S_RXCR_TFS_PCM);
}
- rockchip_snd_txctrl(i2s, 0);
+ rockchip_snd_txctrl(i2s, 1);
rockchip_snd_rxctrl(i2s, 0);
return 0;
rockchip_snd_txctrl函数.
- static void rockchip_snd_txctrl(struct rk_i2s_dev *i2s, int on)
- {
- unsigned long flags;
- unsigned int val = 0;
- int retry = 10;
- spin_lock_irqsave(&lock, flags);
- dev_dbg(i2s->dev, "%s: %d: on: %d\n", __func__, __LINE__, on);
- if (on) {
- regmap_update_bits(i2s->regmap, I2S_DMACR,
- I2S_DMACR_TDE_MASK, I2S_DMACR_TDE_ENABLE);
- regmap_update_bits(i2s->regmap, I2S_XFER,
- I2S_XFER_TXS_MASK | I2S_XFER_RXS_MASK,
- I2S_XFER_TXS_START | I2S_XFER_RXS_START);
- i2s->tx_start = true;
- } else {
- i2s->tx_start = false;
- regmap_update_bits(i2s->regmap, I2S_DMACR,
- I2S_DMACR_TDE_MASK, I2S_DMACR_TDE_DISABLE);
- if (!i2s->rx_start) {
- regmap_update_bits(i2s->regmap, I2S_XFER,
- I2S_XFER_TXS_MASK |
- I2S_XFER_RXS_MASK,
- I2S_XFER_TXS_STOP |
- I2S_XFER_RXS_STOP);
- regmap_update_bits(i2s->regmap, I2S_CLR,
- I2S_CLR_TXC_MASK | I2S_CLR_RXC_MASK,
- I2S_CLR_TXC | I2S_CLR_RXC);
- regmap_read(i2s->regmap, I2S_CLR, &val);
- /* Should wait for clear operation to finish */
- while (val) {
- regmap_read(i2s->regmap, I2S_CLR, &val);
- retry--;
- if (!retry) {
- dev_warn(i2s->dev, "fail to clear\n");
- break;
- }
- }
- dev_dbg(i2s->dev, "%s: %d: stop xfer\n",
- __func__, __LINE__);
- }
- }
- spin_unlock_irqrestore(&lock, flags);
- }