Skip to content

Commit 45b4aca

Browse files
simontrimmerbroonie
authored andcommitted
ASoC: wm_adsp: Add control_add callback and export wm_adsp_control_add()
The callback allows codec drivers to affect how firmware coefficients are added as controls. For example a codec driver may selectively add controls by choosing to call wm_adsp_control_add() based on some filter logic. Signed-off-by: Simon Trimmer <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 93afd02 commit 45b4aca

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

sound/soc/codecs/wm_adsp.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static void wm_adsp_ctl_work(struct work_struct *work)
583583
kfree(kcontrol);
584584
}
585585

586-
static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
586+
int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
587587
{
588588
struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp);
589589
struct cs_dsp *cs_dsp = &dsp->cs_dsp;
@@ -658,6 +658,17 @@ static int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl)
658658

659659
return ret;
660660
}
661+
EXPORT_SYMBOL_GPL(wm_adsp_control_add);
662+
663+
static int wm_adsp_control_add_cb(struct cs_dsp_coeff_ctl *cs_ctl)
664+
{
665+
struct wm_adsp *dsp = container_of(cs_ctl->dsp, struct wm_adsp, cs_dsp);
666+
667+
if (dsp->control_add)
668+
return (dsp->control_add)(dsp, cs_ctl);
669+
else
670+
return wm_adsp_control_add(cs_ctl);
671+
}
661672

662673
static void wm_adsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl)
663674
{
@@ -2072,12 +2083,12 @@ irqreturn_t wm_halo_wdt_expire(int irq, void *data)
20722083
EXPORT_SYMBOL_GPL(wm_halo_wdt_expire);
20732084

20742085
static const struct cs_dsp_client_ops wm_adsp1_client_ops = {
2075-
.control_add = wm_adsp_control_add,
2086+
.control_add = wm_adsp_control_add_cb,
20762087
.control_remove = wm_adsp_control_remove,
20772088
};
20782089

20792090
static const struct cs_dsp_client_ops wm_adsp2_client_ops = {
2080-
.control_add = wm_adsp_control_add,
2091+
.control_add = wm_adsp_control_add_cb,
20812092
.control_remove = wm_adsp_control_remove,
20822093
.pre_run = wm_adsp_pre_run,
20832094
.post_run = wm_adsp_event_post_run,

sound/soc/codecs/wm_adsp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct wm_adsp {
3737
bool wmfw_optional;
3838

3939
struct work_struct boot_work;
40+
int (*control_add)(struct wm_adsp *dsp, struct cs_dsp_coeff_ctl *cs_ctl);
4041
int (*pre_run)(struct wm_adsp *dsp);
4142

4243
bool preloaded;
@@ -132,6 +133,8 @@ int wm_adsp_compr_pointer(struct snd_soc_component *component,
132133
int wm_adsp_compr_copy(struct snd_soc_component *component,
133134
struct snd_compr_stream *stream,
134135
char __user *buf, size_t count);
136+
137+
int wm_adsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl);
135138
int wm_adsp_write_ctl(struct wm_adsp *dsp, const char *name, int type,
136139
unsigned int alg, void *buf, size_t len);
137140
int wm_adsp_read_ctl(struct wm_adsp *dsp, const char *name, int type,

0 commit comments

Comments
 (0)