diff options
author | 2025-03-12 17:22:02 +0000 | |
---|---|---|
committer | 2025-03-16 23:27:55 +0000 | |
commit | 49680c9f13b64c13e79e1312c7616d0ab9775e4a (patch) | |
tree | 7fb4b9f87fdcbb8b659e5e7339a1d2cde518c25e | |
parent | ASoC: SDCA: Use __free() to manage local buffers (diff) | |
download | linux-rng-49680c9f13b64c13e79e1312c7616d0ab9775e4a.tar.xz linux-rng-49680c9f13b64c13e79e1312c7616d0ab9775e4a.zip |
ASoC: SDCA: Allow naming of imp def controls
Implementation defined controls will not be present in the large list of
known controls for SDCA. The driver should not return an error for these,
because it is perfectly legal to have implementation defined controls.
Update the handling to instead generate a generic name.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20250312172205.4152686-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/sdca/sdca_functions.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c index 4ee98d8fe89e..1e36dd20d7ab 100644 --- a/sound/soc/sdca/sdca_functions.c +++ b/sound/soc/sdca/sdca_functions.c @@ -241,7 +241,8 @@ static int find_sdca_init_table(struct device *dev, return 0; } -static const char *find_sdca_control_label(const struct sdca_entity *entity, +static const char *find_sdca_control_label(struct device *dev, + const struct sdca_entity *entity, const struct sdca_control *control) { switch (SDCA_CTL_TYPE(entity->type, control->sel)) { @@ -530,7 +531,7 @@ static const char *find_sdca_control_label(const struct sdca_entity *entity, case SDCA_CTL_TYPE_S(ENTITY_0, DEVICE_SDCA_VERSION): return SDCA_CTL_DEVICE_SDCA_VERSION_NAME; default: - return NULL; + return devm_kasprintf(dev, GFP_KERNEL, "Imp-Def %#x", control->sel); } } @@ -739,12 +740,9 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti if (!ret) control->interrupt_position = tmp; - control->label = find_sdca_control_label(entity, control); - if (!control->label) { - dev_err(dev, "%s: control %#x: name not found\n", - entity->label, control->sel); - return -EINVAL; - } + control->label = find_sdca_control_label(dev, entity, control); + if (!control->label) + return -ENOMEM; control->nbits = find_sdca_control_bits(entity, control); |