[alsa-devel] [PATCH 2/2 v2] ASoC: arizona: Improve ultrasonic frequency response

Charles Keepax ckeepax at opensource.wolfsonmicro.com
Fri Jan 31 17:16:18 CET 2014


Evaluation of the device has given some settings to improve the
ultrasonic frequency response. However, this may cause sub-optimal
performance in system designs with high output gains on the headphone
path (0dB or -2dB), and as the frequencies are inaudible anyway some
users may not desire higher frequency response at those frequencies.
So allow the user the option to select it if it is appopriate for
their system design.

Signed-off-by: Charles Keepax <ckeepax at opensource.wolfsonmicro.com>
---
 include/linux/mfd/arizona/pdata.h |    3 +++
 sound/soc/codecs/arizona.c        |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 12a5c13..3df0ed5 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -177,6 +177,9 @@ struct arizona_pdata {
 	/** Mode for outputs */
 	bool out_mono[ARIZONA_MAX_OUTPUT];
 
+	/** Provide improved ultrasonic frequency response */
+	bool ultrasonic_response;
+
 	/** PDM speaker mute setting */
 	unsigned int spk_mute[ARIZONA_MAX_PDM_SPK];
 
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index e4295fe..f2e1ffe 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1134,6 +1134,21 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
 	}
 	sr_val = i;
 
+	switch (priv->arizona->type) {
+	case WM5102:
+		if (priv->arizona->pdata.ultrasonic_response) {
+			snd_soc_write(codec, 0x80, 0x3);
+			if (params_rate(params) >= 176400)
+				snd_soc_write(codec, 0x4dd, 0x1);
+			else
+				snd_soc_write(codec, 0x4dd, 0x0);
+			snd_soc_write(codec, 0x80, 0x0);
+		}
+		break;
+	default:
+		break;
+	}
+
 	switch (dai_priv->clk) {
 	case ARIZONA_CLK_SYSCLK:
 		snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1,
-- 
1.7.2.5



More information about the Alsa-devel mailing list