Skip to content

Commit 3712851

Browse files
Hsin-Yu Chaobroonie
authored andcommitted
ASoC: rt5514: Revert Hotword Model control
This reverts commit eb33869 ("ASoC: rt5514: Guard Hotword Model bytes loading") and commit d18420b ("ASoC: rt5514: expose Hotword Model control") It is discouraged to use SND_SOC_BYTES_TLV to load arbitrary bytes from userspace to driver. Removing the 'Hotword Model' control until we have a good way to verify the content of hotword model blobs. Signed-off-by: Hsin-Yu Chao <hychao@chromium.org> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 659178f commit 3712851

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

sound/soc/codecs/rt5514.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -338,39 +338,6 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
338338
fw = NULL;
339339
}
340340

341-
if (rt5514->model_buf && rt5514->model_len) {
342-
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
343-
int ret;
344-
345-
ret = rt5514_spi_burst_write(0x4ff80000,
346-
rt5514->model_buf,
347-
((rt5514->model_len / 8) + 1) * 8);
348-
if (ret) {
349-
dev_err(codec->dev,
350-
"Model load failed %d\n", ret);
351-
return ret;
352-
}
353-
#else
354-
dev_err(codec->dev,
355-
"No SPI driver for loading firmware\n");
356-
#endif
357-
} else {
358-
request_firmware(&fw, RT5514_FIRMWARE3,
359-
codec->dev);
360-
if (fw) {
361-
#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
362-
rt5514_spi_burst_write(0x4ff80000,
363-
fw->data,
364-
((fw->size/8)+1)*8);
365-
#else
366-
dev_err(codec->dev,
367-
"No SPI driver to load fw\n");
368-
#endif
369-
release_firmware(fw);
370-
fw = NULL;
371-
}
372-
}
373-
374341
/* DSP run */
375342
regmap_write(rt5514->i2c_regmap, 0x18002f00,
376343
0x00055148);
@@ -385,34 +352,6 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
385352
return 0;
386353
}
387354

388-
static int rt5514_hotword_model_put(struct snd_kcontrol *kcontrol,
389-
const unsigned int __user *bytes, unsigned int size)
390-
{
391-
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
392-
struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
393-
struct snd_soc_codec *codec = rt5514->codec;
394-
int ret = 0;
395-
396-
if (rt5514->model_buf || rt5514->model_len < size) {
397-
if (rt5514->model_buf)
398-
devm_kfree(codec->dev, rt5514->model_buf);
399-
rt5514->model_buf = devm_kmalloc(codec->dev, size, GFP_KERNEL);
400-
if (!rt5514->model_buf) {
401-
ret = -ENOMEM;
402-
goto done;
403-
}
404-
}
405-
406-
/* Skips the TLV header. */
407-
bytes += 2;
408-
409-
if (copy_from_user(rt5514->model_buf, bytes, size))
410-
ret = -EFAULT;
411-
done:
412-
rt5514->model_len = (ret ? 0 : size);
413-
return ret;
414-
}
415-
416355
static const struct snd_kcontrol_new rt5514_snd_controls[] = {
417356
SOC_DOUBLE_TLV("MIC Boost Volume", RT5514_ANA_CTRL_MICBST,
418357
RT5514_SEL_BSTL_SFT, RT5514_SEL_BSTR_SFT, 8, 0, bst_tlv),
@@ -424,8 +363,6 @@ static const struct snd_kcontrol_new rt5514_snd_controls[] = {
424363
adc_vol_tlv),
425364
SOC_SINGLE_EXT("DSP Voice Wake Up", SND_SOC_NOPM, 0, 1, 0,
426365
rt5514_dsp_voice_wake_up_get, rt5514_dsp_voice_wake_up_put),
427-
SND_SOC_BYTES_TLV("Hotword Model", 0x8504,
428-
NULL, rt5514_hotword_model_put),
429366
};
430367

431368
/* ADC Mixer*/

sound/soc/codecs/rt5514.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@
255255

256256
#define RT5514_FIRMWARE1 "rt5514_dsp_fw1.bin"
257257
#define RT5514_FIRMWARE2 "rt5514_dsp_fw2.bin"
258-
#define RT5514_FIRMWARE3 "rt5514_dsp_fw3.bin"
259258

260259
/* System Clock Source */
261260
enum {
@@ -282,8 +281,6 @@ struct rt5514_priv {
282281
int pll_in;
283282
int pll_out;
284283
int dsp_enabled;
285-
u8 *model_buf;
286-
unsigned int model_len;
287284
};
288285

289286
#endif /* __RT5514_H__ */

0 commit comments

Comments
 (0)