From: Jun Yan <jerrysteve1101@gmail.com>
To: broonie@kernel.org
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, heiko@sntech.de,
jerrysteve1101@gmail.com, krzk+dt@kernel.org,
lgirdwood@gmail.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-sound@vger.kernel.org, perex@perex.cz, robh@kernel.org,
tiwai@suse.com
Subject: Re: [PATCH v2 2/2] ASoC: codecs: add support for Everest ES7202 PDM ADC
Date: Sat, 31 Oct 2026 22:15:46 +0800 [thread overview]
Message-ID: <20261031141546.153385-1-jerrysteve1101@gmail.com> (raw)
In-Reply-To: <179330018771.62540.301527067818961107.b4-review@b4>
Hi,
Thanks for your review.
> > Add support for the Everest ES7202, a 2-channel PDM analog-to-digital
> > converter controlled over I2C. The device outputs PDM data to the SoC
> > PDM controller and is configured through registers for supply voltage,
> > analog front-end and per-channel PGA gain.
>
> This looks pretty good, a few relatively minor issues below but nothing
> major.
>
> > --- a/sound/soc/codecs/Kconfig
> > +++ b/sound/soc/codecs/Kconfig
> > @@ -1274,6 +1274,16 @@ config SND_SOC_HDMI_CODEC
> > config SND_SOC_ES7134
> > tristate "Everest Semi ES7134 CODEC"
> >
> > +config SND_SOC_ES7202
> > + tristate "Everest Semi ES7202 CODEC"
> > + depends on I2C
> > + select REGMAP_I2C
>
> You should also add this to SND_SOC_ALL_CODECS.
Added.
>
> > --- /dev/null
> > +++ b/sound/soc/codecs/es7202.c
> > @@ -0,0 +1,367 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * Copyright (C) 2020 Everest Semiconductor Co Ltd.,
> > + * Copyright (C) 2026 Jun Yan <jerrysteve1101@gmail.com>
> > + */
>
> Please make the whole comment block C++ so things look more intentional.
Done.
>
> > +#include <linux/bitfield.h>
> > +#include <linux/delay.h>
> > +#include <linux/device.h>
> > +#include <linux/gpio/consumer.h>
> > +#include <linux/i2c.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/regmap.h>
> > +#include <linux/regulator/consumer.h>
> > +#include <sound/pcm.h>
> > +#include <sound/pcm_params.h>
>
> linux/of.h and sound/pcm_params.h aren't needed I think.
>
Right, both removed.
> > +static bool es7202_volatile_reg(struct device *dev, unsigned int reg)
> > +{
> > + /* status and device-id registers are read-only, never cached */
> > + return reg == ES7202_CHIP_STA ||
> > + reg == ES7202_DEV_ID1 ||
> > + reg == ES7202_DEV_ID0;
> > +}
>
> A switch statement would be neater and would probably generate
> equivalent code. Are you sure that the ID registers are actually
> volatile, that's quite unusual? If they've volatile the hardware is
> accessed on each read, if you just omit the default then they will be
> cached after the first read.
>
Thanks for catching this. The ID registers are static and don't need
volatile marking. I'll drop them from es7202_volatile_reg() and use
.writeable_reg to make them read-only, so they are still cached after
the first read but skipped by regcache_sync().
> Also should the rest register be uncached so we don't try to write it
> back out as part of a cache sync by mistake?
>
Agreed, I missed this. I'll mark ES7202_RESET volatile so it can't be
written back during a cache sync.
> > +static const struct regmap_config es7202_regmap = {
> > + .reg_bits = 8,
> > + .val_bits = 8,
> > + .max_register = ES7202_DEV_ID0,
> > + .reg_defaults = es7202_reg_defaults,
> > + .num_reg_defaults = ARRAY_SIZE(es7202_reg_defaults),
> > + .volatile_reg = es7202_volatile_reg,
> > + .cache_type = REGCACHE_MAPLE,
>
> I notice that other Everest devices set use_single_read and
> use_single_write - especially for write we can easily trigger
> multi-register write as part of a regcache sync so if the device lacks
> support it'll create bugs.
>
Thanks. The other Everest codecs are the only precedent here - the
ES7202 datasheet does not document multi-register (auto-increment)
writes, so I cannot rely on them. I'll set use_single_read and
use_single_write so a regcache sync can never turn into a burst write.
> > + es7202->supply = devm_regulator_get_optional(dev, "vdd");
> > + if (IS_ERR(es7202->supply)) {
>
> Unless the device can operate without power this should be a normal
> regulator_get(), the core will substitude a dummy regulator if it's not
> configurd by the firmware.
>
Right, VDD supply is required. I'll use devm_regulator_get() instead.
I'll send a v3 with these changes.
> --
> Mark Brown <broonie@kernel.org>
prev parent reply other threads:[~2026-10-31 14:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 12:45 [PATCH v2 0/2] ASoC: codecs: Add Everest ES7202 support Jun Yan
2026-10-21 12:45 ` [PATCH v2 1/2] dt-bindings: sound: add Everest ES7202 Jun Yan
2026-10-30 17:23 ` Rob Herring (Arm)
2026-10-21 12:45 ` [PATCH v2 2/2] ASoC: codecs: add support for Everest ES7202 PDM ADC Jun Yan
2026-10-29 18:56 ` Mark Brown
2026-10-31 14:15 ` Jun Yan [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=20261031141546.153385-1-jerrysteve1101@gmail.com \
--to=jerrysteve1101@gmail.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--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 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®