Skip to content

Commit 49680c9

Browse files
charleskeepaxbroonie
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 0d16daa commit 49680c9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

sound/soc/sdca/sdca_functions.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ static int find_sdca_init_table(struct device *dev,
241241
return 0;
242242
}
243243

244-
static const char *find_sdca_control_label(const struct sdca_entity *entity,
244+
static const char *find_sdca_control_label(struct device *dev,
245+
const struct sdca_entity *entity,
245246
const struct sdca_control *control)
246247
{
247248
switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
@@ -530,7 +531,7 @@ static const char *find_sdca_control_label(const struct sdca_entity *entity,
530531
case SDCA_CTL_TYPE_S(ENTITY_0, DEVICE_SDCA_VERSION):
531532
return SDCA_CTL_DEVICE_SDCA_VERSION_NAME;
532533
default:
533-
return NULL;
534+
return devm_kasprintf(dev, GFP_KERNEL, "Imp-Def %#x", control->sel);
534535
}
535536
}
536537

@@ -739,12 +740,9 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
739740
if (!ret)
740741
control->interrupt_position = tmp;
741742

742-
control->label = find_sdca_control_label(entity, control);
743-
if (!control->label) {
744-
dev_err(dev, "%s: control %#x: name not found\n",
745-
entity->label, control->sel);
746-
return -EINVAL;
747-
}
743+
control->label = find_sdca_control_label(dev, entity, control);
744+
if (!control->label)
745+
return -ENOMEM;
748746

749747
control->nbits = find_sdca_control_bits(entity, control);
750748

0 commit comments

Comments
 (0)