mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ASoC: rockchip: pdm_v2: fix the recording signal is 0 when gain is too large
Since the PDM mic has dc signal, the signal will be recorded as 0 when gain is too large. The dc and voice signals will be enlarge to maximum value and they will be filtered to zero by high pass filter. Change-Id: I4973da38a28028dff502e3bc7f97030a3bde7b8f Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
@@ -583,6 +583,7 @@ static bool rockchip_pdm_v2_wr_reg(struct device *dev, unsigned int reg)
|
||||
case PDM_V2_FIFO_CTRL:
|
||||
case PDM_V2_RXFIFO_DATA:
|
||||
case PDM_V2_DATA_VALID:
|
||||
case PDM_V2_GAIN_CTRL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -599,6 +600,7 @@ static bool rockchip_pdm_v2_rd_reg(struct device *dev, unsigned int reg)
|
||||
case PDM_V2_DATA_VALID:
|
||||
case PDM_V2_RXFIFO_DATA:
|
||||
case PDM_V2_VERSION:
|
||||
case PDM_V2_GAIN_CTRL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@@ -818,22 +820,6 @@ static int rockchip_pdm_v2_probe(struct platform_device *pdev)
|
||||
* release time here.
|
||||
*/
|
||||
pdm->version = (pdm->version >> 16) & 0xffff;
|
||||
/*
|
||||
* Set the default gain 24dB, this parameter can get better
|
||||
* performance if the voice energy is lower. In other words this
|
||||
* can improve PDM IP SNR.
|
||||
*
|
||||
* So the applicable range of this is for sound intensity below 100dB.
|
||||
* If you want to record stronger sound intensity, you must set
|
||||
* PDM gain register but not soft gain-controller.
|
||||
*/
|
||||
if (pdm->version == RK3506_PDM) {
|
||||
regmap_update_bits(pdm->regmap, PDM_V2_GAIN_CTRL, PDM_V2_GAIN_CTRL_MSK,
|
||||
PDM_V2_GAIN_CTRL_24DB);
|
||||
} else if (pdm->version == RK3576_PDM) {
|
||||
regmap_update_bits(pdm->regmap, PDM_V2_FILTER_CTRL, PDM_V2_GAIN_MSK,
|
||||
PDM_V2_GAIN_24DB);
|
||||
}
|
||||
|
||||
ret = rockchip_pdm_v2_path_parse(pdm, node);
|
||||
if (ret != 0 && ret != -ENOENT)
|
||||
|
||||
@@ -102,7 +102,6 @@
|
||||
#define PDM_V2_GAIN_MIN 0
|
||||
#define PDM_V2_GAIN_MAX 0x7f
|
||||
#define PDM_V2_GAIN_0DB (175 << 23)
|
||||
#define PDM_V2_GAIN_24DB (239 << 23)
|
||||
#define PDM_V2_HPF_R_MSK (0x1 << 21)
|
||||
#define PDM_V2_HPF_R_EN (0x1 << 21)
|
||||
#define PDM_V2_HPF_R_DIS (0x0 << 21)
|
||||
@@ -151,6 +150,5 @@
|
||||
#define PDM_V2_GAIN_CTRL_SHIFT 1
|
||||
#define PDM_V2_GAIN_CTRL_MIN 0
|
||||
#define PDM_V2_GAIN_CTRL_MAX 0x7f
|
||||
#define PDM_V2_GAIN_CTRL_24DB (239 << 0)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user