mirror of https://lore.kernel.org/lkml/
 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>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@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>,
	Faiz Nabi Kuchay <fkuchay@oss.qualcomm.com>,
	Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>,
	patches@opensource.cirrus.com, linux-sound@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 11/11] ASoC: codecs: add Qualcomm Tambora (WCD9378) SDCA codec
Date: Tue, 8 Sep 2026 17:20:54 +0100	[thread overview]
Message-ID: <aqA15rhdjAtWrWK8@opensource.cirrus.com> (raw)
In-Reply-To: <20260907083727.733705-12-srinivas.kandagatla@oss.qualcomm.com>

On Mon, Sep 07, 2026 at 09:37:25AM +0100, Srinivas Kandagatla wrote:
> Add support for the Qualcomm Tambora (WCD9378) headset codec in SDCA
> mode over SoundWire.  On ARM/DT platforms without ACPI/DisCo firmware
> the SDCA topology and SoundWire port properties are supplied as static
> data through the codec driver.
> 
> The codec exposes a single SimpleJack SDCA Function providing:
>   - Headphone playback via FU 6 (mute + Q7.8 volume) and OT 43/45.
>   - Headset mic capture via IT 33 with MICB2 bias derived from DT
>     (qcom,micbias2-microvolt).
>   - MBHC-based headset jack detection.
> 
> Implements:
>   - sdw_slave_ops.read_prop: SoundWire slave properties and dpn caps
>     for the compute-mode dataports.
>   - sdca_class_hw_ops.hw_init: enables supplies, toggles the reset
>     GPIO, and enables the vendor TX PDM clock via SCP.
>   - sdca_class_hw_ops.populate_function: fills the SDCA Function data
>     (entities, clusters, init_table) from static tables and patches
>     the IT 33 MIC_BIAS default with the DT-derived per-slave value.
> 
> Binds SoundWire slave id 0x0217:0x0110 when qcom,compute-mode is set
> on the DT node.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
> ---
> +int wcd9378_sdca_read_prop(struct sdw_slave *slave)
> +{
> +	struct sdw_slave_prop *prop = &slave->prop;
> +	struct device *dev = &slave->dev;
> +	struct sdw_dpn_prop *sink, *src;
> +	int ret;
> +
> +	ret = sdca_class_read_prop(slave);
> +	if (ret)
> +		return ret;

I am not sure it is worth calling this. All this does that doesn't
come from the firmware is set use_domain_irq and scp_int1_mask,
I would just do both of those locally, calling this means you
technically process a large number of DT properties that aren't in
your binding doc and also you devm allocate a bunch of things you
won't use.

> +	/* Compute-mode fixed SoundWire slave properties (not described in DT) */
> +	prop->simple_clk_stop_capable = true;
> +	prop->paging_support = true;
> +	prop->clock_reg_supported = true;
> +	prop->lane_control_support = true;
> +
> +	/* Source ports: DP2 (headset mic), DP5 (optimisation TX). */
> +	prop->source_ports = BIT(2) | BIT(5);
> +	/* Sink ports: DP6 (HPH audio), DP7 (HPH envelope), DP8 (optimisation RX). */
> +	prop->sink_ports = BIT(6) | BIT(7) | BIT(8);
> +
> +	src = devm_kcalloc(dev, 2, sizeof(*src), GFP_KERNEL);
> +	if (!src)
> +		return -ENOMEM;
> +
> +	src[0].num = 2;
> +	src[0].type = SDW_DPN_SIMPLE;
> +	src[0].simple_ch_prep_sm = true;
> +	src[0].ch_prep_timeout = 10;
> +	src[0].max_ch = 1;
> +	src[0].min_ch = 1;
> +
> +	src[1].num = 5;
> +	src[1].type = SDW_DPN_SIMPLE;
> +	src[1].simple_ch_prep_sm = true;
> +	src[1].ch_prep_timeout = 10;
> +	src[1].max_ch = 1;
> +	src[1].min_ch = 1;

Minor nit: Probably simpler to have a static array and kmemdup
it.

> +static int wcd9378_sdca_populate_function(struct sdw_slave *slave,
> +					  struct sdca_function_data *function)
> +{
> +	/* @function->desc is already set by the framework; fill payload only. */
> +	if (function->desc->type != wcd9378_sdca_desc.type)
> +		return -EINVAL;
> +
> +	function->num_entities    = wcd9378_sdca_data.num_entities;
> +	function->entities        = wcd9378_sdca_data.entities;
> +	function->num_clusters    = wcd9378_sdca_data.num_clusters;
> +	function->clusters        = wcd9378_sdca_data.clusters;
> +	function->num_init_table  = wcd9378_sdca_data.num_init_table;
> +	function->init_table      = wcd9378_sdca_data.init_table;
> +	function->reset_max_delay = wcd9378_sdca_data.reset_max_delay;
> +
> +	/* Elevate is_volatile / has_reset to match the DisCo/ACPI path. */
> +	sdca_apply_default_control_classifiers(function);

Just factor those into the static tables, if we have a bunch of
static data might as well just fill it all in. Doing it this way
is confusing because the static data is incorrect then fixed up
later.

Thanks,
Charles

      parent reply	other threads:[~2026-09-08 16:21 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07  8:37 [PATCH v2 00/11] ASoC: SDCA: enable on DT platforms and add Qualcomm WCD9378 (Tambora) codec Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 01/11] ASoC: SDCA: allow building without ACPI Srinivas Kandagatla
2026-09-07  8:54   ` Richard Fitzgerald
2026-09-07  9:09     ` Takashi Iwai
2026-09-07  8:37 ` [PATCH v2 02/11] ASoC: SDCA: export PM helpers keyed on sdca_class_drv Srinivas Kandagatla
2026-09-08 16:22   ` Charles Keepax
2026-09-08 17:49     ` Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 03/11] ASoC: SDCA: expose class SoundWire probe/remove/read_prop as library Srinivas Kandagatla
2026-09-07 11:31   ` Pierre-Louis Bossart
2026-09-07 13:29     ` Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 04/11] ASoC: SDCA: add hw_ops with hw_init hook Srinivas Kandagatla
2026-09-07 11:29   ` Pierre-Louis Bossart
2026-09-07 13:33     ` Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 05/11] ASoC: SDCA: add populate_function hw_op for DT function data Srinivas Kandagatla
2026-09-07 11:28   ` Pierre-Louis Bossart
2026-09-07 13:16     ` Charles Keepax
2026-09-08 16:25   ` Charles Keepax
2026-09-08 18:00     ` Srinivas Kandagatla
2026-09-09  8:34       ` Charles Keepax
2026-09-07  8:37 ` [PATCH v2 06/11] ASoC: SDCA: class_function: xlate sound-dai cell by entity index Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 07/11] ASoC: SDCA: register SDCA_FUNCTION_TYPE_SIMPLE_JACK in class function driver Srinivas Kandagatla
2026-09-07 11:32   ` Pierre-Louis Bossart
2026-09-07  8:37 ` [PATCH v2 08/11] ASoC: SDCA: make find_sdca_control_reset() return void Srinivas Kandagatla
2026-09-07 11:32   ` Pierre-Louis Bossart
2026-09-07 13:03     ` Charles Keepax
2026-09-07 13:16       ` Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 09/11] ASoC: SDCA: add sdca_apply_default_control_classifiers() helper Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 10/11] dt-bindings: sound: qcom: add Tambora WCD9378 SDCA codec Srinivas Kandagatla
2026-09-07  8:37 ` [PATCH v2 11/11] ASoC: codecs: add Qualcomm Tambora (WCD9378) " Srinivas Kandagatla
2026-09-07 11:32   ` Pierre-Louis Bossart
2026-09-07 13:03     ` Srinivas Kandagatla
2026-09-07 19:47       ` Pierre-Louis Bossart
2026-09-07 21:26         ` Mark Brown
2026-09-07 22:37         ` Srinivas Kandagatla
2026-09-08  8:49           ` Charles Keepax
2026-09-08  9:09             ` Srinivas Kandagatla
2026-09-08 10:37               ` Richard Fitzgerald
2026-09-08 12:31                 ` Srinivas Kandagatla
2026-09-08 13:20                   ` Charles Keepax
2026-09-08 13:34                     ` Srinivas Kandagatla
2026-09-08 14:22                       ` Pierre-Louis Bossart
2026-09-08 15:33                         ` Charles Keepax
2026-09-08 15:34                           ` Srinivas Kandagatla
2026-09-08 15:58   ` Uwe Kleine-König
2026-09-08 16:20   ` Charles Keepax [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=aqA15rhdjAtWrWK8@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fkuchay@oss.qualcomm.com \
    --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=robh@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 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®