Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Gianluca Boiano <morf3089@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Gianluca Boiano <morf3089@gmail.com>,
	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>,
	Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
	Baojun Xu <baojun.xu@ti.com>,
	linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] ASoC: codecs: add TAS2557 mono smart amplifier driver
Date: Sat, 11 Jul 2026 13:40:08 +0200	[thread overview]
Message-ID: <20260711114009.73094-1-morf3089@gmail.com> (raw)
In-Reply-To: <e1471661-cf25-4db4-9a77-48d726811a51@sirena.org.uk>

> +	TAS2557_GPIO6_PIN_REG,            0x01,	/* GPIO6 = ASI2 WCLK input */
> +	TAS2557_GPIO8_PIN_REG,            0x02,	/* GPIO8 = ASI2 DIN */
> +	TAS2557_GPIO5_PIN_REG,            0x01,	/* GPIO5 = ASI2 BCLK input */
>
> This looks suspicously board specific, it should probably come from
> device tree.

It's board specific, and it's not even a TI reference sequence -
checked their Android driver, it never touches ASI2/GPIO5-8 at all,
only ASI1/GPIO1-2. All four boards on this branch happen to share the
same wiring, which is how it ended up hardcoded. Will add DT
properties for the ASI2 pin assignment in a follow-up, defaulting to
today's values.

> +	TAS2557_ASI2_DAC_FORMAT_REG,      0x18,	/* ASI2: 32-bit I2S */
>
> This should be set_dai_fmt().

Fixed in v2: the format is cached in set_dai_fmt() and reapplied in
tas2557_enable() after the reset, so the startup_data write no longer
wins.

> +	TAS2557_ASI2_BDIV_CLK_SEL_REG,   0x01,
> +	TAS2557_ASI2_BDIV_CLK_RATIO_REG, 0x01,
> +	TAS2557_ASI2_BDIV_CLK_RATIO_REG, 0x81,	/* power up BDIV */
> +	TAS2557_ASI2_WDIV_CLK_RATIO_REG, 0x40,
> +	TAS2557_ASI2_WDIV_CLK_RATIO_REG, 0xc0,	/* power up WDIV */
>
> Can't these be worked out dynamically?

No, not from anything the driver has. TI's own driver never writes
these two registers on any board, and unlike every other multi-bit
register in their header, there's no bitfield documentation for them.
GPIO5/6 are wired as ASI2 BCLK/WCLK inputs here, so the chip is a
clock slave on this interface; BDIV/WDIV sit next to the CLKOUT mux
registers in the map, which points to them being master-mode
clock-generation taps, not something a slave needs. Leaving them as
fixed constants.

> +	TAS2557_POWER_CTRL2_REG, 0xA3,		/* Class-D, Boost, IV-sense power up */
>
> tas2557_isense_put() also writes to this register, there's a
> disconnect with blind writing.

Fixed in v2: enable() now reasserts ISENSE/VSENSE from the cached
switch state right after startup_data, so the mixer controls and the
hardcoded 0xA3 don't fight anymore.

> Is there any overlap with other TI firmware parsers?

Checked tas2781-fmwlib.c. Same magic (0x35353532) but the formats
diverge immediately after: tas2557's header has DDC-name/description
fields tas2781's doesn't, tas2557 needs a PLL block loaded before
power-up which none of tas2781's parser variants have, and tas2781's
parser is built around its multi-amplifier device-index model that
tas2557 doesn't use. Not sharing code between them.

> +	if (!tas2557->fw || !tas2557->powered) {
> +		mutex_unlock(&tas2557->lock);
> +		return IRQ_HANDLED;
> +	}
>
> We definitely didn't handle an IRQ in this case - this will break
> sharing and debug features in the interrupt core.

Fixed in v2, returns IRQ_NONE there.

> +	tas2557_dev_write(tas2557, TAS2557_GPIO4_PIN_REG, 0x00);
>
> Is GPIO4 the only line that can be an interrupt source?

No, any GPIO can be assigned INT via its own PIN_REG. Same situation
as the ASI2 pins above - hardcoded because all four current boards
use GPIO4, rolling it into the same DT-properties follow-up.

Gianluca

      reply	other threads:[~2026-07-11 11:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 22:13 [PATCH v1 0/2] ASoC: codecs: add Texas Instruments TAS2557 smart amplifier driver Gianluca Boiano
2026-07-09 22:13 ` [PATCH v1 1/2] dt-bindings: sound: add Texas Instruments TAS2557 Gianluca Boiano
2026-07-10  4:10   ` Wang, Sen
2026-07-11 11:39     ` Gianluca Boiano
2026-07-10 12:49   ` Mark Brown
2026-07-11 11:39     ` Gianluca Boiano
2026-07-09 22:13 ` [PATCH v1 2/2] ASoC: codecs: add TAS2557 mono smart amplifier driver Gianluca Boiano
2026-07-10  4:40   ` Wang, Sen
2026-07-10 12:45     ` Mark Brown
2026-07-11 11:39     ` Gianluca Boiano
2026-07-10 13:55   ` Mark Brown
2026-07-11 11:40     ` Gianluca Boiano [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=20260711114009.73094-1-morf3089@gmail.com \
    --to=morf3089@gmail.com \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=shenghao-ding@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox