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

2020-05-17 Thread kbuild test robot
Hi Steve,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on asoc/for-next]
[also build test WARNING on v5.7-rc6 next-20200515]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Steve-Lee/dt-bindings-Added-device-tree-binding-for-max98390/20200518-085308
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 
for-next
config: i386-randconfig-a004-20200518 (attached as .config)
compiler: gcc-4.9 (Ubuntu 4.9.3-13ubuntu2) 4.9.3
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot 

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/dynamic_debug.h:6:0,
from include/linux/printk.h:326,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from sound/soc/codecs/max98390.c:9:
sound/soc/codecs/max98390.c: In function 'max98390_dsm_init':
>> include/linux/jump_label.h:471:59: warning: format '%ld' expects argument of 
>> type 'long int', but argument 4 has type 'size_t' [-Wformat=]
else if (__builtin_types_compatible_p(typeof(*x), struct static_key_false)) 
  ^
include/linux/dynamic_debug.h:105:2: note: in expansion of macro 
'static_branch_unlikely'
static_branch_unlikely(_key_false)
^
include/linux/dynamic_debug.h:124:6: note: in expansion of macro 
'DYNAMIC_DEBUG_BRANCH'
if (DYNAMIC_DEBUG_BRANCH(id))^
include/linux/dynamic_debug.h:143:2: note: in expansion of macro 
'__dynamic_func_call'
__dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
^
include/linux/dynamic_debug.h:157:2: note: in expansion of macro 
'_dynamic_func_call'
_dynamic_func_call(fmt,__dynamic_dev_dbg,^
include/linux/dev_printk.h:114:2: note: in expansion of macro 'dynamic_dev_dbg'
dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
^
sound/soc/codecs/max98390.c:780:2: note: in expansion of macro 'dev_dbg'
dev_dbg(component->dev,
^

vim +471 include/linux/jump_label.h

11276d5306b8e5 Peter Zijlstra 2015-07-24  465  
11276d5306b8e5 Peter Zijlstra 2015-07-24  466  #define 
static_branch_unlikely(x)\
11276d5306b8e5 Peter Zijlstra 2015-07-24  467  ({   
\
11276d5306b8e5 Peter Zijlstra 2015-07-24  468   bool branch;
\
11276d5306b8e5 Peter Zijlstra 2015-07-24  469   if 
(__builtin_types_compatible_p(typeof(*x), struct static_key_true))   \
11276d5306b8e5 Peter Zijlstra 2015-07-24  470   branch = 
arch_static_branch_jump(&(x)->key, false); \
11276d5306b8e5 Peter Zijlstra 2015-07-24 @471   else if 
(__builtin_types_compatible_p(typeof(*x), struct static_key_false)) \
11276d5306b8e5 Peter Zijlstra 2015-07-24  472   branch = 
arch_static_branch(&(x)->key, false);  \
11276d5306b8e5 Peter Zijlstra 2015-07-24  473   else
\
11276d5306b8e5 Peter Zijlstra 2015-07-24  474   branch = 
wrong_branch_error();  \
81dcf89f03204d Peter Zijlstra 2018-01-18  475   unlikely(branch);   
\
11276d5306b8e5 Peter Zijlstra 2015-07-24  476  })
11276d5306b8e5 Peter Zijlstra 2015-07-24  477  

:: The code at line 471 was first introduced by commit
:: 11276d5306b8e5b438a36bbff855fe792d7eaa61 locking/static_keys: Add a new 
static_key interface

:: TO: Peter Zijlstra 
:: CC: Ingo Molnar 

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[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},
+   {MAX98390_ICC_RX_EN_A, 0x00},
+