[PATCH] ASoC: max98390: Add support for tx slot configuration.

2021-04-05 Thread Steve Lee
 Update voltage/current tx slot configuration support.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 62 +
 sound/soc/codecs/max98390.h |  2 ++
 2 files changed, 64 insertions(+)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index bb736c44e68a..94773ccee9d5 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -856,6 +856,48 @@ static void max98390_init_regs(struct snd_soc_component 
*component)
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);
+
+   /* voltage, current slot configuration */
+   regmap_write(max98390->regmap,
+   MAX98390_PCM_CH_SRC_2,
+   (max98390->i_l_slot << 4 |
+   max98390->v_l_slot)&0xFF);
+
+   if (max98390->v_l_slot < 8) {
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_HIZ_CTRL_A,
+   1 << max98390->v_l_slot, 0);
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_EN_A,
+   1 << max98390->v_l_slot,
+   1 << max98390->v_l_slot);
+   } else {
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_HIZ_CTRL_B,
+   1 << (max98390->v_l_slot - 8), 0);
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_EN_B,
+   1 << (max98390->v_l_slot - 8),
+   1 << (max98390->v_l_slot - 8));
+   }
+
+   if (max98390->i_l_slot < 8) {
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_HIZ_CTRL_A,
+   1 << max98390->i_l_slot, 0);
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_EN_A,
+   1 << max98390->i_l_slot,
+   1 << max98390->i_l_slot);
+   } else {
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_HIZ_CTRL_B,
+   1 << (max98390->i_l_slot - 8), 0);
+   regmap_update_bits(max98390->regmap,
+   MAX98390_PCM_TX_EN_B,
+   1 << (max98390->i_l_slot - 8),
+   1 << (max98390->i_l_slot - 8));
+   }
 }
 
 static int max98390_probe(struct snd_soc_component *component)
@@ -946,6 +988,23 @@ static const struct regmap_config max98390_regmap = {
.cache_type   = REGCACHE_RBTREE,
 };
 
+static void max98390_slot_config(struct i2c_client *i2c,
+   struct max98390_priv *max98390)
+{
+   int value;
+   struct device *dev = >dev;
+
+   if (!device_property_read_u32(dev, "maxim,vmon-slot-no", ))
+   max98390->v_l_slot = value & 0xF;
+   else
+   max98390->v_l_slot = 0;
+
+   if (!device_property_read_u32(dev, "maxim,imon-slot-no", ))
+   max98390->i_l_slot = value & 0xF;
+   else
+   max98390->i_l_slot = 1;
+}
+
 static int max98390_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
 {
@@ -988,6 +1047,9 @@ static int max98390_i2c_probe(struct i2c_client *i2c,
__func__, max98390->ref_rdc_value,
max98390->ambient_temp_value);
 
+   /* voltage/current slot configuration */
+   max98390_slot_config(i2c, max98390);
+
/* regmap initialization */
max98390->regmap = devm_regmap_init_i2c(i2c, _regmap);
if (IS_ERR(max98390->regmap)) {
diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index dff884f68e3e..e31516717d3b 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -658,6 +658,8 @@ struct max98390_priv {
unsigned int sysclk;
unsigned int master;
unsigned int tdm_mode;
+   unsigned int v_l_slot;
+   unsigned int i_l_slot;
unsigned int ref_rdc_value;
unsigned int ambient_temp_value;
 };
-- 
2.17.1



RE: [EXTERNAL] Re: [PATCH] ASoC: max98390: Add controls for tx path

2021-04-02 Thread Steve Lee
> -Original Message-
> From: Mark Brown 
> Sent: Saturday, April 3, 2021 12:23 AM
> To: Steve Lee 
> Cc: lgirdw...@gmail.com; pe...@perex.cz; ti...@suse.com;
> ckee...@opensource.cirrus.com; ge...@linux-m68k.org;
> r...@opensource.wolfsonmicro.com; shumi...@realtek.com;
> srinivas.kandaga...@linaro.org; k...@kernel.org; dmur...@ti.com;
> jack...@realtek.com; nuno...@analog.com; linux-kernel@vger.kernel.org;
> alsa-de...@alsa-project.org; ryan.lee.ma...@gmail.com;
> steves.lee.ma...@gmail.com
> Subject: [EXTERNAL] Re: [PATCH] ASoC: max98390: Add controls for tx path
> 
> On Fri, Apr 02, 2021 at 12:36:43PM +0900, Steve Lee wrote:
> 
> > +   SOC_SINGLE("Tx Enable Selection", MAX98390_PCM_TX_EN_A,
> > +   0, 255, 0),
> 
> I'm not clear what this is (especially given the source selection below) but 
> it
> looks like it should be a mute control?
Yes, each channel of enable and disable control. 
I will update this also configured by TDM slot configuration.  
> 
> > +   SOC_SINGLE("Tx Hiz Selection", MAX98390_PCM_TX_HIZ_CTRL_A,
> > +   0, 255, 0),
> 
> This I'd expect to be tied into machine driver configuration, either DT 
> properties
> or TDM slot configuration - it's not something that looks like it's something
> you'd want to control at runtime.
I will update this with either TDM slot configuration and DT properties.
> 
> > +   SOC_SINGLE("Tx Source Selection", MAX98390_PCM_CH_SRC_2,
> > +   0, 255, 0),
> 
> This looks like it should be a DAPM control or possibly a TDM slot 
> configuration -
> look at how the Arizona devices handle routing from multiple TDM slots for the
> DAPM version.
This is for Current Sensing and Voltage sensing slot selection. I will update 
this as DT properties.


[PATCH] ASoC: max98390: Add controls for tx path

2021-04-01 Thread Steve Lee
 Add controls for tx source.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index bb736c44e68a..163093959da8 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -656,6 +656,12 @@ static const struct snd_kcontrol_new 
max98390_snd_controls[] = {
MAX98390_AMP_DSP_CFG_RMP_DN_SHIFT, 1, 0),
SOC_SINGLE("Boost Clock Phase", MAX98390_BOOST_CTRL3,
MAX98390_BOOST_CLK_PHASE_CFG_SHIFT, 3, 0),
+   SOC_SINGLE("Tx Enable Selection", MAX98390_PCM_TX_EN_A,
+   0, 255, 0),
+   SOC_SINGLE("Tx Hiz Selection", MAX98390_PCM_TX_HIZ_CTRL_A,
+   0, 255, 0),
+   SOC_SINGLE("Tx Source Selection", MAX98390_PCM_CH_SRC_2,
+   0, 255, 0),
SOC_ENUM("Boost Output Voltage", max98390_boost_voltage),
SOC_ENUM("Current Limit", max98390_current_limit),
SOC_SINGLE_EXT("DSM Rdc", SND_SOC_NOPM, 0, 0xff, 0,
-- 
2.17.1



RE: [PATCH 3/3] ASoC: max98390: update dsm param bin max size

2020-07-27 Thread Steve Lee
> -Original Message-
> From: Mark Brown 
> Sent: Monday, July 27, 2020 10:08 PM
> To: Steve Lee 
> Cc: lgirdw...@gmail.com; pe...@perex.cz; ti...@suse.com;
> ckee...@opensource.cirrus.com; ge...@linux-m68k.org;
> r...@opensource.wolfsonmicro.com; shumi...@realtek.com;
> srinivas.kandaga...@linaro.org; k...@kernel.org; dmur...@ti.com;
> jack...@realtek.com; nuno...@analog.com; linux-kernel@vger.kernel.org;
> alsa-de...@alsa-project.org; ryan.lee.ma...@gmail.com; Ryan Lee
> ; steves.lee.ma...@gmail.com
> Subject: Re: [PATCH 3/3] ASoC: max98390: update dsm param bin max size
> 
> On Mon, Jul 27, 2020 at 02:00:09AM +, Steve Lee wrote:
> 
> > > I'm missing patches 1-2 and have no cover letter - what's the story
> > > with dependencies?
> 
> >  I will re-send patch ang please ignore this patch.
> > DSM init param is extended to cover more register so that DSM MAX PARAM
> SIZE value is changed.
> 
> I applied these on Friday having found the other two patches (you're not 
> sending
> things as a thread so they get lost, for example if someone sends a big 
> series at
> a similar time like what happened on Friday) so your new version won't apply,
> please resend whatever change you want to make as an incremental patch
> against current code.
  
> 
> Please do not submit new versions of already applied patches, please submit
> incremental updates to the existing code.  Modifying existing commits creates
> problems for other users building on top of those commits so it's best 
> practice
> to only change pubished git commits if absolutely essential.

Thanks, I missed patched was already applied. I will send patch upon these 
patches later.
 



[RESEND 3/3] ASoC: max98390: update dsm param bin max size

2020-07-26 Thread Steve Lee
 MAX98390_DSM_PARAM_MAX_SIZE is changed to support extended
 register update.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index 5f444e7779b0..dff884f68e3e 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -650,7 +650,7 @@
 
 /* DSM register offset */
 #define MAX98390_DSM_PAYLOAD_OFFSET 16
-#define MAX98390_DSM_PARAM_MAX_SIZE 770
+#define MAX98390_DSM_PARAM_MAX_SIZE 1024
 #define MAX98390_DSM_PARAM_MIN_SIZE 670
 
 struct max98390_priv {
-- 
2.17.1



[RESEND 2/3] ASoC: max98390: Update dsm init sequence and condition.

2020-07-26 Thread Steve Lee
 Modify dsm_init sequence and dsm param bin check condition.
  - Move dsm_init() to after amp init setting to
make sure dsm init is last setting.
  - dsm param bin check condition changed for extended register setting.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 44ffebac15ad..ff5cc9bbec29 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -790,7 +790,7 @@ static int max98390_dsm_init(struct snd_soc_component 
*component)
param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
-   param_start_addr < DSM_STBASS_HPF_B0_BYTE0 ||
+   param_start_addr < MAX98390_IRQ_CTRL ||
fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) {
dev_err(component->dev,
"param fw is invalid.\n");
@@ -864,11 +864,11 @@ static int max98390_probe(struct snd_soc_component 
*component)
regmap_write(max98390->regmap, MAX98390_SOFTWARE_RESET, 0x01);
/* Sleep reset settle time */
msleep(20);
-   /* Update dsm bin param */
-   max98390_dsm_init(component);
 
/* Amp init setting */
max98390_init_regs(component);
+   /* Update dsm bin param */
+   max98390_dsm_init(component);
 
/* Dsm Setting */
if (max98390->ref_rdc_value) {
-- 
2.17.1



[RESEND 1/3] ASoC: max98390: Fix dac event dapm mixer.

2020-07-26 Thread Steve Lee
 Global EN register guide to off before AMP_EN register
 when amp disable sequence.
  - remove AMP_EN control before max98390_dac_event call

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 3e8094241645..44ffebac15ad 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -678,7 +678,7 @@ static const struct snd_kcontrol_new max98390_dai_controls =
 
 static const struct snd_soc_dapm_widget max98390_dapm_widgets[] = {
SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback",
-   MAX98390_R203A_AMP_EN, 0, 0, max98390_dac_event,
+   SND_SOC_NOPM, 0, 0, max98390_dac_event,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_MUX("DAI Sel Mux", SND_SOC_NOPM, 0, 0,
_dai_controls),
-- 
2.17.1



RE: [PATCH 3/3] ASoC: max98390: update dsm param bin max size

2020-07-26 Thread Steve Lee
> -Original Message-
> From: Mark Brown 
> Sent: Friday, July 24, 2020 7:51 PM
> To: Steve Lee 
> Cc: lgirdw...@gmail.com; pe...@perex.cz; ti...@suse.com;
> ckee...@opensource.cirrus.com; ge...@linux-m68k.org;
> r...@opensource.wolfsonmicro.com; shumi...@realtek.com;
> srinivas.kandaga...@linaro.org; k...@kernel.org; dmur...@ti.com;
> jack...@realtek.com; nuno...@analog.com; linux-kernel@vger.kernel.org;
> alsa-de...@alsa-project.org; ryan.lee.ma...@gmail.com; Ryan Lee
> ; steves.lee.ma...@gmail.com
> Subject: Re: [PATCH 3/3] ASoC: max98390: update dsm param bin max size
> 
> On Fri, Jul 24, 2020 at 05:56:44PM +0900, Steve Lee wrote:
> >  MAX98390_DSM_PARAM_MAX_SIZE is changed to support extended  register
> > update.
> 
> I'm missing patches 1-2 and have no cover letter - what's the story with
> dependencies?
 I will re-send patch ang please ignore this patch. 
DSM init param is extended to cover more register so that DSM MAX PARAM SIZE 
value is changed.
Thanks.!


[PATCH 3/3] ASoC: max98390: update dsm param bin max size

2020-07-24 Thread Steve Lee
 MAX98390_DSM_PARAM_MAX_SIZE is changed to support extended
 register update.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index 5f444e7779b0..dff884f68e3e 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -650,7 +650,7 @@
 
 /* DSM register offset */
 #define MAX98390_DSM_PAYLOAD_OFFSET 16
-#define MAX98390_DSM_PARAM_MAX_SIZE 770
+#define MAX98390_DSM_PARAM_MAX_SIZE 1024
 #define MAX98390_DSM_PARAM_MIN_SIZE 670
 
 struct max98390_priv {
-- 
2.17.1



[PATCH 2/2] ASoC: max98390: Update dsm init sequence and condition.

2020-07-24 Thread Steve Lee
 Modify dsm_init sequence and dsm param bin check condition.
  - Move dsm_init() to after amp init setting to
make sure dsm init is last setting.
  - dsm param bin check condition changed for extended register setting.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 44ffebac15ad..ff5cc9bbec29 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -790,7 +790,7 @@ static int max98390_dsm_init(struct snd_soc_component 
*component)
param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
-   param_start_addr < DSM_STBASS_HPF_B0_BYTE0 ||
+   param_start_addr < MAX98390_IRQ_CTRL ||
fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) {
dev_err(component->dev,
"param fw is invalid.\n");
@@ -864,11 +864,11 @@ static int max98390_probe(struct snd_soc_component 
*component)
regmap_write(max98390->regmap, MAX98390_SOFTWARE_RESET, 0x01);
/* Sleep reset settle time */
msleep(20);
-   /* Update dsm bin param */
-   max98390_dsm_init(component);
 
/* Amp init setting */
max98390_init_regs(component);
+   /* Update dsm bin param */
+   max98390_dsm_init(component);
 
/* Dsm Setting */
if (max98390->ref_rdc_value) {
-- 
2.17.1



[PATCH 1/2] ASoC: max98390: Fix dac event dapm mixer.

2020-07-24 Thread Steve Lee
 Global EN register guide to off before AMP_EN register
 when amp disable sequence.
  - remove AMP_EN control before max98390_dac_event call

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 3e8094241645..44ffebac15ad 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -678,7 +678,7 @@ static const struct snd_kcontrol_new max98390_dai_controls =
 
 static const struct snd_soc_dapm_widget max98390_dapm_widgets[] = {
SND_SOC_DAPM_DAC_E("Amp Enable", "HiFi Playback",
-   MAX98390_R203A_AMP_EN, 0, 0, max98390_dac_event,
+   SND_SOC_NOPM, 0, 0, max98390_dac_event,
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_MUX("DAI Sel Mux", SND_SOC_NOPM, 0, 0,
_dai_controls),
-- 
2.17.1



[PATCH 2/2] ASoC: max98390: Update regmap readable reg and volatile

2020-06-11 Thread Steve Lee
 Update max98390_readable_register and max98390_volatile_reg

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 57d15dbfcda3..b345e626956d 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -700,8 +700,8 @@ static bool max98390_readable_register(struct device *dev, 
unsigned int reg)
case MAX98390_IRQ_CTRL ... MAX98390_WDOG_CTRL:
case MAX98390_MEAS_ADC_THERM_WARN_THRESH
... MAX98390_BROWNOUT_INFINITE_HOLD:
-   case MAX98390_BROWNOUT_LVL_HOLD ... THERMAL_COILTEMP_RD_BACK_BYTE0:
-   case DSMIG_DEBUZZER_THRESHOLD ... MAX98390_R24FF_REV_ID:
+   case MAX98390_BROWNOUT_LVL_HOLD ... DSMIG_DEBUZZER_THRESHOLD:
+   case DSM_VOL_ENA ... MAX98390_R24FF_REV_ID:
return true;
default:
return false;
@@ -717,7 +717,7 @@ static bool max98390_volatile_reg(struct device *dev, 
unsigned int reg)
case MAX98390_BROWNOUT_LOWEST_STATUS:
case MAX98390_ENV_TRACK_BOOST_VOUT_READ:
case DSM_STBASS_HPF_B0_BYTE0 ... DSM_DEBUZZER_ATTACK_TIME_BYTE2:
-   case THERMAL_RDC_RD_BACK_BYTE1 ... THERMAL_COILTEMP_RD_BACK_BYTE0:
+   case THERMAL_RDC_RD_BACK_BYTE1 ... DSMIG_DEBUZZER_THRESHOLD:
case DSM_THERMAL_GAIN ... DSM_WBDRC_GAIN:
return true;
default:
-- 
2.17.1



[PATCH 1/2] ASoC: max98390: Add Amp init common setting func.

2020-06-11 Thread Steve Lee
 Add amp common init function to gather common init setting and finaize.
  - add max98390_init_regs func
  - move amp setting to max98390_init_regs func.
  - removed unneceary setting and finalize common register values.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 0d63ebfbff2f..57d15dbfcda3 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -842,6 +842,20 @@ static int max98390_dsm_calibrate(struct snd_soc_component 
*component)
return 0;
 }
 
+static void max98390_init_regs(struct snd_soc_component *component)
+{
+   struct max98390_priv *max98390 =
+   snd_soc_component_get_drvdata(component);
+
+   regmap_write(max98390->regmap, MAX98390_CLK_MON, 0x6f);
+   regmap_write(max98390->regmap, MAX98390_DAT_MON, 0x00);
+   regmap_write(max98390->regmap, MAX98390_PWR_GATE_CTL, 0x00);
+   regmap_write(max98390->regmap, MAX98390_PCM_RX_EN_A, 0x03);
+   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);
+}
+
 static int max98390_probe(struct snd_soc_component *component)
 {
struct max98390_priv *max98390 =
@@ -853,18 +867,10 @@ static int max98390_probe(struct snd_soc_component 
*component)
/* Update dsm bin param */
max98390_dsm_init(component);
 
-   /* 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_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);
+   /* Amp init setting */
+   max98390_init_regs(component);
 
/* Dsm Setting */
-   regmap_write(max98390->regmap, DSM_VOL_CTRL, 0x94);
-   regmap_write(max98390->regmap, DSMIG_EN, 0x19);
-   regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80);
if (max98390->ref_rdc_value) {
regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE0,
max98390->ref_rdc_value & 0x00ff);
-- 
2.17.1



[v2 PATCH] ASoC: max98390: Fix potential crash during param fw loading

2020-06-03 Thread Steve Lee
 malformed firmware file can cause out-of-bound access and crash
 during dsm_param bin loading.
  - add MIN/MAX param size to avoid out-of-bound access.
  - read start addr and size of param and check bound.
  - add condition that fw->size > param_size + _PAYLOAD_OFFSET
to confirm enough data.

Signed-off-by: Steve Lee 
---

Change log v2:
* add condtion that param_size + _PAYLOAD_OFFSET is less than fw->size
  to confirm enough data
* remove unintended code

 sound/soc/codecs/max98390.c | 24 
 sound/soc/codecs/max98390.h |  3 ++-
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index be7cd0aeb6a6..0d63ebfbff2f 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -754,6 +754,7 @@ static struct snd_soc_dai_driver max98390_dai[] = {
 static int max98390_dsm_init(struct snd_soc_component *component)
 {
int ret;
+   int param_size, param_start_addr;
char filename[128];
const char *vendor, *product;
struct max98390_priv *max98390 =
@@ -780,14 +781,29 @@ static int max98390_dsm_init(struct snd_soc_component 
*component)
dev_dbg(component->dev,
"max98390: param fw size %zd\n",
fw->size);
+   if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
+   dev_err(component->dev,
+   "param fw is invalid.\n");
+   goto err_alloc;
+   }
dsm_param = (char *)fw->data;
+   param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
+   param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
+   if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
+   param_start_addr < DSM_STBASS_HPF_B0_BYTE0 ||
+   fw->size < param_size + MAX98390_DSM_PAYLOAD_OFFSET) {
+   dev_err(component->dev,
+   "param fw is invalid.\n");
+   goto err_alloc;
+   }
+   regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80);
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_bulk_write(max98390->regmap, param_start_addr,
+   dsm_param, param_size);
regmap_write(max98390->regmap, MAX98390_R23E1_DSP_GLOBAL_EN, 0x01);
 
+err_alloc:
+   release_firmware(fw);
 err:
return ret;
 }
diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index f59cb114d957..5f444e7779b0 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -650,7 +650,8 @@
 
 /* DSM register offset */
 #define MAX98390_DSM_PAYLOAD_OFFSET 16
-#define MAX98390_DSM_PAYLOAD_OFFSET_2 495
+#define MAX98390_DSM_PARAM_MAX_SIZE 770
+#define MAX98390_DSM_PARAM_MIN_SIZE 670
 
 struct max98390_priv {
struct regmap *regmap;
-- 
2.17.1



RE: [PATCH] ASoC: max98390: Fix potential crash during param fw loading

2020-06-03 Thread Steve Lee
> -Original Message-
> From: Mark Brown 
> Sent: Wednesday, June 3, 2020 8:43 PM
> To: Steve Lee 
> Cc: lgirdw...@gmail.com; pe...@perex.cz; ti...@suse.com;
> ckee...@opensource.cirrus.com; ge...@linux-m68k.org;
> r...@opensource.wolfsonmicro.com; shumi...@realtek.com;
> srinivas.kandaga...@linaro.org; k...@kernel.org; dmur...@ti.com;
> jack...@realtek.com; nuno...@analog.com; linux-kernel@vger.kernel.org;
> alsa-de...@alsa-project.org; ryan.lee.ma...@gmail.com; Ryan Lee
> ; steves.lee.ma...@gmail.com
> Subject: Re: [PATCH] ASoC: max98390: Fix potential crash during param fw
> loading
> 
> On Wed, Jun 03, 2020 at 11:37:44AM +, Steve Lee wrote:
> 
> > > This is now reading the size out of the header of the file which is
> > > good but it should also validate that the file is big enough to have
> > > this much data in it, otherwise it's possible to read beyond the end
> > > of the firmware file (eg, if it got truncated somehow).  Previously
> > > the code used the size of the file read from disk so that wasn't an issue.
> 
> >  Thanks for quick comment. Can this case cover by below line?
> > +   if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
> > +   dev_err(component->dev,
> > +   "param fw is invalid.\n");
> > +   goto err_alloc;
> > +   }
> 
> No, that doesn't cover all of it - the case I'm concerned about is the case 
> where
> we've got enough data for the header but the payload is truncated.  You need a
> check that param_size + _PAYLOAD_OFFSET is less than fw->size as well.

  Yes, I will update this and good enough.


RE: [PATCH] ASoC: max98390: Fix potential crash during param fw loading

2020-06-03 Thread Steve Lee



> -Original Message-
> From: Mark Brown 
> Sent: Wednesday, June 3, 2020 8:32 PM
> To: Steve Lee 
> Cc: lgirdw...@gmail.com; pe...@perex.cz; ti...@suse.com;
> ckee...@opensource.cirrus.com; ge...@linux-m68k.org;
> r...@opensource.wolfsonmicro.com; shumi...@realtek.com;
> srinivas.kandaga...@linaro.org; k...@kernel.org; dmur...@ti.com;
> jack...@realtek.com; nuno...@analog.com; linux-kernel@vger.kernel.org;
> alsa-de...@alsa-project.org; ryan.lee.ma...@gmail.com; Ryan Lee
> ; steves.lee.ma...@gmail.com
> Subject: Re: [PATCH] ASoC: max98390: Fix potential crash during param fw
> loading
> 
> On Wed, Jun 03, 2020 at 08:18:19PM +0900, Steve Lee wrote:
> 
> > +   param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) <<
> 8;
> > +   param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
> > +   if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
> > +   param_start_addr < DSM_STBASS_HPF_B0_BYTE0) {
> > +   dev_err(component->dev,
> > +   "param fw is invalid.\n");
> > +   goto err_alloc;
> > +   }
> 
> This is now reading the size out of the header of the file which is good but 
> it
> should also validate that the file is big enough to have this much data in it,
> otherwise it's possible to read beyond the end of the firmware file (eg, if 
> it got
> truncated somehow).  Previously the code used the size of the file read from 
> disk
> so that wasn't an issue.

 Thanks for quick comment. Can this case cover by below line?
+   if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
+   dev_err(component->dev,
+   "param fw is invalid.\n");
+   goto err_alloc;
+   }
 


RE: [PATCH] ASoC: max98390: Fix potential crash during param fw loading

2020-06-03 Thread Steve Lee
> -Original Message-
> From: Takashi Iwai 
> Sent: Wednesday, June 3, 2020 8:24 PM
> To: Steve Lee 
> Cc: lgirdw...@gmail.com; broo...@kernel.org; pe...@perex.cz;
> ti...@suse.com; ckee...@opensource.cirrus.com; ge...@linux-m68k.org;
> r...@opensource.wolfsonmicro.com; shumi...@realtek.com;
> srinivas.kandaga...@linaro.org; k...@kernel.org; dmur...@ti.com;
> jack...@realtek.com; nuno...@analog.com; linux-kernel@vger.kernel.org;
> alsa-de...@alsa-project.org; ryan.lee.ma...@gmail.com; Ryan Lee
> ; steves.lee.ma...@gmail.com
> Subject: Re: [PATCH] ASoC: max98390: Fix potential crash during param fw
> loading
> 
> EXTERNAL EMAIL
> 
> 
> 
> On Wed, 03 Jun 2020 13:18:19 +0200,
> Steve Lee wrote:
> >
> > @@ -847,7 +861,6 @@ static int max98390_probe(struct snd_soc_component
> *component)
> >
> >   /* Dsm Setting */
> >   regmap_write(max98390->regmap, DSM_VOL_CTRL, 0x94);
> > - regmap_write(max98390->regmap, DSMIG_EN, 0x19);
> 
> Is this change intentional?
> It wasn't mentioned in the patch description.

 It should be another change. I will re-send the patch.

> 
> 
> thanks,
> 
> Takashi


[PATCH] ASoC: max98390: Fix potential crash during param fw loading

2020-06-03 Thread Steve Lee
 malformed firmware file can cause out-of-bound access and crash
 during dsm_param bin loading.
  - add MIN/MAX param size to avoid out-of-bound access.
  - read start addr and size of param and check bound.

Signed-off-by: Steve Lee 
---
 sound/soc/codecs/max98390.c | 23 ++-
 sound/soc/codecs/max98390.h |  3 ++-
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index be7cd0aeb6a6..8c7db568fe64 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -754,6 +754,7 @@ static struct snd_soc_dai_driver max98390_dai[] = {
 static int max98390_dsm_init(struct snd_soc_component *component)
 {
int ret;
+   int param_size, param_start_addr;
char filename[128];
const char *vendor, *product;
struct max98390_priv *max98390 =
@@ -780,14 +781,27 @@ static int max98390_dsm_init(struct snd_soc_component 
*component)
dev_dbg(component->dev,
"max98390: param fw size %zd\n",
fw->size);
+   if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
+   dev_err(component->dev,
+   "param fw is invalid.\n");
+   goto err_alloc;
+   }
dsm_param = (char *)fw->data;
+   param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
+   param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
+   if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
+   param_start_addr < DSM_STBASS_HPF_B0_BYTE0) {
+   dev_err(component->dev,
+   "param fw is invalid.\n");
+   goto err_alloc;
+   }
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_bulk_write(max98390->regmap, param_start_addr,
+   dsm_param, param_size);
regmap_write(max98390->regmap, MAX98390_R23E1_DSP_GLOBAL_EN, 0x01);
 
+err_alloc:
+   release_firmware(fw);
 err:
return ret;
 }
@@ -847,7 +861,6 @@ static int max98390_probe(struct snd_soc_component 
*component)
 
/* Dsm Setting */
regmap_write(max98390->regmap, DSM_VOL_CTRL, 0x94);
-   regmap_write(max98390->regmap, DSMIG_EN, 0x19);
regmap_write(max98390->regmap, MAX98390_R203A_AMP_EN, 0x80);
if (max98390->ref_rdc_value) {
regmap_write(max98390->regmap, DSM_TPROT_RECIP_RDC_ROOM_BYTE0,
diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index f59cb114d957..5f444e7779b0 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -650,7 +650,8 @@
 
 /* DSM register offset */
 #define MAX98390_DSM_PAYLOAD_OFFSET 16
-#define MAX98390_DSM_PAYLOAD_OFFSET_2 495
+#define MAX98390_DSM_PARAM_MAX_SIZE 770
+#define MAX98390_DSM_PARAM_MIN_SIZE 670
 
 struct max98390_priv {
struct regmap *regmap;
-- 
2.17.1



[V7 PATCH] dt-bindings: Added device tree binding for max98390

2020-06-02 Thread Steve Lee
Add DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---

Changed since V6:
* Re-confirm yaml dt binding check
* Add minimum and maximum value for each temperature_calib and r0_calib
* Add maxim prefix for naming.
Changed since V5:
* Change txt to yaml and fix up the examples.
Changed since V4:
* No changes.
Changed since V3:
* No changes.
Changed since V2:
* No changes.
Changed since V1:
* Modified sample text in example

 .../bindings/sound/maxim,max98390.yaml| 51 +++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/maxim,max98390.yaml

diff --git a/Documentation/devicetree/bindings/sound/maxim,max98390.yaml 
b/Documentation/devicetree/bindings/sound/maxim,max98390.yaml
new file mode 100644
index ..e5ac35280da3
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/maxim,max98390.yaml
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/maxim,max98390.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX98390 Speaker Amplifier with Integrated Dynamic 
Speaker Management
+
+maintainers:
+  - Steve Lee 
+
+properties:
+  compatible:
+  const: maxim,max98390
+
+  reg:
+maxItems: 1
+description: I2C address of the device.
+
+  maxim,temperature_calib:
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+description: The calculated temperature data was measured while doing the 
calibration.
+minimum: 0
+maximum: 65535
+
+  maxim,r0_calib:
+allOf:
+  - $ref: /schemas/types.yaml#/definitions/uint32
+description: This is r0 calibration data which was measured in factory 
mode.
+minimum: 1
+maximum: 8388607
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+i2c {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  max98390: amplifier@38 {
+compatible = "maxim,max98390";
+reg = <0x38>;
+maxim,temperature_calib = <1024>;
+maxim,r0_calib = <100232>;
+  };
+};
-- 
2.17.1



Re: [V6 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-31 Thread Steve Lee
On Fri, May 29, 2020 at 6:35 PM Mark Brown  wrote:
>
> On Fri, May 29, 2020 at 05:04:36PM +0900, Steve Lee wrote:
> > On Thu, May 28, 2020 at 8:54 PM Mark Brown  wrote:
>
> > > > Reported-by: kbuild test robot 
>
> > > Don't think the lkp bot asked for this driver! :P
>
> >   Thanks, I will send split patch for this.
>
> No, just don't add the line when it's a new driver.

 Now I understand, thanks for guide.


Re: [V6 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-29 Thread Steve Lee
On Thu, May 28, 2020 at 11:17 PM Rob Herring  wrote:
>
> On Thu, May 28, 2020 at 07:37:55PM +0900, Steve Lee wrote:
> > Add DT binding of max98390 amplifier driver.
> >
> > Signed-off-by: Steve Lee 
> > ---
> > Changed since V5:
> >   * Change txt to yaml and fix up the examples.
> > Changed since V4:
> >   * No changes.
> > Changed since V3:
> >   * No changes.
> > Changed since V2:
> >   * No changes.
> > Changed since V1:
> >   * Modified sample text in example
> >
> >  .../bindings/sound/maxim,max98390.yaml| 39 +++
> >  1 file changed, 39 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/sound/maxim,max98390.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/sound/maxim,max98390.yaml 
> > b/Documentation/devicetree/bindings/sound/maxim,max98390.yaml
> > new file mode 100644
> > index ..1ed4ab9e1c37
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/maxim,max98390.yaml
> > @@ -0,0 +1,39 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/sound/maxim,max98390.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Maxim Integrated MAX98390 Speaker Amplifier with Integrated Dynamic 
> > Speaker Management
> > +
> > +maintainers:
> > +  - Steve Lee 
> > +
> > +properties:
> > +  compatible:
> > +  const: maxim,max98390
> > +
> > +  reg:
> > +maxItems: 1
> > +description: I2C address of the device.
> > +
> > +  temperature_calib:
>
> s/_/-/

 This is follow as coreboot in Chromium OS case.
I'd follow this name unchanged.

>
> And missing 'maxim' prefix.

 Added missed prefix maxim prefix.

>
> > +$ref: /schemas/types.yaml#/definitions/uint32
> > +description: The calculated temperature data was measured while doing 
> > the calibration. Data : Temp / 100 * 2^12
>
> Any constraints? 0-2^32 are valid values?

 I added range of the values

>
> > +
> > +  r0_calib:
>
> Same here.

I added range of the values.

>
> > +$ref: /schemas/types.yaml#/definitions/uint32
> > +description: This is r0 calibration data which was measured in factory 
> > mode.
> > +
> > +required:
> > +  - compatible
> > +  - reg
>
> Add:
>
> additionalProperties: false

I have added this.

>
> > +
> > +examples:
> > +  - |
> > +max98390: amplifier@38 {
> > +compatible = "maxim,max98390";
> > +reg = <0x38>;
> > +maxim,temperature_calib = <1024>;
> > +maxim,r0_calib = <100232>;
> > +};
> > --
> > 2.17.1
> >


Re: [V6 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-29 Thread Steve Lee
On Thu, May 28, 2020 at 11:15 PM Rob Herring  wrote:
>
> On Thu, 28 May 2020 19:37:55 +0900, Steve Lee wrote:
> > Add DT binding of max98390 amplifier driver.
> >
> > Signed-off-by: Steve Lee 
> > ---
> > Changed since V5:
> >   * Change txt to yaml and fix up the examples.
> > Changed since V4:
> >   * No changes.
> > Changed since V3:
> >   * No changes.
> > Changed since V2:
> >   * No changes.
> > Changed since V1:
> >   * Modified sample text in example
> >
> >  .../bindings/sound/maxim,max98390.yaml| 39 +++
> >  1 file changed, 39 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/sound/maxim,max98390.yaml
> >
>
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> Documentation/devicetree/bindings/sound/maxim,max98390.yaml:  mapping values 
> are not allowed in this context
>   in "", line 22, column 97
> Documentation/devicetree/bindings/Makefile:12: recipe for target 
> 'Documentation/devicetree/bindings/sound/maxim,max98390.example.dts' failed
> make[1]: *** 
> [Documentation/devicetree/bindings/sound/maxim,max98390.example.dts] Error 1
> make[1]: *** Waiting for unfinished jobs
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/maxim,max98390.yaml:
>  ignoring, error parsing file
> warning: no schema found in file: 
> ./Documentation/devicetree/bindings/sound/maxim,max98390.yaml
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/maxim,max98390.yaml:
>  ignoring, error parsing file
> warning: no schema found in file: 
> ./Documentation/devicetree/bindings/sound/maxim,max98390.yaml
> Makefile:1300: recipe for target 'dt_binding_check' failed
> make: *** [dt_binding_check] Error 2
>
> See https://patchwork.ozlabs.org/patch/1299651
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure dt-schema is up to date:
>
> pip3 install git+https://github.com/devicetree-org/dt-schema.git@master 
> --upgrade
>
> Please check and re-submit.
>
 Thanks for feedback. I re-submit with after dt binding check again.


Re: [V6 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-29 Thread Steve Lee
On Thu, May 28, 2020 at 8:54 PM Mark Brown  wrote:
>
> On Thu, May 28, 2020 at 07:39:42PM +0900, Steve Lee wrote:
> > This is the initial amplifier driver for max98390.
>
> Please do not submit new versions of already applied patches, please
> submit incremental updates to the existing code.  Modifying existing
> commits creates problems for other users building on top of those
> commits so it's best practice to only change pubished git commits if
> absolutely essential.
>

  Thanks for feedback. I will send incremental patches.

> > Reported-by: kbuild test robot 
>
> Don't think the lkp bot asked for this driver! :P

  Thanks, I will send split patch for this.


[V6 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-28 Thread Steve Lee
This is the initial amplifier driver for max98390.

Reported-by: kbuild test robot 
Signed-off-by: Steve Lee 
---
Changes since V5:
* Fixed warning message reported by kbuild.
* Finalize default register value.
* Update missed AMP_EN register setting during dsm_init.
* Modified SPDEX header style.
Changes since V4:
* Revert return calibration status in max98390_dsm_calib_get:
There is no need to return calibration status in get function 
because there is mixer control lock protecting mixer control 
access.
And set function of DSM calib finishes calibration 
synchronously.
* Fix sprintf in max98390_dsm_init func:
Use snprintf to avoid any unreasonable value from DMI.
Changes since V3:
* Add operation at max98390_dsm_calib_get:
Add cal_running variable at max98390_priv structure
Add return cal_running at max98390_dsm_calib_get
Update cal_running value during calibration
* Update max98390_dsm_init func
Add dsm_param bin name can select upon vendor and product name.
Changes since V2:
* Removed warn massage in max98390_dsm_calib_get func 
  and add comment.
Changes since V1:
* Updated according to Mark's comments.
* Updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control

 sound/soc/codecs/Kconfig|5 +
 sound/soc/codecs/Makefile   |2 +
 sound/soc/codecs/max98390.c | 1041 +++
 sound/soc/codecs/max98390.h |  663 ++
 4 files changed, 1711 insertions(+)
 create mode 100644 sound/soc/codecs/max98390.c
 create mode 100644 sound/soc/codecs/max98390.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..93f88cd9970a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..dc02ee151b52
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1041 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// max98390.c  --  MAX98390 ALSA Soc Audio driver
+//
+// Copyright (C) 2020 Maxim Integrated Products
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+ 

[V6 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-28 Thread Steve Lee
Add DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---
Changed since V5:
* Change txt to yaml and fix up the examples.
Changed since V4:
* No changes.
Changed since V3:
* No changes.
Changed since V2:
* No changes.
Changed since V1:
* Modified sample text in example

 .../bindings/sound/maxim,max98390.yaml| 39 +++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/maxim,max98390.yaml

diff --git a/Documentation/devicetree/bindings/sound/maxim,max98390.yaml 
b/Documentation/devicetree/bindings/sound/maxim,max98390.yaml
new file mode 100644
index ..1ed4ab9e1c37
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/maxim,max98390.yaml
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/maxim,max98390.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX98390 Speaker Amplifier with Integrated Dynamic 
Speaker Management
+
+maintainers:
+  - Steve Lee 
+
+properties:
+  compatible:
+  const: maxim,max98390
+
+  reg:
+maxItems: 1
+description: I2C address of the device.
+
+  temperature_calib:
+$ref: /schemas/types.yaml#/definitions/uint32
+description: The calculated temperature data was measured while doing the 
calibration. Data : Temp / 100 * 2^12
+
+  r0_calib:
+$ref: /schemas/types.yaml#/definitions/uint32
+description: This is r0 calibration data which was measured in factory 
mode.
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+max98390: amplifier@38 {
+compatible = "maxim,max98390";
+reg = <0x38>;
+maxim,temperature_calib = <1024>;
+maxim,r0_calib = <100232>;
+};
-- 
2.17.1



Re: [RESEND][V5 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-28 Thread Steve Lee
On Wed, May 27, 2020 at 7:36 AM Rob Herring  wrote:
>
> On Mon, May 18, 2020 at 09:49:30AM +0900, Steve Lee wrote:
> > Add documentation for DT binding of max98390 amplifier driver.
> >
> > Signed-off-by: Steve Lee 
> > ---
> >
> >
> > Changed since V4:
> >   * No changes.
> > Changed since V3:
> >   * No changes.
> > Changed since V2:
> >   * No changes.
> > Changed since V1:
> >   * Modified sample text in example
>
> You are obviously sending patches too quickly. Give folks a chance to
> review.

 Thanks for your feedback !.

>
> >
> >  .../devicetree/bindings/sound/max98390.txt| 26 +++
>
> Bindings are now in DT schema format. Please convert this. See
> Documentation/devicetree/writing-schema.rst

 Thanks for review. I will change txt to yaml version.

>
> >  1 file changed, 26 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt
> >
> > diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
> > b/Documentation/devicetree/bindings/sound/max98390.txt
> > new file mode 100644
> > index ..0ddd4c6ae55e
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/max98390.txt
> > @@ -0,0 +1,26 @@
> > +Maxim Integrated MAX98390 Speaker Amplifier
> > +
> > +This device supports I2C.
> > +
> > +Required properties:
> > +
> > + - compatible : "maxim,max98390"
> > +
> > + - reg : the I2C address of the device.
> > +
> > +Optional properties:
> > +
> > +- maxim,temperature_calib
> > +  u32. The calculated temperature data was measured while doing the 
> > calibration. Data : Temp / 100 * 2^12
> > +
> > +- maxim,r0_calib
> > +  u32. This is r0 calibration data which was measured in factory mode.
>
> Unless these are shared already with other Maxim chips, s/_/-/.
>
> > +
> > +Example:
> > +
> > +codec: max98390@38 {
>
> amplifier@38

 I will change example as you advise.

>
> > + compatible = "maxim,max98390";
> > + reg = <0x38>;
> > + maxim,temperature_calib = <1024>;
> > + maxim,r0_calib = <100232>;
> > +};
> > --
> > 2.17.1
> >


[RESEND][V5 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-17 Thread Steve Lee
This is the initial amplifier driver for max98390.

Signed-off-by: Steve Lee 
---

Changes since V4:
* Revert return calibration status in max98390_dsm_calib_get:
There is no need to return calibration status in get function 
because there is mixer control lock protecting mixer control 
access.
And set function of DSM calib finishes calibration 
synchronously.
* Fix sprintf in max98390_dsm_init func:
Use snprintf to avoid any unreasonable value from DMI.
Changes since V3:
* Add operation at max98390_dsm_calib_get:
Add cal_running variable at max98390_priv structure
Add return cal_running at max98390_dsm_calib_get
Update cal_running value during calibration
* Update max98390_dsm_init func
Add dsm_param bin name can select upon vendor and product name.
Changes since V2:
* Removed warn massage in max98390_dsm_calib_get func 
  and add comment.
Changes since V1:
* Updated according to Mark's comments.
* Updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control

 sound/soc/codecs/Kconfig|5 +
 sound/soc/codecs/Makefile   |2 +
 sound/soc/codecs/max98390.c | 1040 +++
 sound/soc/codecs/max98390.h |  663 ++
 4 files changed, 1710 insertions(+)
 create mode 100644 sound/soc/codecs/max98390.c
 create mode 100644 sound/soc/codecs/max98390.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..93f88cd9970a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..b9ce44dda886
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1040 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * max98390.c  --  MAX98390 ALSA Soc Audio driver
+ *
+ * Copyright (C) 2020 Maxim Integrated Products
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+   {MAX98390_PCM_CH_SRC_2, 0x00},
+   {MAX98390_PCM_CH_SRC_3, 0x00},
+   {MAX98390_PCM_MODE_CFG, 0xc0},
+   {MAX98390_PCM_MASTER_MODE, 0x1c},
+   {MAX98390_PCM_CLK_SETUP, 0x44},
+   {MAX98390_PCM_SR_SETUP, 0x08},
+

[RESEND][V5 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-17 Thread Steve Lee
Add documentation for DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---


Changed since V4:
* No changes.
Changed since V3:
* No changes.
Changed since V2:
* No changes.
Changed since V1:
* Modified sample text in example

 .../devicetree/bindings/sound/max98390.txt| 26 +++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt

diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
b/Documentation/devicetree/bindings/sound/max98390.txt
new file mode 100644
index ..0ddd4c6ae55e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max98390.txt
@@ -0,0 +1,26 @@
+Maxim Integrated MAX98390 Speaker Amplifier
+
+This device supports I2C.
+
+Required properties:
+
+ - compatible : "maxim,max98390"
+
+ - reg : the I2C address of the device.
+
+Optional properties:
+
+- maxim,temperature_calib
+  u32. The calculated temperature data was measured while doing the 
calibration. Data : Temp / 100 * 2^12
+
+- maxim,r0_calib
+  u32. This is r0 calibration data which was measured in factory mode.
+
+Example:
+
+codec: max98390@38 {
+   compatible = "maxim,max98390";
+   reg = <0x38>;
+   maxim,temperature_calib = <1024>;
+   maxim,r0_calib = <100232>;
+};
-- 
2.17.1



Re: [V5 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-17 Thread Steve Lee
On Fri, May 15, 2020 at 9:29 PM Mark Brown  wrote:
>
> On Fri, May 15, 2020 at 10:42:24AM +0200, Krzysztof Kozlowski wrote:
>
> > Your "From" address still does not match the Signed-off-by. Set the
> > author of commit to the signed-off person.
>
> git commit --amend --author='foo '

 Thanks. I will resend patch with matching email with signed off by.


[V5 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-15 Thread Steve Lee
Add documentation for DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---


Changed since V4:
* No changes.
Changed since V3:
* No changes.
Changed since V2:
* No changes.
Changed since V1:
* Modified sample text in example

 .../devicetree/bindings/sound/max98390.txt| 26 +++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt

diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
b/Documentation/devicetree/bindings/sound/max98390.txt
new file mode 100644
index ..0ddd4c6ae55e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max98390.txt
@@ -0,0 +1,26 @@
+Maxim Integrated MAX98390 Speaker Amplifier
+
+This device supports I2C.
+
+Required properties:
+
+ - compatible : "maxim,max98390"
+
+ - reg : the I2C address of the device.
+
+Optional properties:
+
+- maxim,temperature_calib
+  u32. The calculated temperature data was measured while doing the 
calibration. Data : Temp / 100 * 2^12
+
+- maxim,r0_calib
+  u32. This is r0 calibration data which was measured in factory mode.
+
+Example:
+
+codec: max98390@38 {
+   compatible = "maxim,max98390";
+   reg = <0x38>;
+   maxim,temperature_calib = <1024>;
+   maxim,r0_calib = <100232>;
+};
-- 
2.17.1



[V5 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-15 Thread Steve Lee
This is the initial amplifier driver for max98390.

Signed-off-by: Steve Lee 
---

Changes since V4:
* Revert return calibration status in max98390_dsm_calib_get:
There is no need to return calibration status in get function 
because there is mixer control lock protecting mixer control 
access.
And set function of DSM calib finishes calibration 
synchronously.
* Fix sprintf in max98390_dsm_init func:
Use snprintf to avoid any unreasonable value from DMI.
Changes since V3:
* Add operation at max98390_dsm_calib_get:
Add cal_running variable at max98390_priv structure
Add return cal_running at max98390_dsm_calib_get
Update cal_running value during calibration
* Update max98390_dsm_init func
Add dsm_param bin name can select upon vendor and product name.
Changes since V2:
* Removed warn massage in max98390_dsm_calib_get func 
  and add comment.
Changes since V1:
* Updated according to Mark's comments.
* Updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control

 sound/soc/codecs/Kconfig|5 +
 sound/soc/codecs/Makefile   |2 +
 sound/soc/codecs/max98390.c | 1040 +++
 sound/soc/codecs/max98390.h |  663 ++
 4 files changed, 1710 insertions(+)
 create mode 100644 sound/soc/codecs/max98390.c
 create mode 100644 sound/soc/codecs/max98390.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..93f88cd9970a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..b9ce44dda886
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1040 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * max98390.c  --  MAX98390 ALSA Soc Audio driver
+ *
+ * Copyright (C) 2020 Maxim Integrated Products
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+   {MAX98390_PCM_CH_SRC_2, 0x00},
+   {MAX98390_PCM_CH_SRC_3, 0x00},
+   {MAX98390_PCM_MODE_CFG, 0xc0},
+   {MAX98390_PCM_MASTER_MODE, 0x1c},
+   {MAX98390_PCM_CLK_SETUP, 0x44},
+   {MAX98390_PCM_SR_SETUP, 0x08},
+

[V4 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-14 Thread Steve Lee
This is the initial amplifier driver for max98390.

Signed-off-by: Steve Lee 
---

Changes since V3:
* Add operation at max98390_dsm_calib_get:
Add cal_running variable at max98390_priv structure
Add return cal_running at max98390_dsm_calib_get
Update cal_running value during calibration
* Update max98390_dsm_init func
Add dsm_param bin name can select upon vendor and product name.
Changes since V2:
* Removed warn massage in max98390_dsm_calib_get func 
  and add comment.
Changes since V1:
* Updated according to Mark's comments.
* Updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control

 sound/soc/codecs/Kconfig|5 +
 sound/soc/codecs/Makefile   |2 +
 sound/soc/codecs/max98390.c | 1048 +++
 sound/soc/codecs/max98390.h |  664 ++
 4 files changed, 1719 insertions(+)
 create mode 100644 sound/soc/codecs/max98390.c
 create mode 100644 sound/soc/codecs/max98390.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..93f88cd9970a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..b47ddd295f56
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1048 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * max98390.c  --  MAX98390 ALSA Soc Audio driver
+ *
+ * Copyright (C) 2020 Maxim Integrated Products
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+   {MAX98390_PCM_CH_SRC_2, 0x00},
+   {MAX98390_PCM_CH_SRC_3, 0x00},
+   {MAX98390_PCM_MODE_CFG, 0xc0},
+   {MAX98390_PCM_MASTER_MODE, 0x1c},
+   {MAX98390_PCM_CLK_SETUP, 0x44},
+   {MAX98390_PCM_SR_SETUP, 0x08},
+   {MAX98390_ICC_RX_EN_A, 0x00},
+   {MAX98390_ICC_RX_EN_B, 0x00},
+   {MAX98390_ICC_TX_EN_A, 0x00},
+   {MAX98390_ICC_TX_EN_B, 0x00},
+   {MAX98390_ICC_HIZ_MANUAL_MODE, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_A, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_B, 0x00},
+   {MAX98390_ICC_LNK_EN, 0x00},
+   {MAX98390_R2039_AMP_DSP_CFG, 0x0f},
+   {MAX98390_R203A_AMP_EN, 0x81},
+   {MAX98390_TONE_GEN_DC_CFG, 0x00},
+   {MAX98390_SPK_SRC_SEL, 0x00},
+

[V4 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-14 Thread Steve Lee
Add documentation for DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---

Changed since V3:
* No changes.
Changed since V2:
* No changes.
Changed since V1:
* Modified sample text in example

 .../devicetree/bindings/sound/max98390.txt| 26 +++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt

diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
b/Documentation/devicetree/bindings/sound/max98390.txt
new file mode 100644
index ..0ddd4c6ae55e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max98390.txt
@@ -0,0 +1,26 @@
+Maxim Integrated MAX98390 Speaker Amplifier
+
+This device supports I2C.
+
+Required properties:
+
+ - compatible : "maxim,max98390"
+
+ - reg : the I2C address of the device.
+
+Optional properties:
+
+- maxim,temperature_calib
+  u32. The calculated temperature data was measured while doing the 
calibration. Data : Temp / 100 * 2^12
+
+- maxim,r0_calib
+  u32. This is r0 calibration data which was measured in factory mode.
+
+Example:
+
+codec: max98390@38 {
+   compatible = "maxim,max98390";
+   reg = <0x38>;
+   maxim,temperature_calib = <1024>;
+   maxim,r0_calib = <100232>;
+};
-- 
2.17.1



Re: [V3 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-14 Thread Steve Lee
On Thu, May 14, 2020 at 7:17 PM Mark Brown  wrote:
>
> On Wed, May 13, 2020 at 07:58:12PM +0800, Tzung-Bi Shih wrote:
> > On Wed, May 13, 2020 at 6:53 PM Mark Brown  wrote:
> > > On Wed, May 13, 2020 at 04:45:23PM +0900, Steve Lee wrote:
>
> > > > Changes since V2:
> > > >   * Removed warn massage in max98390_dsm_calib_get func
> > > > and add comment.
>
> > > The problem isn't the warning, the problem is that you have an empty
> > > operation.  You should either implement the function (eg, by caching the
> > > value written) or remove it and fix whatever problems you were running
> > > into further up the stack when it's missing.
>
> > The purpose for the mixer control is: to signal max98390 to start to
> > calibrate from userspace.
> > Thus,
> > max98390_dsm_calib_get() -> do nothing.
> > max98390_dsm_calib_put() -> call max98390_dsm_calibrate().
>
> In that case it should probably do something like read back if a
> callibration is currently running.

Thanks for feedback. I will follow this guide.


[V3 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-13 Thread Steve Lee
This is the initial amplifier driver for max98390.

Signed-off-by: Steve Lee 
---

Changes since V2:
* Removed warn massage in max98390_dsm_calib_get func 
  and add comment.
Changes since v1:
* Updated according to Mark's comments.
* Updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control

 sound/soc/codecs/Kconfig|5 +
 sound/soc/codecs/Makefile   |2 +
 sound/soc/codecs/max98390.c | 1030 +++
 sound/soc/codecs/max98390.h |  663 ++
 4 files changed, 1700 insertions(+)
 create mode 100644 sound/soc/codecs/max98390.c
 create mode 100644 sound/soc/codecs/max98390.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..93f88cd9970a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..3b7e2962fc90
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1030 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * max98390.c  --  MAX98390 ALSA Soc Audio driver
+ *
+ * Copyright (C) 2020 Maxim Integrated Products
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+   {MAX98390_PCM_CH_SRC_2, 0x00},
+   {MAX98390_PCM_CH_SRC_3, 0x00},
+   {MAX98390_PCM_MODE_CFG, 0xc0},
+   {MAX98390_PCM_MASTER_MODE, 0x1c},
+   {MAX98390_PCM_CLK_SETUP, 0x44},
+   {MAX98390_PCM_SR_SETUP, 0x08},
+   {MAX98390_ICC_RX_EN_A, 0x00},
+   {MAX98390_ICC_RX_EN_B, 0x00},
+   {MAX98390_ICC_TX_EN_A, 0x00},
+   {MAX98390_ICC_TX_EN_B, 0x00},
+   {MAX98390_ICC_HIZ_MANUAL_MODE, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_A, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_B, 0x00},
+   {MAX98390_ICC_LNK_EN, 0x00},
+   {MAX98390_R2039_AMP_DSP_CFG, 0x0f},
+   {MAX98390_R203A_AMP_EN, 0x81},
+   {MAX98390_TONE_GEN_DC_CFG, 0x00},
+   {MAX98390_SPK_SRC_SEL, 0x00},
+   {MAX98390_SSM_CFG, 0x85},
+   {MAX98390_MEAS_EN, 0x03},
+   {MAX98390_MEAS_DSP_CFG, 0x0f},
+   {MAX98390_BOOST_CTRL0, 0x1c},
+   {MAX98390_BOOST_CTRL3, 0x01},
+   {MAX98390_BOOST_CTRL1, 0x40},
+   {MAX98390_MEAS_ADC_CFG, 0x07},
+   {MAX98390_MEAS_ADC_BASE_MSB, 0x00},
+   {MAX98390_MEAS_ADC_BASE_LSB, 0x23},
+   {MAX98390_ADC_CH0_DIVIDE, 0x00},
+   

[V3 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-13 Thread Steve Lee
Add documentation for DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---

Changed since V2:
* No changes.
Changed since V1:
* Modified sample text in example

 .../devicetree/bindings/sound/max98390.txt| 26 +++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt

diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
b/Documentation/devicetree/bindings/sound/max98390.txt
new file mode 100644
index ..0ddd4c6ae55e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max98390.txt
@@ -0,0 +1,26 @@
+Maxim Integrated MAX98390 Speaker Amplifier
+
+This device supports I2C.
+
+Required properties:
+
+ - compatible : "maxim,max98390"
+
+ - reg : the I2C address of the device.
+
+Optional properties:
+
+- maxim,temperature_calib
+  u32. The calculated temperature data was measured while doing the 
calibration. Data : Temp / 100 * 2^12
+
+- maxim,r0_calib
+  u32. This is r0 calibration data which was measured in factory mode.
+
+Example:
+
+codec: max98390@38 {
+   compatible = "maxim,max98390";
+   reg = <0x38>;
+   maxim,temperature_calib = <1024>;
+   maxim,r0_calib = <100232>;
+};
-- 
2.17.1



Re: [PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-12 Thread Steve Lee
On Tue, May 12, 2020 at 7:33 PM Mark Brown  wrote:
>
> On Tue, May 12, 2020 at 06:13:05PM +0900, Steve Lee wrote:
> > On Mon, May 11, 2020 at 8:03 PM Mark Brown  wrote:
>
> > > > +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.
>
> > > > +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 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.
>
> > 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.


[V2 PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-12 Thread Steve Lee
This is the initial amplifier driver for max98390.

Signed-off-by: Steve Lee 
---

Changes since v1:
* updated according to Mark's comments.
* updated according to Tzung-Bi's comments.
* Removed Enum structure and use TLV data for Volume control

 sound/soc/codecs/Kconfig|5 +
 sound/soc/codecs/Makefile   |2 +
 sound/soc/codecs/max98390.c | 1033 +++
 sound/soc/codecs/max98390.h |  663 ++
 4 files changed, 1703 insertions(+)
 create mode 100644 sound/soc/codecs/max98390.c
 create mode 100644 sound/soc/codecs/max98390.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..93f88cd9970a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..c12da25885e4
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1033 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * max98390.c  --  MAX98390 ALSA Soc Audio driver
+ *
+ * Copyright (C) 2020 Maxim Integrated Products
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+   {MAX98390_PCM_CH_SRC_2, 0x00},
+   {MAX98390_PCM_CH_SRC_3, 0x00},
+   {MAX98390_PCM_MODE_CFG, 0xc0},
+   {MAX98390_PCM_MASTER_MODE, 0x1c},
+   {MAX98390_PCM_CLK_SETUP, 0x44},
+   {MAX98390_PCM_SR_SETUP, 0x08},
+   {MAX98390_ICC_RX_EN_A, 0x00},
+   {MAX98390_ICC_RX_EN_B, 0x00},
+   {MAX98390_ICC_TX_EN_A, 0x00},
+   {MAX98390_ICC_TX_EN_B, 0x00},
+   {MAX98390_ICC_HIZ_MANUAL_MODE, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_A, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_B, 0x00},
+   {MAX98390_ICC_LNK_EN, 0x00},
+   {MAX98390_R2039_AMP_DSP_CFG, 0x0f},
+   {MAX98390_R203A_AMP_EN, 0x81},
+   {MAX98390_TONE_GEN_DC_CFG, 0x00},
+   {MAX98390_SPK_SRC_SEL, 0x00},
+   {MAX98390_SSM_CFG, 0x85},
+   {MAX98390_MEAS_EN, 0x03},
+   {MAX98390_MEAS_DSP_CFG, 0x0f},
+   {MAX98390_BOOST_CTRL0, 0x1c},
+   {MAX98390_BOOST_CTRL3, 0x01},
+   {MAX98390_BOOST_CTRL1, 0x40},
+   {MAX98390_MEAS_ADC_CFG, 0x07},
+   {MAX98390_MEAS_ADC_BASE_MSB, 0x00},
+   {MAX98390_MEAS_ADC_BASE_LSB, 0x23},
+   {MAX98390_ADC_CH0_DIVIDE, 0x00},
+   {MAX98390_ADC_CH1_DIVIDE, 0x00},
+   {MAX98390_ADC_CH2_DIVIDE, 0x00},
+   {M

[V2 PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-12 Thread Steve Lee
Add documentation for DT binding of max98390 amplifier driver.

Signed-off-by: Steve Lee 
---
 .../devicetree/bindings/sound/max98390.txt| 26 +++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt

diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
b/Documentation/devicetree/bindings/sound/max98390.txt
new file mode 100644
index ..0ddd4c6ae55e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max98390.txt
@@ -0,0 +1,26 @@
+Maxim Integrated MAX98390 Speaker Amplifier
+
+This device supports I2C.
+
+Required properties:
+
+ - compatible : "maxim,max98390"
+
+ - reg : the I2C address of the device.
+
+Optional properties:
+
+- maxim,temperature_calib
+  u32. The calculated temperature data was measured while doing the 
calibration. Data : Temp / 100 * 2^12
+
+- maxim,r0_calib
+  u32. This is r0 calibration data which was measured in factory mode.
+
+Example:
+
+codec: max98390@38 {
+   compatible = "maxim,max98390";
+   reg = <0x38>;
+   maxim,temperature_calib = <1024>;
+   maxim,r0_calib = <100232>;
+};
-- 
2.17.1



Re: [PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-12 Thread Steve Lee
On Mon, May 11, 2020 at 8:16 PM Tzung-Bi Shih  wrote:
>
> (The patch passed 2 round review in https://crrev.com/c/2083354)
>
> On Sun, May 10, 2020 at 4:23 PM Steve Lee  wrote:
> > +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");
> > +   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.
Thank you for feedback.
I've add initial value for invert.
>
> > +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.
>
> > +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, );
> > +   regmap_read(max98390->regmap, THERMAL_RDC_RD_BACK_BYTE0, );
> > +   rdc0 |= rdc << 8;
> > +   ucontrol->value.integer.value[0] = rdc0;
> ucontrol->value.integer.value[0] = rdc0 | (rdc << 8);
Done as requested.
>
> > +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.
Done as requested.
>
> > +
> > +   filename = "dsm_param.bin";
> Either:
> - initialize when declaring the variable
> - remove the variable and inline into request_firmware() call
I've added initialized at declare.
>
> > +   ret = request_firmware(, 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);
>

Re: [PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-12 Thread Steve Lee
On Mon, May 11, 2020 at 8:03 PM Mark Brown  wrote:
>
> On Sat, May 09, 2020 at 12:19:19PM +0900, Steve Lee wrote:
> > Signed-off-by: Steve Lee 
>
> This looks mostly good, a few smallish things below though:
>
> > +++ b/sound/soc/codecs/max98390.c
> > @@ -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.
>
> > + dev_info(component->dev, "Tdm mode : %d\n",
> > + max98390->tdm_mode);
>
> This is a bit noisy, please make it at most a dev_dbg().
>
> > +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.
> > +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.
>
> > +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.
>
> > +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 ?
>
> > + dev_info(component->dev,
> > + "max98390: param fw size %d\n",
> > + fw->size);
>
> This should probably be a dev_dbg() too.
Modified as requested.
>
> > + /* 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.
I removed hard-coded Volume setting.
>
> > +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.
>
> > +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.
>
> > + dev_info(>dev, "ASoC: MAX98390 i2c probe\n");
>
> Just drop this.
Removed.
>
> > + ret = device_property_read_u32(>dev, "maxim,temperature_calib",
> > +>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.


[PATCH 2/2] ASoC: max98390: Added Amplifier Driver

2020-05-08 Thread Steve Lee
Signed-off-by: Steve Lee 
---
 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

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index e60e0b6a689c..bb0c73422163 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -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
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 03533157cda6..e7c17f701529 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -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
diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
new file mode 100644
index ..625219b7517c
--- /dev/null
+++ b/sound/soc/codecs/max98390.c
@@ -0,0 +1,1039 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2020, Maxim Integrated.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "max98390.h"
+
+static struct reg_default max98390_reg_defaults[] = {
+   {MAX98390_INT_EN1, 0xf0},
+   {MAX98390_INT_EN2, 0x00},
+   {MAX98390_INT_EN3, 0x00},
+   {MAX98390_INT_FLAG_CLR1, 0x00},
+   {MAX98390_INT_FLAG_CLR2, 0x00},
+   {MAX98390_INT_FLAG_CLR3, 0x00},
+   {MAX98390_IRQ_CTRL, 0x01},
+   {MAX98390_CLK_MON, 0x6d},
+   {MAX98390_DAT_MON, 0x03},
+   {MAX98390_WDOG_CTRL, 0x00},
+   {MAX98390_WDOG_RST, 0x00},
+   {MAX98390_MEAS_ADC_THERM_WARN_THRESH, 0x75},
+   {MAX98390_MEAS_ADC_THERM_SHDN_THRESH, 0x8c},
+   {MAX98390_MEAS_ADC_THERM_HYSTERESIS, 0x08},
+   {MAX98390_PIN_CFG, 0x55},
+   {MAX98390_PCM_RX_EN_A, 0x00},
+   {MAX98390_PCM_RX_EN_B, 0x00},
+   {MAX98390_PCM_TX_EN_A, 0x00},
+   {MAX98390_PCM_TX_EN_B, 0x00},
+   {MAX98390_PCM_TX_HIZ_CTRL_A, 0xff},
+   {MAX98390_PCM_TX_HIZ_CTRL_B, 0xff},
+   {MAX98390_PCM_CH_SRC_1, 0x00},
+   {MAX98390_PCM_CH_SRC_2, 0x00},
+   {MAX98390_PCM_CH_SRC_3, 0x00},
+   {MAX98390_PCM_MODE_CFG, 0xc0},
+   {MAX98390_PCM_MASTER_MODE, 0x1c},
+   {MAX98390_PCM_CLK_SETUP, 0x44},
+   {MAX98390_PCM_SR_SETUP, 0x08},
+   {MAX98390_ICC_RX_EN_A, 0x00},
+   {MAX98390_ICC_RX_EN_B, 0x00},
+   {MAX98390_ICC_TX_EN_A, 0x00},
+   {MAX98390_ICC_TX_EN_B, 0x00},
+   {MAX98390_ICC_HIZ_MANUAL_MODE, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_A, 0x00},
+   {MAX98390_ICC_TX_HIZ_EN_B, 0x00},
+   {MAX98390_ICC_LNK_EN, 0x00},
+   {MAX98390_R2039_AMP_DSP_CFG, 0x0f},
+   {MAX98390_R203A_AMP_EN, 0x81},
+   {MAX98390_TONE_GEN_DC_CFG, 0x00},
+   {MAX98390_SPK_SRC_SEL, 0x00},
+   {MAX98390_SSM_CFG, 0x85},
+   {MAX98390_MEAS_EN, 0x03},
+   {MAX98390_MEAS_DSP_CFG, 0x0f},
+   {MAX98390_BOOST_CTRL0, 0x1c},
+   {MAX98390_BOOST_CTRL3, 0x01},
+   {MAX98390_BOOST_CTRL1, 0x40},
+   {MAX98390_MEAS_ADC_CFG, 0x07},
+   {MAX98390_MEAS_ADC_BASE_MSB, 0x00},
+   {MAX98390_MEAS_ADC_BASE_LSB, 0x23},
+   {MAX98390_ADC_CH0_DIVIDE, 0x00},
+   {MAX98390_ADC_CH1_DIVIDE, 0x00},
+   {MAX98390_ADC_CH2_DIVIDE, 0x00},
+   {MAX98390_ADC_CH0_FILT_CFG, 0x00},
+   {MAX98390_ADC_CH1_FILT_CFG, 0x00},
+   {MAX98390_ADC_CH2_FILT_CFG, 0x00},
+   {MAX98390_PWR_GATE_CTL, 0x2c},
+   {MAX98390_BROWNOUT_EN, 0x00},
+   {MAX98390_BROWNOUT_INFINITE_HOLD, 0x00},
+   {MAX98390_BROWNOUT_INFINITE_HOLD_CLR, 0x00},
+   {MA

[PATCH 1/2] dt-bindings: Added device tree binding for max98390

2020-05-08 Thread Steve Lee
Signed-off-by: Steve Lee 
---
 .../devicetree/bindings/sound/max98390.txt| 26 +++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/max98390.txt

diff --git a/Documentation/devicetree/bindings/sound/max98390.txt 
b/Documentation/devicetree/bindings/sound/max98390.txt
new file mode 100644
index ..147dfd88cd3b
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/max98390.txt
@@ -0,0 +1,26 @@
+Maxim Integrated MAX98390 Speaker Amplifier
+
+This device supports I2C.
+
+Required properties:
+
+ - compatible : "maxim,max98390"
+
+ - reg : the I2C address of the device.
+
+Optional properties:
+
+ - maxim,temperature_calib
+   u32. The calculated temperature data was measured while doing the 
calibration. Data calibration : Temp / 100 * 2^12
+
+ - maxim,r0_calib
+   u32. This is r0 calibration data which was measured in factory mode.
+
+Example:
+
+codec: max98390@38 {
+   compatible = "maxim,max98390";
+   reg = <0x38>;
+   maxim,temperature_calib = <1024>;
+   maxim,r0_calib = <0x224050>;
+};
-- 
2.17.1



Re: 3com 3c59x stopped working with 2.6.13-rc[56]

2005-08-22 Thread Steve Lee
> i tried to boot 2.6.13-rc5-git4 and 2.6.13-rc6-git13 both with the same
> result: my 3com (3c59x driver on 3com 905c) card not working.
> Here is what I saw in the logs.
> Notice the regularity of the log barfs. They continue the same every
10secs.

I'm currently using 2.6.13-rc6-git13 with the 3c95x driver compiled as a
module,
without any issues.  I've tested all of the 2.6.13-* kernels.  One
noticeable
difference, I've been using gcc-3.4.4 and not gcc-4.0.1.

Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: 3com 3c59x stopped working with 2.6.13-rc[56]

2005-08-22 Thread Steve Lee
 i tried to boot 2.6.13-rc5-git4 and 2.6.13-rc6-git13 both with the same
 result: my 3com (3c59x driver on 3com 905c) card not working.
 Here is what I saw in the logs.
 Notice the regularity of the log barfs. They continue the same every
10secs.

I'm currently using 2.6.13-rc6-git13 with the 3c95x driver compiled as a
module,
without any issues.  I've tested all of the 2.6.13-* kernels.  One
noticeable
difference, I've been using gcc-3.4.4 and not gcc-4.0.1.

Steve


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] Linux Kernel Subversion Howto

2005-02-10 Thread Steve Lee
Roman, besides BK being closed source, how exactly is it lacking for
your needs?  If what it lacks is a good idea and helps many, Larry and
crew might be willing to add whatever it is you need.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] Linux Kernel Subversion Howto

2005-02-10 Thread Steve Lee
Roman, besides BK being closed source, how exactly is it lacking for
your needs?  If what it lacks is a good idea and helps many, Larry and
crew might be willing to add whatever it is you need.


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/