ASoC sst v2: Add sn95031 codec driver
PATCH 1/4 ASoC sst v2: Add sn95031 codec driver
From: Vinod Koul <[email protected]>
This patch adds the sn95031 asoc codec driver. This driver currently supports only playback. Capture and jack detection to be added later
--- sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/sn95031.c | 495 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/sn95031.h | 99 +++++++++ 4 files changed, 600 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/sn95031.c create mode 100644 sound/soc/codecs/sn95031.h
sound/soc/codecs/Kconfig +4 -0
@@ -32,6 +32,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_MAX98088 if I2C select SND_SOC_MAX9877 if I2C select SND_SOC_PCM3008 + select SND_SOC_SN95031 if INTEL_SCU_IPC select SND_SOC_SPDIF select SND_SOC_SSM2602 if I2C select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
@@ -173,6 +174,9 @@ config SND_SOC_MAX98088 config SND_SOC_PCM3008 tristate +config SND_SOC_SN95031 + tristate + config SND_SOC_SPDIF tristate
sound/soc/codecs/Makefile +2 -0
@@ -18,6 +18,7 @@ snd-soc-l3-objs := l3.o snd-soc-max98088-objs := max98088.o snd-soc-pcm3008-objs := pcm3008.o snd-soc-alc5623-objs := alc5623.o +snd-soc-sn95031-objs := sn95031.o snd-soc-spdif-objs := spdif_transciever.o snd-soc-ssm2602-objs := ssm2602.o snd-soc-stac9766-objs := stac9766.o
@@ -97,6 +98,7 @@ obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o +obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif.o obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o
sound/soc/codecs/sn95031.c new file +495 -0
495 lines not on this page · raw message
sound/soc/codecs/sn95031.h new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
1.7.2.3
On Tue, Jan 04, 2011 at 08:16:07PM +0530, Koul, Vinod wrote:
A few comments below; depending on what Liam feels I think we can possibly merge this as-is on the basis that it's going to get future updates.
Quoted 5 lines
sound/soc/codecs/sn95031.c new file +5
-0+/* PCM interface config +* This sets the pcm rx slot conguration to max 6 slots +* for max 4 dais (2 stereo and 2 mono) +*/ +snd_soc_write (codec,SN95031_PCM2RXSLOT01 ,0x10 );
sound/soc/codecs/sn95031.c line 400
Quoted 10 lines
sound/soc/codecs/sn95031.c new file +10
-0+snd_soc_write (codec,SN95031_PCM2RXSLOT23 ,0x32 ); +snd_soc_write (codec,SN95031_PCM2RXSLOT45 ,0x54 ); +/* pcm port setting +* This sets the pcm port to slave and clock at 19.2Mhz which +* can support 6slots, sampling rate set per stream in hw-params +*/ +snd_soc_write (codec,SN95031_PCM1C1 ,0x00 ); +snd_soc_write (codec,SN95031_PCM2C1 ,0x01 ); +snd_soc_write (codec,SN95031_PCM2C2 ,0x0A ); +snd_soc_write (codec,SN95031_HSMIXER ,BIT (0 )|BIT (4 ));
This stuff should all be dynamically configured at runtime - the clocks should be being managed with set_sysclk() and the slot configuration with the TDM API or dynamic routing depending on what the actual control is.
I guess this is OK for now, though.
sound/soc/codecs/sn95031.c line 413
Quoted 2 lines
sound/soc/codecs/sn95031.c new file +2
-0+/* soft mute ramp time */ +snd_soc_write (codec,SN95031_SOFTMUTE ,0x3 );
Ideally this should be user controllable.
sound/soc/codecs/sn95031.c line 424
Quoted 3 lines
sound/soc/codecs/sn95031.c new file +3
-0+/* dac mode and lineout workaround */ +snd_soc_write (codec,SN95031_SSR2 ,0x10 ); +snd_soc_write (codec,SN95031_SSR3 ,0x40 );
DAC mode?
sound/soc/codecs/sn95031.c line 452
Quoted 7 lines
sound/soc/codecs/sn95031.c new file +7
-0+struct snd_soc_codec_driver sn95031_codec = { + .probe = sn95031_codec_probe, + .remove = sn95031_codec_remove, + .read = sn95031_read, + .write = sn95031_write, + .set_bias_level = sn95031_set_vaud_bias, +};
The formatting of the = should be consistent here.
Quoted 1 line
+MODULE_DESCRIPTION("ASoC Intel(R) SN95031 codec driver");
I thought you said this was a TI chip? For example...
Quoted 1 line
+ *
sn95031.h- TI sn95031 Codec driver
Quoted 4 lines
A few comments below; depending on what Liam feels I think we can possibly merge this as-is on the basis that it's going to get future updates.
Thanks Mark,
As we had communicated back in Nov that we are committed to asoc porting. We will continue to submit patches for fixing these as well as adding new features and codecs.
Liam, please let us know your comments or if you are okay with this.
Quoted 22 lines
Quoted 6 lines
sound/soc/codecs/sn95031.c new file +5
-0+/* PCM interface config +* This sets the pcm rx slot conguration to max 6 slots +* for max 4 dais (2 stereo and 2 mono) +*/ +snd_soc_write (codec,SN95031_PCM2RXSLOT01 ,0x10 );sound/soc/codecs/sn95031.c line 400
Quoted 10 lines
sound/soc/codecs/sn95031.c new file +10
-0+snd_soc_write (codec,SN95031_PCM2RXSLOT23 ,0x32 ); +snd_soc_write (codec,SN95031_PCM2RXSLOT45 ,0x54 ); +/* pcm port setting +* This sets the pcm port to slave and clock at 19.2Mhz which +* can support 6slots, sampling rate set per stream in hw-params +*/ +snd_soc_write (codec,SN95031_PCM1C1 ,0x00 ); +snd_soc_write (codec,SN95031_PCM2C1 ,0x01 ); +snd_soc_write (codec,SN95031_PCM2C2 ,0x0A ); +snd_soc_write (codec,SN95031_HSMIXER ,BIT (0 )|BIT (4 ));This stuff should all be dynamically configured at runtime - the clocks should be being managed with
set_sysclk()and the slot configuration with the TDM API or dynamic routing depending on what the actual control is.
Quoted 1 line
I guess this is OK for now, though.
Since we have single PCM port and TDM slots. For all DAIs it needs to be single configuration and not changed while one is running.
Quoted 4 lines
sound/soc/codecs/sn95031.c line 413
Quoted 2 lines
sound/soc/codecs/sn95031.c new file +2
-0+/* soft mute ramp time */ +snd_soc_write (codec,SN95031_SOFTMUTE ,0x3 );Ideally this should be user controllable.
I will send a patch later for this
Quoted 6 lines
sound/soc/codecs/sn95031.c line 424
Quoted 4 lines
sound/soc/codecs/sn95031.c new file +3
-0+/* dac mode and lineout workaround */ +snd_soc_write (codec,SN95031_SSR2 ,0x10 ); +snd_soc_write (codec,SN95031_SSR3 ,0x40 );DAC mode?
DAC performance mode, yes ideally it should be in controls Will add next...
Quoted 11 lines
sound/soc/codecs/sn95031.c line 452
Quoted 8 lines
sound/soc/codecs/sn95031.c new file +7
-0+struct snd_soc_codec_driver sn95031_codec = { + .probe = sn95031_codec_probe, + .remove = sn95031_codec_remove, + .read = sn95031_read, + .write = sn95031_write, + .set_bias_level = sn95031_set_vaud_bias, +};The formatting of the = should be consistent here.
Quoted 5 lines
Quoted 1 line
+MODULE_DESCRIPTION("ASoC Intel(R) SN95031 codec driver");
I thought you said this was a TI chip? For example...
Quoted 1 line
+ *
sn95031.h- TI sn95031 Codec driver
My bad missed it, will fix it in next patch.
~Vinod
Quoted 10 lines · Vinod
Quoted 9 lines
sound/soc/codecs/sn95031.c line 389
Quoted 4 lines
sound/soc/codecs/sn95031.c new file +4
-0+/* PCM interface config +* This sets the pcm rx slot conguration to max 6 slots +* for max 4 dais (2 stereo and 2 mono) +*/ This stuff should all be dynamically configured at runtime - the clocks should be being managed with
set_sysclk()and the slot configuration with the TDM API or dynamic routing depending on what the actual control is.
Quoted 2 lines
Since we have single PCM port and TDM slots. For all DAIs it needs to be single configuration and not changed while one is running.
It's a big jump to go from not being able to configure while active to hard coding within the CODEC driver - machine drivers should be able to change this sort of thing during initialisation, and ideally also dynamically where possible (for example, only while there are no active audio streams).
Liam Girdwood
Acked-byQuoted 10 lines · Vinod
Quoted 4 lines
A few comments below; depending on what Liam feels I think we can possibly merge this as-is on the basis that it's going to get future updates.
Thanks Mark,
As we had communicated back in Nov that we are committed to asoc porting. We will continue to submit patches for fixing these as well as adding new features and codecs.Liam, please let us know your comments or if you are okay with this.
Sorry, been on the road last week.
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk