diff mbox

ASoC: nau8825: disable sinc filter for high THD of ADC

Message ID 1480643338-9423-1-git-send-email-KCHSU0@nuvoton.com (mailing list archive)
State Accepted
Commit 5f1516d52f9287a94dc3b9d57c370ed01802a911
Headers show

Commit Message

AS50 KCHSU0 Dec. 2, 2016, 1:48 a.m. UTC
This bit will enable 4th order SINC filter.  
=1, filter will enable;  but it consumes higher power.
=0, the sinc filter is disable, and it should always keep 0 value to
get high THD.

Therefor, disable the filter when codec initiation for better
performance when recording.

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
---
 sound/soc/codecs/nau8825.c | 3 ++-
 sound/soc/codecs/nau8825.h | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Mark Brown Dec. 5, 2016, 11:50 a.m. UTC | #1
On Fri, Dec 02, 2016 at 09:48:58AM +0800, John Hsu wrote:

> This bit will enable 4th order SINC filter.  
> =1, filter will enable;  but it consumes higher power.
> =0, the sinc filter is disable, and it should always keep 0 value to
> get high THD.

> Therefor, disable the filter when codec initiation for better
> performance when recording.

This looks like something that users should be able to control at
runtime - while some users are going to prefer lower power there will
most likely also be some users who prefer the better performance (or
perhaps even users who switch depending on if they're running on battery
or something).
AS50 KCHSU0 Dec. 6, 2016, 2:07 a.m. UTC | #2
Hi,
On 12/5/2016 7:50 PM, Mark Brown wrote:
> On Fri, Dec 02, 2016 at 09:48:58AM +0800, John Hsu wrote:
>
>   
>> This bit will enable 4th order SINC filter.  
>> =1, filter will enable;  but it consumes higher power.
>> =0, the sinc filter is disable, and it should always keep 0 value to
>> get high THD.
>>     
>
>   
>> Therefor, disable the filter when codec initiation for better
>> performance when recording.
>>     
>
> This looks like something that users should be able to control at
> runtime - while some users are going to prefer lower power there will
> most likely also be some users who prefer the better performance (or
> perhaps even users who switch depending on if they're running on battery
> or something).
>   

The function is not suitable for the voice application and easy to
make distortion. Therefore, we want to disalbe it as default to
get a high signal to distortion ratio. Yes, I agree it that users
maybe want to eanble it sometimes. I can add a kcontrol for the
function as well.
diff mbox

Patch

diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 2b89569..efe3a44 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1846,7 +1846,8 @@  static void nau8825_init_regs(struct nau8825 *nau8825)
 	 * (audible hiss). Set it to something better.
 	 */
 	regmap_update_bits(regmap, NAU8825_REG_ADC_RATE,
-		NAU8825_ADC_SYNC_DOWN_MASK, NAU8825_ADC_SYNC_DOWN_64);
+		NAU8825_ADC_SYNC_DOWN_MASK | NAU8825_ADC_SINC4_EN,
+		NAU8825_ADC_SYNC_DOWN_64);
 	regmap_update_bits(regmap, NAU8825_REG_DAC_CTRL1,
 		NAU8825_DAC_OVERSAMPLE_MASK, NAU8825_DAC_OVERSAMPLE_64);
 	/* Disable DACR/L power */
diff --git a/sound/soc/codecs/nau8825.h b/sound/soc/codecs/nau8825.h
index 0672a25..5d1704e 100644
--- a/sound/soc/codecs/nau8825.h
+++ b/sound/soc/codecs/nau8825.h
@@ -269,6 +269,8 @@ 
 #define NAU8825_BIQ_PATH_DAC   (1 << NAU8825_BIQ_PATH_SFT)
 
 /* ADC_RATE (0x2b) */
+#define NAU8825_ADC_SINC4_SFT		4
+#define NAU8825_ADC_SINC4_EN		(1 << NAU8825_ADC_SINC4_SFT)
 #define NAU8825_ADC_SYNC_DOWN_SFT	0
 #define NAU8825_ADC_SYNC_DOWN_MASK	0x3
 #define NAU8825_ADC_SYNC_DOWN_32	0