mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Luca Weiss <luca@lucaweiss.eu>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
	phone-devel@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Weidong Wang <wangweidong.a@awinic.com>,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v2 2/3] ASoC: codecs: Add Awinic AW8898 amplifier driver
Date: Mon, 7 Jul 2025 13:02:20 +0100	[thread overview]
Message-ID: <57472ea1-a9c1-472b-a178-eae1cb207468@sirena.org.uk> (raw)
In-Reply-To: <20250705-aw8898-v2-2-9c3adb1fc1a2@lucaweiss.eu>

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

On Sat, Jul 05, 2025 at 02:03:06PM +0200, Luca Weiss wrote:

> +static void aw8898_update_dev_mode(struct aw8898 *aw8898)
> +{
> +	unsigned int mode = AW8898_SYSCTRL_SPK_MODE;
> +
> +	if (aw8898->dev_mode == AW8898_RECEIVER)
> +		mode = AW8898_SYSCTRL_RCV_MODE;
> +
> +	regmap_update_bits(aw8898->regmap, AW8898_SYSCTRL,
> +			   AW8898_SYSCTRL_MODE_MASK,
> +			   FIELD_PREP(AW8898_SYSCTRL_MODE_MASK, mode));
> +}

Why is this open coded rather than just being a standard enum?  AFAICT
we never reference dev_mode outside of here or the _get() and put()
callbacks.  You might be looking for a _VALUE_ENUM?

> +	if (!fw) {
> +		dev_err(&aw8898->client->dev, "Failed to load firmware\n");
> +		return;
> +	}
> +
> +	dev_dbg(&aw8898->client->dev, "Loaded %s - size: %zu\n", AW8898_CFG_NAME, fw->size);

We print the firmware name we were looking for if we loaded it, but not
if we failed to load it when it's probably more useful.

> +	aw8898_cfg_write(aw8898, aw8898_cfg);

The "firmware" here is just a list of arbatrary register writes with no
validation of addresses or anything...

> +	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
> +	case SND_SOC_DAIFMT_I2S:
> +		if ((fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK)
> +				!= SND_SOC_DAIFMT_CBC_CFC) {
> +			dev_err(component->dev, "Invalid codec master mode: %d\n",

Clock provider mode.

> +static int aw8898_startup(struct snd_pcm_substream *substream,
> +               struct snd_soc_dai *dai)
> +{
> +	struct aw8898 *aw8898 = snd_soc_component_get_drvdata(dai->component);
> +	unsigned int val;
> +	int err;
> +
> +	err = regmap_read_poll_timeout(aw8898->regmap, AW8898_SYSST,
> +				       val, val & AW8898_SYSST_PLLS,
> +				       2000, 1 * USEC_PER_SEC);

What's this actually checking?  You shouldn't rely on I2S being clocked
prior to trigger...

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

  parent reply	other threads:[~2025-07-07 12:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-05 12:03 [PATCH v2 0/3] Add support for AW8898 Amplifier Luca Weiss
2025-07-05 12:03 ` [PATCH v2 1/3] ASoC: dt-bindings: Document Awinic AW8898 amplifier Luca Weiss
2025-07-05 12:03 ` [PATCH v2 2/3] ASoC: codecs: Add Awinic AW8898 amplifier driver Luca Weiss
2025-07-06  8:35   ` Christophe JAILLET
2025-07-07 12:02   ` Mark Brown [this message]
2025-07-07 15:52     ` Luca Weiss
2025-07-07 16:03       ` Mark Brown
2025-07-05 12:03 ` [PATCH v2 3/3] arm64: dts: qcom: sdm632-fairphone-fp3: Add AW8898 amplifier Luca Weiss

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=57472ea1-a9c1-472b-a178-eae1cb207468@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=luca@lucaweiss.eu \
    --cc=perex@perex.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=tiwai@suse.com \
    --cc=wangweidong.a@awinic.com \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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®