diff mbox series

[1/2] ASoC: rt5682: fix the random recording noise of headset

Message ID 20200317073308.11572-1-shumingf@realtek.com (mailing list archive)
State Accepted
Commit 557270e8dc79f66a1db8907eb3079ade60241fe7
Headers show
Series [1/2] ASoC: rt5682: fix the random recording noise of headset | expand

Commit Message

Shuming [范書銘] March 17, 2020, 7:33 a.m. UTC
From: Shuming Fan <shumingf@realtek.com>

The cycle time of FIFO clock should increase 2 times to avoid
the random recording noise issue.
This setting could apply to all known situations in i2s mode.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/codecs/rt5682.c | 2 ++
 sound/soc/codecs/rt5682.h | 2 ++
 2 files changed, 4 insertions(+)

Comments

Keyon Jie March 18, 2020, 2:31 a.m. UTC | #1
On 3/17/20 3:33 PM, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> The cycle time of FIFO clock should increase 2 times to avoid
> the random recording noise issue.
> This setting could apply to all known situations in i2s mode.

Thanks for fixing this Shuming.

Just try to understand what has happened.

Can you help share more details about it, e.g.
1. the recording noise happened on headset mic or dmic?
2. will this change impact the microphone sampling clock, or the BCLK 
that of the I2S bclk pin?
3. without this change, why the clk is wrong, some example?

Thanks,
~Keyon

> 
> Signed-off-by: Shuming Fan <shumingf@realtek.com>
> ---
>   sound/soc/codecs/rt5682.c | 2 ++
>   sound/soc/codecs/rt5682.h | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
> index 7ca02a5e52e9..023bc672274b 100644
> --- a/sound/soc/codecs/rt5682.c
> +++ b/sound/soc/codecs/rt5682.c
> @@ -3643,6 +3643,8 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
>   			RT5682_CP_CLK_HP_MASK, RT5682_CP_CLK_HP_300KHZ);
>   	regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1,
>   			RT5682_PM_HP_MASK, RT5682_PM_HP_HV);
> +	regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
> +			RT5682_FIFO_CLK_DIV_MASK, RT5682_FIFO_CLK_DIV_2);
>   
>   	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
>   				rt5682_jack_detect_handler);
> diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
> index 43de6e802309..0baeece84ec4 100644
> --- a/sound/soc/codecs/rt5682.h
> +++ b/sound/soc/codecs/rt5682.h
> @@ -657,6 +657,8 @@
>   #define RT5682_DMIC_1_EN_SFT			15
>   #define RT5682_DMIC_1_DIS			(0x0 << 15)
>   #define RT5682_DMIC_1_EN			(0x1 << 15)
> +#define RT5682_FIFO_CLK_DIV_MASK		(0x7 << 12)
> +#define RT5682_FIFO_CLK_DIV_2			(0x1 << 12)
>   #define RT5682_DMIC_1_DP_MASK			(0x3 << 4)
>   #define RT5682_DMIC_1_DP_SFT			4
>   #define RT5682_DMIC_1_DP_GPIO2			(0x0 << 4)
>
Albert Chen March 18, 2020, 3:06 a.m. UTC | #2
Dear Sir,

Inline.

Thanks,
Albert

-----Original Message-----
From: Keyon Jie <yang.jie@linux.intel.com> 
Sent: Wednesday, March 18, 2020 10:32 AM
To: Shuming [范書銘] <shumingf@realtek.com>; broonie@kernel.org; lgirdwood@gmail.com
Cc: Oder Chiou <oder_chiou@realtek.com>; Jack Yu <jack.yu@realtek.com>; alsa-devel@alsa-project.org; lars@metafoo.de; Albert Chen <albertchen@realtek.com>; Derek [方德義] <derek.fang@realtek.com>; sathya.prakash.m.r@intel.com; Flove(HsinFu) <flove@realtek.com>
Subject: Re: [PATCH 1/2] ASoC: rt5682: fix the random recording noise of headset

On 3/17/20 3:33 PM, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
> 
> The cycle time of FIFO clock should increase 2 times to avoid the 
> random recording noise issue.
> This setting could apply to all known situations in i2s mode.

Thanks for fixing this Shuming.

Just try to understand what has happened.

Can you help share more details about it, e.g.
1. the recording noise happened on headset mic or dmic?
<Albert> Headset Mic
2. will this change impact the microphone sampling clock, or the BCLK that of the I2S bclk pin?
<Albert> No.
3. without this change, why the clk is wrong, some example?
<Albert> Only adjust FIFO buffer setting. 

Thanks,
~Keyon

> 
> Signed-off-by: Shuming Fan <shumingf@realtek.com>
> ---
>   sound/soc/codecs/rt5682.c | 2 ++
>   sound/soc/codecs/rt5682.h | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c 
> index 7ca02a5e52e9..023bc672274b 100644
> --- a/sound/soc/codecs/rt5682.c
> +++ b/sound/soc/codecs/rt5682.c
> @@ -3643,6 +3643,8 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
>   			RT5682_CP_CLK_HP_MASK, RT5682_CP_CLK_HP_300KHZ);
>   	regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1,
>   			RT5682_PM_HP_MASK, RT5682_PM_HP_HV);
> +	regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
> +			RT5682_FIFO_CLK_DIV_MASK, RT5682_FIFO_CLK_DIV_2);
>   
>   	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
>   				rt5682_jack_detect_handler);
> diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h 
> index 43de6e802309..0baeece84ec4 100644
> --- a/sound/soc/codecs/rt5682.h
> +++ b/sound/soc/codecs/rt5682.h
> @@ -657,6 +657,8 @@
>   #define RT5682_DMIC_1_EN_SFT			15
>   #define RT5682_DMIC_1_DIS			(0x0 << 15)
>   #define RT5682_DMIC_1_EN			(0x1 << 15)
> +#define RT5682_FIFO_CLK_DIV_MASK		(0x7 << 12)
> +#define RT5682_FIFO_CLK_DIV_2			(0x1 << 12)
>   #define RT5682_DMIC_1_DP_MASK			(0x3 << 4)
>   #define RT5682_DMIC_1_DP_SFT			4
>   #define RT5682_DMIC_1_DP_GPIO2			(0x0 << 4)
> 

------Please consider the environment before printing this e-mail.
Keyon Jie March 18, 2020, 3:31 a.m. UTC | #3
On 3/18/20 11:06 AM, Albert Chen wrote:
> Dear Sir,
> 
> Inline.
> 
> Thanks,
> Albert
> 
> -----Original Message-----
> From: Keyon Jie <yang.jie@linux.intel.com>
> Sent: Wednesday, March 18, 2020 10:32 AM
> To: Shuming [范書銘] <shumingf@realtek.com>; broonie@kernel.org; lgirdwood@gmail.com
> Cc: Oder Chiou <oder_chiou@realtek.com>; Jack Yu <jack.yu@realtek.com>; alsa-devel@alsa-project.org; lars@metafoo.de; Albert Chen <albertchen@realtek.com>; Derek [方德義] <derek.fang@realtek.com>; sathya.prakash.m.r@intel.com; Flove(HsinFu) <flove@realtek.com>
> Subject: Re: [PATCH 1/2] ASoC: rt5682: fix the random recording noise of headset
> 
> On 3/17/20 3:33 PM, shumingf@realtek.com wrote:
>> From: Shuming Fan <shumingf@realtek.com>
>>
>> The cycle time of FIFO clock should increase 2 times to avoid the
>> random recording noise issue.
>> This setting could apply to all known situations in i2s mode.
> 
> Thanks for fixing this Shuming.
> 
> Just try to understand what has happened.
> 
> Can you help share more details about it, e.g.
> 1. the recording noise happened on headset mic or dmic?
> <Albert> Headset Mic
> 2. will this change impact the microphone sampling clock, or the BCLK that of the I2S bclk pin?
> <Albert> No.
> 3. without this change, why the clk is wrong, some example?
> <Albert> Only adjust FIFO buffer setting.

Where is the FIFO buffer you mentioned located? Is it included in the 
path "headset mic ADC--(loopback)-->ADC headphone"?

The issue was reported to Intel also, that's why I am querying this here.

 From previous feedback, Shuming shared that the loopback path mentioned 
above don't have this random noise issue.

Thanks,
~Keyon

> 
> Thanks,
> ~Keyon
> 
>>
>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
>> ---
>>    sound/soc/codecs/rt5682.c | 2 ++
>>    sound/soc/codecs/rt5682.h | 2 ++
>>    2 files changed, 4 insertions(+)
>>
>> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
>> index 7ca02a5e52e9..023bc672274b 100644
>> --- a/sound/soc/codecs/rt5682.c
>> +++ b/sound/soc/codecs/rt5682.c
>> @@ -3643,6 +3643,8 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
>>    			RT5682_CP_CLK_HP_MASK, RT5682_CP_CLK_HP_300KHZ);
>>    	regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1,
>>    			RT5682_PM_HP_MASK, RT5682_PM_HP_HV);
>> +	regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
>> +			RT5682_FIFO_CLK_DIV_MASK, RT5682_FIFO_CLK_DIV_2);
>>    
>>    	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
>>    				rt5682_jack_detect_handler);
>> diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
>> index 43de6e802309..0baeece84ec4 100644
>> --- a/sound/soc/codecs/rt5682.h
>> +++ b/sound/soc/codecs/rt5682.h
>> @@ -657,6 +657,8 @@
>>    #define RT5682_DMIC_1_EN_SFT			15
>>    #define RT5682_DMIC_1_DIS			(0x0 << 15)
>>    #define RT5682_DMIC_1_EN			(0x1 << 15)
>> +#define RT5682_FIFO_CLK_DIV_MASK		(0x7 << 12)
>> +#define RT5682_FIFO_CLK_DIV_2			(0x1 << 12)
>>    #define RT5682_DMIC_1_DP_MASK			(0x3 << 4)
>>    #define RT5682_DMIC_1_DP_SFT			4
>>    #define RT5682_DMIC_1_DP_GPIO2			(0x0 << 4)
>>
> 
> ------Please consider the environment before printing this e-mail.
>
Albert Chen March 18, 2020, 6:07 a.m. UTC | #4
-----Original Message-----
From: Keyon Jie <yang.jie@linux.intel.com> 
Sent: Wednesday, March 18, 2020 11:31 AM
To: Albert Chen <albertchen@realtek.com>; Shuming [范書銘] <shumingf@realtek.com>; broonie@kernel.org; lgirdwood@gmail.com
Cc: Oder Chiou <oder_chiou@realtek.com>; Jack Yu <jack.yu@realtek.com>; alsa-devel@alsa-project.org; lars@metafoo.de; Derek [方德義] <derek.fang@realtek.com>; sathya.prakash.m.r@intel.com; Flove(HsinFu) <flove@realtek.com>
Subject: Re: [PATCH 1/2] ASoC: rt5682: fix the random recording noise of headset


On 3/18/20 11:06 AM, Albert Chen wrote:
> Dear Sir,
> 
> Inline.
> 
> Thanks,
> Albert
> 
> -----Original Message-----
> From: Keyon Jie <yang.jie@linux.intel.com>
> Sent: Wednesday, March 18, 2020 10:32 AM
> To: Shuming [范書銘] <shumingf@realtek.com>; broonie@kernel.org; 
> lgirdwood@gmail.com
> Cc: Oder Chiou <oder_chiou@realtek.com>; Jack Yu 
> <jack.yu@realtek.com>; alsa-devel@alsa-project.org; lars@metafoo.de; 
> Albert Chen <albertchen@realtek.com>; Derek [方德義] 
> <derek.fang@realtek.com>; sathya.prakash.m.r@intel.com; Flove(HsinFu) 
> <flove@realtek.com>
> Subject: Re: [PATCH 1/2] ASoC: rt5682: fix the random recording noise 
> of headset
> 
> On 3/17/20 3:33 PM, shumingf@realtek.com wrote:
>> From: Shuming Fan <shumingf@realtek.com>
>>
>> The cycle time of FIFO clock should increase 2 times to avoid the 
>> random recording noise issue.
>> This setting could apply to all known situations in i2s mode.
> 
> Thanks for fixing this Shuming.
> 
> Just try to understand what has happened.
> 
> Can you help share more details about it, e.g.
> 1. the recording noise happened on headset mic or dmic?
> <Albert> Headset Mic
> 2. will this change impact the microphone sampling clock, or the BCLK that of the I2S bclk pin?
> <Albert> No.
> 3. without this change, why the clk is wrong, some example?
> <Albert> Only adjust FIFO buffer setting.

Where is the FIFO buffer you mentioned located? Is it included in the path "headset mic ADC--(loopback)-->ADC headphone"?
<Albert> I2S interface.

The issue was reported to Intel also, that's why I am querying this here.

From previous feedback, Shuming shared that the loopback path mentioned above don't have this random noise issue.

<Albert>These are have total two recording random noise issues, one is the PCB trace design and another is Codec setting, Our previous reported is PCB trace cause noise. 

Thanks,
~Keyon

> 
> Thanks,
> ~Keyon
> 
>>
>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
>> ---
>>    sound/soc/codecs/rt5682.c | 2 ++
>>    sound/soc/codecs/rt5682.h | 2 ++
>>    2 files changed, 4 insertions(+)
>>
>> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c 
>> index 7ca02a5e52e9..023bc672274b 100644
>> --- a/sound/soc/codecs/rt5682.c
>> +++ b/sound/soc/codecs/rt5682.c
>> @@ -3643,6 +3643,8 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
>>    			RT5682_CP_CLK_HP_MASK, RT5682_CP_CLK_HP_300KHZ);
>>    	regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1,
>>    			RT5682_PM_HP_MASK, RT5682_PM_HP_HV);
>> +	regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
>> +			RT5682_FIFO_CLK_DIV_MASK, RT5682_FIFO_CLK_DIV_2);
>>    
>>    	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
>>    				rt5682_jack_detect_handler);
>> diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h 
>> index 43de6e802309..0baeece84ec4 100644
>> --- a/sound/soc/codecs/rt5682.h
>> +++ b/sound/soc/codecs/rt5682.h
>> @@ -657,6 +657,8 @@
>>    #define RT5682_DMIC_1_EN_SFT			15
>>    #define RT5682_DMIC_1_DIS			(0x0 << 15)
>>    #define RT5682_DMIC_1_EN			(0x1 << 15)
>> +#define RT5682_FIFO_CLK_DIV_MASK		(0x7 << 12)
>> +#define RT5682_FIFO_CLK_DIV_2			(0x1 << 12)
>>    #define RT5682_DMIC_1_DP_MASK			(0x3 << 4)
>>    #define RT5682_DMIC_1_DP_SFT			4
>>    #define RT5682_DMIC_1_DP_GPIO2			(0x0 << 4)
>>
> 
> ------Please consider the environment before printing this e-mail.
>
Keyon Jie March 18, 2020, 9:36 a.m. UTC | #5
On 3/18/20 2:07 PM, Albert Chen wrote:
> 
> 
> -----Original Message-----
> From: Keyon Jie <yang.jie@linux.intel.com>
> Sent: Wednesday, March 18, 2020 11:31 AM
> To: Albert Chen <albertchen@realtek.com>; Shuming [范書銘] <shumingf@realtek.com>; broonie@kernel.org; lgirdwood@gmail.com
> Cc: Oder Chiou <oder_chiou@realtek.com>; Jack Yu <jack.yu@realtek.com>; alsa-devel@alsa-project.org; lars@metafoo.de; Derek [方德義] <derek.fang@realtek.com>; sathya.prakash.m.r@intel.com; Flove(HsinFu) <flove@realtek.com>
> Subject: Re: [PATCH 1/2] ASoC: rt5682: fix the random recording noise of headset
> 
> 
> On 3/18/20 11:06 AM, Albert Chen wrote:
>> Dear Sir,
>>
>> Inline.
>>
>> Thanks,
>> Albert
>>
>> -----Original Message-----
>> From: Keyon Jie <yang.jie@linux.intel.com>
>> Sent: Wednesday, March 18, 2020 10:32 AM
>> To: Shuming [范書銘] <shumingf@realtek.com>; broonie@kernel.org;
>> lgirdwood@gmail.com
>> Cc: Oder Chiou <oder_chiou@realtek.com>; Jack Yu
>> <jack.yu@realtek.com>; alsa-devel@alsa-project.org; lars@metafoo.de;
>> Albert Chen <albertchen@realtek.com>; Derek [方德義]
>> <derek.fang@realtek.com>; sathya.prakash.m.r@intel.com; Flove(HsinFu)
>> <flove@realtek.com>
>> Subject: Re: [PATCH 1/2] ASoC: rt5682: fix the random recording noise
>> of headset
>>
>> On 3/17/20 3:33 PM, shumingf@realtek.com wrote:
>>> From: Shuming Fan <shumingf@realtek.com>
>>>
>>> The cycle time of FIFO clock should increase 2 times to avoid the
>>> random recording noise issue.
>>> This setting could apply to all known situations in i2s mode.
>>
>> Thanks for fixing this Shuming.
>>
>> Just try to understand what has happened.
>>
>> Can you help share more details about it, e.g.
>> 1. the recording noise happened on headset mic or dmic?
>> <Albert> Headset Mic
>> 2. will this change impact the microphone sampling clock, or the BCLK that of the I2S bclk pin?
>> <Albert> No.
>> 3. without this change, why the clk is wrong, some example?
>> <Albert> Only adjust FIFO buffer setting.
> 
> Where is the FIFO buffer you mentioned located? Is it included in the path "headset mic ADC--(loopback)-->ADC headphone"?
> <Albert> I2S interface.
> 
> The issue was reported to Intel also, that's why I am querying this here.
> 
>  From previous feedback, Shuming shared that the loopback path mentioned above don't have this random noise issue.
> 
> <Albert>These are have total two recording random noise issues, one is the PCB trace design and another is Codec setting, Our previous reported is PCB trace cause noise.

Okay, thanks for explaining. Looks good to me now. :)

Thanks,
~Keyon

> 
> Thanks,
> ~Keyon
> 
>>
>> Thanks,
>> ~Keyon
>>
>>>
>>> Signed-off-by: Shuming Fan <shumingf@realtek.com>
>>> ---
>>>     sound/soc/codecs/rt5682.c | 2 ++
>>>     sound/soc/codecs/rt5682.h | 2 ++
>>>     2 files changed, 4 insertions(+)
>>>
>>> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
>>> index 7ca02a5e52e9..023bc672274b 100644
>>> --- a/sound/soc/codecs/rt5682.c
>>> +++ b/sound/soc/codecs/rt5682.c
>>> @@ -3643,6 +3643,8 @@ static int rt5682_i2c_probe(struct i2c_client *i2c,
>>>     			RT5682_CP_CLK_HP_MASK, RT5682_CP_CLK_HP_300KHZ);
>>>     	regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1,
>>>     			RT5682_PM_HP_MASK, RT5682_PM_HP_HV);
>>> +	regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
>>> +			RT5682_FIFO_CLK_DIV_MASK, RT5682_FIFO_CLK_DIV_2);
>>>     
>>>     	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
>>>     				rt5682_jack_detect_handler);
>>> diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
>>> index 43de6e802309..0baeece84ec4 100644
>>> --- a/sound/soc/codecs/rt5682.h
>>> +++ b/sound/soc/codecs/rt5682.h
>>> @@ -657,6 +657,8 @@
>>>     #define RT5682_DMIC_1_EN_SFT			15
>>>     #define RT5682_DMIC_1_DIS			(0x0 << 15)
>>>     #define RT5682_DMIC_1_EN			(0x1 << 15)
>>> +#define RT5682_FIFO_CLK_DIV_MASK		(0x7 << 12)
>>> +#define RT5682_FIFO_CLK_DIV_2			(0x1 << 12)
>>>     #define RT5682_DMIC_1_DP_MASK			(0x3 << 4)
>>>     #define RT5682_DMIC_1_DP_SFT			4
>>>     #define RT5682_DMIC_1_DP_GPIO2			(0x0 << 4)
>>>
>>
>> ------Please consider the environment before printing this e-mail.
>>
diff mbox series

Patch

diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index 7ca02a5e52e9..023bc672274b 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -3643,6 +3643,8 @@  static int rt5682_i2c_probe(struct i2c_client *i2c,
 			RT5682_CP_CLK_HP_MASK, RT5682_CP_CLK_HP_300KHZ);
 	regmap_update_bits(rt5682->regmap, RT5682_HP_CHARGE_PUMP_1,
 			RT5682_PM_HP_MASK, RT5682_PM_HP_HV);
+	regmap_update_bits(rt5682->regmap, RT5682_DMIC_CTRL_1,
+			RT5682_FIFO_CLK_DIV_MASK, RT5682_FIFO_CLK_DIV_2);
 
 	INIT_DELAYED_WORK(&rt5682->jack_detect_work,
 				rt5682_jack_detect_handler);
diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h
index 43de6e802309..0baeece84ec4 100644
--- a/sound/soc/codecs/rt5682.h
+++ b/sound/soc/codecs/rt5682.h
@@ -657,6 +657,8 @@ 
 #define RT5682_DMIC_1_EN_SFT			15
 #define RT5682_DMIC_1_DIS			(0x0 << 15)
 #define RT5682_DMIC_1_EN			(0x1 << 15)
+#define RT5682_FIFO_CLK_DIV_MASK		(0x7 << 12)
+#define RT5682_FIFO_CLK_DIV_2			(0x1 << 12)
 #define RT5682_DMIC_1_DP_MASK			(0x3 << 4)
 #define RT5682_DMIC_1_DP_SFT			4
 #define RT5682_DMIC_1_DP_GPIO2			(0x0 << 4)