linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: broonie@kernel.org, yung-chuan.liao@linux.intel.com,
	peter.ujfalusi@linux.intel.com, shumingf@realtek.com,
	lgirdwood@gmail.com, linux-sound@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: Re: [PATCH v3 RESEND 14/19] ASoC: SDCA: Add FDL library for XU entities
Date: Thu, 30 Oct 2025 11:01:06 +0000	[thread overview]
Message-ID: <aQNFcpAnoaMzRZD0@opensource.cirrus.com> (raw)
In-Reply-To: <39108baa-b379-4171-8426-c3b00a94e5f9@linux.dev>

On Mon, Oct 27, 2025 at 03:39:40PM +0100, Pierre-Louis Bossart wrote:
> > +config SND_SOC_SDCA_FDL
> > +	bool "SDCA FDL (File DownLoad) support"
> > +	depends on SND_SOC_SDCA
> > +	default y
> > +	help
> > +	  This option enables support for the File Download using UMP,
> > +	  typically used for downloading firmware to devices.
> 
> nit-pick: shouldn't this option be selected by device drivers
> who need this library?

These bits are all bools that add additional stuff into the main
SDCA module, so they do nothing if SDCA isn't selected. So the
device driver would just select SDCA generally speaking and I
think it makes sense if you enable SDCA that you get all the
functionality. If a certain config wants less they can disable
but that feels like its just for people really trying to size
optimise their kernel.

> There should be guardrails to prevent the fallback helpers from
> being used silently.

A top level driver has to bind to the device and it still
basically controls what happens, it has to register the stuff for
FDL to happen before it will happen.

> > +int sdca_reset_function(struct device *dev, struct sdca_function_data *function,
> > +			struct regmap *regmap)
> > +{
> > +	unsigned int reg = SDW_SDCA_CTL(function->desc->adr,
> > +					SDCA_ENTITY_TYPE_ENTITY_0,
> > +					SDCA_CTL_ENTITY_0_FUNCTION_ACTION, 0);
> > +	unsigned int val, poll_us;
> > +	int ret;
> > +
> > +	ret = regmap_write(regmap, reg, SDCA_CTL_ENTITY_0_RESET_FUNCTION_NOW);
> > +	if (ret) // Allowed for function reset to not be implemented
> > +		return 0;
> 
> nit-pick: maybe document why this is allowed. This doesn't seem
> very good in terms of design.

It's what the spec says, as often is the case I tend to agree with
you its not the best design decision. I guess perhaps the wording
could be tweaked but in general where the comments say this weird
thing is allowed/required they are referring to the spec.

> > +	if (!function->reset_max_delay) {
> > +		dev_err(dev, "No reset delay specified in DisCo\n");
> > +		return -EINVAL;
> > +	}
> 
> nit-pick: or maybe fallback to a reasonable default? Making the
> entire download dependent on Disco correctness isn't going to work
> long-term.

I don't have any objections to a default here, although it should
also have a comment to say why, since the spec requires this
property if function reset is implemented.

On a wider point I am not sure I totally agree with the DisCo
correctness point. I guess we have to cross those bridges as we find
them but in general an awful lot of this class driver relies on DisCo
correctness. We build the whole function topology from DisCo if that
is incorrect there is a fairly good chance the part won't work.
Although for the most part my thinking has been if someone stuffs
up the DisCo too badly they will have to implement a custom
driver to handle it rather than relying on the class driver, but
for cases like this I think we can be a little flexible.

> > +
> > +	poll_us = umin(function->reset_max_delay >> 4, 1000);
> 
> add comment on what this >> 4 means.

Yeah that could use a comment I will add one.

> > +	switch (response) {
> > +	case SDCA_CTL_XU_FDLH_RESET_ACK:
> > +		dev_dbg(dev, "FDL request reset\n");
> > +
> > +		switch (xu->reset_mechanism) {
> > +		default:
> > +			dev_warn(dev, "Requested reset mechanism not implemented\n");
> > +			fallthrough;
> 
> this fallthrough looks odd since it forces a check on the reset a second time ...
> 
> > +		case SDCA_XU_RESET_FUNCTION:
> > +			goto reset_function;
> > +		}
> > +	default:
> > +		return 0;
> > +	}
> > +
> > +reset_function:
> 
> ... inside this function call
> 
> > +	sdca_reset_function(dev, interrupt->function, interrupt->function_regmap);

Not sure I totally follow this one, there isn't a second check of
reset_mechanism inside sdca_reset_function(). Perhaps this was an
earlier iteration of the code.

Thanks,
Charles

  reply	other threads:[~2025-10-30 11:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 15:54 [PATCH v3 RESEND 00/19] Add SDCA UMP/FDL support Charles Keepax
2025-10-20 15:54 ` [PATCH v3 RESEND 01/19] ASoC: SDCA: Rename SoundWire struct device variables Charles Keepax
2025-10-20 15:54 ` [PATCH v3 RESEND 02/19] regmap: sdw-mbq: Don't assume the regmap device is the SoundWire slave Charles Keepax
2025-10-20 15:54 ` [PATCH v3 RESEND 03/19] ASoC: SDCA: Add manual PM runtime gets to IRQ handlers Charles Keepax
2025-10-20 15:54 ` [PATCH v3 RESEND 04/19] ASoC: SDCA: Pass SoundWire slave to HID Charles Keepax
2025-10-20 15:54 ` [PATCH v3 RESEND 05/19] ASoC: SDCA: Pass device register map from IRQ alloc to handlers Charles Keepax
2025-10-20 15:54 ` [PATCH v3 RESEND 06/19] ASoC: SDCA: Update externally_requested flag to cover all requests Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 07/19] ASoC: SDCA: Factor out a helper to find SDCA IRQ data Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 08/19] ASoC: SDCA: Rely less on the ASoC component in IRQ handling Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 09/19] ASoC: SDCA: Force some SDCA Controls to be volatile Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 10/19] ASoC: SDCA: Parse XU Entity properties Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 11/19] ASoC: SDCA: Parse Function Reset max delay Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 12/19] ASoC: SDCA: Add UMP buffer helper functions Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 13/19] ASoC: SDCA: Add SDCA FDL data parsing Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 14/19] ASoC: SDCA: Add FDL library for XU entities Charles Keepax
2025-10-27 14:39   ` Pierre-Louis Bossart
2025-10-30 11:01     ` Charles Keepax [this message]
2025-10-20 15:55 ` [PATCH v3 RESEND 15/19] ASoC: SDCA: Add FDL-specific IRQ processing Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 16/19] ASoC: SDCA: Add completion for FDL start and stop Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 17/19] ASoC: SDCA: Add UMP timeout handling for FDL Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 18/19] ASoC: SDCA: Add early IRQ handling Charles Keepax
2025-10-20 15:55 ` [PATCH v3 RESEND 19/19] ASoC: SDCA: Add HID button IRQ Charles Keepax
2025-10-27 14:43 ` [PATCH v3 RESEND 00/19] Add SDCA UMP/FDL support Pierre-Louis Bossart
2025-10-29 22:02 ` Mark Brown

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=aQNFcpAnoaMzRZD0@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=shumingf@realtek.com \
    --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).