From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <broonie@kernel.org>
Cc: <lgirdwood@gmail.com>, <pierre-louis.bossart@linux.dev>,
<yung-chuan.liao@linux.intel.com>,
<peter.ujfalusi@linux.intel.com>, <linux-sound@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>
Subject: [PATCH 5/6] ASoC: SDCA: Add SDCA Control Range data access helper
Date: Wed, 12 Mar 2025 17:22:04 +0000 [thread overview]
Message-ID: <20250312172205.4152686-6-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20250312172205.4152686-1-ckeepax@opensource.cirrus.com>
SDCA Ranges are two dimensional arrays of data associated with controls,
add a helper to provide an x,y access mechanism to the data and a helper
to locate a specific value inside a range.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
include/sound/sdca_function.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/sound/sdca_function.h b/include/sound/sdca_function.h
index ca0376903e87c..d7489e3c7e471 100644
--- a/include/sound/sdca_function.h
+++ b/include/sound/sdca_function.h
@@ -1136,6 +1136,25 @@ struct sdca_function_data {
unsigned int busy_max_delay;
};
+static inline u32 sdca_range(struct sdca_control_range *range,
+ unsigned int col, unsigned int row)
+{
+ return range->data[(row * range->cols) + col];
+}
+
+static inline u32 sdca_range_search(struct sdca_control_range *range,
+ int search_col, int value, int result_col)
+{
+ int i;
+
+ for (i = 0; i < range->rows; i++) {
+ if (sdca_range(range, search_col, i) == value)
+ return sdca_range(range, result_col, i);
+ }
+
+ return 0;
+}
+
int sdca_parse_function(struct device *dev,
struct sdca_function_desc *desc,
struct sdca_function_data *function);
--
2.39.5
next prev parent reply other threads:[~2025-03-12 17:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 17:21 [PATCH 0/6] Some minor SDCA preparation Charles Keepax
2025-03-12 17:22 ` [PATCH 1/6] ASoC: SDCA: Tidy up initialization write parsing Charles Keepax
2025-03-12 17:22 ` [PATCH 2/6] ASoC: SDCA: Use __free() to manage local buffers Charles Keepax
2025-03-12 17:22 ` [PATCH 3/6] ASoC: SDCA: Allow naming of imp def controls Charles Keepax
2025-03-12 17:22 ` [PATCH 4/6] ASoC: SDCA: Add type flag for Controls Charles Keepax
2025-03-12 17:22 ` Charles Keepax [this message]
2025-03-12 17:22 ` [PATCH 6/6] ASoC: SDCA: Add support for GE Entity properties Charles Keepax
2025-03-17 21:54 ` [PATCH 0/6] Some minor SDCA preparation 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=20250312172205.4152686-6-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