ASoC: Add max98925 codec driver
PATCH 1/1 ASoC: Add max98925 codec driver
--- sound/soc/codecs/Kconfig | 9 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98925.c | 843 +++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98925.h | 845 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1699 insertions(+) create mode 100644 sound/soc/codecs/max98925.c create mode 100644 sound/soc/codecs/max98925.h
sound/soc/codecs/Kconfig +9 -0
@@ -47,6 +47,7 @@ config SND_SOC_ALL_CODECS select SND_SOC_MAX98088 if I2C select SND_SOC_MAX98090 if I2C select SND_SOC_MAX98095 if I2C + select SND_SOC_MAX98925 if I2C select SND_SOC_MAX9850 if I2C select SND_SOC_MAX9768 if I2C select SND_SOC_MAX9877 if I2C
@@ -285,6 +286,14 @@ config SND_SOC_MAX9850 config SND_SOC_OMAP_HDMI_CODEC tristate +config SND_SOC_MAX98925 + tristate "Support MAX98925 audio codec" + depends on I2C + help + MAX98925 is a high-efficiency mono + Class DG audio amplifier. Use this + option to enable the codec. + config SND_SOC_PCM3008 tristate
sound/soc/codecs/Makefile +2 -0
@@ -38,6 +38,7 @@ snd-soc-max98088-objs := max98088.o snd-soc-max98090-objs := max98090.o snd-soc-max98095-objs := max98095.o snd-soc-max9850-objs := max9850.o +snd-soc-max98925-objs := max98925.o snd-soc-mc13783-objs := mc13783.o snd-soc-ml26124-objs := ml26124.o snd-soc-omap-hdmi-codec-objs := omap-hdmi.o
@@ -233,6 +234,7 @@ obj-$(CONFIG_SND_SOC_WM8994) += snd-soc-wm8994.o obj-$(CONFIG_SND_SOC_WM8995) += snd-soc-wm8995.o obj-$(CONFIG_SND_SOC_WM9081) += snd-soc-wm9081.o obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o +obj-$(CONFIG_SND_SOC_MAX98925) += snd-soc-max98925.o obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
sound/soc/codecs/max98925.c new file +843 -0
843 lines not on this page · raw message
sound/soc/codecs/max98925.h new file +845 -0
845 lines not on this page · raw message
Signature · 1 line
1.9.3
Quoted 2 lines · Anish Kumar
Signed-off-by Anish Kumar <[email protected]>---
For the revised patches, it is a good idea to add the version number in the subject line. You can do that with --subject-prefix flag while issuing git-format-patch command.
Also please include changelog in the patch explaining the changes in subsequent revisions.
Quoted 8 lines
sound/soc/codecs/Kconfig | 9 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98925.c | 843 +++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98925.h | 845 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1699 insertions(+) create mode 100644 sound/soc/codecs/max98925.c create mode 100644 sound/soc/codecs/max98925.h
Signature · 1 line
Tushar Behera
Quoted 9 lines · Tushar Behera
Quoted 2 lines · Anish Kumar
Signed-off-by Anish Kumar <[email protected]>---
For the revised patches, it is a good idea to add the version number in the subject line. You can do that with --subject-prefix flag while issuing git-format-patch command.
Also please include changelog in the patch explaining the changes in subsequent revisions.
will sure do it for the next revision. Can i get some comments for this?
Quoted 12 lines
Quoted 9 lines
sound/soc/codecs/Kconfig | 9 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98925.c | 843 +++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98925.h | 845 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1699 insertions(+) create mode 100644 sound/soc/codecs/max98925.c create mode 100644 sound/soc/codecs/max98925.h--
Tushar Behera
Mark Brown
maintainerQuoted 2 lines · anish
will sure do it for the next revision. Can i get some comments for this?
Please allow a reasonable time for review - at least a week as a bare minimum, normally longer and obviously larger changes like entire new drivers can slow things down a bit. If it's only been a week or two then unless it's an urgent bugfix a mail chasing is just adding to the amount of e-mail that needs to be read.
Mark Brown
maintainersound/soc/codecs/Kconfig config SND_SOC_MAX9850 · line 296
Quoted 8 lines · Anish Kumar
sound/soc/codecs/Kconfig +8
-0+config SND_SOC_MAX98925 + tristate "Support MAX98925 audio codec" + depends on I2C + help + MAX98925 is a high-efficiency mono + Class DG audio amplifier. Use this + option to enable the codec. +
As I said in reply to an earlier version of this patch please format this using the normal style for Kconfig entries.
sound/soc/codecs/max98925.c line 27
Quoted 7 lines
sound/soc/codecs/max98925.c new file +7
-0+static const char *const dai_text[] = { +"left" ,"right" ,"leftright" ,"leftrightdiv2" , +}; + +static const char *const hpf_text[] = { +"disable" ,"dc_block" ,"100Hz" ,"200Hz" ,"400Hz" ,"800Hz" , +};
As I also said in reply to an earlier version please follow the normal style for enumeration entries with capitalization, use of spaces and so on.
sound/soc/codecs/max98925.c line 34
Quoted 6 lines
sound/soc/codecs/max98925.c new file +6
-0+static struct reg_default max98925_reg[] = { + {0x00 ,0x00 },/* Battery Voltage Data */ + {0x01 ,0x00 },/* Boost Voltage Data */ + {0x02 ,0x00 },/* Live Status0 */ + {0x03 ,0x00 },/* Live Status1 */ + {0x04 ,0x00 },/* Live Status2 */
As I said in reply to a previous version of this patch these seem like volatile registers so why do they have defaults defined?
I'm going to glance through the rest of this but not too closely given that a number of issues from the original review appear to remain unaddressed and (perhaps more importantly) I'm about to run out of batter).
sound/soc/codecs/max98925.c line 103
Quoted 13 lines
sound/soc/codecs/max98925.c new file +13
-0+static int max98925_reg_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol,unsigned int reg, +unsigned int mask,unsigned int shift) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +struct max98925_priv *max98925 =snd_soc_codec_get_drvdata (codec); +unsigned int sel = ucontrol->value.integer.value[0 ]; + +regmap_update_bits (max98925->regmap, reg, mask, sel<<shift); +dev_dbg (codec->dev,"%s: register 0x%02X, value 0x%02X\n" , + __func__, reg, sel); +return 0 ; +}
This looks like a standard control, why is this open coded? I'd also expect some bounds checking on the write.
Quoted 6 lines
sound/soc/codecs/max98925.c new file +6
-0+static int max98925_dac_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_codec *codec = w->codec; +struct max98925_priv *max98925 =snd_soc_codec_get_drvdata (codec); +
sound/soc/codecs/max98925.c line 131
Quoted 10 lines
sound/soc/codecs/max98925.c new file +10
-0+regmap_update_bits (max98925->regmap, +MAX98925_R036_BLOCK_ENABLE , +M98925_BST_EN_MASK | +M98925_ADC_IMON_EN_MASK |M98925_ADC_VMON_EN_MASK , +M98925_BST_EN_MASK | +M98925_ADC_IMON_EN_MASK |M98925_ADC_VMON_EN_MASK ); +regmap_write (max98925->regmap, +MAX98925_R038_GLOBAL_ENABLE ,M98925_EN_MASK ); +return 0 ; +}
It's a bit surprising not to see any of these enables getting turned off when we power down - won't that waste power? Looking at the names I'm wondering if these might make more sense as supply widgets.
sound/soc/codecs/max98925.c line 219
Quoted 11 lines
sound/soc/codecs/max98925.c new file +11
-0+static int max98925_spk_gain_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +struct max98925_priv *max98925 =snd_soc_codec_get_drvdata (codec); +unsigned int sel = ucontrol->value.integer.value[0 ]; + +if (sel < ((1 <<M98925_SPK_GAIN_WIDTH ) -1 )) { +regmap_update_bits (max98925->regmap,MAX98925_R02D_GAIN , +M98925_SPK_GAIN_MASK , sel <<M98925_SPK_GAIN_SHIFT ); + max98925->spk_gain = sel;
Why is this not just a normal control? I can't see any reference to spk_gain elsewhere... similar things apply to a lot of these controls.
Quoted 13 lines · Mark Brown
sound/soc/codecs/Kconfig config SND_SOC_MAX9850 · line 296
Quoted 8 lines · Anish Kumar
sound/soc/codecs/Kconfig +8
-0+config SND_SOC_MAX98925 + tristate "Support MAX98925 audio codec" + depends on I2C + help + MAX98925 is a high-efficiency mono + Class DG audio amplifier. Use this + option to enable the codec. +As I said in reply to an earlier version of this patch please format this using the normal style for
Kconfigentries.
Sorry but i don't understand. I thought i copied the style. Can you be specific as to the meaning?
Quoted 12 lines
sound/soc/codecs/max98925.c line 27
Quoted 8 lines
sound/soc/codecs/max98925.c new file +7
-0+static const char *const dai_text[] = { +"left" ,"right" ,"leftright" ,"leftrightdiv2" , +}; + +static const char *const hpf_text[] = { +"disable" ,"dc_block" ,"100Hz" ,"200Hz" ,"400Hz" ,"800Hz" , +};As I also said in reply to an earlier version please follow the normal style for enumeration entries with capitalization, use of spaces and so on.
I think the problem is only with "disable" and "dc_block". I will change it as you said.
Quoted 10 lines
sound/soc/codecs/max98925.c line 34
Quoted 7 lines
sound/soc/codecs/max98925.c new file +6
-0+static struct reg_default max98925_reg[] = { + {0x00 ,0x00 },/* Battery Voltage Data */ + {0x01 ,0x00 },/* Boost Voltage Data */ + {0x02 ,0x00 },/* Live Status0 */ + {0x03 ,0x00 },/* Live Status1 */ + {0x04 ,0x00 },/* Live Status2 */ As I said in reply to a previous version of this patch these seem like volatile registers so why do they have defaults defined?
overlooked this.Will remove it.
Quoted 6 lines
I'm going to glance through the rest of this but not too closely given that a number of issues from the original review appear to remain unaddressed and (perhaps more importantly) I'm about to run out of batter).
Quoted 16 lines
sound/soc/codecs/max98925.c line 103
Quoted 13 lines
sound/soc/codecs/max98925.c new file +13
-0+static int max98925_reg_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol,unsigned int reg, +unsigned int mask,unsigned int shift) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +struct max98925_priv *max98925 =snd_soc_codec_get_drvdata (codec); +unsigned int sel = ucontrol->value.integer.value[0 ]; + +regmap_update_bits (max98925->regmap, reg, mask, sel<<shift); +dev_dbg (codec->dev,"%s: register 0x%02X, value 0x%02X\n" , + __func__, reg, sel); +return 0 ; +}This looks like a standard control, why is this open coded? I'd also expect some bounds checking on the write.
We wanted mechanism to read/write any register so we used this control. Is this functionality already available?
Quoted 13 lines
Quoted 13 lines
sound/soc/codecs/max98925.c new file +12
-0+static int max98925_dac_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_codec *codec = w->codec; +struct max98925_priv *max98925 =snd_soc_codec_get_drvdata (codec); + +regmap_update_bits (max98925->regmap, +MAX98925_R036_BLOCK_ENABLE , +M98925_BST_EN_MASK | +M98925_ADC_IMON_EN_MASK |M98925_ADC_VMON_EN_MASK , +M98925_BST_EN_MASK | +M98925_ADC_IMON_EN_MASK |M98925_ADC_VMON_EN_MASK );
Quoted 8 lines
sound/soc/codecs/max98925.c line 131
Quoted 4 lines
sound/soc/codecs/max98925.c new file +4
-0+regmap_write (max98925->regmap, +MAX98925_R038_GLOBAL_ENABLE ,M98925_EN_MASK ); +return 0 ; +}It's a bit surprising not to see any of these enables getting turned off when we power down - won't that waste power? Looking at the names I'm wondering if these might make more sense as supply widgets.
will change it as supply widgets.
Quoted 15 lines
sound/soc/codecs/max98925.c line 219
Quoted 12 lines
sound/soc/codecs/max98925.c new file +11
-0+static int max98925_spk_gain_put (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_codec *codec =snd_kcontrol_chip (kcontrol); +struct max98925_priv *max98925 =snd_soc_codec_get_drvdata (codec); +unsigned int sel = ucontrol->value.integer.value[0 ]; + +if (sel < ((1 <<M98925_SPK_GAIN_WIDTH ) -1 )) { +regmap_update_bits (max98925->regmap,MAX98925_R02D_GAIN , +M98925_SPK_GAIN_MASK , sel <<M98925_SPK_GAIN_SHIFT ); + max98925->spk_gain = sel;Why is this not just a normal control? I can't see any reference to
spk_gainelsewhere... similar things apply to a lot of these controls.
it is used in corresponding get function.