From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <lgirdwood@gmail.com>, <yung-chuan.liao@linux.intel.com>,
<pierre-louis.bossart@linux.dev>,
<peter.ujfalusi@linux.intel.com>, <linux-sound@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>
Subject: [PATCH 04/10] ASoC: SDCA: Add support for Entity 0
Date: Wed, 5 Feb 2025 11:37:55 +0000 [thread overview]
Message-ID: <20250205113801.3699902-5-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20250205113801.3699902-1-ckeepax@opensource.cirrus.com>
Within SDCA there is a special Entity called Entity 0 which is used
to hold Function level controls. Whilst Entity 0 isn't a full SDCA
Entity, it is helpful to add an sdca_entity structure for it. This
will allow it to be treated identically in the code that handles
SDCA Controls.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
include/sound/sdca_function.h | 4 ++++
sound/soc/sdca/sdca_functions.c | 14 +++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/include/sound/sdca_function.h b/include/sound/sdca_function.h
index 47fc1da8e4f33..a51e3a459e361 100644
--- a/include/sound/sdca_function.h
+++ b/include/sound/sdca_function.h
@@ -117,6 +117,9 @@ enum sdca_entity0_controls {
/**
* enum sdca_entity_type - SDCA Entity Type codes
+ * @SDCA_ENTITY_TYPE_ENTITY_0: Entity 0, not actually from the
+ * specification but useful internally as an Entity structure
+ * is allocated for Entity 0, to hold Entity 0 controls.
* @SDCA_ENTITY_TYPE_IT: Input Terminal.
* @SDCA_ENTITY_TYPE_OT: Output Terminal.
* @SDCA_ENTITY_TYPE_MU: Mixer Unit.
@@ -141,6 +144,7 @@ enum sdca_entity0_controls {
* all Entity Types not described are reserved.
*/
enum sdca_entity_type {
+ SDCA_ENTITY_TYPE_ENTITY_0 = 0x00,
SDCA_ENTITY_TYPE_IT = 0x02,
SDCA_ENTITY_TYPE_OT = 0x03,
SDCA_ENTITY_TYPE_MU = 0x05,
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
index f914ec3f86c9a..b0ca92f1bc57f 100644
--- a/sound/soc/sdca/sdca_functions.c
+++ b/sound/soc/sdca/sdca_functions.c
@@ -293,7 +293,8 @@ static int find_sdca_entities(struct device *dev,
return -EINVAL;
}
- entities = devm_kcalloc(dev, num_entities, sizeof(*entities), GFP_KERNEL);
+ /* Add 1 to make space for Entity 0 */
+ entities = devm_kcalloc(dev, num_entities + 1, sizeof(*entities), GFP_KERNEL);
if (!entities)
return -ENOMEM;
@@ -331,7 +332,13 @@ static int find_sdca_entities(struct device *dev,
return ret;
}
- function->num_entities = num_entities;
+ /*
+ * Add Entity 0 at end of the array, makes it easy to skip during
+ * all the Entity searches involved in creating connections.
+ */
+ entities[num_entities].label = "entity0";
+
+ function->num_entities = num_entities + 1;
function->entities = entities;
return 0;
@@ -440,7 +447,8 @@ static int find_sdca_connections(struct device *dev,
{
int i;
- for (i = 0; i < function->num_entities; i++) {
+ /* Entity 0 cannot have connections */
+ for (i = 0; i < function->num_entities - 1; i++) {
struct sdca_entity *entity = &function->entities[i];
char entity_property[SDCA_PROPERTY_LENGTH];
struct fwnode_handle *entity_node;
--
2.39.5
next prev parent reply other threads:[~2025-02-05 11:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 11:37 [PATCH 00/10] Add SDCA DisCo parsing support Charles Keepax
2025-02-05 11:37 ` [PATCH 01/10] ASoC: SDCA: Minor formatting and naming tweaks Charles Keepax
2025-02-05 11:37 ` [PATCH 02/10] ASoC: SDCA: Add code to parse Function information Charles Keepax
2025-02-05 11:37 ` [PATCH 03/10] ASoC: SDCA: Parse initialization write table Charles Keepax
2025-02-05 11:37 ` Charles Keepax [this message]
2025-02-05 11:37 ` [PATCH 05/10] ASoC: SDCA: Add SDCA Control parsing Charles Keepax
2025-02-05 11:37 ` [PATCH 06/10] ASoC: SDCA: Add parsing for Control range structures Charles Keepax
2025-02-05 11:37 ` [PATCH 07/10] ASoC: SDCA: Add Channel Cluster parsing Charles Keepax
2025-02-05 11:37 ` [PATCH 08/10] ASoC: SDCA: Add support for IT/OT Entity properties Charles Keepax
2025-02-05 11:38 ` [PATCH 09/10] ASoC: SDCA: Add support for clock " Charles Keepax
2025-02-05 11:38 ` [PATCH 10/10] ASoC: SDCA: Add support for PDE " Charles Keepax
2025-02-07 17:14 ` [PATCH 00/10] Add SDCA DisCo parsing support Pierre-Louis Bossart
2025-02-10 16:30 ` 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=20250205113801.3699902-5-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--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