ASoC: Add support for Cirrus Logic CS42L73 Codec
Subsystems (3)
PATCH 1/1 ASoC: Add support for Cirrus Logic CS42L73 Codec
--- sound/soc/codecs/Kconfig | 4 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs42l73.c | 1372 ++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/cs42l73.h | 225 ++++++++ 4 files changed, 1603 insertions(+), 0 deletions(-) create mode 100644 sound/soc/codecs/cs42l73.c create mode 100644 sound/soc/codecs/cs42l73.h
sound/soc/codecs/Kconfig +4 -0
@@ -28,6 +28,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_ALC5623 if I2C select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC select SND_SOC_CS42L51 if I2C + select SND_SOC_CS42L73 if I2C select SND_SOC_CS4270 if I2C select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI select SND_SOC_CX20442
@@ -173,6 +174,9 @@ config SND_SOC_CQ0093VC config SND_SOC_CS42L51 tristate +config SND_SOC_CS42L73 + tristate + # Cirrus Logic CS4270 Codec config SND_SOC_CS4270 tristate
sound/soc/codecs/Makefile +2 -0
@@ -15,6 +15,7 @@ snd-soc-ak4642-objs := ak4642.o snd-soc-ak4671-objs := ak4671.o snd-soc-cq93vc-objs := cq93vc.o snd-soc-cs42l51-objs := cs42l51.o +snd-soc-cs42l73-objs := cs42l73.o snd-soc-cs4270-objs := cs4270.o snd-soc-cs4271-objs := cs4271.o snd-soc-cx20442-objs := cx20442.o
@@ -113,6 +114,7 @@ obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o +obj-$(CONFIG_SND_SOC_CS42L73) += snd-soc-cs42l73.o obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o
sound/soc/codecs/cs42l73.c new file +1372 -0
1,372 lines not on this page · raw message
sound/soc/codecs/cs42l73.h new file +225 -0
225 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Quoted 1 line · Brian Austin
---
This patch can't be applied as you haven't signed it off. Please follow the process in Documentation/SubmittingPatches, including the bit about always CCing maintainers on patches.
sound/soc/codecs/cs42l73.c line 22
Quoted 2 lines
sound/soc/codecs/cs42l73.c new file +2
-0+#include <linux/i2c.h> +#include <linux/platform_device.h>
Platform device?
sound/soc/codecs/cs42l73.c line 43
Quoted 4 lines
sound/soc/codecs/cs42l73.c new file +4
-0+struct cs42l73_private { +enum snd_soc_control_type control_type; +void *control_data; +u8 reg_cache[CS42L73_CACHEREGNUM ];
Use the standard cache infrastructure, don't open code it.
sound/soc/codecs/cs42l73.c line 105
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+int cs42l73_write (struct snd_soc_codec *codec,unsigned reg,u_int val) +{ +u8 data[2 ]; + +if (reg >CS42L73_CACHEREGNUM ) +return -EINVAL ;
Use the standard I/O infrastructure too.
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+int cs42l73_get_volsw (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; + +unsigned int reg = mc->reg; +unsigned int shift = mc->shift; +unsigned int rshift = mc->rshift;
sound/soc/codecs/cs42l73.c line 150
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+int max = mc->max; +int min = mc->min; +int mmax = (max > min) ? max:min; +unsigned int mask = (1 <<fls (mmax)) -1 ; + + ucontrol->value.integer.value[0 ] = + ((cs42l73_read (codec, reg) >> shift) - min) & mask; +if (shift != rshift) + ucontrol->value.integer.value[1 ] = + ((cs42l73_read (codec, reg) >> rshift) - min) & mask;
Why is this open coded? This doesn't look driver specific and...
sound/soc/codecs/cs42l73.c line 250
Quoted 2 lines
sound/soc/codecs/cs42l73.c new file +2
-0+#define SOC_SINGLE_S8_C_TLV (xname, xreg, xshift, xmax, xmin, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
...the names given are obviously not driver specific names.
sound/soc/codecs/cs42l73.c line 371
Quoted 12 lines
sound/soc/codecs/cs42l73.c new file +12
-0+/* ESL-ASP, ESL-XSP, SPK-ASP, SPK-XSP Mono Mixer Selects */ +static const struct soc_enum mono_mixer_enum[] = +{ +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,6 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,4 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,2 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,0 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +};
Don't use arrays of controls, use named variables. Arrays are error prone when referencing.
sound/soc/codecs/cs42l73.c line 397
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+static const struct snd_kcontrol_new cs42l73_snd_controls[] = { +/* +SOC_DOUBLE_R_S8_C (..., max, min) +min - min from CS datasheet +max - fls(max) - min + max from CS datasheet +*/
In general you've got rather a lot of comments pointing out very obvious things.
Quoted 1 line
+/* Volume */
Indentation here and throughout the table.
sound/soc/codecs/cs42l73.c line 576
Quoted 3 lines
sound/soc/codecs/cs42l73.c new file +3
-0+SND_SOC_DAPM_MICBIAS ("MIC1 Bias" ,CS42L73_PWRCTL2 ,6 ,1 ), +SND_SOC_DAPM_INPUT ("MIC2" ), + SND_SOC_DAPM_MICBIAS("MIC2 Bias", CS42L73_PWRCTL2, 7, 1),
Just use supply widgets.
sound/soc/codecs/cs42l73.c line 677
Quoted 7 lines
sound/soc/codecs/cs42l73.c new file +7
-0+static int cs42l73_add_widgets (struct snd_soc_codec *codec) +{ +struct snd_soc_dapm_context *dapm = &codec->dapm; + +snd_soc_dapm_new_controls (dapm, cs42l73_dapm_widgets, +ARRAY_SIZE (cs42l73_dapm_widgets)); +snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map));
Just initialize these using the driver structure.
sound/soc/codecs/cs42l73.c line 789
Quoted 5 lines
sound/soc/codecs/cs42l73.c new file +5
-0+/* MCLKX -> MCLK */ + mclkx_coeff =cs42l74_get_mclkx_coeff (priv->sysclk); + +if (mclkx_coeff <0 ) +return -EINVAL ;
Better to pass through the error code you got.
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+static int cs42l73_set_sysclk (struct snd_soc_dai *dai, +int clk_id,unsigned int freq,int dir) +{ +struct snd_soc_codec *codec = dai->codec; +struct cs42l73_private *priv =snd_soc_codec_get_drvdata (codec); +
sound/soc/codecs/cs42l73.c line 824
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+if (clk_id !=CS42L73_CLKID_MCLK1 && clk_id !=CS42L73_CLKID_MCLK2 ) { +dev_err (codec->dev,"Invalid clk_id %u\n" , clk_id); +return -EINVAL ; + } + +if ((cs42l74_get_mclkx_coeff (freq) <0 )) { +dev_err (codec->dev,"Invalid sysclk %u\n" , freq); +return -EINVAL ; + } +
This ought to be a switch statement I think.
sound/soc/codecs/cs42l73.c line 828
Quoted 4 lines
sound/soc/codecs/cs42l73.c new file +4
-0+ priv->sysclk = freq; + priv->mclksel = clk_id; + +return cs42l73_set_mclk (dai);
With this we could assign the variables and then fail.
sound/soc/codecs/cs42l73.c line 836
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+/* +cs42l73_set_dai_clkdiv() +Setup MCLKx, MMCC dividers. +The dividers are selected from the MCLKX and the +sample rate. +*/
Coding style.
sound/soc/codecs/cs42l73.c line 842
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+static int cs42l73_set_clkdiv (struct snd_soc_dai *codec_dai, +int div_id,int div) +{ +struct snd_soc_codec *codec = codec_dai->codec; +int id = codec_dai->id; +u8 reg;
Indentation.
sound/soc/codecs/cs42l73.c line 849
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+switch (div_id) { +case CS42L73_MCLKXDIV : +/* MCLKDIV */ + reg =cs42l73_read (codec,CS42L73_DMMCC ) &0xf1 ; +cs42l73_write (codec,CS42L73_DMMCC , + reg | ((div &0x07 ) <<1 ));
Coding style and indentation are both bad here. checkpatch should spot some of this. You should use snd_soc_update_bits() too (and throughout the code), and the comment should be fairly obvious but actually doesn't agree with the constant.
Also, why are users having to explicitly set this stuff, can't the driver work this out?
Quoted 4 lines
sound/soc/codecs/cs42l73.c new file +4
-0+static u32 cs42l73_asrc_rates[] = { +8000 ,11025 ,12000 ,16000 ,22050 , +24000 ,32000 ,44100 ,48000 +};
sound/soc/codecs/cs42l73.c line 953
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+ +static unsigned int cs42l73_get_xspfs_coeff (u32 rate) +{ +int i; +for (i =0 ; i <ARRAY_SIZE (cs42l73_asrc_rates); i++) { +if (cs42l73_asrc_rates[i] == rate) +return (i +1 ); + } +return 0 ;/* 0 = Don't know */ +}
Shouldn't you return an error?
sound/soc/codecs/cs42l73.c line 965
Quoted 12 lines
sound/soc/codecs/cs42l73.c new file +12
-0+ +static void cs42l73_update_asrc (struct snd_soc_codec *codec,int id,int srate) +{ +u8 spfs =0 ; +u8 reg; + +if (srate >0 ) + spfs =cs42l73_get_xspfs_coeff (srate); + +switch (id) { +case CS42L73_XSP : + reg =cs42l73_read (codec,CS42L73_VXSPFS );
Coding style. There's a lot more issues than I've been pointing out, in general if your code doesn't visually resemble other Linux code there's an issue.
Quoted 7 lines
sound/soc/codecs/cs42l73.c new file +7
-0+case SND_SOC_BIAS_STANDBY : +/* Powerdown all ports, inputs and outputs */ +cs42l73_write (codec,CS42L73_DMMCC , dmmcc & ~MCLKDIS ); + +cs42l73_write (codec,CS42L73_PWRCTL3 , +PDN_THMS |PDN_SPKLO |PDN_EAR | +PDN_SPK |PDN_LO |PDN_HP );
sound/soc/codecs/cs42l73.c line 1067
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+ +cs42l73_write (codec,CS42L73_PWRCTL2 , +PDN_MIC2_BIAS |PDN_MIC1_BIAS | +PDN_VSP |PDN_ASP_SDOUT |PDN_ASP_SDIN | +PDN_XSP_SDOUT |PDN_XSP_SDIN ); + +cs42l73_write (codec,CS42L73_PWRCTL1 , +PDN_ADCB |PDN_ADCA |PDN_DMICB | +PDN_DMICA |PDN ); +break ;
This looks like it should all be managed by DAPM.
sound/soc/codecs/cs42l73.c line 1113
Quoted 9 lines
sound/soc/codecs/cs42l73.c new file +9
-0+static void cs42l73_shutdown (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct snd_soc_codec *codec = dai->codec; +int id = dai->id; +struct cs42l73_private *priv =snd_soc_codec_get_drvdata (codec); + priv->config[id].srate =0 ; +cs42l73_update_asrc (codec,id,0 ); +}
What happens with simultaneous playback and record?
sound/soc/codecs/cs42l73.c line 1221
Quoted 9 lines
sound/soc/codecs/cs42l73.c new file +9
-0+static int cs42l73_resume (struct snd_soc_codec *codec) +{ +int i; +u8 *cache = codec->reg_cache; + +/* Sync reg_cache with the hardware */ +for (i =CS42L73_PWRCTL1 ; i <ARRAY_SIZE (cs42l73_reg); i++) { +cs42l73_write (codec, i, cache[i]); + }
There's standard infrastructure for this too.
sound/soc/codecs/cs42l73.h line 138
Quoted 8 lines
sound/soc/codecs/cs42l73.h new file +8
-0+/* CS42L73_PWRCTL1 */ +#define PDN_ADCB (1 << 7) +#define PDN_DMICB (1 << 6) +#define PDN_ADCA (1 << 5) +#define PDN_DMICA (1 << 4) +#define PDN_LDO (1 << 2) +#define DISCHG_FILT (1 << 1) +#define PDN (1 << 0)
Namespacing here and elsewhere in the header.
Quoted 247 lines · Mark Brown
Quoted 1 line · Brian Austin
---
This patch can't be applied as you haven't signed it off. Please follow the process in
Documentation/SubmittingPatches, including the bit about always CCing maintainers on patches.sound/soc/codecs/cs42l73.c line 22
Quoted 2 lines
sound/soc/codecs/cs42l73.c new file +2
-0+#include <linux/i2c.h> +#include <linux/platform_device.h> Platform device?
sound/soc/codecs/cs42l73.c line 43
Quoted 4 lines
sound/soc/codecs/cs42l73.c new file +4
-0+struct cs42l73_private { +enum snd_soc_control_type control_type; +void *control_data; +u8 reg_cache[CS42L73_CACHEREGNUM ];Use the standard cache infrastructure, don't open code it.
sound/soc/codecs/cs42l73.c line 105
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+int cs42l73_write (struct snd_soc_codec *codec,unsigned reg,u_int val) +{ +u8 data[2 ]; + +if (reg >CS42L73_CACHEREGNUM ) +return -EINVAL ;Use the standard I/O infrastructure too.
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+int cs42l73_get_volsw (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +struct soc_mixer_control *mc = + (struct soc_mixer_control *)kcontrol->private_value; + +unsigned int reg = mc->reg; +unsigned int shift = mc->shift; +unsigned int rshift = mc->rshift;sound/soc/codecs/cs42l73.c line 150
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+int max = mc->max; +int min = mc->min; +int mmax = (max > min) ? max:min; +unsigned int mask = (1 <<fls (mmax)) -1 ; + + ucontrol->value.integer.value[0 ] = + ((cs42l73_read (codec, reg) >> shift) - min) & mask; +if (shift != rshift) + ucontrol->value.integer.value[1 ] = + ((cs42l73_read (codec, reg) >> rshift) - min) & mask;Why is this open coded? This doesn't look driver specific and...
sound/soc/codecs/cs42l73.c line 250
Quoted 2 lines
sound/soc/codecs/cs42l73.c new file +2
-0+#define SOC_SINGLE_S8_C_TLV (xname, xreg, xshift, xmax, xmin, tlv_array) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \...the names given are obviously not driver specific names.
sound/soc/codecs/cs42l73.c line 371
Quoted 12 lines
sound/soc/codecs/cs42l73.c new file +12
-0+/* ESL-ASP, ESL-XSP, SPK-ASP, SPK-XSP Mono Mixer Selects */ +static const struct soc_enum mono_mixer_enum[] = +{ +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,6 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,4 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,2 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +SOC_ENUM_SINGLE (CS42L73_MMIXCTL ,0 , +ARRAY_SIZE (cs42l73_mono_mixer_text), cs42l73_mono_mixer_text), +};Don't use arrays of controls, use named variables. Arrays are error prone when referencing.
sound/soc/codecs/cs42l73.c line 397
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+static const struct snd_kcontrol_new cs42l73_snd_controls[] = { +/* +SOC_DOUBLE_R_S8_C (..., max, min) +min - min from CS datasheet +max - fls(max) - min + max from CS datasheet +*/ In general you've got rather a lot of comments pointing out very obvious things.
Quoted 1 line
+/* Volume */
Indentation here and throughout the table.
sound/soc/codecs/cs42l73.c line 576
Quoted 3 lines
sound/soc/codecs/cs42l73.c new file +3
-0+SND_SOC_DAPM_MICBIAS ("MIC1 Bias" ,CS42L73_PWRCTL2 ,6 ,1 ), +SND_SOC_DAPM_INPUT ("MIC2" ), + SND_SOC_DAPM_MICBIAS("MIC2 Bias", CS42L73_PWRCTL2, 7, 1),Just use supply widgets.
sound/soc/codecs/cs42l73.c line 677
Quoted 7 lines
sound/soc/codecs/cs42l73.c new file +7
-0+static int cs42l73_add_widgets (struct snd_soc_codec *codec) +{ +struct snd_soc_dapm_context *dapm = &codec->dapm; + +snd_soc_dapm_new_controls (dapm, cs42l73_dapm_widgets, +ARRAY_SIZE (cs42l73_dapm_widgets)); +snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map));Just initialize these using the driver structure.
sound/soc/codecs/cs42l73.c line 789
Quoted 5 lines
sound/soc/codecs/cs42l73.c new file +5
-0+/* MCLKX -> MCLK */ + mclkx_coeff =cs42l74_get_mclkx_coeff (priv->sysclk); + +if (mclkx_coeff <0 ) +return -EINVAL ;Better to pass through the error code you got.
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+static int cs42l73_set_sysclk (struct snd_soc_dai *dai, +int clk_id,unsigned int freq,int dir) +{ +struct snd_soc_codec *codec = dai->codec; +struct cs42l73_private *priv =snd_soc_codec_get_drvdata (codec); +sound/soc/codecs/cs42l73.c line 824
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+if (clk_id !=CS42L73_CLKID_MCLK1 && clk_id !=CS42L73_CLKID_MCLK2 ) { +dev_err (codec->dev,"Invalid clk_id %u\n" , clk_id); +return -EINVAL ; + } + +if ((cs42l74_get_mclkx_coeff (freq) <0 )) { +dev_err (codec->dev,"Invalid sysclk %u\n" , freq); +return -EINVAL ; + } +This ought to be a switch statement I think.
sound/soc/codecs/cs42l73.c line 828
Quoted 4 lines
sound/soc/codecs/cs42l73.c new file +4
-0+ priv->sysclk = freq; + priv->mclksel = clk_id; + +return cs42l73_set_mclk (dai);With this we could assign the variables and then fail.
sound/soc/codecs/cs42l73.c line 836
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+/* +cs42l73_set_dai_clkdiv() +Setup MCLKx, MMCC dividers. +The dividers are selected from the MCLKX and the +sample rate. +*/ Coding style.
sound/soc/codecs/cs42l73.c line 842
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+static int cs42l73_set_clkdiv (struct snd_soc_dai *codec_dai, +int div_id,int div) +{ +struct snd_soc_codec *codec = codec_dai->codec; +int id = codec_dai->id; +u8 reg;Indentation.
sound/soc/codecs/cs42l73.c line 849
Quoted 6 lines
sound/soc/codecs/cs42l73.c new file +6
-0+switch (div_id) { +case CS42L73_MCLKXDIV : +/* MCLKDIV */ + reg =cs42l73_read (codec,CS42L73_DMMCC ) &0xf1 ; +cs42l73_write (codec,CS42L73_DMMCC , + reg | ((div &0x07 ) <<1 ));Coding style and indentation are both bad here. checkpatch should spot some of this. You should use
snd_soc_update_bits()too (and throughout the code), and the comment should be fairly obvious but actually doesn't agree with the constant.Also, why are users having to explicitly set this stuff, can't the driver work this out?
Quoted 4 lines
sound/soc/codecs/cs42l73.c new file +4
-0+static u32 cs42l73_asrc_rates[] = { +8000 ,11025 ,12000 ,16000 ,22050 , +24000 ,32000 ,44100 ,48000 +};sound/soc/codecs/cs42l73.c line 953
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+ +static unsigned int cs42l73_get_xspfs_coeff (u32 rate) +{ +int i; +for (i =0 ; i <ARRAY_SIZE (cs42l73_asrc_rates); i++) { +if (cs42l73_asrc_rates[i] == rate) +return (i +1 ); + } +return 0 ;/* 0 = Don't know */ +}Shouldn't you return an error?
sound/soc/codecs/cs42l73.c line 965
Quoted 12 lines
sound/soc/codecs/cs42l73.c new file +12
-0+ +static void cs42l73_update_asrc (struct snd_soc_codec *codec,int id,int srate) +{ +u8 spfs =0 ; +u8 reg; + +if (srate >0 ) + spfs =cs42l73_get_xspfs_coeff (srate); + +switch (id) { +case CS42L73_XSP : + reg =cs42l73_read (codec,CS42L73_VXSPFS );Coding style. There's a lot more issues than I've been pointing out, in general if your code doesn't visually resemble other Linux code there's an issue.
Quoted 7 lines
sound/soc/codecs/cs42l73.c new file +7
-0+case SND_SOC_BIAS_STANDBY : +/* Powerdown all ports, inputs and outputs */ +cs42l73_write (codec,CS42L73_DMMCC , dmmcc & ~MCLKDIS ); + +cs42l73_write (codec,CS42L73_PWRCTL3 , +PDN_THMS |PDN_SPKLO |PDN_EAR | +PDN_SPK |PDN_LO |PDN_HP );sound/soc/codecs/cs42l73.c line 1067
Quoted 10 lines
sound/soc/codecs/cs42l73.c new file +10
-0+ +cs42l73_write (codec,CS42L73_PWRCTL2 , +PDN_MIC2_BIAS |PDN_MIC1_BIAS | +PDN_VSP |PDN_ASP_SDOUT |PDN_ASP_SDIN | +PDN_XSP_SDOUT |PDN_XSP_SDIN ); + +cs42l73_write (codec,CS42L73_PWRCTL1 , +PDN_ADCB |PDN_ADCA |PDN_DMICB | +PDN_DMICA |PDN ); +break ;This looks like it should all be managed by DAPM.
sound/soc/codecs/cs42l73.c line 1113
Quoted 9 lines
sound/soc/codecs/cs42l73.c new file +9
-0+static void cs42l73_shutdown (struct snd_pcm_substream *substream, +struct snd_soc_dai *dai) +{ +struct snd_soc_codec *codec = dai->codec; +int id = dai->id; +struct cs42l73_private *priv =snd_soc_codec_get_drvdata (codec); + priv->config[id].srate =0 ; +cs42l73_update_asrc (codec,id,0 ); +}What happens with simultaneous playback and record?
sound/soc/codecs/cs42l73.c line 1221
Quoted 9 lines
sound/soc/codecs/cs42l73.c new file +9
-0+static int cs42l73_resume (struct snd_soc_codec *codec) +{ +int i; +u8 *cache = codec->reg_cache; + +/* Sync reg_cache with the hardware */ +for (i =CS42L73_PWRCTL1 ; i <ARRAY_SIZE (cs42l73_reg); i++) { +cs42l73_write (codec, i, cache[i]); + }There's standard infrastructure for this too.
Quoted 11 lines
sound/soc/codecs/cs42l73.h line 138
Quoted 8 lines
sound/soc/codecs/cs42l73.h new file +8
-0+/* CS42L73_PWRCTL1 */ +#define PDN_ADCB (1 << 7) +#define PDN_DMICB (1 << 6) +#define PDN_ADCA (1 << 5) +#define PDN_DMICA (1 << 4) +#define PDN_LDO (1 << 2) +#define DISCHG_FILT (1 << 1) +#define PDN (1 << 0)Namespacing here and elsewhere in the header.
Thanks for the quick feedback. I will fix it up and resend. Sorry about the sloppy formatting.
Brian