alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Niranjan H Y <niranjan.hy@ti.com>
Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org,
	lgirdwood@gmail.com, broonie@kernel.org,
	yung-chuan.liao@linux.intel.com,
	ranjani.sridharan@linux.intel.com, perex@perex.cz,
	tiwai@suse.com, cezary.rojewski@intel.com,
	peter.ujfalusi@linux.intel.com, kai.vehmanen@linux.intel.com,
	pierre-louis.bossart@linux.dev, navada@ti.com,
	shenghao-ding@ti.com, v-hampiholi@ti.com, baojun.xu@ti.com,
	dan.carpenter@linaro.org
Subject: Re: [PATCH v1 7/8] ASoC: tas2783A: use acpi initialisation table
Date: Thu, 20 Nov 2025 10:16:03 +0000	[thread overview]
Message-ID: <aR7qY+ToHyuYQW2p@opensource.cirrus.com> (raw)
In-Reply-To: <20251120092050.1218-7-niranjan.hy@ti.com>

On Thu, Nov 20, 2025 at 02:50:49PM +0530, Niranjan H Y wrote:
> This patch adds support for parsing the initilisation
> data from ACPI table. This table is required to configure
> each device correctly so that correct channel's data is
> selected during playback.
> 
> Signed-off-by: Niranjan H Y <niranjan.hy@ti.com>
> ---
>  sound/soc/codecs/Kconfig       |  1 +
>  sound/soc/codecs/tas2783-sdw.c | 61 +++++++++++++++++++++++++++++++---
>  2 files changed, 58 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
> index 433af9bc7..94d66e4d5 100644
> --- a/sound/soc/codecs/Kconfig
> +++ b/sound/soc/codecs/Kconfig
> @@ -2146,6 +2146,7 @@ config SND_SOC_TAS2781_I2C
>  config SND_SOC_TAS2783_SDW
>  	tristate "Texas Instruments TAS2783 speaker amplifier (sdw)"
>  	depends on SOUNDWIRE
> +	depends on SND_SOC_SDCA

Great to see some of the SDCA library stuff starting to be useful
for people :-)

> -		ret = regmap_multi_reg_write(tas_dev->regmap, tas2783_init_seq,
> -					     ARRAY_SIZE(tas2783_init_seq));
> -		tas_dev->hw_init = true;
> +		if (tas_dev->sa_func_data) {
> +			for (i = 0; i < tas_dev->sa_func_data->num_init_table; i++) {
> +				ret = regmap_write(tas_dev->regmap,
> +						   tas_dev->sa_func_data->init_table[i].addr,
> +						   tas_dev->sa_func_data->init_table[i].val);
> +				if (ret)
> +					break;
> +			}

Should be able to use sdca_regmap_write_init() here once the
patch is merged:

https://lore.kernel.org/linux-sound/20251106114422.906370-11-ckeepax@opensource.cirrus.com/

No point holding up this patch for it, but would be good to move
it across once the core function is merged. And if you wanted to
test the core patch out check it works for you that would be
amazing.

> +		} else {
> +			ret = regmap_multi_reg_write(tas_dev->regmap, tas2783_init_seq,
> +						     ARRAY_SIZE(tas2783_init_seq));
> +		}
> +
> +		if (ret)
> +			dev_err(tas_dev->dev,
> +				"init writes failed, err=%d", ret);
> +		else
> +			tas_dev->hw_init = true;
>  	}
>  
> +	/* check if we have any SDCA function data available */
> +	if (peripheral->sdca_data.num_functions > 0) {
> +		dev_dbg(dev, "SDCA functions found: %d", peripheral->sdca_data.num_functions);
> +
> +		/* Look for Smart Amp function type */
> +		for (i = 0; i < peripheral->sdca_data.num_functions; i++) {
> +			if (peripheral->sdca_data.function[i].type ==
> +			    SDCA_FUNCTION_TYPE_SMART_AMP) {
> +				dev_info(dev, "Found Smart Amp function at index %d", i);
> +				break;
> +			}
> +		}
> +	}

I do wonder if we should add a core function for this search, I
am guessing this will become a fairly common pattern. But again
no need to hold up your patches for that.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

  reply	other threads:[~2025-11-20 10:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20  9:20 [PATCH v1 1/8] ASoC: tas2783A: sdw_utils: support ch 3 & 4 Niranjan H Y
2025-11-20  9:20 ` [PATCH v1 2/8] ASoC: tas2783A: use custom firmware Niranjan H Y
2025-11-20  9:20 ` [PATCH v1 3/8] ASoC: tas2783A: update default init writes Niranjan H Y
2025-11-20  9:20 ` [PATCH v1 4/8] ASoC: tas2783A: fix error log for calibration data Niranjan H Y
2025-11-20  9:20 ` [PATCH v1 5/8] ASoc: tas2783A: fw name based on system details Niranjan H Y
2025-11-20  9:20 ` [PATCH v1 6/8] ASoc: tas2783A: acpi match for 4 channel for mtl Niranjan H Y
2025-11-20  9:20 ` [PATCH v1 7/8] ASoC: tas2783A: use acpi initialisation table Niranjan H Y
2025-11-20 10:16   ` Charles Keepax [this message]
2025-11-20  9:20 ` [PATCH v1 8/8] ASoC: tas2783A: read slave properties from acpi table Niranjan H Y
2025-11-20 10:16   ` Charles Keepax

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=aR7qY+ToHyuYQW2p@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=navada@ti.com \
    --cc=niranjan.hy@ti.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.com \
    --cc=v-hampiholi@ti.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).