mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
To: Maciej Strozek <mstrozek@opensource.cirrus.com>,
	Mark Brown <broonie@kernel.org>,
	Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: Re: [PATCH] ASoC: SDCA: Add quirk for incorrect function types for 3 systems
Date: Mon, 1 Sep 2025 15:55:25 +0200	[thread overview]
Message-ID: <7bd4d359-2367-4002-a082-151a42e710d3@linux.dev> (raw)
In-Reply-To: <20250901075755.2070983-1-mstrozek@opensource.cirrus.com>

On 9/1/25 09:57, Maciej Strozek wrote:
> Certain systems have CS42L43 DisCo that claims to conform to version 0.6.28
> but uses the function types from the 1.0 spec. Add a quirk as a workaround.
> 
> Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>

yay firmware quirks... Probably the start of a *long* list, eh?

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>

> ---
>  include/sound/sdca.h            |  1 +
>  sound/soc/sdca/sdca_device.c    | 20 ++++++++++++++++++++
>  sound/soc/sdca/sdca_functions.c | 13 ++++++++-----
>  3 files changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/include/sound/sdca.h b/include/sound/sdca.h
> index 5a5d6de78d728..9c6a351c9d474 100644
> --- a/include/sound/sdca.h
> +++ b/include/sound/sdca.h
> @@ -46,6 +46,7 @@ struct sdca_device_data {
> 
>  enum sdca_quirk {
>  	SDCA_QUIRKS_RT712_VB,
> +	SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING,
>  };
> 
>  #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)
> diff --git a/sound/soc/sdca/sdca_device.c b/sound/soc/sdca/sdca_device.c
> index 0244cdcdd109a..4798ce2c8f0b4 100644
> --- a/sound/soc/sdca/sdca_device.c
> +++ b/sound/soc/sdca/sdca_device.c
> @@ -7,6 +7,7 @@
>   */
> 
>  #include <linux/acpi.h>
> +#include <linux/dmi.h>
>  #include <linux/module.h>
>  #include <linux/property.h>
>  #include <linux/soundwire/sdw.h>
> @@ -55,11 +56,30 @@ static bool sdca_device_quirk_rt712_vb(struct sdw_slave *slave)
>  	return false;
>  }
> 
> +static bool sdca_device_quirk_skip_func_type_patching(struct sdw_slave *slave)
> +{
> +	const char *vendor, *sku;
> +
> +	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
> +	sku = dmi_get_system_info(DMI_PRODUCT_SKU);
> +
> +	if (vendor && sku &&
> +	    !strcmp(vendor, "Dell Inc.") &&
> +	    (!strcmp(sku, "0C62") || !strcmp(sku, "0C63") || !strcmp(sku, "0C6B")) &&
> +	    slave->sdca_data.interface_revision == 0x061c &&
> +	    slave->id.mfg_id == 0x01fa && slave->id.part_id == 0x4243)
> +		return true;
> +
> +	return false;
> +}
> +
>  bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
>  {
>  	switch (quirk) {
>  	case SDCA_QUIRKS_RT712_VB:
>  		return sdca_device_quirk_rt712_vb(slave);
> +	case SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING:
> +		return sdca_device_quirk_skip_func_type_patching(slave);
>  	default:
>  		break;
>  	}
> diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
> index f26f597dca9e9..13f68f7b6dd6a 100644
> --- a/sound/soc/sdca/sdca_functions.c
> +++ b/sound/soc/sdca/sdca_functions.c
> @@ -90,6 +90,7 @@ static int find_sdca_function(struct acpi_device *adev, void *data)
>  {
>  	struct fwnode_handle *function_node = acpi_fwnode_handle(adev);
>  	struct sdca_device_data *sdca_data = data;
> +	struct sdw_slave *slave = container_of(sdca_data, struct sdw_slave, sdca_data);
>  	struct device *dev = &adev->dev;
>  	struct fwnode_handle *control5; /* used to identify function type */
>  	const char *function_name;
> @@ -137,11 +138,13 @@ static int find_sdca_function(struct acpi_device *adev, void *data)
>  		return ret;
>  	}
> 
> -	ret = patch_sdca_function_type(sdca_data->interface_revision, &function_type);
> -	if (ret < 0) {
> -		dev_err(dev, "SDCA version %#x invalid function type %d\n",
> -			sdca_data->interface_revision, function_type);
> -		return ret;
> +	if (!sdca_device_quirk_match(slave, SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING)) {
> +		ret = patch_sdca_function_type(sdca_data->interface_revision, &function_type);
> +		if (ret < 0) {
> +			dev_err(dev, "SDCA version %#x invalid function type %d\n",
> +				sdca_data->interface_revision, function_type);
> +			return ret;
> +		}
>  	}
> 
>  	function_name = get_sdca_function_name(function_type);
> --
> 2.47.2
> 


  reply	other threads:[~2025-09-01 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  7:57 Maciej Strozek
2025-09-01 13:55 ` Pierre-Louis Bossart [this message]
2025-09-01 14:05 ` Takashi Iwai
2025-09-01 14:28   ` Maciej Strozek
2025-09-01 14:47     ` Takashi Iwai
2025-09-02 11:51 ` 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=7bd4d359-2367-4002-a082-151a42e710d3@linux.dev \
    --to=pierre-louis.bossart@linux.dev \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mstrozek@opensource.cirrus.com \
    --cc=patches@opensource.cirrus.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

all inboxes | Powered by JetHome®