All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Maciej Strozek <mstrozek@opensource.cirrus.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Srinivas Kandagatla <srini@kernel.org>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
	Richard Fitzgerald <rf@opensource.cirrus.com>,
	Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, patches@opensource.cirrus.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 8/8] ASoC: codecs: add Qualcomm Tambora (WCD9378) SDCA codec
Date: Wed, 5 Aug 2026 17:04:26 +0100	[thread overview]
Message-ID: <anNfCj2e5kPZhaK0@opensource.cirrus.com> (raw)
In-Reply-To: <20260722234221.884765-9-srinivas.kandagatla@oss.qualcomm.com>

On Thu, Jul 23, 2026 at 12:42:18AM +0100, Srinivas Kandagatla wrote:
> Add support for the Qualcomm Tambora (WCD9378) headset codec in SDCA
> mode over SoundWire.
> 
> WCD9378 ("Tambora") is a low-power stereo audio codec used across
> Qualcomm mobile and compute platforms.  It integrates a headphone
> amplifier, mono earpiece output, three analogue microphone inputs
> with independent programmable mic-bias supplies, jack and button
> detection, and SoundWire dataports for both playback and capture.
> 
> Assisted-by: Claude:claude-opus-4-7
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
> ---
> +	if (entity_id == WCD9378_PDE34_ENTITY_ID) {
> +		unsigned int mic_bias = SDW_SDCA_CTL(function_id,
> +						     WCD9378_IT33_ENTITY_ID,
> +						     WCD9378_IT33_MICBIAS_SEL, 0);
> +
> +		regcache_drop_region(regmap, mic_bias, mic_bias);
> +		ret = regmap_write(regmap, mic_bias, ctrl_it33_micbias_vals[0]);
> +		if (ret)
> +			dev_err(&slave->dev, "IT33 MIC_BIAS: %d\n", ret);
> +	} else if (entity_id == WCD9378_PDE47_ENTITY_ID) {
> +		/* Announce commit-group count for the FU42 writes in pde_post_pmu. */
> +		ret = regmap_write(core->dev_regmap,
> +				   WCD9378_ENT0_COMMIT_GROUP_COUNT_ADDR,
> +				   WCD9378_ENT0_COMMIT_GROUP_COUNT_TWO);
> +		if (ret)
> +			dev_err(&slave->dev, "Commit_Group_Count: %d\n", ret);
> +
> +		/* Let the master's WR FIFO drain before PDE47_REQ_PS=0. */
> +		usleep_range(2000, 2500);

Feels a bit odd using these callbacks for commit groups, really
that is a thing that should be implemented more generically. That
is a pretty serious task, so I can probably look past this as
vendor specific thing for now. I guess my only points would be
can you live without the commit groups and just use the current
values? And if not, are you prepared that there is a good chance
this gets missed when someone does implement commit groups and
this breaks.

> +	/*
> +	 * Unmute FU42 CH1/CH2 and stage 0 dB volume via the _CN (NEXT) alias
> +	 * so all four staged writes activate together on the SCP_COMMIT
> +	 * below.  Writes go to the vendor slave regmap because FU42
> +	 * addresses are outside the SDCA class regmap's routing.
> +	 */
> +	ret = regmap_write(core->dev_regmap, WCD9378_FU42_MUTE_CH1_ADDR,
> +			   WCD9378_FU42_MUTE_UNMUTE);
> +	if (ret)
> +		dev_err(&slave->dev, "FU42 MUTE_CH1: %d\n", ret);
> +
> +	ret = regmap_write(core->dev_regmap, WCD9378_FU42_MUTE_CH2_ADDR,
> +			   WCD9378_FU42_MUTE_UNMUTE);
> +	if (ret)
> +		dev_err(&slave->dev, "FU42 MUTE_CH2: %d\n", ret);
> +
> +	ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH1_MSB_ADDR,
> +			   WCD9378_FU42_CH_VOL_UNITY_BYTE);
> +	if (ret)
> +		dev_err(&slave->dev, "FU42 CH1_MSB: %d\n", ret);
> +	ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH1_LSB_ADDR,
> +			   WCD9378_FU42_CH_VOL_UNITY_BYTE);
> +	if (ret)
> +		dev_err(&slave->dev, "FU42 CH1_LSB: %d\n", ret);
> +	ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH2_MSB_ADDR,
> +			   WCD9378_FU42_CH_VOL_UNITY_BYTE);
> +	if (ret)
> +		dev_err(&slave->dev, "FU42 CH2_MSB: %d\n", ret);
> +	ret = regmap_write(core->dev_regmap, WCD9378_FU42_CH_VOL_CH2_LSB_ADDR,
> +			   WCD9378_FU42_CH_VOL_UNITY_BYTE);
> +	if (ret)
> +		dev_err(&slave->dev, "FU42 CH2_LSB: %d\n", ret);

These should all really be part of the function regmap they are
function controls. Also would mean you have the MBQ so you don't
need to do two writes per register. I assume, with the commit
group stuff, these are writing the next value rather than the
current? But nothing here updates the functions regmap for the
new values, is it ok that those two get out of sync? Or do we
not define these controls at the function level?

Thanks,
Charles

  parent reply	other threads:[~2026-08-05 16:04 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 23:42 [RFC PATCH 0/8] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Srinivas Kandagatla
2026-07-22 23:42 ` [RFC PATCH 1/8] ASoC: SDCA: hw_params: program upstream Input Terminals for OT DAI Srinivas Kandagatla
2026-07-22 23:54   ` sashiko-bot
2026-07-24 13:14   ` Charles Keepax
2026-07-24 13:53     ` Charles Keepax
2026-07-24 16:35     ` Srinivas Kandagatla
2026-07-27  8:33       ` Charles Keepax
2026-07-27 12:42         ` Srinivas Kandagatla
2026-07-22 23:42 ` [RFC PATCH 2/8] ASoC: SDCA: allow building without ACPI Srinivas Kandagatla
2026-07-22 23:59   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 3/8] ASoC: SDCA: expose class helpers with hw_ops for non-DisCo platforms Srinivas Kandagatla
2026-07-22 23:58   ` sashiko-bot
2026-08-05 15:45   ` Charles Keepax
2026-07-22 23:42 ` [RFC PATCH 4/8] ASoC: SDCA: add PDE pre/post-pmu hooks to hw_ops Srinivas Kandagatla
2026-07-22 23:56   ` sashiko-bot
2026-08-05 15:50   ` Charles Keepax
2026-07-22 23:42 ` [RFC PATCH 5/8] ASoC: SDCA: class_function: xlate sound-dai cell by entity index Srinivas Kandagatla
2026-07-22 23:57   ` sashiko-bot
2026-07-22 23:42 ` [RFC PATCH 6/8] ASoC: SDCA: register SDCA_FUNCTION_TYPE_SIMPLE_JACK in class function driver Srinivas Kandagatla
2026-07-22 23:56   ` sashiko-bot
2026-07-23 10:55   ` Charles Keepax
2026-07-22 23:42 ` [RFC PATCH 7/8] dt-bindings: sound: qcom: add Tambora WCD9378 SDCA codec Srinivas Kandagatla
2026-07-22 23:51   ` sashiko-bot
2026-07-23  9:14   ` Konrad Dybcio
2026-07-23 13:28     ` Srinivas Kandagatla
2026-07-23 13:31       ` Konrad Dybcio
2026-07-29 11:40   ` Krzysztof Kozlowski
2026-07-29 12:17     ` Srinivas Kandagatla
2026-07-29 12:30       ` Krzysztof Kozlowski
2026-07-29 12:36         ` Srinivas Kandagatla
2026-07-29 12:43           ` Krzysztof Kozlowski
2026-07-29 13:02             ` Srinivas Kandagatla
2026-07-29 13:23               ` Krzysztof Kozlowski
2026-07-29 13:34                 ` Srinivas Kandagatla
2026-07-29 14:04                   ` Krzysztof Kozlowski
2026-07-29 17:23                     ` Jorijn van der Graaf
2026-07-22 23:42 ` [RFC PATCH 8/8] ASoC: codecs: add Qualcomm Tambora (WCD9378) " Srinivas Kandagatla
2026-07-23  0:03   ` sashiko-bot
2026-08-05 16:04   ` Charles Keepax [this message]
2026-07-23 10:17 ` [RFC PATCH 0/8] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Charles Keepax
2026-07-23 13:24   ` Srinivas Kandagatla
2026-07-24 12:36     ` Charles Keepax
2026-07-24 14:31       ` Srinivas Kandagatla
2026-07-24 15:40         ` Charles Keepax
2026-07-24 16:29           ` Srinivas Kandagatla
2026-07-29 11:14         ` Srinivas Kandagatla
2026-07-29 11:41   ` Krzysztof Kozlowski
2026-07-30  9:08     ` Charles Keepax
2026-07-30  9:11       ` Krzysztof Kozlowski
2026-07-30 10:20         ` Charles Keepax
2026-07-23 19:40 ` Jorijn van der Graaf
2026-07-24 12:17   ` Srinivas Kandagatla
2026-07-24 19:14     ` Jorijn van der Graaf

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=anNfCj2e5kPZhaK0@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jorijnvdgraaf@catcrafts.net \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --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=rf@opensource.cirrus.com \
    --cc=robh@kernel.org \
    --cc=srini@kernel.org \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.