[alsa-devel] [PATCH 0/1] ASoC: TWL4030: Add mixer control for the HS ramp delay
Hello,
The following patch adds user control for the desired ramp delay used on the Headset output - it has been hardwired to use 874/645/437 ms.
The actuall delay depends on the MCLK frequency, for example: value 0x0 in RAMP_DELAY means 2^19/f(MCLK), which is: 27 ms when the f(MCLK) = 19.2 MHz 20 ms when the f(MCLK) = 26 MHz 14 ms when the f(MCLK) = 38.4 MHz
value 0x5 in RAMP_DELAY means 2^24/f(MCLK), which is: 874 ms when the f(MCLK) = 19.2 MHz 645 ms when the f(MCLK) = 26 MHz 437 ms when the f(MCLK) = 38.4 MHz
I think having the actual ms values in the enums are makes more sense than to have the calculation ("2^24/F(MCLK)" for example).
If one can suggest more descriptive name, I would love to change the texts.
--- Peter Ujfalusi (1): ASoC: TWL4030: Make the HS ramp delay configurable
sound/soc/codecs/twl4030.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
Enum type for selecting the desired ramp delay for the headset output.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@nokia.com --- sound/soc/codecs/twl4030.c | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 535d8ce..86bb15c 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -584,12 +584,11 @@ static int headsetl_event(struct snd_soc_dapm_widget *w,
/* Save the current volume */ hs_gain = twl4030_read_reg_cache(w->codec, TWL4030_REG_HS_GAIN_SET); + hs_pop = twl4030_read_reg_cache(w->codec, TWL4030_REG_HS_POPN_SET);
switch (event) { case SND_SOC_DAPM_POST_PMU: /* Do the anti-pop/bias ramp enable according to the TRM */ - hs_pop = TWL4030_RAMP_DELAY_645MS; - twl4030_write(w->codec, TWL4030_REG_HS_POPN_SET, hs_pop); hs_pop |= TWL4030_VMID_EN; twl4030_write(w->codec, TWL4030_REG_HS_POPN_SET, hs_pop); /* Is this needed? Can we just use whatever gain here? */ @@ -603,8 +602,6 @@ static int headsetl_event(struct snd_soc_dapm_widget *w, break; case SND_SOC_DAPM_POST_PMD: /* Do the anti-pop/bias ramp disable according to the TRM */ - hs_pop = twl4030_read_reg_cache(w->codec, - TWL4030_REG_HS_POPN_SET); hs_pop &= ~TWL4030_RAMP_EN; twl4030_write(w->codec, TWL4030_REG_HS_POPN_SET, hs_pop); /* Bypass the reg_cache to mute the headset */ @@ -847,6 +844,17 @@ static DECLARE_TLV_DB_SCALE(digital_capture_tlv, 0, 100, 0); */ static DECLARE_TLV_DB_SCALE(input_gain_tlv, 0, 600, 0);
+static const char *twl4030_rampdelay_texts[] = { + "27/20/14 ms", "55/40/27 ms", "109/81/55 ms", "218/161/109 ms", + "437/323/218 ms", "874/645/437 ms", "1748/1291/874 ms", + "3495/2581/1748 ms" +}; + +static const struct soc_enum twl4030_rampdelay_enum = + SOC_ENUM_SINGLE(TWL4030_REG_HS_POPN_SET, 2, + ARRAY_SIZE(twl4030_rampdelay_texts), + twl4030_rampdelay_texts); + static const struct snd_kcontrol_new twl4030_snd_controls[] = { /* Common playback gain controls */ SOC_DOUBLE_R_TLV("DAC1 Digital Fine Playback Volume", @@ -901,6 +909,8 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = {
SOC_DOUBLE_TLV("Analog Capture Volume", TWL4030_REG_ANAMIC_GAIN, 0, 3, 5, 0, input_gain_tlv), + + SOC_ENUM("HS ramp delay", twl4030_rampdelay_enum), };
static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
On Thu, Mar 05, 2009 at 12:48:49PM +0200, Peter Ujfalusi wrote:
Enum type for selecting the desired ramp delay for the headset output.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@nokia.com
Applied, thanks.
BTW, please CC me on ASoC patches - it helps make sure I notice stuff when I'm busy or travelling.
participants (2)
-
Mark Brown
-
Peter Ujfalusi