Skip to content

Commit a44b7b5

Browse files
committed
ASoC: Extend wm_adsp so cs35l56 can suppress controls
Merge series from Simon Trimmer <[email protected]>: This pair of patches extend wm_adsp to add a callback that can be used to control whether ALSA controls are added and then tweak cs35l56 to use it to suppress controls made from firmware coefficients.
2 parents e42066d + 2c3640b commit a44b7b5

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

sound/soc/codecs/cs35l56.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,11 @@ int cs35l56_system_resume(struct device *dev)
10951095
}
10961096
EXPORT_SYMBOL_GPL(cs35l56_system_resume);
10971097

1098+
static int cs35l56_control_add_nop(struct wm_adsp *dsp, struct cs_dsp_coeff_ctl *cs_ctl)
1099+
{
1100+
return 0;
1101+
}
1102+
10981103
static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
10991104
{
11001105
struct wm_adsp *dsp;
@@ -1117,6 +1122,12 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)
11171122
dsp->fw = 12;
11181123
dsp->wmfw_optional = true;
11191124

1125+
/*
1126+
* None of the firmware controls need to be exported so add a no-op
1127+
* callback that suppresses creating an ALSA control.
1128+
*/
1129+
dsp->control_add = &cs35l56_control_add_nop;
1130+
11201131
dev_dbg(cs35l56->base.dev, "DSP system name: '%s'\n", dsp->system_name);
11211132

11221133
ret = wm_halo_init(dsp);

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)