From: Herve Codina <herve.codina@bootlin.com>
To: Mark Brown <broonie@kernel.org>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-kernel@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
linux-gpio@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH 2/3] ASoC: codecs: Add support for the Renesas IDT821034 codec
Date: Fri, 13 Jan 2023 09:04:31 +0100 [thread overview]
Message-ID: <20230113090431.7f84c93a@bootlin.com> (raw)
In-Reply-To: <Y774bY4icD8RuMnX@sirena.org.uk>
Hi Mark,
On Wed, 11 Jan 2023 17:57:01 +0000
Mark Brown <broonie@kernel.org> wrote:
> On Wed, Jan 11, 2023 at 05:40:22PM +0100, Herve Codina wrote:
> > Mark Brown <broonie@kernel.org> wrote:
> > > On Wed, Jan 11, 2023 at 02:49:04PM +0100, Herve Codina wrote:
>
> > > Without knowing why things are written in this way or what it's trying
> > > to accomplish it's hard to comment in detail on what specifically should
> > > be done.
>
> > Yes, I use regmap to ease the integration of controls and use the
> > already defined controls macros but the device registers do not fit
> > well with regmap.
>
> If this doesn't fit into regmap then don't try to shoehorn it into
> regmap, that just makes it incredibly hard to follow what's going on.
>
> > The device registers are not defined as simple as address/value pairs.
> > Accesses contains one or more bytes and the signification of the
> > data (and bytes) depends on the first bits.
> > - 0b10xxxxxx means 'Control register' with some data as xxxxxx
> > and one extra byte
> > - 0b1101yyyy means 'Configuration register, slic mode' with
> > some other data as yyyy and one extra byte
> > - 0b1100zzzz means 'Configuration register, gain mode' with
> > some other data as zzzz and two extra bytes
>
> So really the device only has three registers, each of different sizes
> and windowed fields within those registers? I love innovation,
> innovation is great and it's good that our hardware design colleagues
> work so hard to keep us in jobs. It seems hardly worth it to treat them
> as registers TBH. This is so far off a register/value type thing that I
> just wouldn't even try.
>
> > Of course, I can describe all of these in details.
> > Where do you want to have this information ? All at the top
> > of the file ? Each part (low-level, virtual regs, ...) at
> > the beginning of each part in the code ?
>
> I'm not sure what problem it solves to use regmap or have virtual
> registers in the first place. I think you would be better off with
> custom _EXT controls, you almost have that anway just hidden in the
> middle of the fake register stuff instead of directly there. My sense
> is that the result would be much less code. If you are trying to map
> things onto registers you probably want comments at every level since
> you don't know where people are going to end up jumping into the code.
>
> Perhaps it's possible to write some new SND_SOC_ helpers that work with
> just a value in the device's driver data rather than a regmap and have
> a callback to trigger a write to the device? I suspect that'd be
> generally useful actually...
Well, I wil try to use my own .put() and .get() for snd_controls.
For DAPM (struct snd_soc_dapm_widget), no kind of .put() and .get()
are available. I will use some Ids for the 'reg' value and use the
.write() and .read() hooks available in struct snd_soc_component_driver
in order to handle these Ids and so perform the accesses.
Do you think this can be the right way (at least for a first try) ?
Best regards,
Hervé
--
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
WARNING: multiple messages have this Message-ID (diff)
From: Herve Codina <herve.codina@bootlin.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 2/3] ASoC: codecs: Add support for the Renesas IDT821034 codec
Date: Fri, 13 Jan 2023 09:04:31 +0100 [thread overview]
Message-ID: <20230113090431.7f84c93a@bootlin.com> (raw)
In-Reply-To: <Y774bY4icD8RuMnX@sirena.org.uk>
Hi Mark,
On Wed, 11 Jan 2023 17:57:01 +0000
Mark Brown <broonie@kernel.org> wrote:
> On Wed, Jan 11, 2023 at 05:40:22PM +0100, Herve Codina wrote:
> > Mark Brown <broonie@kernel.org> wrote:
> > > On Wed, Jan 11, 2023 at 02:49:04PM +0100, Herve Codina wrote:
>
> > > Without knowing why things are written in this way or what it's trying
> > > to accomplish it's hard to comment in detail on what specifically should
> > > be done.
>
> > Yes, I use regmap to ease the integration of controls and use the
> > already defined controls macros but the device registers do not fit
> > well with regmap.
>
> If this doesn't fit into regmap then don't try to shoehorn it into
> regmap, that just makes it incredibly hard to follow what's going on.
>
> > The device registers are not defined as simple as address/value pairs.
> > Accesses contains one or more bytes and the signification of the
> > data (and bytes) depends on the first bits.
> > - 0b10xxxxxx means 'Control register' with some data as xxxxxx
> > and one extra byte
> > - 0b1101yyyy means 'Configuration register, slic mode' with
> > some other data as yyyy and one extra byte
> > - 0b1100zzzz means 'Configuration register, gain mode' with
> > some other data as zzzz and two extra bytes
>
> So really the device only has three registers, each of different sizes
> and windowed fields within those registers? I love innovation,
> innovation is great and it's good that our hardware design colleagues
> work so hard to keep us in jobs. It seems hardly worth it to treat them
> as registers TBH. This is so far off a register/value type thing that I
> just wouldn't even try.
>
> > Of course, I can describe all of these in details.
> > Where do you want to have this information ? All at the top
> > of the file ? Each part (low-level, virtual regs, ...) at
> > the beginning of each part in the code ?
>
> I'm not sure what problem it solves to use regmap or have virtual
> registers in the first place. I think you would be better off with
> custom _EXT controls, you almost have that anway just hidden in the
> middle of the fake register stuff instead of directly there. My sense
> is that the result would be much less code. If you are trying to map
> things onto registers you probably want comments at every level since
> you don't know where people are going to end up jumping into the code.
>
> Perhaps it's possible to write some new SND_SOC_ helpers that work with
> just a value in the device's driver data rather than a regmap and have
> a callback to trigger a write to the device? I suspect that'd be
> generally useful actually...
Well, I wil try to use my own .put() and .get() for snd_controls.
For DAPM (struct snd_soc_dapm_widget), no kind of .put() and .get()
are available. I will use some Ids for the 'reg' value and use the
.write() and .read() hooks available in struct snd_soc_component_driver
in order to handle these Ids and so perform the accesses.
Do you think this can be the right way (at least for a first try) ?
Best regards,
Hervé
--
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2023-01-13 8:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 13:49 [PATCH 0/3] Add the Renesas IDT821034 codec support Herve Codina
2023-01-11 13:49 ` Herve Codina
2023-01-11 13:49 ` [PATCH 1/3] dt-bindings: sound: Add Renesas IDT821034 codec Herve Codina
2023-01-11 13:49 ` Herve Codina
2023-01-11 16:28 ` Krzysztof Kozlowski
2023-01-11 16:28 ` Krzysztof Kozlowski
2023-01-11 16:55 ` Herve Codina
2023-01-11 16:55 ` Herve Codina
2023-01-11 13:49 ` [PATCH 2/3] ASoC: codecs: Add support for the " Herve Codina
2023-01-11 13:49 ` Herve Codina
2023-01-11 14:09 ` Mark Brown
2023-01-11 14:09 ` Mark Brown
2023-01-11 16:40 ` Herve Codina
2023-01-11 16:40 ` Herve Codina
2023-01-11 17:57 ` Mark Brown
2023-01-11 17:57 ` Mark Brown
2023-01-13 8:04 ` Herve Codina [this message]
2023-01-13 8:04 ` Herve Codina
2023-01-13 12:59 ` Mark Brown
2023-01-13 12:59 ` Mark Brown
2023-01-13 14:19 ` Herve Codina
2023-01-13 14:19 ` Herve Codina
2023-01-11 13:49 ` [PATCH 3/3] MAINTAINERS: add the Renesas IDT821034 codec entry Herve Codina
2023-01-11 13:49 ` Herve Codina
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=20230113090431.7f84c93a@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=alsa-devel@alsa-project.org \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--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 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.