* [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
@ 2011-10-15 9:23 Ashish Chavan
2011-10-17 21:42 ` Mark Brown
0 siblings, 1 reply; 9+ messages in thread
From: Ashish Chavan @ 2011-10-15 9:23 UTC (permalink / raw)
To: Mark Brown, lrg, alsa-devel
Cc: linux-kernel, kuninori.morimoto.gx, David Dajun Chen
This patch adds support for below set of controls,
(1) Mute controls for MIC, AUX and ADC
(2) Zero cross controls for head phone, AUX, INPGA and line out
(3) Head phone mode selection - class H or G
It also adds digital_mute() call back.
Signed-off-by: Ashish Chavan <ashish.chavan@kpitcummins.com>
Signed-off-by: David Dajun Chen <dchen@diasemi.com>
---
Changes since v2:
- Added digital_mute() call back and removed control for "DAC Mute
Switch"
- Renamed mute control switches
Changes since v1:
- Changed Mic mute control to a double control
- Fixed a typo
---
sound/soc/codecs/da7210.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 480fc6d..cac4f26 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -30,6 +30,7 @@
#define DA7210_STARTUP1 0x03
#define DA7210_MIC_L 0x07
#define DA7210_MIC_R 0x08
+#define DA7210_AUX2 0x0B
#define DA7210_INMIX_L 0x0D
#define DA7210_INMIX_R 0x0E
#define DA7210_ADC_HPF 0x0F
@@ -41,6 +42,7 @@
#define DA7210_DAC_L 0x15
#define DA7210_DAC_R 0x16
#define DA7210_DAC_SEL 0x17
+#define DA7210_SOFTMUTE 0x18
#define DA7210_DAC_EQ1_2 0x19
#define DA7210_DAC_EQ3_4 0x1A
#define DA7210_DAC_EQ5 0x1B
@@ -49,6 +51,7 @@
#define DA7210_HP_L_VOL 0x21
#define DA7210_HP_R_VOL 0x22
#define DA7210_HP_CFG 0x23
+#define DA7210_ZERO_CROSS 0x24
#define DA7210_DAI_SRC_SEL 0x25
#define DA7210_DAI_CFG1 0x26
#define DA7210_DAI_CFG3 0x28
@@ -144,6 +147,9 @@
#define DA7210_PLL_FS_96000 (0xF << 0)
#define DA7210_PLL_EN (0x1 << 7)
+/* SOFTMUTE bit fields */
+#define DA7210_RAMP_EN (1 << 6)
+
#define DA7210_VERSION "0.0.1"
/*
@@ -189,6 +195,13 @@ static const struct soc_enum da7210_dac_vf_cutoff =
static const struct soc_enum da7210_adc_vf_cutoff =
SOC_ENUM_SINGLE(DA7210_ADC_HPF, 4, 8, da7210_vf_cutoff_txt);
+static const char *da7210_hp_mode_txt[] = {
+ "Class H", "Class G"
+};
+
+static const struct soc_enum da7210_hp_mode_sel =
+ SOC_ENUM_SINGLE(DA7210_HP_CFG, 0, 2, da7210_hp_mode_txt);
+
static const struct snd_kcontrol_new da7210_snd_controls[] = {
SOC_DOUBLE_R_TLV("HeadPhone Playback Volume",
@@ -232,6 +245,22 @@ static const struct snd_kcontrol_new da7210_snd_controls[] = {
SOC_ENUM("ADC HPF Cutoff", da7210_adc_hpf_cutoff),
SOC_SINGLE("ADC Voice Mode Switch", DA7210_ADC_HPF, 7, 1, 0),
SOC_ENUM("ADC Voice Cutoff", da7210_adc_vf_cutoff),
+
+ /* Mute controls */
+ SOC_DOUBLE_R("Mic Capture Switch", DA7210_MIC_L, DA7210_MIC_R, 3, 1, 0),
+ SOC_SINGLE("Aux2 Capture Switch", DA7210_AUX2, 2, 1, 0),
+ SOC_SINGLE("ADC Left Capture Switch", DA7210_ADC, 2, 1, 0),
+ SOC_SINGLE("ADC Right Capture Switch", DA7210_ADC, 6, 1, 0),
+ SOC_SINGLE("Digital Soft Mute Switch", DA7210_SOFTMUTE, 7, 1, 0),
+ SOC_SINGLE("Digital Soft Mute Rate", DA7210_SOFTMUTE, 0, 0x7, 0),
+
+ /* Zero cross controls */
+ SOC_DOUBLE("Aux1 ZC Switch", DA7210_ZERO_CROSS, 0, 1, 1, 0),
+ SOC_DOUBLE("In PGA ZC Switch", DA7210_ZERO_CROSS, 2, 3, 1, 0),
+ SOC_DOUBLE("Lineout ZC Switch", DA7210_ZERO_CROSS, 4, 5, 1, 0),
+ SOC_DOUBLE("Headphone ZC Switch", DA7210_ZERO_CROSS, 6, 7, 1, 0),
+
+ SOC_ENUM("Headphone Class", da7210_hp_mode_sel),
};
/* Codec private data */
@@ -448,6 +477,18 @@ static int da7210_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
return 0;
}
+static int da7210_mute(struct snd_soc_dai *dai, int mute)
+{
+ struct snd_soc_codec *codec = dai->codec;
+ u8 mute_reg = snd_soc_read(codec, DA7210_DAC_HPF) & 0xFB;
+
+ if (mute)
+ snd_soc_write(codec, DA7210_DAC_HPF, mute_reg | 0x4);
+ else
+ snd_soc_write(codec, DA7210_DAC_HPF, mute_reg);
+ return 0;
+}
+
#define DA7210_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
@@ -456,6 +497,7 @@ static struct snd_soc_dai_ops da7210_dai_ops = {
.startup = da7210_startup,
.hw_params = da7210_hw_params,
.set_fmt = da7210_set_dai_fmt,
+ .digital_mute = da7210_mute,
};
static struct snd_soc_dai_driver da7210_dai = {
@@ -545,6 +587,9 @@ static int da7210_probe(struct snd_soc_codec *codec)
DA7210_HP_2CAP_MODE | DA7210_HP_SENSE_EN |
DA7210_HP_L_EN | DA7210_HP_MODE | DA7210_HP_R_EN);
+ /* Enable ramp mode for DAC gain update */
+ snd_soc_write(codec, DA7210_SOFTMUTE, DA7210_RAMP_EN);
+
/* Diable PLL and bypass it */
snd_soc_write(codec, DA7210_PLL, DA7210_PLL_FS_48000);
--
1.7.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-15 9:23 [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls Ashish Chavan
@ 2011-10-17 21:42 ` Mark Brown
2011-10-18 11:49 ` Ashish Chavan
0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2011-10-17 21:42 UTC (permalink / raw)
To: Ashish Chavan
Cc: linux-kernel, alsa-devel, lrg, kuninori.morimoto.gx,
David Dajun Chen
On Sat, Oct 15, 2011 at 02:53:15PM +0530, Ashish Chavan wrote:
> + SOC_SINGLE("ADC Left Capture Switch", DA7210_ADC, 2, 1, 0),
> + SOC_SINGLE("ADC Right Capture Switch", DA7210_ADC, 6, 1, 0),
I'd really expect this to be a single stereo control.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-17 21:42 ` Mark Brown
@ 2011-10-18 11:49 ` Ashish Chavan
2011-10-18 12:08 ` [alsa-devel] " Mark Brown
0 siblings, 1 reply; 9+ messages in thread
From: Ashish Chavan @ 2011-10-18 11:49 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, kuninori.morimoto.gx, linux-kernel, David, Chen, lrg
On Mon, 2011-10-17 at 22:42 +0100, Mark Brown wrote:
> On Sat, Oct 15, 2011 at 02:53:15PM +0530, Ashish Chavan wrote:
>
> > + SOC_SINGLE("ADC Left Capture Switch", DA7210_ADC, 2, 1, 0),
> > + SOC_SINGLE("ADC Right Capture Switch", DA7210_ADC, 6, 1, 0),
>
> I'd really expect this to be a single stereo control.
>
Yes, I will update it to be a single stereo control.
I would also like to get clarified on one potential naming conflict. As
per your comments to first version of this patch, I renamed Mic and Aux2
mute controls as,
SOC_DOUBLE_R("Mic Capture Switch", ...),
SOC_SINGLE("Aux2 Capture Switch", ...),
Now I have realized that this may cause a naming conflict with my
"mic_aux_inpga" patch, which I am going to submit after DAPM issues get
sorted. In "mic aux inpga" patch there are controls for Mic and Aux2
volume control,
SOC_DOUBLE_R_TLV("Mic Capture Volume", ...),
SOC_SINGLE_TLV("Aux2 Capture Volume", ...),
As per my view, "Mic Capture Volume" is correct name for Mic volume
control and we need to change name for Mic mute control. Do you agree?
If yes, any suggestion for the name of Mic mute control?
Thanks,
-- Ashish (GNU FAN)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [alsa-devel] [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-18 11:49 ` Ashish Chavan
@ 2011-10-18 12:08 ` Mark Brown
2011-10-18 12:29 ` Ashish Chavan
0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2011-10-18 12:08 UTC (permalink / raw)
To: Ashish Chavan
Cc: lrg, alsa-devel, David Dajun Chen, kuninori.morimoto.gx,
linux-kernel
On Tue, Oct 18, 2011 at 05:19:08PM +0530, Ashish Chavan wrote:
> SOC_DOUBLE_R("Mic Capture Switch", ...),
> SOC_SINGLE("Aux2 Capture Switch", ...),
> Now I have realized that this may cause a naming conflict with my
> "mic_aux_inpga" patch, which I am going to submit after DAPM issues get
> sorted. In "mic aux inpga" patch there are controls for Mic and Aux2
> volume control,
> SOC_DOUBLE_R_TLV("Mic Capture Volume", ...),
> SOC_SINGLE_TLV("Aux2 Capture Volume", ...),
> As per my view, "Mic Capture Volume" is correct name for Mic volume
> control and we need to change name for Mic mute control. Do you agree?
> If yes, any suggestion for the name of Mic mute control?
I don't see any conflict in the above?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-18 12:08 ` [alsa-devel] " Mark Brown
@ 2011-10-18 12:29 ` Ashish Chavan
2011-10-18 12:31 ` [alsa-devel] " Mark Brown
0 siblings, 1 reply; 9+ messages in thread
From: Ashish Chavan @ 2011-10-18 12:29 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, kuninori.morimoto.gx, linux-kernel, David, Chen, lrg
On Tue, 2011-10-18 at 13:08 +0100, Mark Brown wrote:
> On Tue, Oct 18, 2011 at 05:19:08PM +0530, Ashish Chavan wrote:
>
> > SOC_DOUBLE_R("Mic Capture Switch", ...),
> > SOC_SINGLE("Aux2 Capture Switch", ...),
>
> > Now I have realized that this may cause a naming conflict with my
> > "mic_aux_inpga" patch, which I am going to submit after DAPM issues get
> > sorted. In "mic aux inpga" patch there are controls for Mic and Aux2
> > volume control,
>
> > SOC_DOUBLE_R_TLV("Mic Capture Volume", ...),
> > SOC_SINGLE_TLV("Aux2 Capture Volume", ...),
>
> > As per my view, "Mic Capture Volume" is correct name for Mic volume
> > control and we need to change name for Mic mute control. Do you agree?
> > If yes, any suggestion for the name of Mic mute control?
>
> I don't see any conflict in the above?
>
If I add these two, alsamixer and amixer shows only one of them (one
which is added first). Is that fine?
I guess the token here is only "Mic" and "Aux2".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [alsa-devel] [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-18 12:29 ` Ashish Chavan
@ 2011-10-18 12:31 ` Mark Brown
2011-10-18 13:00 ` Ashish Chavan
0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2011-10-18 12:31 UTC (permalink / raw)
To: Ashish Chavan
Cc: lrg, alsa-devel, David Dajun Chen, kuninori.morimoto.gx,
linux-kernel
On Tue, Oct 18, 2011 at 05:59:03PM +0530, Ashish Chavan wrote:
> On Tue, 2011-10-18 at 13:08 +0100, Mark Brown wrote:
> > On Tue, Oct 18, 2011 at 05:19:08PM +0530, Ashish Chavan wrote:
> > > SOC_DOUBLE_R("Mic Capture Switch", ...),
> > > SOC_SINGLE("Aux2 Capture Switch", ...),
> > > SOC_DOUBLE_R_TLV("Mic Capture Volume", ...),
> > > SOC_SINGLE_TLV("Aux2 Capture Volume", ...),
> > I don't see any conflict in the above?
> If I add these two, alsamixer and amixer shows only one of them (one
> which is added first). Is that fine?
Eh? One is a Volume, the other is a Switch. Note that alsamixer does
render the two stacked on top of each other in the UI.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-18 13:00 ` Ashish Chavan
@ 2011-10-18 12:55 ` Mark Brown
2011-10-18 13:19 ` Ashish Chavan
0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2011-10-18 12:55 UTC (permalink / raw)
To: Ashish Chavan
Cc: alsa-devel, David, kuninori.morimoto.gx, linux-kernel, Chen, lrg
On Tue, Oct 18, 2011 at 06:30:28PM +0530, Ashish Chavan wrote:
> > Eh? One is a Volume, the other is a Switch. Note that alsamixer does
> > render the two stacked on top of each other in the UI.
> Yes, I guessed that earlier. Anyways I generally don't rely on alsamixer
> and use amixer whereever possible. In amixer also, it shows only one
> control, the one that I add first. If I change "Mic" to some thing else
> like "MicM" or "Mic Mute", then it shows both controls.
Check again, amixer also merges controls.
> BTW does amixer version have any significance here? I know my alsa-utils
> are quite old (1.0.14)
That's spectacularly old, I guess it's possible it's buggy.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-18 12:31 ` [alsa-devel] " Mark Brown
@ 2011-10-18 13:00 ` Ashish Chavan
2011-10-18 12:55 ` Mark Brown
0 siblings, 1 reply; 9+ messages in thread
From: Ashish Chavan @ 2011-10-18 13:00 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, kuninori.morimoto.gx, linux-kernel, David, Chen, lrg
> > > I don't see any conflict in the above?
>
> > If I add these two, alsamixer and amixer shows only one of them (one
> > which is added first). Is that fine?
>
> Eh? One is a Volume, the other is a Switch. Note that alsamixer does
> render the two stacked on top of each other in the UI.
>
Yes, I guessed that earlier. Anyways I generally don't rely on alsamixer
and use amixer whereever possible. In amixer also, it shows only one
control, the one that I add first. If I change "Mic" to some thing else
like "MicM" or "Mic Mute", then it shows both controls.
BTW does amixer version have any significance here? I know my alsa-utils
are quite old (1.0.14)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls
2011-10-18 12:55 ` Mark Brown
@ 2011-10-18 13:19 ` Ashish Chavan
0 siblings, 0 replies; 9+ messages in thread
From: Ashish Chavan @ 2011-10-18 13:19 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, David, kuninori.morimoto.gx, linux-kernel, Chen, lrg
On Tue, 2011-10-18 at 13:55 +0100, Mark Brown wrote:
> On Tue, Oct 18, 2011 at 06:30:28PM +0530, Ashish Chavan wrote:
>
> > > Eh? One is a Volume, the other is a Switch. Note that alsamixer does
> > > render the two stacked on top of each other in the UI.
>
> > Yes, I guessed that earlier. Anyways I generally don't rely on alsamixer
> > and use amixer whereever possible. In amixer also, it shows only one
> > control, the one that I add first. If I change "Mic" to some thing else
> > like "MicM" or "Mic Mute", then it shows both controls.
>
> Check again, amixer also merges controls.
>
Yes, you are right.
> > BTW does amixer version have any significance here? I know my alsa-utils
> > are quite old (1.0.14)
>
> That's spectacularly old, I guess it's possible it's buggy.
>
I see, thanks. I will update it to my earliest convenience. As of now, I
will go forward in submitting the patches.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-10-18 13:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-15 9:23 [PATCH v4 3/7] ASoC: da7210: Add support for mute and zero cross controls Ashish Chavan
2011-10-17 21:42 ` Mark Brown
2011-10-18 11:49 ` Ashish Chavan
2011-10-18 12:08 ` [alsa-devel] " Mark Brown
2011-10-18 12:29 ` Ashish Chavan
2011-10-18 12:31 ` [alsa-devel] " Mark Brown
2011-10-18 13:00 ` Ashish Chavan
2011-10-18 12:55 ` Mark Brown
2011-10-18 13:19 ` Ashish Chavan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).