From 16b009825608164b17dabd877c78123a667b4981 Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Sat, 31 Jul 2021 10:15:12 -0500 Subject: ErosQ Native: Add DC Offset to PCM data A small negative offset seems to silence all play/pause clicking on the PCM5102A. Also adding PCM soft muting, and muting the headphone amp when the headphones are detected as removed. This has been tested to not cause any unintended side effects on the line out. Also confirmed the numerical dB values are (approx.) correct. Change-Id: I689d68887c86add9cc5e0ccb0c7de01aaa69b4d9 --- firmware/pcm_sw_volume.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'firmware/pcm_sw_volume.c') diff --git a/firmware/pcm_sw_volume.c b/firmware/pcm_sw_volume.c index 7322269f44..3593c684af 100644 --- a/firmware/pcm_sw_volume.c +++ b/firmware/pcm_sw_volume.c @@ -54,7 +54,11 @@ static typeof (memcpy) *pcm_scaling_fn = NULL; /* Scale sample by PCM factor */ static inline int32_t pcm_scale_sample(PCM_F_T f, int32_t s) { +#if defined(PCM_DC_OFFSET_VALUE) + return (f * s + PCM_DC_OFFSET_VALUE) >> PCM_SW_VOLUME_FRACBITS; +#else return (f * s) >> PCM_SW_VOLUME_FRACBITS; +#endif } /* Both UNITY, use direct copy */ -- cgit v1.2.3