public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
Cc: lgirdwood@gmail.com, broonie@kernel.org,
	linux-sound@vger.kernel.org, kai.vehmanen@linux.intel.com,
	seppo.ingalsuo@linux.intel.com, stable@vger.kernel.org,
	niranjan.hy@ti.com
Subject: Re: [PATCH] ASoC: soc-ops: Correct the max value for clamp in soc_mixer_reg_to_ctl()
Date: Wed, 17 Dec 2025 15:00:17 +0000	[thread overview]
Message-ID: <aULFgS9sV0uy4wNN@opensource.cirrus.com> (raw)
In-Reply-To: <a367ee5f-c46f-470f-976c-011ac9cfc55b@linux.intel.com>

On Wed, Dec 17, 2025 at 04:31:37PM +0200, Péter Ujfalusi wrote:
> On 17/12/2025 15:42, Charles Keepax wrote:
> > On Wed, Dec 17, 2025 at 03:13:45PM +0200, Péter Ujfalusi wrote:
> >> On 17/12/2025 14:47, Charles Keepax wrote:
> >>> On Wed, Dec 17, 2025 at 02:06:23PM +0200, Peter Ujfalusi wrote:
> > you drop the sign bit giving you:
> > 
> > 0x6 -> -2dB
> > 0x7 -> -1dB
> > 0x0 -> 0dB
> > 0x1 -> 1dB
> > 0x2 -> 2dB
> 
> I must say, wow.
> Being a SW guy I would probably done this differently:
> 0x0 -> -2dB
> 0x1 -> -1dB
> 0x2 -> 0dB
> 0x3 -> 1dB
> 0x4 -> 2dB

Yes that is exactly what I would have done too :-) but then
that is probably why we arn't hardware guys, would make life too
easy for the software guys.

> > This then results in an SX control with a minimum of 0x6 and a
> > mask of 0x7.
> 
> then the comment at info() is hard to match still.

Yeah I think the wording "min is the minimum register value" is
perhaps slightly misleading. It is the register value that equates to the
lowest volume, but that isn't necessarily the minimum value that
can be written into the register.

If I can find a spare minute I will ping up a patch to tweak
that.

> static const DECLARE_TLV_DB_RANGE(sx_thing,
> 	6, 7, TLV_DB_SCALE_ITEM(-2000, -1000, 0),
> 	0, 2, TLV_DB_SCALE_ITEM(0, 1000, 0)
> };
> 
> is sort of the same, no?

Similar but some issues, I think it would let you write values
that arn't valid. The control would be fairly confusing to a
manual user, as the values are not strictly increasing. And I
would imagine it blows up most user-space stuff, which likely
also assumes all values are valid and strictly increasing.

> Thanks for the explanation, fascinating!

No problem, I would be a rich man if I had a pound for each
minute I have spent chasing SX control gremlins.

Thanks,
Charles

      reply	other threads:[~2025-12-17 15:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17 12:06 [PATCH] ASoC: soc-ops: Correct the max value for clamp in soc_mixer_reg_to_ctl() Peter Ujfalusi
2025-12-17 12:16 ` Mark Brown
2025-12-17 12:20   ` Péter Ujfalusi
2025-12-17 12:36     ` Richard Fitzgerald
2025-12-17 12:38       ` Péter Ujfalusi
2025-12-17 12:40         ` Richard Fitzgerald
2025-12-17 12:44           ` Mark Brown
2025-12-17 13:01           ` Péter Ujfalusi
2025-12-17 13:16             ` Richard Fitzgerald
2025-12-17 13:54               ` Péter Ujfalusi
2025-12-17 13:56                 ` Mark Brown
2025-12-17 13:59                   ` Péter Ujfalusi
2025-12-17 14:00                     ` Mark Brown
2025-12-17 14:19                       ` Péter Ujfalusi
2025-12-17 14:22                         ` Mark Brown
2025-12-17 13:18       ` Mark Brown
2025-12-17 12:17 ` Péter Ujfalusi
2025-12-17 12:47 ` Charles Keepax
2025-12-17 13:13   ` Péter Ujfalusi
2025-12-17 13:42     ` Charles Keepax
2025-12-17 14:31       ` Péter Ujfalusi
2025-12-17 15:00         ` Charles Keepax [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=aULFgS9sV0uy4wNN@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=niranjan.hy@ti.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=seppo.ingalsuo@linux.intel.com \
    --cc=stable@vger.kernel.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