From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: Niranjan H Y <niranjan.hy@ti.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.com, cezary.rojewski@intel.com,
peter.ujfalusi@linux.intel.com, yung-chuan.liao@linux.intel.com,
ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
baojun.xu@ti.com, shenghao-ding@ti.com, sandeepk@ti.com,
v-hampiholi@ti.com
Subject: Re: [PATCH v1 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver
Date: Tue, 24 Mar 2026 09:59:01 +0000 [thread overview]
Message-ID: <acJgZV3MuxmbPIb4@opensource.cirrus.com> (raw)
In-Reply-To: <b79e1263-e696-45a1-a335-e023058ad035@linux.dev>
On Mon, Mar 23, 2026 at 02:40:42PM -0700, Pierre-Louis Bossart wrote:
> > +/* Convert dB to Q7.8 format (16-bit signed value) */
> > +static inline u16 db_to_q7_8(int db_value_times_100)
> > +{
> > + u16 result = (u16)(((db_value_times_100 * 256) / 100) & 0xFFFF);
> > + return result;
> > +}
> > +
> > +/* Convert Q7.8 format to dB*100 */
> > +static inline int q7_8_to_db_times_100(u16 q7_8_value)
> > +{
> > + s16 signed_val = (s16)q7_8_value;
> > +
> > + return (signed_val * 100) / 256;
> > +}
>
> Didn't Charles Keepax add some macros for the Q7.8 format?
Me and Shuming Fan did some work on this in the SDCA class driver,
it is currently based on a slightly different system using the
TLV to map to dB's where as this code seems to present 100ths
of a dB directly. The problem with that approach however is you
tend to loose some precision as you generally don't end up with
a 1-to-1 mapping from control values to register values.
The helpers are not currently seperately exported although
no reason they couldn't be. q78_put_volsw and q78_get_volsw
in sdca_asoc.c.
Thanks,
Charles
next prev parent reply other threads:[~2026-03-24 9:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 4:15 [PATCH v1 2/4] ASoC: tac5xx2-sdw: add soundwire based codec driver Niranjan H Y
2026-03-23 21:40 ` Pierre-Louis Bossart
2026-03-24 9:59 ` Charles Keepax [this message]
2026-03-24 14:22 ` Holalu Yogendra, Niranjan
2026-03-24 10:53 ` Charles Keepax
2026-03-24 15:40 ` [EXTERNAL] " Holalu Yogendra, Niranjan
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=acJgZV3MuxmbPIb4@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=niranjan.hy@ti.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sandeepk@ti.com \
--cc=shenghao-ding@ti.com \
--cc=tiwai@suse.com \
--cc=v-hampiholi@ti.com \
--cc=yung-chuan.liao@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.