The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bard Liao <yung-chuan.liao@linux.intel.com>
To: broonie@kernel.org, tiwai@suse.de, vkoul@kernel.org
Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org,
	linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev,
	bard.liao@intel.com
Subject: [PATCH 04/11] soundwire: slave: lookup SDCA version and functions
Date: Wed, 16 Oct 2024 18:23:26 +0800	[thread overview]
Message-ID: <20241016102333.294448-5-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20241016102333.294448-1-yung-chuan.liao@linux.intel.com>

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Use SDCA helpers to get the basic information and store it in the
slave context. The information will be optionally be used in codec
drivers to register sub-devices for each Function.

When platforms are not based on ACPI the helpers do absolutely
nothing.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/Kconfig |  1 +
 drivers/soundwire/slave.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/soundwire/Kconfig b/drivers/soundwire/Kconfig
index 4d8f3b7024ae..f66f869dff2e 100644
--- a/drivers/soundwire/Kconfig
+++ b/drivers/soundwire/Kconfig
@@ -6,6 +6,7 @@
 menuconfig SOUNDWIRE
 	tristate "SoundWire support"
 	depends on ACPI || OF
+	depends on SND_SOC_SDCA_OPTIONAL
 	help
 	  SoundWire is a 2-Pin interface with data and clock line ratified
 	  by the MIPI Alliance. SoundWire is used for transporting data
diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c
index f1a4df6cfebd..97cf8bcca047 100644
--- a/drivers/soundwire/slave.c
+++ b/drivers/soundwire/slave.c
@@ -5,6 +5,7 @@
 #include <linux/of.h>
 #include <linux/soundwire/sdw.h>
 #include <linux/soundwire/sdw_type.h>
+#include <sound/sdca.h>
 #include "bus.h"
 #include "sysfs_local.h"
 
@@ -70,6 +71,17 @@ int sdw_slave_add(struct sdw_bus *bus,
 	list_add_tail(&slave->node, &bus->slaves);
 	mutex_unlock(&bus->bus_lock);
 
+	/*
+	 * The Soundwire driver probe may optionally register SDCA
+	 * sub-devices, one per Function. This means the information
+	 * on the SDCA revision and the number/type of Functions need
+	 * to be extracted from platform firmware before the SoundWire
+	 * driver probe, and as a consequence before the SoundWire
+	 * device_register() below.
+	 */
+	sdca_lookup_interface_revision(slave);
+	sdca_lookup_functions(slave);
+
 	ret = device_register(&slave->dev);
 	if (ret) {
 		dev_err(bus->dev, "Failed to add slave: ret %d\n", ret);
@@ -259,3 +271,5 @@ int sdw_of_find_slaves(struct sdw_bus *bus)
 
 	return 0;
 }
+
+MODULE_IMPORT_NS(SND_SOC_SDCA);
-- 
2.43.0


  parent reply	other threads:[~2024-10-16 10:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 10:23 [PATCH 00/11] ASoC/soundwire: add initial support for SDCA Bard Liao
2024-10-16 10:23 ` [PATCH 01/11] soundwire: sdw_intel: include linux/acpi.h Bard Liao
2024-10-17 12:23   ` Vinod Koul
2024-10-16 10:23 ` [PATCH 02/11] ASoC/soundwire: remove sdw_slave_extended_id Bard Liao
2024-10-16 10:23 ` [PATCH 03/11] ASoC: SDCA: add initial module Bard Liao
2024-10-16 10:23 ` Bard Liao [this message]
2024-10-17 12:24   ` [PATCH 04/11] soundwire: slave: lookup SDCA version and functions Vinod Koul
2024-10-16 10:23 ` [PATCH 05/11] ASoC: SDCA: add quirk function for RT712_VB match Bard Liao
2024-10-16 10:23 ` [PATCH 06/11] ASoC: rt712-sdca: detect the SMART_MIC function during the probe stage Bard Liao
2024-10-16 10:23 ` [PATCH 07/11] ASoC: soc-acpi: introduce new 'machine check' callback Bard Liao
2024-10-16 10:23 ` [PATCH 08/11] ASoC: sdw_utils: add SmartMic DAI for RT712 VB Bard Liao
2024-10-16 10:23 ` [PATCH 09/11] ASoC: sdw_utils: add SmartMic DAI for RT713 VB Bard Liao
2024-10-16 10:23 ` [PATCH 10/11] ASoC: Intel: soc-acpi: add is_device_rt712_vb() helper Bard Liao
2024-10-16 10:23 ` [PATCH 11/11] ASoC: SOF: Intel: hda: use machine_check() for SoundWire Bard Liao
2024-10-18 21:30 ` [PATCH 00/11] ASoC/soundwire: add initial support for SDCA 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=20241016102333.294448-5-yung-chuan.liao@linux.intel.com \
    --to=yung-chuan.liao@linux.intel.com \
    --cc=bard.liao@intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@linaro.org \
    --cc=vkoul@kernel.org \
    /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