ASoC: rt5677: Support DSP function for VAD application
Subsystems (3)
Oder Chiou
maintainerPATCH 1/1 ASoC: rt5677: Support DSP function for VAD application
The ALC5677 has a programmable DSP, and there is a SPI that is dadicated for DSP firmware loading. Therefore, the patch includes a SPI driver for writing the DSP firmware. The VAD(Voice Activaty Detection) has be implemented and use the DSP to recognize the key phase.
--- sound/soc/codecs/Makefile | 2 +- sound/soc/codecs/rt5677-spi.c | 129 +++++++++++++++++++ sound/soc/codecs/rt5677-spi.h | 21 ++++ sound/soc/codecs/rt5677.c | 286 +++++++++++++++++++++++++++++++++++++++++- sound/soc/codecs/rt5677.h | 6 + 5 files changed, 439 insertions(+), 5 deletions(-) create mode 100644 sound/soc/codecs/rt5677-spi.c create mode 100644 sound/soc/codecs/rt5677-spi.h
sound/soc/codecs/Makefile +1 -1
@@ -75,7 +75,7 @@ snd-soc-rt5640-objs := rt5640.o snd-soc-rt5645-objs := rt5645.o snd-soc-rt5651-objs := rt5651.o snd-soc-rt5670-objs := rt5670.o -snd-soc-rt5677-objs := rt5677.o +snd-soc-rt5677-objs := rt5677.o rt5677-spi.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o snd-soc-alc5632-objs := alc5632.o
sound/soc/codecs/rt5677-spi.c new file +129 -0
129 lines not on this page · raw message
sound/soc/codecs/rt5677-spi.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* rt5677-spi.h -- RT5677 ALSA SoC audio codec driver +* +* Copyright 2013 Realtek Semiconductor Corp. +* Author: Oder Chiou <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __RT5671_SPI_H__ +#define __RT5671_SPI_H__ + +#define RT5677_SPI_BUF_LEN 240 +#define RT5677_SPI_CMD_BURST_WRITE 0x05 + +int rt5677_spi_write (u8 *txbuf,size_t len); +int rt5677_spi_burst_write (u32 addr,const struct firmware *fw); + +#endif /* __RT5677_SPI_H__ */
sound/soc/codecs/rt5677.c +282 -4
346 lines not on this page · raw message
sound/soc/codecs/rt5677.h +6 -0
@@ -1403,6 +1403,9 @@#define RT5677_GPIO5_FUNC_GPIO (0x0 << 9)#define RT5677_GPIO5_FUNC_DMIC (0x1 << 9) +#define RT5677_FIRMWARE1 "rt5677_dsp_fw1.bin" +#define RT5677_FIRMWARE2 "rt5677_dsp_fw2.bin" +/* System Clock Source */ enum {RT5677_SCLK_S_MCLK ,
@@ -1432,6 +1435,8 @@ struct rt5677_priv {struct snd_soc_codec *codec;struct rt5677_platform_data pdata;struct regmap *regmap; +const struct firmware *fw1, *fw2; +struct mutex dsp_cmd_lock;int sysclk;int sysclk_src;
@@ -1441,6 +1446,7 @@ struct rt5677_priv {int pll_src;int pll_in;int pll_out; + bool dsp_vad_en; };#endif /* __RT5677_H__ */
Signature · 1 line
1.8.1.1.439.g50a6b54
Mark Brown
maintainerQuoted 4 lines · Oder Chiou
The ALC5677 has a programmable DSP, and there is a SPI that is dadicated for DSP firmware loading. Therefore, the patch includes a SPI driver for writing the DSP firmware. The VAD(Voice Activaty Detection) has be implemented and use the DSP to recognize the key phase.
This is fine but doesn't apply against current code, please check and resend.