mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: “Ryan <ryan.lee.analog@gmail.com>,
	lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	krzysztof.kozlowski@linaro.org, rf@opensource.cirrus.com,
	ckeepax@opensource.cirrus.com, herve.codina@bootlin.com,
	wangweidong.a@awinic.com, james.schulman@cirrus.com,
	ajye_huang@compal.corp-partner.google.com, shumingf@realtek.com,
	povik+lin@cutebit.org, flatmax@flatmax.com,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	robh+dt@kernel.org, devicetree@vger.kernel.org,
	ryans.lee@analog.com
Subject: Re: [PATCH 1/2] ASoC: max98363: add soundwire amplifier driver
Date: Mon, 27 Feb 2023 17:47:22 +0000	[thread overview]
Message-ID: <Y/zsqjOWFKrpDtl8@sirena.org.uk> (raw)
In-Reply-To: <0fb47fe7-719b-0773-fc14-3d62d7d33619@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]

On Mon, Feb 27, 2023 at 10:17:45AM -0500, Pierre-Louis Bossart wrote:

> > +static struct reg_default max98363_reg[] = {
> > +	{MAX98363_R0040_SCP_INIT_STAT_1, 0x00},
> > +	{MAX98363_R0041_SCP_INIT_MASK_1, 0x00},
> > +	{MAX98363_R0042_SCP_INIT_STAT_2, 0x00},
> > +	{MAX98363_R0044_SCP_CTRL, 0x00},
> > +	{MAX98363_R0045_SCP_SYSTEM_CTRL, 0x00},
> > +	{MAX98363_R0046_SCP_DEV_NUMBER, 0x00},
> > +	{MAX98363_R004D_SCP_BUS_CLK, 0x00},
> > +	{MAX98363_R0050_SCP_DEV_ID_0, 0x21},
> > +	{MAX98363_R0051_SCP_DEV_ID_1, 0x01},
> > +	{MAX98363_R0052_SCP_DEV_ID_2, 0x9F},
> > +	{MAX98363_R0053_SCP_DEV_ID_3, 0x87},
> > +	{MAX98363_R0054_SCP_DEV_ID_4, 0x08},
> > +	{MAX98363_R0055_SCP_DEV_ID_5, 0x00},

> That seems wrong, why would you declare standard registers that are
> known to the bus and required to be implemented?

This is the register defaults table, it gets used to initialise the
register cache and optimise resync after suspend - all this does is
supply defaults for the cache.  That said...

I would suggest it's better to not supply defaults for ID registers and
read them back from the device otherwise things might get confused.

> > +static const struct regmap_config max98363_sdw_regmap = {
> > +	.reg_bits = 32,
> > +	.val_bits = 8,
> > +	.max_register = MAX98363_R21FF_REV_ID,
> > +	.reg_defaults  = max98363_reg,
> > +	.num_reg_defaults = ARRAY_SIZE(max98363_reg),
> > +	.readable_reg = max98363_readable_register,
> > +	.volatile_reg = max98363_volatile_reg,

> I don't see why the SoundWire standard registers are part of regmap?

...if there's an issue with the SoundWire core modifying the registers
directly then the driver would need to mark all the core registers as
volatile so that they're not cached otherwise there will be collisions.
Or is it the case that we always need to go via the SoundWire core for
the generic registers, so they should just never be written at all?

> > +	if (max98363->dvddio) {
> > +		ret = regulator_enable(max98363->dvddio);
> > +		if (ret < 0)
> > +			return ret;
> > +	}
> > +
> > +	if (max98363->vdd) {
> > +		ret = regulator_enable(max98363->vdd);
> > +		if (ret < 0)
> > +			return ret;
> > +	}

> that is very very odd. It's the first time we see a SoundWire codec
> driver that has a power dependency, and it's quite likely that it's too
> late to enable power resources *AFTER* dealing with all the
> initialization and enumeration.

> It's not even clear to me how this device would be enumerated.

> You'd need to explain what part of the amplifier is controlled by those
> regulator, otherwise it's impossible to review and understand if the
> driver does the 'right thing'

It's also buggy to have regulators treated as optional unless they may
be physically absent.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2023-02-27 17:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  1:08 “Ryan
2023-02-24  1:08 ` [PATCH 2/2] ASoC: dt-bindings: " “Ryan
2023-02-24  9:59   ` Krzysztof Kozlowski
     [not found]   ` <167721259313.5904.2321260293669174372.robh@kernel.org>
2023-03-10  1:32     ` Lee, RyanS
2023-02-24  7:56 ` [PATCH 1/2] ASoC: " Nuno Sá
2023-03-10  1:34   ` Lee, RyanS
2023-02-27 15:17 ` Pierre-Louis Bossart
2023-02-27 17:47   ` Mark Brown [this message]
2023-02-27 18:19     ` Pierre-Louis Bossart
2023-02-27 18:44       ` Mark Brown
2023-02-27 22:37         ` Lee, RyanS
2023-02-27 23:38           ` Pierre-Louis Bossart
2023-03-10  1:37             ` Lee, RyanS
2023-03-10  1:36   ` Lee, RyanS

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=Y/zsqjOWFKrpDtl8@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=ajye_huang@compal.corp-partner.google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=devicetree@vger.kernel.org \
    --cc=flatmax@flatmax.com \
    --cc=herve.codina@bootlin.com \
    --cc=james.schulman@cirrus.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=povik+lin@cutebit.org \
    --cc=rf@opensource.cirrus.com \
    --cc=robh+dt@kernel.org \
    --cc=ryan.lee.analog@gmail.com \
    --cc=ryans.lee@analog.com \
    --cc=shumingf@realtek.com \
    --cc=tiwai@suse.com \
    --cc=wangweidong.a@awinic.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

all inboxes | Powered by JetHome®