Linux Sound subsystem development
 help / color / mirror / Atom feed
From: "Sheetal ." <sheetal@nvidia.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Thierry Reding <thierry.reding@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Sameer Pujar <spujar@nvidia.com>,
	Mohan Kumar <mkumard@nvidia.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	linux-sound@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ASoC: tegra: Add per-stream Mixer Fade controls
Date: Thu, 30 Apr 2026 15:12:08 +0530	[thread overview]
Message-ID: <f6200923-d796-4ac1-85d8-3ed7383b90a0@nvidia.com> (raw)
In-Reply-To: <afLv3S6kWnt0D6PW@sirena.co.uk>



On 30-04-2026 11:29, Mark Brown wrote:
> On Wed, Apr 29, 2026 at 07:06:03AM +0000, Sheetal wrote:
>> Add per-stream fade controls for the Tegra mixer to allow
>> independently configuring target gain and fade duration for each of
>> the 10 input streams (RX1 through RX10).
> 
>> +static int tegra210_mixer_get_fade_status(struct snd_kcontrol *kcontrol,
>> +					  struct snd_ctl_elem_value *ucontrol)
>> +{
> 
>> +		if (count >= mixer->duration[id]) {
>> +			ucontrol->value.integer.value[id] = TEGRA210_MIXER_FADE_COMPLETE;
>> +			regmap_update_bits(mixer->regmap,
>> +					   MIXER_REG(TEGRA210_MIXER_RX1_CTRL, id),
>> +					   TEGRA210_MIXER_SAMPLE_COUNT_ENABLE, 0);
>> +			mixer->in_fade[id] = false;
>> +		} else {
>> +			ucontrol->value.integer.value[id] = TEGRA210_MIXER_FADE_ACTIVE;
>> +		}
> 
> Is the _FADE_COMPLETE state a good idea here?  Only the first read after
> a fade will show it, and functionally it's the same as _IDLE - there's
> no current fade running.
> 

Yes makes sense, will keep IDLE(0) and ACTIVE(1)

> Also is there any overhead to having the sample counting enabled?  This
> is the only thing that turns it off AFAICT so if userspace doesn't look
> at the control we'll just leave it running indefinitely.  Perhaps a
> timer to disable might be useful?  It's generally a bit odd that we have
> a write to the hardware in a get().
> 


Rather than a timer (which would require sample rate tracking to convert 
the sample-based duration to wall-clock time), sample count will be 
disabled before re-enabling it in the put callback, ensuring the counter 
restarts from zero for each new fade. Does that sound reasonable, or 
would you prefer a different approach?


>> +	SOC_SINGLE_EXT("Fade Enable", SND_SOC_NOPM, 0, 1, 0,
>> +		       tegra210_mixer_get_fade_enable,
>> +		       tegra210_mixer_put_fade_enable),
> 
> Fade Switch.
> 

Ack

>>   struct tegra210_mixer {
>>   	int gain_value[TEGRA210_MIXER_RX_MAX];
>> +	u32 duration[TEGRA210_MIXER_RX_MAX];
>> +	bool in_fade[TEGRA210_MIXER_RX_MAX];
>> +	bool fade_pending[TEGRA210_MIXER_RX_MAX];
>>   	struct regmap *regmap;
>>   };
> 
> gain_value is used by the existing RX n Gain Volume controls, don't we
> need separate data for the fade controls here, or should we just have
> the new Fade Gain controls?  Having the separate controls is more
> complicated.


The existing "RXn Gain Volume" applies gain immediately on each put 
call, while Fade Gain needs to be staged until the Fade Switch strobe is 
triggered. Sharing gain_value would break this staged semantics, so a 
separate fade_gain[] field keeps the two independent.



  reply	other threads:[~2026-04-30  9:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29  7:06 [PATCH v2] ASoC: tegra: Add per-stream Mixer Fade controls Sheetal
2026-04-30  5:59 ` Mark Brown
2026-04-30  9:42   ` Sheetal . [this message]
2026-04-30 10:41     ` Mark Brown

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=f6200923-d796-4ac1-85d8-3ed7383b90a0@nvidia.com \
    --to=sheetal@nvidia.com \
    --cc=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mkumard@nvidia.com \
    --cc=perex@perex.cz \
    --cc=spujar@nvidia.com \
    --cc=thierry.reding@kernel.org \
    --cc=tiwai@suse.com \
    /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