linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Ban Tao <fengzheng923@gmail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Chen-Yu Tsai <wens@csie.org>,
	Samuel Holland <samuel@sholland.org>,
	Joao Schim <joao@schimsalabim.eu>
Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: sunxi: DMIC: Add controls for adjusting the mic gains
Date: Mon, 29 Apr 2024 20:47:49 +0200	[thread overview]
Message-ID: <2179677.irdbgypaU6@jernej-laptop> (raw)
In-Reply-To: <534a73a7-bc41-42a7-a060-bc1465f3a21e@schimsalabim.eu>

Dne ponedeljek, 29. april 2024 ob 20:39:24 GMT +2 je Joao Schim napisal(a):
> On 4/26/24 16:39, Jernej Škrabec wrote:
> > Dne četrtek, 25. april 2024 ob 13:03:56 GMT +2 je Joao Schim napisal(a):
> >> On 4/24/24 20:42, Jernej Škrabec wrote:
> >>> Hi Joao,
> >> Hi Jernej,  thanks for your prompt response.
> >>> Dne ponedeljek, 22. april 2024 ob 17:02:13 GMT +2 je Joao Schim napisal(a):
> >>>> The AllWinner H6 and later SoCs that sport a DMIC block contain a set of registers to control
> >>>> the gain (left + right) of each of the four supported channels.
> >>>>
> >>>> Add ASoC controls for changing each of the stereo channel gains using alsamixer and alike
> >>> Add SoB tag.
> >> Yeah, i realized that too late. Thanks for bringing that to my
> >> attention. I will add it in v1.
> >>>> ---
> >>>>    sound/soc/sunxi/sun50i-dmic.c | 34 ++++++++++++++++++++++++++++++++++
> >>>>    1 file changed, 34 insertions(+)
> >>>>
> >>>> diff --git a/sound/soc/sunxi/sun50i-dmic.c b/sound/soc/sunxi/sun50i-dmic.c
> >>>> index c76628bc86c6..f8613d8c3462 100644
> >>>> --- a/sound/soc/sunxi/sun50i-dmic.c
> >>>> +++ b/sound/soc/sunxi/sun50i-dmic.c
> >>>> @@ -14,6 +14,7 @@
> >>>>    #include <sound/dmaengine_pcm.h>
> >>>>    #include <sound/pcm_params.h>
> >>>>    #include <sound/soc.h>
> >>>> +#include <sound/tlv.h>
> >>>>    
> >>>>    #define SUN50I_DMIC_EN_CTL			(0x00)
> >>>>    	#define SUN50I_DMIC_EN_CTL_GLOBE			BIT(8)
> >>>> @@ -43,6 +44,17 @@
> >>>>    	#define SUN50I_DMIC_CH_NUM_N_MASK			GENMASK(2, 0)
> >>>>    #define SUN50I_DMIC_CNT				(0x2c)
> >>>>    	#define SUN50I_DMIC_CNT_N				(1 << 0)
> >>>> +#define SUN50I_DMIC_D0D1_VOL_CTR		(0x30)
> >>>> +	#define SUN50I_DMIC_D0D1_VOL_CTR_0R			(0)
> >>>> +	#define SUN50I_DMIC_D0D1_VOL_CTR_0L			(8)
> >>>> +	#define SUN50I_DMIC_D0D1_VOL_CTR_1R			(16)
> >>>> +	#define SUN50I_DMIC_D0D1_VOL_CTR_1L			(24)
> >>>> +#define SUN50I_DMIC_D2D3_VOL_CTR                (0x34)
> >>>> +        #define SUN50I_DMIC_D2D3_VOL_CTR_2R                     (0)
> >>>> +        #define SUN50I_DMIC_D2D3_VOL_CTR_2L                     (8)
> >>>> +        #define SUN50I_DMIC_D2D3_VOL_CTR_3R                     (16)
> >>>> +        #define SUN50I_DMIC_D2D3_VOL_CTR_3L                     (24)
> >>>> +
> >>>>    #define SUN50I_DMIC_HPF_CTRL			(0x38)
> >>>>    #define SUN50I_DMIC_VERSION			(0x50)
> >>>>    
> >>>> @@ -273,8 +285,30 @@ static const struct of_device_id sun50i_dmic_of_match[] = {
> >>>>    };
> >>>>    MODULE_DEVICE_TABLE(of, sun50i_dmic_of_match);
> >>>>    
> >>>> +static const DECLARE_TLV_DB_SCALE(sun50i_dmic_vol_scale, -12000, 75, 1);
> >>> DECLARE_TLV_DB_SCALE is old name, SNDRV_CTL_TLVD_DECLARE_DB_SCALE should be
> >>> used instead.
> >> I can't seem to find that define in HEAD. what code-base are you
> >> referring to that i should checkout ?
> > Here is define:
> > https://elixir.bootlin.com/linux/v6.9-rc1/source/include/uapi/sound/tlv.h#L52
> >
> > However, I'm not sure if this message means DECLARE_TLV_DB_SCALE is
> > deprecated or not:
> > https://elixir.bootlin.com/linux/v6.9-rc1/source/include/sound/tlv.h#L12
> 
> Right, apparently i sneaked in another D in the name. That explains i 
> could not find it.
> 
> Will send v1 in a few minutes. Thanks.

that would be v2?

v1 is first submission and it's usually not marked as such.

Best regards,
Jernej

> 
> Kind regards,
> 
> Joao
> 
> > Best regards,
> > Jernej
> >
> >>> Other than that, it looks fine.
> >> Thanks.
> >>
> >>> Best regards,
> >>> Jernej
> >>>
> >>>> +
> >>>> +static const struct snd_kcontrol_new sun50i_dmic_controls[] = {
> >>>> +
> >>>> +        SOC_DOUBLE_TLV("DMIC Channel 0 Capture Volume", SUN50I_DMIC_D0D1_VOL_CTR,
> >>>> +                       SUN50I_DMIC_D0D1_VOL_CTR_0L, SUN50I_DMIC_D0D1_VOL_CTR_0R,
> >>>> +                       0xFF, 0, sun50i_dmic_vol_scale),
> >>>> +        SOC_DOUBLE_TLV("DMIC Channel 1 Capture Volume", SUN50I_DMIC_D0D1_VOL_CTR,
> >>>> +                       SUN50I_DMIC_D0D1_VOL_CTR_1L, SUN50I_DMIC_D0D1_VOL_CTR_1R,
> >>>> +                       0xFF, 0, sun50i_dmic_vol_scale),
> >>>> +        SOC_DOUBLE_TLV("DMIC Channel 2 Capture Volume", SUN50I_DMIC_D2D3_VOL_CTR,
> >>>> +                       SUN50I_DMIC_D2D3_VOL_CTR_2L, SUN50I_DMIC_D2D3_VOL_CTR_2R,
> >>>> +                       0xFF, 0, sun50i_dmic_vol_scale),
> >>>> +        SOC_DOUBLE_TLV("DMIC Channel 3 Capture Volume", SUN50I_DMIC_D2D3_VOL_CTR,
> >>>> +                       SUN50I_DMIC_D2D3_VOL_CTR_3L, SUN50I_DMIC_D2D3_VOL_CTR_3R,
> >>>> +                       0xFF, 0, sun50i_dmic_vol_scale),
> >>>> +
> >>>> +
> >>>> +};
> >>>> +
> >>>>    static const struct snd_soc_component_driver sun50i_dmic_component = {
> >>>>    	.name           = "sun50i-dmic",
> >>>> +	.controls	= sun50i_dmic_controls,
> >>>> +	.num_controls	= ARRAY_SIZE(sun50i_dmic_controls),
> >>>>    };
> >>>>    
> >>>>    static int sun50i_dmic_runtime_suspend(struct device *dev)
> >>>>
> >>>
> >>>
> >> Kind regards,
> >>
> >> Joao
> >>
> >>
> >
> >
> >
> 





      reply	other threads:[~2024-04-29 18:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 15:02 [PATCH] ASoC: sunxi: DMIC: Add controls for adjusting the mic gains Joao Schim
2024-04-24 18:42 ` Jernej Škrabec
2024-04-25 11:03   ` Joao Schim
2024-04-26 14:39     ` Jernej Škrabec
2024-04-29 18:39       ` Joao Schim
2024-04-29 18:47         ` Jernej Škrabec [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2179677.irdbgypaU6@jernej-laptop \
    --to=jernej.skrabec@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=fengzheng923@gmail.com \
    --cc=joao@schimsalabim.eu \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=perex@perex.cz \
    --cc=samuel@sholland.org \
    --cc=tiwai@suse.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).