ASoC: rt5670: Add dsp support
Subsystems (3)
PATCH RESEND 1/1 ASoC: rt5670: Add dsp support
Add dsp part of rt5670 codec driver
--- sound/soc/codecs/Makefile | 2 +- sound/soc/codecs/rt5670-dsp.c | 383 ++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/rt5670-dsp.h | 11 +- sound/soc/codecs/rt5670.c | 43 +++++ sound/soc/codecs/rt5670.h | 3 + 5 files changed, 435 insertions(+), 7 deletions(-) create mode 100644 sound/soc/codecs/rt5670-dsp.c
sound/soc/codecs/Makefile +1 -1
@@ -78,7 +78,7 @@ snd-soc-rt5631-objs := rt5631.o 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-rt5670-objs := rt5670.o rt5670-dsp.o snd-soc-rt5677-objs := rt5677.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o
sound/soc/codecs/rt5670-dsp.c new file +383 -0
383 lines not on this page · raw message
sound/soc/codecs/rt5670-dsp.h +5 -6
@@ -43,12 +43,11 @@#define RT5670_DSP_I2C_AL_16 (0x1 << 1)#define RT5670_DSP_CMD_EN (0x1) -struct rt5670_dsp_param { -u16 cmd_fmt; -u16 addr; -u16 data; -u8 cmd; -}; +int rt5670_dsp_probe (struct snd_soc_codec *codec); +int rt5670_dsp_write (struct snd_soc_codec *codec, +unsigned int addr,unsigned int data); +unsigned int rt5670_dsp_read ( +struct snd_soc_codec *codec,unsigned int reg);#endif /* __RT5670_DSP_H__ */
sound/soc/codecs/rt5670.c +43 -0
67 lines not on this page · raw message
sound/soc/codecs/rt5670.h +3 -0
@@ -1997,4 +1997,7 @@ struct rt5670_priv { int jack_type; }; +int rt5670_write_fw (struct snd_soc_codec *codec,const struct firmware *fw, +unsigned int pos,unsigned int num); +#endif /* __RT5670_H__ */
Signature · 1 line
1.8.1.1.439.g50a6b54
Mark Brown
maintainerQuoted 1 line · Bard Liao
+static const struct firmware
*rt5670_dsp_fw;
This should be part of the driver data not a global static.
sound/soc/codecs/rt5670-dsp.c line 237
Quoted 4 lines
sound/soc/codecs/rt5670-dsp.c new file +4
-0+/* DSP Mode */ +static const char *const rt5670_dsp_mode[] = { +"Mode 1" ,"Mode 2" ,"Mode 3" ,"Mode 4" ,"Mode 5" +};
What exactly are these modes?
Quoted 8 lines
-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Saturday, October 04, 2014 12:32 AM
To: Bard Liao
Cc: [email protected]; [email protected]; [email protected]; Flove; Oder Chiou
Subject: Re: [PATCH RESEND] ASoC: rt5670: Add dsp support
Quoted 6 lines
sound/soc/codecs/rt5670-dsp.c line 237
Quoted 4 lines
sound/soc/codecs/rt5670-dsp.c new file +4
-0+/* DSP Mode */ +static const char *const rt5670_dsp_mode[] = { +"Mode 1" ,"Mode 2" ,"Mode 3" ,"Mode 4" ,"Mode 5" +};What exactly are these modes?
These are DSP working modes, such as noise suppression, echo cancellation... The reason we won't have a specific name on alsa control is that the driver will be more flexible and we can define customized modes on the firmware. For example, the 5 modes may be noise suppression 1, noise suppression 2, noise suppression + echo cancellation, voice tracking, echo cancellation.
Quoted 2 lines
------Please consider the environment before printing this e-mail.
Mark Brown
maintainerQuoted 7 lines · Bard Liao
Quoted 6 lines
sound/soc/codecs/rt5670-dsp.c line 237
Quoted 4 lines
sound/soc/codecs/rt5670-dsp.c new file +4
-0+/* DSP Mode */ +static const char *const rt5670_dsp_mode[] = { +"Mode 1" ,"Mode 2" ,"Mode 3" ,"Mode 4" ,"Mode 5" +};What exactly are these modes?
Quoted 5 lines
These are DSP working modes, such as noise suppression, echo cancellation... The reason we won't have a specific name on alsa control is that the driver will be more flexible and we can define customized modes on the firmware. For example, the 5 modes may be noise suppression 1, noise suppression 2, noise suppression + echo cancellation, voice tracking, echo cancellation.
That's not really good for users, it means that their configuration silently depends on the firmware they're using so a new firmware version could break things non-obviously and the control might not work for some values if one of the modes is unused. What would be much better would be if the firmware were to describe the modes it implements (this could be done as metadata rather than as a part of the image being downloaded) then we can read the modes at runtime and match them up with the control.
As things stand this may as well just be a plain numeric control.