ASoC: max98390: Added Amplifier Driver
PATCH 2/2 ASoC: max98390: Added Amplifier Driver
--- sound/soc/codecs/Kconfig | 5 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/max98390.c | 1039 +++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98390.h | 661 ++++++++++++++++++++++ 4 files changed, 1707 insertions(+) create mode 100644 sound/soc/codecs/max98390.c create mode 100644 sound/soc/codecs/max98390.h
sound/soc/codecs/Kconfig +5 -0
@@ -116,6 +116,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_MAX98926 imply SND_SOC_MAX98927 imply SND_SOC_MAX98373 + imply SND_SOC_MAX98390 if I2C imply SND_SOC_MAX9850 imply SND_SOC_MAX9860 imply SND_SOC_MAX9759
@@ -867,6 +868,10 @@ config SND_SOC_MAX98373 tristate "Maxim Integrated MAX98373 Speaker Amplifier" depends on I2C +config SND_SOC_MAX98390 + tristate "Maxim Integrated MAX98390 Speaker Amplifier" + depends on I2C + config SND_SOC_MAX9850 tristate depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -115,6 +115,7 @@ snd-soc-max98925-objs := max98925.o snd-soc-max98926-objs := max98926.o snd-soc-max98927-objs := max98927.o snd-soc-max98373-objs := max98373.o +snd-soc-max98390-objs := max98390.o snd-soc-max9850-objs := max9850.o snd-soc-max9860-objs := max9860.o snd-soc-mc13783-objs := mc13783.o
@@ -415,6 +416,7 @@ obj-$(CONFIG_SND_SOC_MAX98925) += snd-soc-max98925.o obj-$(CONFIG_SND_SOC_MAX98926) += snd-soc-max98926.o obj-$(CONFIG_SND_SOC_MAX98927) += snd-soc-max98927.o obj-$(CONFIG_SND_SOC_MAX98373) += snd-soc-max98373.o +obj-$(CONFIG_SND_SOC_MAX98390) += snd-soc-max98390.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_MAX9860) += snd-soc-max9860.o obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
sound/soc/codecs/max98390.c new file +1039 -0
1,039 lines not on this page · raw message
sound/soc/codecs/max98390.h new file +661 -0
661 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerQuoted 1 line · Steve Lee
Signed-off-by Steve Lee <[email protected]>
This looks mostly good, a few smallish things below though:
sound/soc/codecs/max98390.c line 4
Quoted 6 lines
+++
b/sound/soc/codecs/max98390.csound/soc/codecs/max98390.c new file +4
-0@@ -0,0 +1,1039 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2020, Maxim Integrated. +*/
Please make the entire comment a C++ one so things look more intentional.
sound/soc/codecs/max98390.c line 397
Quoted 2 lines
sound/soc/codecs/max98390.c new file +2
-0+dev_info (component->dev,"Tdm mode : %d\n" , + max98390->tdm_mode);
This is a bit noisy, please make it at most a dev_dbg().
sound/soc/codecs/max98390.c line 503
Quoted 2 lines
sound/soc/codecs/max98390.c new file +2
-0+static const char *const max98390_analog_gain_text[] = { +"Mute" ,"3dB" ,"6dB" ,"9dB" ,"12dB" ,"15dB" ,"18dB" };
Use TLV data with regulator Volume controls for volumes, don't make them enums.
sound/soc/codecs/max98390.c line 510
Quoted 6 lines
sound/soc/codecs/max98390.c new file +6
-0+static const char *const max98390_boost_voltage_text[] = { +"6.5V" ,"6.625V" ,"6.75V" ,"6.875V" ,"7V" ,"7.125V" ,"7.25V" ,"7.375V" , +"7.5V" ,"7.625V" ,"7.75V" ,"7.875V" ,"8V" ,"8.125V" ,"8.25V" ,"8.375V" , +"8.5V" ,"8.625V" ,"8.75V" ,"8.875V" ,"9V" ,"9.125V" ,"9.25V" ,"9.375V" , +"9.5V" ,"9.625V" ,"9.75V" ,"9.875V" ,"10V" +};
Is this really something that should be configured at runtime rather than through DT?
sound/soc/codecs/max98390.c line 520
Quoted 3 lines
sound/soc/codecs/max98390.c new file +3
-0+static const char *const max98390_current_limit_text[] = { +"0.00A" ,"0.50A" ,"1.00A" ,"1.05A" ,"1.10A" ,"1.15A" ,"1.20A" ,"1.25A" , +"1.30A" ,"1.35A" ,"1.40A" ,"1.45A" ,"1.50A" ,"1.55A" ,"1.60A" ,"1.65A" ,
This looks like it should be in DT too.
sound/soc/codecs/max98390.c line 639
Quoted 10 lines
sound/soc/codecs/max98390.c new file +10
-0+static int max98390_dsm_calib_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); + +dev_warn (component->dev,"Get dsm_calib_get not supported\n" ); + +return 0 ; +}
Just don't implement the operation if you can't implement it.
sound/soc/codecs/max98390.c line 777
Quoted 3 lines
sound/soc/codecs/max98390.c new file +3
-0+dev_info (component->dev, +"max98390: param fw size %d\n" , + fw->size);
This should probably be a dev_dbg() too.
sound/soc/codecs/max98390.c line 843
Quoted 9 lines
sound/soc/codecs/max98390.c new file +9
-0+/* Amp Setting */ +regmap_write (max98390->regmap,MAX98390_CLK_MON ,0x6f ); +regmap_write (max98390->regmap,MAX98390_PCM_RX_EN_A ,0x03 ); +regmap_write (max98390->regmap,MAX98390_R203D_SPK_GAIN ,0x05 ); +regmap_write (max98390->regmap,MAX98390_MEAS_EN ,0x03 ); +regmap_write (max98390->regmap,MAX98390_PWR_GATE_CTL ,0x2d ); +regmap_write (max98390->regmap,MAX98390_ENV_TRACK_VOUT_HEADROOM ,0x0e ); +regmap_write (max98390->regmap,MAX98390_BOOST_BYPASS1 ,0x46 ); +regmap_write (max98390->regmap,MAX98390_FET_SCALING3 ,0x03 );
Are some of these things that might vary per system? If so they probably shouldn't be hard code but instead in DT. Things like the speaker gain jump out.
sound/soc/codecs/max98390.c line 872
Quoted 5 lines
sound/soc/codecs/max98390.c new file +5
-0+static int max98390_suspend (struct device *dev) +{ +struct max98390_priv *max98390 =dev_get_drvdata (dev); + +dev_info (dev,"%s:Enter\n" , __func__);
dev_dbg()
sound/soc/codecs/max98390.c line 884
Quoted 5 lines
sound/soc/codecs/max98390.c new file +5
-0+static int max98390_resume (struct device *dev) +{ +struct max98390_priv *max98390 =dev_get_drvdata (dev); + +dev_info (dev,"%s:Enter\n" , __func__);
dev_dbg()
sound/soc/codecs/max98390.c line 939
Quoted 1 line
sound/soc/codecs/max98390.c new file +1
-0+dev_info (&i2c->dev,"ASoC: MAX98390 i2c probe\n" );
Just drop this.
sound/soc/codecs/max98390.c line 957
Quoted 2 lines
sound/soc/codecs/max98390.c new file +2
-0+ ret =device_property_read_u32 (&i2c->dev,"maxim,temperature_calib" , + &max98390->ambient_temp_value);
Normally for DT that'd be maxim,temperature-calib.
Quoted 6 lines · Mark Brown
Quoted 1 line · Steve Lee
Signed-off-by Steve Lee <[email protected]>This looks mostly good, a few smallish things below though:
Quoted 9 lines
sound/soc/codecs/max98390.c line 4
Quoted 6 lines
+++
b/sound/soc/codecs/max98390.csound/soc/codecs/max98390.c new file +4
-0@@ -0,0 +1,1039 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2020, Maxim Integrated. +*/ Please make the entire comment a C++ one so things look more intentional.
Thank you for feedback.
Modified as requested.
Quoted 4 lines
sound/soc/codecs/max98390.c line 397
Quoted 3 lines
sound/soc/codecs/max98390.c new file +2
-0+dev_info (component->dev,"Tdm mode : %d\n" , + max98390->tdm_mode);
Quoted 8 lines
This is a bit noisy, please make it at most a
dev_dbg().sound/soc/codecs/max98390.c line 503
Quoted 2 lines
sound/soc/codecs/max98390.c new file +2
-0+static const char *const max98390_analog_gain_text[] = { +"Mute" ,"3dB" ,"6dB" ,"9dB" ,"12dB" ,"15dB" ,"18dB" };Use TLV data with regulator Volume controls for volumes, don't make them enums.
Remove enums and use TLV.
Quoted 9 lines
sound/soc/codecs/max98390.c line 510
Quoted 6 lines
sound/soc/codecs/max98390.c new file +6
-0+static const char *const max98390_boost_voltage_text[] = { +"6.5V" ,"6.625V" ,"6.75V" ,"6.875V" ,"7V" ,"7.125V" ,"7.25V" ,"7.375V" , +"7.5V" ,"7.625V" ,"7.75V" ,"7.875V" ,"8V" ,"8.125V" ,"8.25V" ,"8.375V" , +"8.5V" ,"8.625V" ,"8.75V" ,"8.875V" ,"9V" ,"9.125V" ,"9.25V" ,"9.375V" , +"9.5V" ,"9.625V" ,"9.75V" ,"9.875V" ,"10V" +};Is this really something that should be configured at runtime rather than through DT?
Since this control is needed while running system according to system battery situation.
I'd keep this mixer for further use.
Quoted 6 lines
sound/soc/codecs/max98390.c line 520
Quoted 4 lines
sound/soc/codecs/max98390.c new file +3
-0+static const char *const max98390_current_limit_text[] = { +"0.00A" ,"0.50A" ,"1.00A" ,"1.05A" ,"1.10A" ,"1.15A" ,"1.20A" ,"1.25A" , +"1.30A" ,"1.35A" ,"1.40A" ,"1.45A" ,"1.50A" ,"1.55A" ,"1.60A" ,"1.65A" ,This looks like it should be in DT too.
Since this control is needed while running system according to system battery situation.
I'd keep this mixer for further use.
Quoted 13 lines
sound/soc/codecs/max98390.c line 639
Quoted 11 lines
sound/soc/codecs/max98390.c new file +10
-0+static int max98390_dsm_calib_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); + +dev_warn (component->dev,"Get dsm_calib_get not supported\n" ); + +return 0 ; +}Just don't implement the operation if you can't implement it.
If this not exist as dummy operation and all mixer was not working and could not implement better idea.
Could you consider it as with warn message ?
Quoted 6 lines
sound/soc/codecs/max98390.c line 777
Quoted 4 lines
sound/soc/codecs/max98390.c new file +3
-0+dev_info (component->dev, +"max98390: param fw size %d\n" , + fw->size);This should probably be a
dev_dbg()too.
Modified as requested.
Quoted 11 lines
sound/soc/codecs/max98390.c line 843
Quoted 10 lines
sound/soc/codecs/max98390.c new file +9
-0+/* Amp Setting */ +regmap_write (max98390->regmap,MAX98390_CLK_MON ,0x6f ); +regmap_write (max98390->regmap,MAX98390_PCM_RX_EN_A ,0x03 ); +regmap_write (max98390->regmap,MAX98390_R203D_SPK_GAIN ,0x05 ); +regmap_write (max98390->regmap,MAX98390_MEAS_EN ,0x03 ); +regmap_write (max98390->regmap,MAX98390_PWR_GATE_CTL ,0x2d ); +regmap_write (max98390->regmap,MAX98390_ENV_TRACK_VOUT_HEADROOM ,0x0e ); +regmap_write (max98390->regmap,MAX98390_BOOST_BYPASS1 ,0x46 ); +regmap_write (max98390->regmap,MAX98390_FET_SCALING3 ,0x03 );
Quoted 3 lines
Are some of these things that might vary per system? If so they probably shouldn't be hard code but instead in DT. Things like the speaker gain jump out.
I removed hard-coded Volume setting.
Quoted 8 lines
sound/soc/codecs/max98390.c line 872
Quoted 6 lines
sound/soc/codecs/max98390.c new file +5
-0+static int max98390_suspend (struct device *dev) +{ +struct max98390_priv *max98390 =dev_get_drvdata (dev); + +dev_info (dev,"%s:Enter\n" , __func__);
dev_dbg()
Modified as requested.
Quoted 8 lines
sound/soc/codecs/max98390.c line 884
Quoted 6 lines
sound/soc/codecs/max98390.c new file +5
-0+static int max98390_resume (struct device *dev) +{ +struct max98390_priv *max98390 =dev_get_drvdata (dev); + +dev_info (dev,"%s:Enter\n" , __func__);
dev_dbg()
Modified as requested.
Quoted 4 lines
sound/soc/codecs/max98390.c line 939
Quoted 2 lines
sound/soc/codecs/max98390.c new file +1
-0+dev_info (&i2c->dev,"ASoC: MAX98390 i2c probe\n" );Just drop this.
Removed.
Quoted 5 lines
sound/soc/codecs/max98390.c line 957
Quoted 3 lines
sound/soc/codecs/max98390.c new file +2
-0+ ret =device_property_read_u32 (&i2c->dev,"maxim,temperature_calib" , + &max98390->ambient_temp_value);Normally for DT that'd be maxim,temperature-calib.
This is follow as coreboot in Chromium OS case.
I'd follow this name unchanged.
Mark Brown
maintainerQuoted 11 lines · Steve Lee
Quoted 5 lines · Mark Brown
sound/soc/codecs/max98390.c line 520
Quoted 3 lines
sound/soc/codecs/max98390.c new file +3
-0+static const char *const max98390_current_limit_text[] = { +"0.00A" ,"0.50A" ,"1.00A" ,"1.05A" ,"1.10A" ,"1.15A" ,"1.20A" ,"1.25A" , +"1.30A" ,"1.35A" ,"1.40A" ,"1.45A" ,"1.50A" ,"1.55A" ,"1.60A" ,"1.65A" ,This looks like it should be in DT too.
Since this control is needed while running system according to system battery situation.
I'd keep this mixer for further use.
That's... interesting for a current limit, and sounds like it would have issues for the common case use of current limits to protect the hardware.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
sound/soc/codecs/max98390.c new file +4
-0+static int max98390_dsm_calib_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_component *component =Quoted 8 lines
sound/soc/codecs/max98390.c line 639
Quoted 6 lines
sound/soc/codecs/max98390.c new file +6
-0+snd_soc_kcontrol_component (kcontrol); + +dev_warn (component->dev,"Get dsm_calib_get not supported\n" ); + +return 0 ; +}Just don't implement the operation if you can't implement it.
Quoted 2 lines
If this not exist as dummy operation and all mixer was not working and could not implement better idea.
Could you be more specific about what you mean by "not working" or how simply not initializing the value returned fixes things please?
Quoted 1 line
Could you consider it as with warn message ?
No, if there's a problem here we should fix it properly.
Quoted 31 lines · Mark Brown
Quoted 11 lines · Steve Lee
Quoted 5 lines · Mark Brown
sound/soc/codecs/max98390.c line 520
Quoted 3 lines
sound/soc/codecs/max98390.c new file +3
-0+static const char *const max98390_current_limit_text[] = { +"0.00A" ,"0.50A" ,"1.00A" ,"1.05A" ,"1.10A" ,"1.15A" ,"1.20A" ,"1.25A" , +"1.30A" ,"1.35A" ,"1.40A" ,"1.45A" ,"1.50A" ,"1.55A" ,"1.60A" ,"1.65A" ,This looks like it should be in DT too.
Since this control is needed while running system according to system battery situation.
I'd keep this mixer for further use.That's... interesting for a current limit, and sounds like it would have issues for the common case use of current limits to protect the hardware.
Quoted 12 lines
Quoted 12 lines
sound/soc/codecs/max98390.c line 639
Quoted 10 lines
sound/soc/codecs/max98390.c new file +10
-0+static int max98390_dsm_calib_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); + +dev_warn (component->dev,"Get dsm_calib_get not supported\n" ); + +return 0 ; +}Just don't implement the operation if you can't implement it.
Quoted 5 lines
Quoted 2 lines
If this not exist as dummy operation and all mixer was not working and could not implement better idea.
Could you be more specific about what you mean by "not working" or how simply not initializing the value returned fixes things please?
I mean that xhandler_get pointing to NULL makes mixer list unexpected operation. I will do return fixed value without warn message.
Quoted 4 lines
Quoted 2 lines
Could you consider it as with warn message ?
No, if there's a problem here we should fix it properly.
Thanks for feed back.I will do return fixed value without warn message.
(The patch passed 2 round review in https://crrev.com/c/2083354)
Quoted 34 lines · Steve Lee
sound/soc/codecs/max98390.c new file +34
-0+static int max98390_dai_set_fmt (struct snd_soc_dai *codec_dai,unsigned int fmt) +{ +struct snd_soc_component *component = codec_dai->component; +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); +unsigned int mode; +unsigned int format; +unsigned int invert; + +dev_dbg (component->dev,"%s: fmt 0x%08X\n" , __func__, fmt); + +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBS_CFS : + mode =MAX98390_PCM_MASTER_MODE_SLAVE ; +break ; +case SND_SOC_DAIFMT_CBM_CFM : + max98390->master = true; + mode =MAX98390_PCM_MASTER_MODE_MASTER ; +break ; +default : +dev_err (component->dev,"DAI clock mode unsupported\n" ); +return -EINVAL ; + } + +regmap_update_bits (max98390->regmap, +MAX98390_PCM_MASTER_MODE , +MAX98390_PCM_MASTER_MODE_MASK , + mode); + +switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { +case SND_SOC_DAIFMT_NB_NF : +break ; +case SND_SOC_DAIFMT_IB_NF : + invert =MAX98390_PCM_MODE_CFG_PCM_BCLKEDGE ;
sound/soc/codecs/max98390.c line 205
Quoted 10 lines
sound/soc/codecs/max98390.c new file +10
-0+break ; +default : +dev_err (component->dev,"DAI invert mode unsupported\n" ); +return -EINVAL ; + } + +regmap_update_bits (max98390->regmap, +MAX98390_PCM_MODE_CFG , +MAX98390_PCM_MODE_CFG_PCM_BCLKEDGE , + invert);
invert will be uninitialized in the SND_SOC_DAIFMT_NB_NF case.
sound/soc/codecs/max98390.c line 300
Quoted 3 lines
sound/soc/codecs/max98390.c new file +3
-0+static int max98390_dai_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai)
Lack of 1 tab indent.
sound/soc/codecs/max98390.c line 625
Quoted 13 lines
sound/soc/codecs/max98390.c new file +13
-0+static int max98390_adaptive_rdc_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +int rdc, rdc0; +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); + +regmap_read (max98390->regmap,THERMAL_RDC_RD_BACK_BYTE1 , &rdc); +regmap_read (max98390->regmap,THERMAL_RDC_RD_BACK_BYTE0 , &rdc0); + rdc0 |= rdc <<8 ; + ucontrol->value.integer.value[0 ] = rdc0;
ucontrol->value.integer.value[0] = rdc0 | (rdc << 8);
sound/soc/codecs/max98390.c line 765
Quoted 8 lines
sound/soc/codecs/max98390.c new file +8
-0+static int max98390_dsm_init (struct snd_soc_component *component) +{ +int ret; +const char *filename; +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); +const struct firmware *fw =NULL ; +char *dsm_param =NULL ;
Don't need to initialize fw and dsm_param in the case.
sound/soc/codecs/max98390.c line 767
Quoted 2 lines
sound/soc/codecs/max98390.c new file +2
-0+ + filename ="dsm_param.bin" ;
Either:
- initialize when declaring the variable
- remove the variable and inline into request_firmware() call
Quoted 18 lines
sound/soc/codecs/max98390.c new file +18
-0+ ret =request_firmware (&fw, filename, component->dev); +if (ret) { +dev_err (component->dev, +"Failed to acquire dsm params: %d\n" , ret); + goto err; + } + +dev_info (component->dev, +"max98390: param fw size %d\n" , + fw->size); + dsm_param = (char *)fw->data; + dsm_param +=MAX98390_DSM_PAYLOAD_OFFSET ; +regmap_bulk_write (max98390->regmap,DSM_EQ_BQ1_B0_BYTE0 , + dsm_param, + fw->size -MAX98390_DSM_PAYLOAD_OFFSET ); +release_firmware (fw); +regmap_write (max98390->regmap,MAX98390_R23E1_DSP_GLOBAL_EN ,0x01 ); +
sound/soc/codecs/max98390.c line 829
Quoted 10 lines
sound/soc/codecs/max98390.c new file +9
-0+err: +return ret; +} +static int max98390_probe (struct snd_soc_component *component) +{ +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); + +/* Update dsm bin param */
This comment makes more sense if before max98390_dsm_init().
Review
Quoted 9 lines
(quoted diff) +8
-0+ regmap_write(max98390->regmap, MAX98390_SOFTWARE_RESET, 0x01); + /* Sleep reset settle time */ + msleep(20); + max98390_dsm_init(component); + /* Check Revision ID */ + ret = regmap_read(max98390->regmap, + MAX98390_R24FF_REV_ID, ®); + if (ret < 0) {
if (ret)
Quoted 41 lines · Tzung-Bi Shih
(The patch passed 2 round review in https://crrev.com/c/2083354)
Quoted 37 lines · Steve Lee
sound/soc/codecs/max98390.c new file +37
-0+static int max98390_dai_set_fmt (struct snd_soc_dai *codec_dai,unsigned int fmt) +{ +struct snd_soc_component *component = codec_dai->component; +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); +unsigned int mode; +unsigned int format; +unsigned int invert; + +dev_dbg (component->dev,"%s: fmt 0x%08X\n" , __func__, fmt); + +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBS_CFS : + mode =MAX98390_PCM_MASTER_MODE_SLAVE ; +break ; +case SND_SOC_DAIFMT_CBM_CFM : + max98390->master = true; + mode =MAX98390_PCM_MASTER_MODE_MASTER ; +break ; +default : +dev_err (component->dev,"DAI clock mode unsupported\n" ); +return -EINVAL ; + } + +regmap_update_bits (max98390->regmap, +MAX98390_PCM_MASTER_MODE , +MAX98390_PCM_MASTER_MODE_MASK , + mode); + +switch (fmt &SND_SOC_DAIFMT_INV_MASK ) { +case SND_SOC_DAIFMT_NB_NF : +break ; +case SND_SOC_DAIFMT_IB_NF : + invert =MAX98390_PCM_MODE_CFG_PCM_BCLKEDGE ; +break ; +default : +dev_err (component->dev,"DAI invert mode unsupported\n" );
Quoted 8 lines
sound/soc/codecs/max98390.c line 205
Quoted 7 lines
sound/soc/codecs/max98390.c new file +7
-0+return -EINVAL ; + } + +regmap_update_bits (max98390->regmap, +MAX98390_PCM_MODE_CFG , +MAX98390_PCM_MODE_CFG_PCM_BCLKEDGE , + invert);invert will be uninitialized in the
SND_SOC_DAIFMT_NB_NFcase.
Thank you for feedback.
I've add initial value for invert.
Quoted 5 lines
sound/soc/codecs/max98390.c line 300
Quoted 4 lines
sound/soc/codecs/max98390.c new file +3
-0+static int max98390_dai_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai)Lack of 1 tab indent.
Done as requested.
Quoted 15 lines
Quoted 4 lines
sound/soc/codecs/max98390.c new file +3
-0+static int max98390_adaptive_rdc_get (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{sound/soc/codecs/max98390.c line 625
Quoted 10 lines
sound/soc/codecs/max98390.c new file +10
-0+int rdc, rdc0; +struct snd_soc_component *component = +snd_soc_kcontrol_component (kcontrol); +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); + +regmap_read (max98390->regmap,THERMAL_RDC_RD_BACK_BYTE1 , &rdc); +regmap_read (max98390->regmap,THERMAL_RDC_RD_BACK_BYTE0 , &rdc0); + rdc0 |= rdc <<8 ; + ucontrol->value.integer.value[0 ] = rdc0;ucontrol->value.integer.value[0] = rdc0 | (rdc << 8);
Done as requested.
Quoted 10 lines
sound/soc/codecs/max98390.c line 765
Quoted 9 lines
sound/soc/codecs/max98390.c new file +8
-0+static int max98390_dsm_init (struct snd_soc_component *component) +{ +int ret; +const char *filename; +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); +const struct firmware *fw =NULL ; +char *dsm_param =NULL ;Don't need to initialize fw and
dsm_paramin the case.
Done as requested.
Quoted 6 lines
sound/soc/codecs/max98390.c line 767
Quoted 3 lines
sound/soc/codecs/max98390.c new file +2
-0+ + filename ="dsm_param.bin" ;Either:
- initialize when declaring the variable
- remove the variable and inline intorequest_firmware()call
I've added initialized at declare.
Quoted 23 lines
Quoted 22 lines
sound/soc/codecs/max98390.c new file +21
-0+ ret =request_firmware (&fw, filename, component->dev); +if (ret) { +dev_err (component->dev, +"Failed to acquire dsm params: %d\n" , ret); + goto err; + } + +dev_info (component->dev, +"max98390: param fw size %d\n" , + fw->size); + dsm_param = (char *)fw->data; + dsm_param +=MAX98390_DSM_PAYLOAD_OFFSET ; +regmap_bulk_write (max98390->regmap,DSM_EQ_BQ1_B0_BYTE0 , + dsm_param, + fw->size -MAX98390_DSM_PAYLOAD_OFFSET ); +release_firmware (fw); +regmap_write (max98390->regmap,MAX98390_R23E1_DSP_GLOBAL_EN ,0x01 ); + +err: +return ret; +}
Quoted 7 lines
sound/soc/codecs/max98390.c line 829
Quoted 6 lines
sound/soc/codecs/max98390.c new file +6
-0+static int max98390_probe (struct snd_soc_component *component) +{ +struct max98390_priv *max98390 = +snd_soc_component_get_drvdata (component); + +/* Update dsm bin param */ This comment makes more sense if before
max98390_dsm_init().
Done as requested.
Quoted 11 lines
Review
Quoted 10 lines
(quoted diff) +8
-0+ regmap_write(max98390->regmap, MAX98390_SOFTWARE_RESET, 0x01); + /* Sleep reset settle time */ + msleep(20); + max98390_dsm_init(component); + /* Check Revision ID */ + ret = regmap_read(max98390->regmap, + MAX98390_R24FF_REV_ID, ®); + if (ret < 0) {if (ret)
Done as requested.