devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Lee Jones <lee@kernel.org>
Cc: <broonie@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<linus.walleij@linaro.org>, <vkoul@kernel.org>,
	<robh+dt@kernel.org>, <conor+dt@kernel.org>,
	<lgirdwood@gmail.com>, <yung-chuan.liao@linux.intel.com>,
	<sanyog.r.kale@intel.com>, <pierre-louis.bossart@linux.intel.com>,
	<alsa-devel@alsa-project.org>, <patches@opensource.cirrus.com>,
	<devicetree@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 3/6] mfd: cs42l43: Add support for cs42l43 core driver
Date: Mon, 19 Jun 2023 08:52:44 +0000	[thread overview]
Message-ID: <20230619085244.GU68926@ediswmail.ad.cirrus.com> (raw)
In-Reply-To: <20230619083005.GN3635807@google.com>

On Mon, Jun 19, 2023 at 09:30:05AM +0100, Lee Jones wrote:
> On Fri, 16 Jun 2023, Charles Keepax wrote:
> > On Thu, Jun 15, 2023 at 06:11:24PM +0100, Lee Jones wrote:
> > > On Mon, 05 Jun 2023, Charles Keepax wrote:
> > > > +static struct i2c_device_id cs42l43_i2c_id[] = {
> > > > +	{ "cs42l43", 0 },
> > > > +	{}
> > > > +};
> > > > +MODULE_DEVICE_TABLE(i2c, cs42l43_i2c_id);
> > > 
> > > Is this required anymore?
> > > 
> > 
> > I was not aware of it not being required, I think it will still
> > be used for the purposes of module naming. Perhaps someone more
> > knowledgable than me can comment?
> 
> Since this table isn't providing any information which cannot be derived
> from the other (OF, ACPI) tables, the I2C subsystem should be able to
> obtain it from those sources instead.
> 

Sorry I literally just sent a v4 then saw this email. I will test
removing this table and send a v5.

> > > > +#if IS_ENABLED(CONFIG_MFD_CS42L43_I2C)
> > > > +const struct regmap_config cs42l43_i2c_regmap = {
> > > > +	.reg_bits		= 32,
> > > > +	.reg_stride		= 4,
> > > > +	.val_bits		= 32,
> > > > +	.reg_format_endian	= REGMAP_ENDIAN_BIG,
> > > > +	.val_format_endian	= REGMAP_ENDIAN_BIG,
> > > > +
> > > > +	.max_register		= CS42L43_MCU_RAM_MAX,
> > > > +	.readable_reg		= cs42l43_readable_register,
> > > > +	.volatile_reg		= cs42l43_volatile_register,
> > > > +	.precious_reg		= cs42l43_precious_register,
> > > > +
> > > > +	.cache_type		= REGCACHE_RBTREE,
> > > > +	.reg_defaults		= cs42l43_reg_default,
> > > > +	.num_reg_defaults	= ARRAY_SIZE(cs42l43_reg_default),
> > > > +};
> > > > +EXPORT_SYMBOL_NS_GPL(cs42l43_i2c_regmap, MFD_CS42L43);
> > > > +#endif
> > > 
> > > We don't tend to like #ifery in C files.
> > > 
> > > Why is it required?
> > > 
> > > And why not just put them were they're consumed?
> > 
> > The trouble is the cs42l43_reg_default array and the array size.
> > There is no good way to statically initialise those two fields
> > from a single array in both the I2C and SDW modules.
> 
> Can you have a little think for another way to solve this please?
> 

I will have another go at it, if memory serves the vague options
were:

1) this approach
2) some sort of horrible #include to put the defaults array in
both modules, although I would really prefer to avoid this one.
3) dynamically allocate the regmap_configs so those two fields
can be filled in with non-static data.

If I fail to come up with an option 4 would you prefer 1 or 3?
Well or 2 but I really would prefer not to do 2.

> > > Perhaps some simple function headers would help?
> > You mean add some kernel doc for these functions, right? Assuming
> > that is what you mean, will do.
> 
> I'd suggest not using kernel-doc formatting, but that type of thing,
> yes.

Ok I will remove the kernel doc bits for v5.

Thanks,
Charles

  reply	other threads:[~2023-06-19  8:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 12:54 [PATCH v3 0/6] Add cs42l43 PC focused SoundWire CODEC Charles Keepax
2023-06-05 12:54 ` [PATCH v3 1/6] soundwire: bus: Allow SoundWire peripherals to register IRQ handlers Charles Keepax
2023-06-15 22:14   ` andy.shevchenko
2023-06-16 16:01     ` Charles Keepax
2023-06-05 12:55 ` [PATCH v3 2/6] dt-bindings: mfd: cirrus,cs42l43: Add initial DT binding Charles Keepax
2023-06-06  8:49   ` Krzysztof Kozlowski
2023-06-05 12:55 ` [PATCH v3 3/6] mfd: cs42l43: Add support for cs42l43 core driver Charles Keepax
2023-06-15 17:11   ` Lee Jones
2023-06-16  8:34     ` Charles Keepax
2023-06-19  8:30       ` Lee Jones
2023-06-19  8:52         ` Charles Keepax [this message]
2023-06-19  9:11           ` Charles Keepax
2023-06-05 12:55 ` [PATCH v3 4/6] pinctrl: cs42l43: Add support for the cs42l43 Charles Keepax
2023-06-05 12:55 ` [PATCH v3 5/6] spi: cs42l43: Add SPI controller support Charles Keepax
2023-06-05 12:55 ` [PATCH v3 6/6] ASoC: cs42l43: Add support for the cs42l43 Charles Keepax

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=20230619085244.GU68926@ediswmail.ad.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sanyog.r.kale@intel.com \
    --cc=vkoul@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).