ASoC: Add support for NAU8824 codec to ASoC
PATCH 1/1 ASoC: Add support for NAU8824 codec to ASoC
--- sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/nau8824.c | 770 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/nau8824.h | 379 ++++++++++++++++++++++ 4 files changed, 1156 insertions(+) create mode 100644 sound/soc/codecs/nau8824.c create mode 100644 sound/soc/codecs/nau8824.h
sound/soc/codecs/Kconfig +5 -0
@@ -75,6 +75,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_MAX9877 if I2C select SND_SOC_MC13783 if MFD_MC13XXX select SND_SOC_ML26124 if I2C + select SND_SOC_NAU8824 if I2C select SND_SOC_HDMI_CODEC select SND_SOC_PCM1681 if I2C select SND_SOC_PCM1792A if SPI_MASTER
@@ -463,6 +464,10 @@ config SND_SOC_MAX98357A config SND_SOC_MAX9850 tristate +config SND_SOC_NAU8824 + tristate "Nuvoton NAU8824 CODEC" + depends on I2C + config SND_SOC_PCM1681 tristate "Texas Instruments PCM1681 CODEC" depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -68,6 +68,7 @@ snd-soc-max98357a-objs := max98357a.o snd-soc-max9850-objs := max9850.o snd-soc-mc13783-objs := mc13783.o snd-soc-ml26124-objs := ml26124.o +snd-soc-nau8824-objs := nau8824.o snd-soc-hdmi-codec-objs := hdmi.o snd-soc-pcm1681-objs := pcm1681.o snd-soc-pcm1792a-codec-objs := pcm1792a.o
@@ -250,6 +251,7 @@ obj-$(CONFIG_SND_SOC_MAX98357A) += snd-soc-max98357a.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o +obj-$(CONFIG_SND_SOC_NAU8824) += snd-soc-nau8824.o obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
sound/soc/codecs/nau8824.c new file +770 -0
770 lines not on this page · raw message
sound/soc/codecs/nau8824.h new file +379 -0
379 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Mark Brown
maintainersound/soc/codecs/nau8824.c line 71
Quoted 7 lines · Wan Zongshun
sound/soc/codecs/nau8824.c new file +7
-0+/* SP Class-D mute control */ +SOC_DOUBLE ("HP Playback Switch" ,NAU8824_HP_MUTE ,NAU8824_L_MUTE_SFT , +NAU8824_R_MUTE_SFT ,1 ,1 ), +SOC_SINGLE_TLV ("HP Left Volume" ,NAU8824_HP_VOL ,NAU8824_L_VOL_SFT , +NAU8824_VOL_RSCL_RANGE ,1 , out_hp_vol_tlv), +SOC_SINGLE_TLV ("HP Right Volume" ,NAU8824_HP_VOL ,NAU8824_R_VOL_SFT , + NAU8824_VOL_RSCL_RANGE, 1, out_hp_vol_tlv),
I would have expected the headphone volume control to be a stereo (double) control - same for speakers.
sound/soc/codecs/nau8824.c line 77
Quoted 6 lines
sound/soc/codecs/nau8824.c new file +6
-0+/* DMIC control */ +SOC_DOUBLE ("DMIC L R Switch" ,NAU8824_ENA_CTRL ,NAU8824_DMIC_CH0_SFT , +NAU8824_DMIC_CH1_SFT ,1 ,0 ), +SOC_SINGLE ("DMIC Enable" ,NAU8824_BIAS_ADJ ,NAU8824_DMIC1_SFT ,1 ,0 ), +SOC_SINGLE ("VMID Switch" ,NAU8824_BIAS_ADJ ,NAU8824_VMID_SFT ,1 ,0 ), + SOC_SINGLE("BIAS Switch", NAU8824_BOOST, NAU8824_G_BIAS_SFT, 1, 0),
This all looks like stuff that should be done with DAPM...
sound/soc/codecs/nau8824.c line 80
Quoted 3 lines
sound/soc/codecs/nau8824.c new file +3
-0+SOC_DOUBLE_R_TLV ("MIC L R Gain" ,NAU8824_ADC_CH0_DGAIN_CTRL , +NAU8824_ADC_CH1_DGAIN_CTRL ,0 , + NAU8824_ADC_VOL_RSCL_RANGE, 0, adc_vol_tlv),
All volume controls should be called Volume.
sound/soc/codecs/nau8824.c line 86
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +4
-0+static int set_dmic_clk (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_codec *codec = w->codec;
w->codec is going away, use snd_soc_dapm_to_codec(). You should always submit against current code.
sound/soc/codecs/nau8824.c line 103
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +4
-0+static const struct snd_kcontrol_new nau8824_rec_l_mix[] = { +SOC_DAPM_SINGLE ("BST1 Switch" ,SND_SOC_NOPM , +0 ,0 ,0 ), +};
Please use normal indentation, a single tab is enough.
sound/soc/codecs/nau8824.c line 166
Quoted 5 lines
sound/soc/codecs/nau8824.c new file +5
-0+static int nau8824_hp_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +return 0 ; +}
Remove empty functions.
sound/soc/codecs/nau8824.c line 375
Quoted 8 lines
sound/soc/codecs/nau8824.c new file +8
-0+switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : + reg_val_2 |=NAU8824_I2S_MS_M ; +break ; +case SND_SOC_DAIFMT_CBS_CFS : +break ; +case SND_SOC_DAIFMT_CBS_CFM : +break ;
These two clocking configurations appear not to differ in terms of what we do to the device - this suggests that only one of them is actually supported.
sound/soc/codecs/nau8824.c line 427
Quoted 3 lines
sound/soc/codecs/nau8824.c new file +3
-0+static int nau8824_FLL_freerun_mode (struct snd_soc_codec *codec,int IsEnable) +{ +if (IsEnable == true) {
This doesn't look like Linux coding style...
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +4
-0+void set_sys_clk (struct snd_soc_codec *codec,int sys_clk) +{ +pr_debug ("%s sys_clk=%x\n" , __func__, sys_clk); +switch (sys_clk) {
sound/soc/codecs/nau8824.c line 452
Quoted 10 lines
sound/soc/codecs/nau8824.c new file +10
-0+case NAU8824_INTERNALCLOCK : +nau8824_FLL_freerun_mode (codec, true); +break ; + +case NAU8824_MCLK : +default : +nau8824_FLL_freerun_mode (codec, false); +break ; + } +}
...and I don't entirely see why it's a separate function to this (which is itself an internal wrapper function which possibly shouldn't exist)>
Quoted 6 lines
sound/soc/codecs/nau8824.c new file +6
-0+static int nau8824_set_sysclk (struct snd_soc_codec *codec, +int clk_id,int source,unsigned int freq,int dir) +{ +int divider =1 ; + +if (clk_id ==NAU8824_MCLK ) {
sound/soc/codecs/nau8824.c line 479
Quoted 10 lines
sound/soc/codecs/nau8824.c new file +10
-0+set_sys_clk (codec,NAU8824_MCLK ); +dev_dbg (codec->dev,"%s: input freq = %d divider = %d" , + __func__, freq, divider); + + }else if (clk_id ==NAU8824_INTERNALCLOCK ) { +set_sys_clk (codec,NAU8824_INTERNALCLOCK ); + }else { +dev_err (codec->dev,"Wrong clock src\n" ); +return -EINVAL ; + }
Use switch statements rather than if trees like other drivers. It looks like clk_id should actually be source since we're selecting the clock to use rather than selecting which clock to configure.
sound/soc/codecs/nau8824.c line 490
Quoted 8 lines
sound/soc/codecs/nau8824.c new file +8
-0+static int nau8824_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) +{ +dev_dbg (codec->dev,"## nau8824_set_bias_level %d\n" , level); +if (level == codec->dapm.bias_level) { +dev_dbg (codec->dev,"##set_bias_level: level returning...\r\n" ); +return -EINVAL ; + }
Why is this here - other drivers don't do this and it doesn't look device specific?
sound/soc/codecs/nau8824.c line 499
Quoted 8 lines
sound/soc/codecs/nau8824.c new file +8
-0+switch (level) { +case SND_SOC_BIAS_ON : +/* All power is driven by DAPM system*/ +dev_dbg (codec->dev,"###nau8824_set_bias_level BIAS_ON\n" ); +snd_soc_update_bits (codec,NAU8824_BIAS_ADJ , +NAU8824_VMID_MASK ,NAU8824_VMID_EN ); +snd_soc_update_bits (codec,NAU8824_BOOST , +NAU8824_G_BIAS_MASK ,NAU8824_G_BIAS_EN );
We turn on VMID last? That's a strange thing to do...
sound/soc/codecs/nau8824.c line 533
Quoted 7 lines
sound/soc/codecs/nau8824.c new file +7
-0+static int nau8824_suspend (struct snd_soc_codec *codec) +{ +dev_dbg (codec->dev,"%s: Entered\n" , __func__); +nau8824_set_bias_level (codec,SND_SOC_BIAS_OFF ); +dev_dbg (codec->dev,"%s: Exiting\n" , __func__); +return 0 ; +}
Set idle_bias_off (which it looks like you should be doing) and this becomes redundant. If you're *not* using idle_bias_off for some reason then the set_bias_level() work done in _ON should be undone in at least _SUSPEND rather than _OFF so we save power on idle.
sound/soc/codecs/nau8824.c line 546
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +4
-0+struct nau8824_init_reg { +u8 reg; +u16 val; +};
This looks like you're reimplementing regmap's register sequence stuff... It's also a *very* large sequence you have, are you sure it's all required? It seems like this may be doing a bunch of machine specific configuration but since it's all magic numbers it's hard to tell.
Quoted 1 line
+#define
NAU8824_INIT_REG_LENARRAY_SIZE(init_list)
Just use ARRAY_SIZE().
sound/soc/codecs/nau8824.c line 637
Quoted 12 lines
sound/soc/codecs/nau8824.c new file +12
-0+static int nau8824_reg_init (struct snd_soc_codec *codec) +{ +int i; + +mdelay (1 ); +for (i =0 ; i <NAU8824_INIT_REG_LEN ; i++) { +if (init_list[i].reg ==0xFFFF ) +mdelay (1 ); +else +snd_soc_write (codec, init_list[i].reg, + init_list[i].val); + }
Use the standard regmap patch stuff. If you need the delays in the sequence implement that in the core, though I guess you don't since reg is a u8 and you're looking for 0xffff in it...
sound/soc/codecs/nau8824.c line 660
Quoted 10 lines
sound/soc/codecs/nau8824.c new file +10
-0+/* Dynamic Headset detection enabled */ +snd_soc_update_bits (codec,0x01 ,0x400 ,0x400 ); +snd_soc_update_bits (codec,0x02 ,0x0008 ,0x0008 ); +snd_soc_update_bits (codec,0x0f ,0x0300 ,0x0100 ); +snd_soc_write (codec,0x09 ,0xE000 ); +snd_soc_write (codec,NAU8824_IRQ_SETTING ,0x1006 ); +snd_soc_write (codec,0x13 ,0x1615 ); +snd_soc_write (codec,0x15 ,0x0414 ); +snd_soc_update_bits (codec,0x16 ,0xFF00 ,0x5900 ); +snd_soc_update_bits (codec,0x66 ,0x0070 ,0x0060 );
Too many magic numbers here I think and this looks like it should be configured using platform data and/or the machine driver (what if the headphone detection/IRQ aren't wired up?). I'd also expect to see reporting via the standard interfaces for jack reporting.
sound/soc/codecs/nau8824.c line 753
Quoted 6 lines
sound/soc/codecs/nau8824.c new file +6
-0+static const struct i2c_device_id nau8824_i2c_id[] = { + {"nau8824" ,0 }, + {"10508824:00" ,0 }, + {"10508824" ,0 }, + { } +};
It looks like you've put some ACPI IDs in the I2C ID table here. At least I hope that's what the last two entries are... if they are ACPI IDs they should be registered as such. If they're something else then what are they?
Quoted 10 lines · Mark Brown
sound/soc/codecs/nau8824.c line 71
Quoted 7 lines · Wan Zongshun
sound/soc/codecs/nau8824.c new file +7
-0+/* SP Class-D mute control */ +SOC_DOUBLE ("HP Playback Switch" ,NAU8824_HP_MUTE ,NAU8824_L_MUTE_SFT , +NAU8824_R_MUTE_SFT ,1 ,1 ), +SOC_SINGLE_TLV ("HP Left Volume" ,NAU8824_HP_VOL ,NAU8824_L_VOL_SFT , +NAU8824_VOL_RSCL_RANGE ,1 , out_hp_vol_tlv), +SOC_SINGLE_TLV ("HP Right Volume" ,NAU8824_HP_VOL ,NAU8824_R_VOL_SFT , + NAU8824_VOL_RSCL_RANGE, 1, out_hp_vol_tlv),
Quoted 2 lines
I would have expected the headphone volume control to be a stereo (double) control - same for speakers.
The nau8824 related registers which control left/right volume are located in different addresses and different shift bits. Since there is no available preprocessor macro to meet our requirements, the driver consists of left/right volume control separately.
Quoted 9 lines
sound/soc/codecs/nau8824.c line 77
Quoted 7 lines
sound/soc/codecs/nau8824.c new file +6
-0+/* DMIC control */ +SOC_DOUBLE ("DMIC L R Switch" ,NAU8824_ENA_CTRL ,NAU8824_DMIC_CH0_SFT , +NAU8824_DMIC_CH1_SFT ,1 ,0 ), +SOC_SINGLE ("DMIC Enable" ,NAU8824_BIAS_ADJ ,NAU8824_DMIC1_SFT ,1 ,0 ), +SOC_SINGLE ("VMID Switch" ,NAU8824_BIAS_ADJ ,NAU8824_VMID_SFT ,1 ,0 ), + SOC_SINGLE("BIAS Switch", NAU8824_BOOST, NAU8824_G_BIAS_SFT, 1, 0),This all looks like stuff that should be done with DAPM...
The above controls have been done with DAPM in next patch submit.
Quoted 6 lines
sound/soc/codecs/nau8824.c line 80
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +3
-0+SOC_DOUBLE_R_TLV ("MIC L R Gain" ,NAU8824_ADC_CH0_DGAIN_CTRL , +NAU8824_ADC_CH1_DGAIN_CTRL ,0 , + NAU8824_ADC_VOL_RSCL_RANGE, 0, adc_vol_tlv),All volume controls should be called Volume.
The naming has been changed.
Quoted 8 lines
sound/soc/codecs/nau8824.c line 86
Quoted 5 lines
sound/soc/codecs/nau8824.c new file +4
-0+static int set_dmic_clk (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_codec *codec = w->codec;
w->codecis going away, usesnd_soc_dapm_to_codec(). You should always submit against current code.
Modified done in next patch submit.
Quoted 7 lines
sound/soc/codecs/nau8824.c line 103
Quoted 5 lines
sound/soc/codecs/nau8824.c new file +4
-0+static const struct snd_kcontrol_new nau8824_rec_l_mix[] = { +SOC_DAPM_SINGLE ("BST1 Switch" ,SND_SOC_NOPM , +0 ,0 ,0 ), +};Please use normal indentation, a single tab is enough.
Modified done in next patch submit.
Quoted 8 lines
sound/soc/codecs/nau8824.c line 166
Quoted 6 lines
sound/soc/codecs/nau8824.c new file +5
-0+static int nau8824_hp_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +return 0 ; +}Remove empty functions.
Modified done in next patch submit.
Quoted 10 lines
sound/soc/codecs/nau8824.c line 375
Quoted 9 lines
sound/soc/codecs/nau8824.c new file +8
-0+switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBM_CFM : + reg_val_2 |=NAU8824_I2S_MS_M ; +break ; +case SND_SOC_DAIFMT_CBS_CFS : +break ; +case SND_SOC_DAIFMT_CBS_CFM : +break ;
Quoted 3 lines
These two clocking configurations appear not to differ in terms of what we do to the device - this suggests that only one of them is actually supported.
Modified done in next patch submit.
Quoted 6 lines
sound/soc/codecs/nau8824.c line 427
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +3
-0+static int nau8824_FLL_freerun_mode (struct snd_soc_codec *codec,int IsEnable) +{ +if (IsEnable == true) {This doesn't look like Linux coding style...
Remove this function
Quoted 10 lines
Quoted 10 lines
sound/soc/codecs/nau8824.c new file +9
-0+void set_sys_clk (struct snd_soc_codec *codec,int sys_clk) +{ +pr_debug ("%s sys_clk=%x\n" , __func__, sys_clk); +switch (sys_clk) { +case NAU8824_INTERNALCLOCK : +nau8824_FLL_freerun_mode (codec, true); +break ; + +case NAU8824_MCLK :
Quoted 8 lines
sound/soc/codecs/nau8824.c line 452
Quoted 5 lines
sound/soc/codecs/nau8824.c new file +5
-0+default : +nau8824_FLL_freerun_mode (codec, false); +break ; + } +}...and I don't entirely see why it's a separate function to this (which is itself an internal wrapper function which possibly shouldn't exist)>
Remove "nau8824_FLL_freerun_mode()" function
Quoted 13 lines
Quoted 13 lines
sound/soc/codecs/nau8824.c new file +12
-0+static int nau8824_set_sysclk (struct snd_soc_codec *codec, +int clk_id,int source,unsigned int freq,int dir) +{ +int divider =1 ; + +if (clk_id ==NAU8824_MCLK ) { +set_sys_clk (codec,NAU8824_MCLK ); +dev_dbg (codec->dev,"%s: input freq = %d divider = %d" , + __func__, freq, divider); + + }else if (clk_id ==NAU8824_INTERNALCLOCK ) { +set_sys_clk (codec,NAU8824_INTERNALCLOCK );
Quoted 8 lines
sound/soc/codecs/nau8824.c line 479
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +4
-0+ }else { +dev_err (codec->dev,"Wrong clock src\n" ); +return -EINVAL ; + }Use switch statements rather than if trees like other drivers. It looks like
clk_idshould actually be source since we're selecting the clock to use rather than selecting which clock to configure.
Modified done in next patch submit.
Quoted 12 lines
sound/soc/codecs/nau8824.c line 490
Quoted 9 lines
sound/soc/codecs/nau8824.c new file +8
-0+static int nau8824_set_bias_level (struct snd_soc_codec *codec, +enum snd_soc_bias_level level) +{ +dev_dbg (codec->dev,"## nau8824_set_bias_level %d\n" , level); +if (level == codec->dapm.bias_level) { +dev_dbg (codec->dev,"##set_bias_level: level returning...\r\n" ); +return -EINVAL ; + }Why is this here - other drivers don't do this and it doesn't look device specific?
Remove it
Quoted 11 lines
sound/soc/codecs/nau8824.c line 499
Quoted 9 lines
sound/soc/codecs/nau8824.c new file +8
-0+switch (level) { +case SND_SOC_BIAS_ON : +/* All power is driven by DAPM system*/ +dev_dbg (codec->dev,"###nau8824_set_bias_level BIAS_ON\n" ); +snd_soc_update_bits (codec,NAU8824_BIAS_ADJ , +NAU8824_VMID_MASK ,NAU8824_VMID_EN ); +snd_soc_update_bits (codec,NAU8824_BOOST , +NAU8824_G_BIAS_MASK ,NAU8824_G_BIAS_EN );We turn on VMID last? That's a strange thing to do...
In nau8824, VMID_EN is to enable Vreff pin
Quoted 13 lines
sound/soc/codecs/nau8824.c line 533
Quoted 8 lines
sound/soc/codecs/nau8824.c new file +7
-0+static int nau8824_suspend (struct snd_soc_codec *codec) +{ +dev_dbg (codec->dev,"%s: Entered\n" , __func__); +nau8824_set_bias_level (codec,SND_SOC_BIAS_OFF ); +dev_dbg (codec->dev,"%s: Exiting\n" , __func__); +return 0 ; +}Set
idle_bias_off(which it looks like you should be doing) and this becomes redundant. If you're *not* usingidle_bias_offfor some reason then theset_bias_level()work done in_ONshould be undone in at least_SUSPENDrather than_OFFso we save power on idle.
Remove suspend function
Quoted 11 lines
sound/soc/codecs/nau8824.c line 546
Quoted 5 lines
sound/soc/codecs/nau8824.c new file +4
-0+struct nau8824_init_reg { +u8 reg; +u16 val; +};This looks like you're reimplementing regmap's register sequence stuff... It's also a *very* large sequence you have, are you sure it's all required? It seems like this may be doing a bunch of machine specific configuration but since it's all magic numbers it's hard to tell.
Initial settings are arranged in order
Quoted 4 lines
Quoted 2 lines
+#define
NAU8824_INIT_REG_LENARRAY_SIZE(init_list)Just use
ARRAY_SIZE().
Modified done in next patch submit.
Quoted 17 lines
sound/soc/codecs/nau8824.c line 637
Quoted 13 lines
sound/soc/codecs/nau8824.c new file +12
-0+static int nau8824_reg_init (struct snd_soc_codec *codec) +{ +int i; + +mdelay (1 ); +for (i =0 ; i <NAU8824_INIT_REG_LEN ; i++) { +if (init_list[i].reg ==0xFFFF ) +mdelay (1 ); +else +snd_soc_write (codec, init_list[i].reg, + init_list[i].val); + }Use the standard regmap patch stuff. If you need the delays in the sequence implement that in the core, though I guess you don't since reg is a u8 and you're looking for
0xffffin it...
Modified done in next patch submit.
Quoted 12 lines
sound/soc/codecs/nau8824.c line 660
Quoted 11 lines
sound/soc/codecs/nau8824.c new file +10
-0+/* Dynamic Headset detection enabled */ +snd_soc_update_bits (codec,0x01 ,0x400 ,0x400 ); +snd_soc_update_bits (codec,0x02 ,0x0008 ,0x0008 ); +snd_soc_update_bits (codec,0x0f ,0x0300 ,0x0100 ); +snd_soc_write (codec,0x09 ,0xE000 ); +snd_soc_write (codec,NAU8824_IRQ_SETTING ,0x1006 ); +snd_soc_write (codec,0x13 ,0x1615 ); +snd_soc_write (codec,0x15 ,0x0414 ); +snd_soc_update_bits (codec,0x16 ,0xFF00 ,0x5900 ); +snd_soc_update_bits (codec,0x66 ,0x0070 ,0x0060 );
Quoted 4 lines
Too many magic numbers here I think and this looks like it should be configured using platform data and/or the machine driver (what if the headphone detection/IRQ aren't wired up?). I'd also expect to see reporting via the standard interfaces for jack reporting.
The above initial settings are for jack detection. As for other jack detection flow, it will be implemented in machine driver but not be included in this application.
Quoted 12 lines
sound/soc/codecs/nau8824.c line 753
Quoted 7 lines
sound/soc/codecs/nau8824.c new file +6
-0+static const struct i2c_device_id nau8824_i2c_id[] = { + {"nau8824" ,0 }, + {"10508824:00" ,0 }, + {"10508824" ,0 }, + { } +};It looks like you've put some ACPI IDs in the I2C ID table here. At least I hope that's what the last two entries are... if they are ACPI IDs they should be registered as such. If they're something else then what are they?
Yes, there are ACPI ID table and registered in the dedicated platform BIOS.
Quoted 1 line
===========================================================================================
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerQuoted 9 lines · Chih-Chiang Chang
Quoted 2 lines · Mark Brown
I would have expected the headphone volume control to be a stereo (double) control - same for speakers.
The nau8824 related registers which control left/right volume are located in different addresses and different shift bits. Since there is no available preprocessor macro to meet our requirements, the driver consists of left/right volume control separately.
Add relevant control types if you need them, it's important to have proper stereo controls available to userspace.
Quoted 11 lines
Quoted 10 lines
sound/soc/codecs/nau8824.c line 546
Quoted 4 lines
sound/soc/codecs/nau8824.c new file +4
-0+struct nau8824_init_reg { +u8 reg; +u16 val; +};This looks like you're reimplementing regmap's register sequence stuff... It's also a *very* large sequence you have, are you sure it's all required? It seems like this may be doing a bunch of machine specific configuration but since it's all magic numbers it's hard to tell.
Quoted 1 line
Initial settings are arranged in order
This doesn't answer or address my concern.
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
sound/soc/codecs/nau8824.c new file +10
-0+/* Dynamic Headset detection enabled */ +snd_soc_update_bits (codec,0x01 ,0x400 ,0x400 ); +snd_soc_update_bits (codec,0x02 ,0x0008 ,0x0008 ); +snd_soc_update_bits (codec,0x0f ,0x0300 ,0x0100 ); +snd_soc_write (codec,0x09 ,0xE000 ); +snd_soc_write (codec,NAU8824_IRQ_SETTING ,0x1006 ); +snd_soc_write (codec,0x13 ,0x1615 ); +snd_soc_write (codec,0x15 ,0x0414 ); +snd_soc_update_bits (codec,0x16 ,0xFF00 ,0x5900 ); +snd_soc_update_bits (codec,0x66 ,0x0070 ,0x0060 );
Quoted 8 lines
Quoted 4 lines
Too many magic numbers here I think and this looks like it should be configured using platform data and/or the machine driver (what if the headphone detection/IRQ aren't wired up?). I'd also expect to see reporting via the standard interfaces for jack reporting.
The above initial settings are for jack detection. As for other jack detection flow, it will be implemented in machine driver but not be included in this application.
Please either remove this for now or implement it properly.
Quoted 2 lines
===========================================================================================
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.
Don't include noise like this in upstream communication, if your company won't fix this then please use an external mail account for upstream communication.
Quoted 6 lines · Mark Brown
Quoted 4 lines · Chih-Chiang Chang
Quoted 2 lines · Mark Brown
I would have expected the headphone volume control to be a stereo (double) control - same for speakers.
Quoted 7 lines
Quoted 4 lines
The nau8824 related registers which control left/right volume are located in different addresses and different shift bits. Since there is no available preprocessor macro to meet our requirements, the driver consists of left/right volume control separately.
Add relevant control types if you need them, it's important to have proper stereo controls available to userspace.
We cannot find suitable macro in file "include\sound\soc.h", so we want to add below two macro for our chip. SOC_DOUBLE_L_R_VALUESOC_DOUBLE_L_R_TLV
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
sound/soc/codecs/nau8824.c line 546
Quoted 5 lines
sound/soc/codecs/nau8824.c new file +4
-0+struct nau8824_init_reg { +u8 reg; +u16 val; +};This looks like you're reimplementing regmap's register sequence stuff... It's also a *very* large sequence you have, are you sure it's all required? It seems like this may be doing a bunch of machine specific configuration but since it's all magic numbers it's hard to tell.
Quoted 3 lines
Quoted 1 line
Initial settings are arranged in order
This doesn't answer or address my concern.
These large number of register setting is used to initial our codec, and some of other codec have the same behavior. We will remove few unnecessary register default setting and add some remark for registers.
Quoted 17 lines
Quoted 16 lines
Quoted 16 lines
sound/soc/codecs/nau8824.c line 660
Quoted 11 lines
sound/soc/codecs/nau8824.c new file +10
-0+/* Dynamic Headset detection enabled */ +snd_soc_update_bits (codec,0x01 ,0x400 ,0x400 ); +snd_soc_update_bits (codec,0x02 ,0x0008 ,0x0008 ); +snd_soc_update_bits (codec,0x0f ,0x0300 ,0x0100 ); +snd_soc_write (codec,0x09 ,0xE000 ); +snd_soc_write (codec,NAU8824_IRQ_SETTING ,0x1006 ); +snd_soc_write (codec,0x13 ,0x1615 ); +snd_soc_write (codec,0x15 ,0x0414 ); +snd_soc_update_bits (codec,0x16 ,0xFF00 ,0x5900 ); +snd_soc_update_bits (codec,0x66 ,0x0070 ,0x0060 );Too many magic numbers here I think and this looks like it should be configured using platform data and/or the machine driver (what if the headphone detection/IRQ aren't wired up?). I'd also expect to see reporting via the standard interfaces for jack reporting.
Quoted 5 lines
Quoted 3 lines
The above initial settings are for jack detection. As for other jack detection flow, it will be implemented in machine driver but not be included in this application.
Please either remove this for now or implement it properly.
We will remove it.
Quoted 7 lines
Quoted 3 lines
===========================================================================================
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.Don't include noise like this in upstream communication, if your company won't fix this then please use an external mail account for upstream communication.
Our MIS report they have disabled to append message in mail. Hope you do not see it in this mail.
Quoted 1 line
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerOn Fri, Mar 06, 2015 at 03:28:33PM +0800, Chih-Chiang Chang wrote:
Please fix your mailer to word wrap within paragraphs, it makes things a lot easier to read.
Quoted 10 lines · Mark Brown
Quoted 5 lines · Chih-Chiang Chang
Quoted 1 line · Mark Brown
Add relevant control types if you need them, it's important to have proper stereo controls available to userspace.
We cannot find suitable macro in file "include\sound\soc.h", so we want to add below two macro for our chip.
SOC_DOUBLE_L_R_VALUESOC_DOUBLE_L_R_TLV
Sounds good.
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
This looks like you're reimplementing regmap's register sequence stuff... It's also a *very* large sequence you have, are you sure it's all required? It seems like this may be doing a bunch of machine specific configuration but since it's all magic numbers it's hard to tell.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Initial settings are arranged in order
This doesn't answer or address my concern.
These large number of register setting is used to initial our codec, and some of other codec have the same behavior. We will remove few unnecessary register default setting and add some remark for registers.
I'd really like to have a better understanding of what this is doing - it can be valid to do this but there are some warning signs here such as the volume of writes being large in comparison with the set of controls the driver exposes which mean I'd like to be sure the use matches expectations. Normally this sort of thing is a small number of fixes for undocumented registers or updates to register defaults changed in later revisions of the chip.
Quoted 5 lines
Quoted 3 lines
Don't include noise like this in upstream communication, if your company won't fix this then please use an external mail account for upstream communication.
Our MIS report they have disabled to append message in mail. Hope you do not see it in this mail.
It's gone, thanks.
Hi Mark,
Sorry late to the response.
Quoted 4 lines · Mark Brown
On Fri, Mar 06, 2015 at 03:28:33PM +0800, Chih-Chiang Chang wrote:
Please fix your mailer to word wrap within paragraphs, it makes things a lot easier to read.
This seems to violate the kernel's rule. I am using the Thunderbird to do upstream. And in kernel's documentation, it shows we should set "mailnews.wraplength" from "72" to "0". Any way, for your convenience, I already modify the "mailnews.wraplength" back to "72".
Quoted 22 lines
Quoted 9 lines · Mark Brown
Quoted 4 lines · Chih-Chiang Chang
Quoted 1 line · Mark Brown
Add relevant control types if you need them, it's important to have proper stereo controls available to userspace.
We cannot find suitable macro in file "include\sound\soc.h", so we want to add below two macro for our chip.
SOC_DOUBLE_L_R_VALUESOC_DOUBLE_L_R_TLVSounds good.
Quoted 11 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
This looks like you're reimplementing regmap's register sequence stuff... It's also a *very* large sequence you have, are you sure it's all required? It seems like this may be doing a bunch of machine specific configuration but since it's all magic numbers it's hard to tell.
Initial settings are arranged in order
This doesn't answer or address my concern.
These large number of register setting is used to initial our codec, and some of other codec have the same behavior. We will remove few unnecessary register default setting and add some remark for registers.
Quoted 7 lines
I'd really like to have a better understanding of what this is doing - it can be valid to do this but there are some warning signs here such as the volume of writes being large in comparison with the set of controls the driver exposes which mean I'd like to be sure the use matches expectations. Normally this sort of thing is a small number of fixes for undocumented registers or updates to register defaults changed in later revisions of the chip.
We have tried to reduce the sequence recently, but it got some issues in the tests. We think these large number of register settings are necessary to our NAU8824 codec. We will provide the comments of all values in source to have a better understanding, is it acceptable to you?
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Don't include noise like this in upstream communication, if your company won't fix this then please use an external mail account for upstream communication.
Our MIS report they have disabled to append message in mail. Hope you do not see it in this mail.
It's gone, thanks.
Mark Brown
maintainerQuoted 10 lines · Chih-Chiang Chang
Quoted 4 lines · Mark Brown
On Fri, Mar 06, 2015 at 03:28:33PM +0800, Chih-Chiang Chang wrote:
Please fix your mailer to word wrap within paragraphs, it makes things a lot easier to read.
This seems to violate the kernel's rule. I am using the Thunderbird to do upstream. And in kernel's documentation, it shows we should set "mailnews.wraplength" from "72" to "0". Any way, for your convenience, I already modify the "mailnews.wraplength" back to "72".
You should never word wrap code since that corrupts the patches but always word wrap text.
Quoted 8 lines
Quoted 7 lines
I'd really like to have a better understanding of what this is doing - it can be valid to do this but there are some warning signs here such as the volume of writes being large in comparison with the set of controls the driver exposes which mean I'd like to be sure the use matches expectations. Normally this sort of thing is a small number of fixes for undocumented registers or updates to register defaults changed in later revisions of the chip.
Quoted 4 lines
We have tried to reduce the sequence recently, but it got some issues in the tests. We think these large number of register settings are necessary to our NAU8824 codec. We will provide the comments of all values in source to have a better understanding, is it acceptable to you?
It sounds reasonable but obviously I've not seen the results yet.