mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: Mark Brown <broonie@kernel.org>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Maciej Strozek <mstrozek@opensource.cirrus.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
	Takashi Iwai <tiwai@suse.com>,
	patches@opensource.cirrus.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] ASoC: SDCA: class_function: clear sconfig.bps on PDM data-port terminals
Date: Tue, 20 Oct 2026 08:17:19 +0100	[thread overview]
Message-ID: <123d6912-5b52-4d57-96f8-cdfa016ebb11@oss.qualcomm.com> (raw)
In-Reply-To: <atXck2Ef4OllKrAA@opensource.cirrus.com>

On 10/19/26 10:02 AM, Charles Keepax wrote:
> On Sun, Oct 18, 2026 at 08:23:59PM +0100, Srinivas Kandagatla wrote:
>> snd_sdw_params_to_config() derives sconfig.bps from the PCM container
>> width, which is not meaningful on PDM data-port terminals and clashes
>> with masters that declare their own view of the wire word length (e.g.
>> the Qualcomm SoundWire master hardcodes sconfig.bps = 1 for PDM).
>>
>> Clear sconfig.bps when the DAI's SDCA terminal is PDM so compute_params()
>> or the slave silicon drives the per-port wire word length.
>>
>> Assisted-by: LLM
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
>> ---
>>  sound/soc/sdca/sdca_class_function.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/sound/soc/sdca/sdca_class_function.c b/sound/soc/sdca/sdca_class_function.c
>> index 13b70f0f0dbf..acaadd12432a 100644
>> --- a/sound/soc/sdca/sdca_class_function.c
>> +++ b/sound/soc/sdca/sdca_class_function.c
>> @@ -126,6 +126,17 @@ static int class_function_startup(struct snd_pcm_substream *substream,
>>  					 substream, dai);
>>  }
>>  
>> +static bool class_function_terminal_is_pdm(enum sdca_terminal_type t)
>> +{
>> +	switch (t) {
>> +	case SDCA_TERM_TYPE_RAW_PDM_MIC:
>> +	case SDCA_TERM_TYPE_PDM_RENDER_STREAM:
>> +		return true;
>> +	default:
>> +		return false;
>> +	}
>> +}
> 
> I think this would make sense as a generic helper in sdca_asoc.c
> probably taking the function and the DAI as arguments.

v2 will have this change.
> 
>>  static int class_function_sdw_add_peripheral(struct snd_pcm_substream *substream,
>>  					     struct snd_pcm_hw_params *params,
>>  					     struct snd_soc_dai *dai)
>> @@ -133,6 +144,7 @@ static int class_function_sdw_add_peripheral(struct snd_pcm_substream *substream
>>  	struct class_function_drv *drv = snd_soc_component_get_drvdata(dai->component);
>>  	struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
>>  	struct sdw_slave *sdw = dev_to_sdw_dev(drv->dev->parent);
>> +	struct sdca_entity *entity = &drv->function->entities[dai->id];
>>  	struct sdw_stream_config sconfig = {0};
>>  	struct sdw_port_config pconfig = {0};
>>  	int ret;
>> @@ -152,6 +164,9 @@ static int class_function_sdw_add_peripheral(struct snd_pcm_substream *substream
>>  
>>  	pconfig.num = ret;
>>  
>> +	if (class_function_terminal_is_pdm(entity->iot.type))
>> +		sconfig.bps = 0;
> 
> I think this is fine, as you say bps makes no sense for a PDM
> stream but I might need to spend a little more time working out
> how this all propagates through the core. I guess my concern is
> if other drivers don't handle PDM in the same way.
in v2, i have now set the stream type correctly based on terminal type.

--srini
> 
> Thanks,
> Charles


      parent reply	other threads:[~2026-10-20  7:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 19:23 [PATCH 0/4] ASoC: SDCA: class-driver fixes and PDM data-port support Srinivas Kandagatla
2026-10-18 19:23 ` [PATCH 1/4] ASoC: SDCA: propagate sdw_slave_read_prop() failure in class_read_prop Srinivas Kandagatla
2026-10-19  8:37   ` Charles Keepax
2026-10-18 19:23 ` [PATCH 2/4] ASoC: SDCA: enable pm_runtime before taking the initial reference Srinivas Kandagatla
2026-10-19  8:39   ` Charles Keepax
2026-10-20  6:37     ` Srinivas Kandagatla
2026-10-18 19:23 ` [PATCH 3/4] ASoC: SDCA: re-enable IRQ on pm_runtime_force_suspend failure Srinivas Kandagatla
2026-10-19  8:40   ` Charles Keepax
2026-10-18 19:23 ` [PATCH 4/4] ASoC: SDCA: class_function: clear sconfig.bps on PDM data-port terminals Srinivas Kandagatla
2026-10-19  9:02   ` Charles Keepax
2026-10-19 16:19     ` Pierre-Louis Bossart
2026-10-20  7:18       ` Srinivas Kandagatla
2026-10-20 10:16       ` Charles Keepax
2026-10-20  7:17     ` Srinivas Kandagatla [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=123d6912-5b52-4d57-96f8-cdfa016ebb11@oss.qualcomm.com \
    --to=srinivas.kandagatla@oss.qualcomm.com \
    --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=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=tiwai@suse.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®