All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-11 14:52 ` Vitaly Rodionov
  0 siblings, 0 replies; 14+ messages in thread
From: Vitaly Rodionov @ 2021-05-11 14:52 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, patches, linux-kernel

HSBIAS_SENSE_EN configures HSBIAS output current sense through
the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
the potential pop noise during the headset plug out slowly. But on some
platforms ESD voltage will affect it causing test to fail, especially
with CTIA headset type. For different hardware setups, a designer might
want to tweak default behavior.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
---
 Documentation/devicetree/bindings/sound/cs42l42.txt | 7 +++++++
 sound/soc/codecs/cs42l42.c                          | 7 ++++++-
 sound/soc/codecs/cs42l42.h                          | 1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/cs42l42.txt b/Documentation/devicetree/bindings/sound/cs42l42.txt
index 7dfaa2ab906f..5d416fdaf023 100644
--- a/Documentation/devicetree/bindings/sound/cs42l42.txt
+++ b/Documentation/devicetree/bindings/sound/cs42l42.txt
@@ -81,6 +81,13 @@ Optional properties:
   < x1 x2 x3 x4 >
   Default = < 15 8 4 1>
 
+  - cirrus,hs-bias-sense-disable: This is boolean property. If present the
+  HSBIAS sense is disabled. Configures HSBIAS output current sense through
+  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
+  the potential pop noise during the headset plug out slowly. But on some
+  platforms ESD voltage will affect it causing test to fail, especially
+  with CTIA headset type. For different hardware setups, a designer might
+  want to tweak default behavior.
 
 Example:
 
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index d7fb6b38fd7c..5087c5b781f8 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -1033,7 +1033,7 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
 			CS42L42_AUTO_HSBIAS_HIZ_MASK |
 			CS42L42_TIP_SENSE_EN_MASK |
 			CS42L42_HSBIAS_SENSE_TRIP_MASK,
-			(1 << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
+			(cs42l42->hs_bias_sense_en << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
 			(1 << CS42L42_AUTO_HSBIAS_HIZ_SHIFT) |
 			(0 << CS42L42_TIP_SENSE_EN_SHIFT) |
 			(3 << CS42L42_HSBIAS_SENSE_TRIP_SHIFT));
@@ -1808,6 +1808,11 @@ static int cs42l42_handle_device_data(struct device *dev,
 			(cs42l42->hs_bias_ramp_rate <<
 			CS42L42_HSBIAS_RAMP_SHIFT));
 
+	if (device_property_read_bool(dev, "cirrus,hs-bias-sense-disable"))
+		cs42l42->hs_bias_sense_en = 0;
+	else
+		cs42l42->hs_bias_sense_en = 1;
+
 	return 0;
 }
 
diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h
index 2e0d3836bd7e..24f7be228d5f 100644
--- a/sound/soc/codecs/cs42l42.h
+++ b/sound/soc/codecs/cs42l42.h
@@ -787,6 +787,7 @@ struct  cs42l42_private {
 	u8 bias_thresholds[CS42L42_NUM_BIASES];
 	u8 hs_bias_ramp_rate;
 	u8 hs_bias_ramp_time;
+	u8 hs_bias_sense_en;
 	u8 stream_use;
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-11 14:52 ` Vitaly Rodionov
  0 siblings, 0 replies; 14+ messages in thread
From: Vitaly Rodionov @ 2021-05-11 14:52 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: patches, alsa-devel, linux-kernel

HSBIAS_SENSE_EN configures HSBIAS output current sense through
the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
the potential pop noise during the headset plug out slowly. But on some
platforms ESD voltage will affect it causing test to fail, especially
with CTIA headset type. For different hardware setups, a designer might
want to tweak default behavior.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
---
 Documentation/devicetree/bindings/sound/cs42l42.txt | 7 +++++++
 sound/soc/codecs/cs42l42.c                          | 7 ++++++-
 sound/soc/codecs/cs42l42.h                          | 1 +
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/cs42l42.txt b/Documentation/devicetree/bindings/sound/cs42l42.txt
index 7dfaa2ab906f..5d416fdaf023 100644
--- a/Documentation/devicetree/bindings/sound/cs42l42.txt
+++ b/Documentation/devicetree/bindings/sound/cs42l42.txt
@@ -81,6 +81,13 @@ Optional properties:
   < x1 x2 x3 x4 >
   Default = < 15 8 4 1>
 
+  - cirrus,hs-bias-sense-disable: This is boolean property. If present the
+  HSBIAS sense is disabled. Configures HSBIAS output current sense through
+  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
+  the potential pop noise during the headset plug out slowly. But on some
+  platforms ESD voltage will affect it causing test to fail, especially
+  with CTIA headset type. For different hardware setups, a designer might
+  want to tweak default behavior.
 
 Example:
 
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index d7fb6b38fd7c..5087c5b781f8 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -1033,7 +1033,7 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
 			CS42L42_AUTO_HSBIAS_HIZ_MASK |
 			CS42L42_TIP_SENSE_EN_MASK |
 			CS42L42_HSBIAS_SENSE_TRIP_MASK,
-			(1 << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
+			(cs42l42->hs_bias_sense_en << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
 			(1 << CS42L42_AUTO_HSBIAS_HIZ_SHIFT) |
 			(0 << CS42L42_TIP_SENSE_EN_SHIFT) |
 			(3 << CS42L42_HSBIAS_SENSE_TRIP_SHIFT));
@@ -1808,6 +1808,11 @@ static int cs42l42_handle_device_data(struct device *dev,
 			(cs42l42->hs_bias_ramp_rate <<
 			CS42L42_HSBIAS_RAMP_SHIFT));
 
+	if (device_property_read_bool(dev, "cirrus,hs-bias-sense-disable"))
+		cs42l42->hs_bias_sense_en = 0;
+	else
+		cs42l42->hs_bias_sense_en = 1;
+
 	return 0;
 }
 
diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h
index 2e0d3836bd7e..24f7be228d5f 100644
--- a/sound/soc/codecs/cs42l42.h
+++ b/sound/soc/codecs/cs42l42.h
@@ -787,6 +787,7 @@ struct  cs42l42_private {
 	u8 bias_thresholds[CS42L42_NUM_BIASES];
 	u8 hs_bias_ramp_rate;
 	u8 hs_bias_ramp_time;
+	u8 hs_bias_sense_en;
 	u8 stream_use;
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
  2021-05-11 14:52 ` Vitaly Rodionov
@ 2021-05-12 17:04   ` Mark Brown
  -1 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2021-05-12 17:04 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Liam Girdwood, Takashi Iwai,
	Vitaly Rodionov, Jaroslav Kysela
  Cc: Mark Brown, linux-kernel, patches, alsa-devel

On Tue, 11 May 2021 15:52:20 +0100, Vitaly Rodionov wrote:
> HSBIAS_SENSE_EN configures HSBIAS output current sense through
> the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
> the potential pop noise during the headset plug out slowly. But on some
> platforms ESD voltage will affect it causing test to fail, especially
> with CTIA headset type. For different hardware setups, a designer might
> want to tweak default behavior.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
      commit: c9f2e3c3ddab87d93cde99f6da10dd00c1d1edb9

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-12 17:04   ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2021-05-12 17:04 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Liam Girdwood, Takashi Iwai,
	Vitaly Rodionov, Jaroslav Kysela
  Cc: patches, alsa-devel, Mark Brown, linux-kernel

On Tue, 11 May 2021 15:52:20 +0100, Vitaly Rodionov wrote:
> HSBIAS_SENSE_EN configures HSBIAS output current sense through
> the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
> the potential pop noise during the headset plug out slowly. But on some
> platforms ESD voltage will affect it causing test to fail, especially
> with CTIA headset type. For different hardware setups, a designer might
> want to tweak default behavior.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
      commit: c9f2e3c3ddab87d93cde99f6da10dd00c1d1edb9

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
  2021-05-07 14:17 ` Lucas Tanure
  (?)
@ 2021-05-07 18:17   ` kernel test robot
  -1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-05-07 18:17 UTC (permalink / raw)
  To: Lucas Tanure, James Schulman, David Rhodes, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: kbuild-all, clang-built-linux, alsa-devel, patches, linux-kernel,
	Vitaly Rodionov

[-- Attachment #1: Type: text/plain, Size: 8870 bytes --]

Hi Lucas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20210507]
[cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-a013-20210507 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a3a8a1a15b524d91b5308db68e9d293b34cd88dd)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/17dc415a57a00d44b8be8db4791a2843daee7db1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
        git checkout 17dc415a57a00d44b8be8db4791a2843daee7db1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> sound/soc/codecs/cs42l42.c:1812:33: error: use of undeclared identifier 'dev'
           ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
                                          ^
   sound/soc/codecs/cs42l42.c:1820:12: error: use of undeclared identifier 'dev'
                           dev_err(dev,
                                   ^
   2 errors generated.


vim +/dev +1812 sound/soc/codecs/cs42l42.c

  1632	
  1633	static int cs42l42_handle_device_data(struct i2c_client *i2c_client,
  1634						struct cs42l42_private *cs42l42)
  1635	{
  1636		struct device_node *np = i2c_client->dev.of_node;
  1637		unsigned int val;
  1638		unsigned int thresholds[CS42L42_NUM_BIASES];
  1639		int ret;
  1640		int i;
  1641	
  1642		ret = of_property_read_u32(np, "cirrus,ts-inv", &val);
  1643	
  1644		if (!ret) {
  1645			switch (val) {
  1646			case CS42L42_TS_INV_EN:
  1647			case CS42L42_TS_INV_DIS:
  1648				cs42l42->ts_inv = val;
  1649				break;
  1650			default:
  1651				dev_err(&i2c_client->dev,
  1652					"Wrong cirrus,ts-inv DT value %d\n",
  1653					val);
  1654				cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1655			}
  1656		} else {
  1657			cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1658		}
  1659	
  1660		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1661				CS42L42_TS_INV_MASK,
  1662				(cs42l42->ts_inv << CS42L42_TS_INV_SHIFT));
  1663	
  1664		ret = of_property_read_u32(np, "cirrus,ts-dbnc-rise", &val);
  1665	
  1666		if (!ret) {
  1667			switch (val) {
  1668			case CS42L42_TS_DBNCE_0:
  1669			case CS42L42_TS_DBNCE_125:
  1670			case CS42L42_TS_DBNCE_250:
  1671			case CS42L42_TS_DBNCE_500:
  1672			case CS42L42_TS_DBNCE_750:
  1673			case CS42L42_TS_DBNCE_1000:
  1674			case CS42L42_TS_DBNCE_1250:
  1675			case CS42L42_TS_DBNCE_1500:
  1676				cs42l42->ts_dbnc_rise = val;
  1677				break;
  1678			default:
  1679				dev_err(&i2c_client->dev,
  1680					"Wrong cirrus,ts-dbnc-rise DT value %d\n",
  1681					val);
  1682				cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1683			}
  1684		} else {
  1685			cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1686		}
  1687	
  1688		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1689				CS42L42_TS_RISE_DBNCE_TIME_MASK,
  1690				(cs42l42->ts_dbnc_rise <<
  1691				CS42L42_TS_RISE_DBNCE_TIME_SHIFT));
  1692	
  1693		ret = of_property_read_u32(np, "cirrus,ts-dbnc-fall", &val);
  1694	
  1695		if (!ret) {
  1696			switch (val) {
  1697			case CS42L42_TS_DBNCE_0:
  1698			case CS42L42_TS_DBNCE_125:
  1699			case CS42L42_TS_DBNCE_250:
  1700			case CS42L42_TS_DBNCE_500:
  1701			case CS42L42_TS_DBNCE_750:
  1702			case CS42L42_TS_DBNCE_1000:
  1703			case CS42L42_TS_DBNCE_1250:
  1704			case CS42L42_TS_DBNCE_1500:
  1705				cs42l42->ts_dbnc_fall = val;
  1706				break;
  1707			default:
  1708				dev_err(&i2c_client->dev,
  1709					"Wrong cirrus,ts-dbnc-fall DT value %d\n",
  1710					val);
  1711				cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1712			}
  1713		} else {
  1714			cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1715		}
  1716	
  1717		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1718				CS42L42_TS_FALL_DBNCE_TIME_MASK,
  1719				(cs42l42->ts_dbnc_fall <<
  1720				CS42L42_TS_FALL_DBNCE_TIME_SHIFT));
  1721	
  1722		ret = of_property_read_u32(np, "cirrus,btn-det-init-dbnce", &val);
  1723	
  1724		if (!ret) {
  1725			if (val <= CS42L42_BTN_DET_INIT_DBNCE_MAX)
  1726				cs42l42->btn_det_init_dbnce = val;
  1727			else {
  1728				dev_err(&i2c_client->dev,
  1729					"Wrong cirrus,btn-det-init-dbnce DT value %d\n",
  1730					val);
  1731				cs42l42->btn_det_init_dbnce =
  1732					CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1733			}
  1734		} else {
  1735			cs42l42->btn_det_init_dbnce =
  1736				CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1737		}
  1738	
  1739		ret = of_property_read_u32(np, "cirrus,btn-det-event-dbnce", &val);
  1740	
  1741		if (!ret) {
  1742			if (val <= CS42L42_BTN_DET_EVENT_DBNCE_MAX)
  1743				cs42l42->btn_det_event_dbnce = val;
  1744			else {
  1745				dev_err(&i2c_client->dev,
  1746				"Wrong cirrus,btn-det-event-dbnce DT value %d\n", val);
  1747				cs42l42->btn_det_event_dbnce =
  1748					CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1749			}
  1750		} else {
  1751			cs42l42->btn_det_event_dbnce =
  1752				CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1753		}
  1754	
  1755		ret = of_property_read_u32_array(np, "cirrus,bias-lvls",
  1756					   (u32 *)thresholds, CS42L42_NUM_BIASES);
  1757	
  1758		if (!ret) {
  1759			for (i = 0; i < CS42L42_NUM_BIASES; i++) {
  1760				if (thresholds[i] <= CS42L42_HS_DET_LEVEL_MAX)
  1761					cs42l42->bias_thresholds[i] = thresholds[i];
  1762				else {
  1763					dev_err(&i2c_client->dev,
  1764					"Wrong cirrus,bias-lvls[%d] DT value %d\n", i,
  1765						thresholds[i]);
  1766					cs42l42->bias_thresholds[i] =
  1767						threshold_defaults[i];
  1768				}
  1769			}
  1770		} else {
  1771			for (i = 0; i < CS42L42_NUM_BIASES; i++)
  1772				cs42l42->bias_thresholds[i] = threshold_defaults[i];
  1773		}
  1774	
  1775		ret = of_property_read_u32(np, "cirrus,hs-bias-ramp-rate", &val);
  1776	
  1777		if (!ret) {
  1778			switch (val) {
  1779			case CS42L42_HSBIAS_RAMP_FAST_RISE_SLOW_FALL:
  1780				cs42l42->hs_bias_ramp_rate = val;
  1781				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME0;
  1782				break;
  1783			case CS42L42_HSBIAS_RAMP_FAST:
  1784				cs42l42->hs_bias_ramp_rate = val;
  1785				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME1;
  1786				break;
  1787			case CS42L42_HSBIAS_RAMP_SLOW:
  1788				cs42l42->hs_bias_ramp_rate = val;
  1789				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1790				break;
  1791			case CS42L42_HSBIAS_RAMP_SLOWEST:
  1792				cs42l42->hs_bias_ramp_rate = val;
  1793				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME3;
  1794				break;
  1795			default:
  1796				dev_err(&i2c_client->dev,
  1797					"Wrong cirrus,hs-bias-ramp-rate DT value %d\n",
  1798					val);
  1799				cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1800				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1801			}
  1802		} else {
  1803			cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1804			cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1805		}
  1806	
  1807		regmap_update_bits(cs42l42->regmap, CS42L42_HS_BIAS_CTL,
  1808				CS42L42_HSBIAS_RAMP_MASK,
  1809				(cs42l42->hs_bias_ramp_rate <<
  1810				CS42L42_HSBIAS_RAMP_SHIFT));
  1811	
> 1812		ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
  1813		if (!ret) {
  1814			switch (val) {
  1815			case CS42L42_HSBIAS_SENSE_OFF:
  1816			case CS42L42_HSBIAS_SENSE_ON:
  1817				cs42l42->hs_bias_sense_en = val;
  1818				break;
  1819			default:
  1820				dev_err(dev,
  1821					"Wrong cirrus,hs-bias-sense-en DT value %d\n",
  1822					val);
  1823				cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1824				break;
  1825			}
  1826		} else {
  1827			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1828		}
  1829	
  1830		return 0;
  1831	}
  1832	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37207 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 18:17   ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-05-07 18:17 UTC (permalink / raw)
  To: Lucas Tanure, James Schulman, David Rhodes, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, kbuild-all, Vitaly Rodionov, patches, linux-kernel,
	clang-built-linux

[-- Attachment #1: Type: text/plain, Size: 8870 bytes --]

Hi Lucas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20210507]
[cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-a013-20210507 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a3a8a1a15b524d91b5308db68e9d293b34cd88dd)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/17dc415a57a00d44b8be8db4791a2843daee7db1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
        git checkout 17dc415a57a00d44b8be8db4791a2843daee7db1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> sound/soc/codecs/cs42l42.c:1812:33: error: use of undeclared identifier 'dev'
           ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
                                          ^
   sound/soc/codecs/cs42l42.c:1820:12: error: use of undeclared identifier 'dev'
                           dev_err(dev,
                                   ^
   2 errors generated.


vim +/dev +1812 sound/soc/codecs/cs42l42.c

  1632	
  1633	static int cs42l42_handle_device_data(struct i2c_client *i2c_client,
  1634						struct cs42l42_private *cs42l42)
  1635	{
  1636		struct device_node *np = i2c_client->dev.of_node;
  1637		unsigned int val;
  1638		unsigned int thresholds[CS42L42_NUM_BIASES];
  1639		int ret;
  1640		int i;
  1641	
  1642		ret = of_property_read_u32(np, "cirrus,ts-inv", &val);
  1643	
  1644		if (!ret) {
  1645			switch (val) {
  1646			case CS42L42_TS_INV_EN:
  1647			case CS42L42_TS_INV_DIS:
  1648				cs42l42->ts_inv = val;
  1649				break;
  1650			default:
  1651				dev_err(&i2c_client->dev,
  1652					"Wrong cirrus,ts-inv DT value %d\n",
  1653					val);
  1654				cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1655			}
  1656		} else {
  1657			cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1658		}
  1659	
  1660		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1661				CS42L42_TS_INV_MASK,
  1662				(cs42l42->ts_inv << CS42L42_TS_INV_SHIFT));
  1663	
  1664		ret = of_property_read_u32(np, "cirrus,ts-dbnc-rise", &val);
  1665	
  1666		if (!ret) {
  1667			switch (val) {
  1668			case CS42L42_TS_DBNCE_0:
  1669			case CS42L42_TS_DBNCE_125:
  1670			case CS42L42_TS_DBNCE_250:
  1671			case CS42L42_TS_DBNCE_500:
  1672			case CS42L42_TS_DBNCE_750:
  1673			case CS42L42_TS_DBNCE_1000:
  1674			case CS42L42_TS_DBNCE_1250:
  1675			case CS42L42_TS_DBNCE_1500:
  1676				cs42l42->ts_dbnc_rise = val;
  1677				break;
  1678			default:
  1679				dev_err(&i2c_client->dev,
  1680					"Wrong cirrus,ts-dbnc-rise DT value %d\n",
  1681					val);
  1682				cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1683			}
  1684		} else {
  1685			cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1686		}
  1687	
  1688		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1689				CS42L42_TS_RISE_DBNCE_TIME_MASK,
  1690				(cs42l42->ts_dbnc_rise <<
  1691				CS42L42_TS_RISE_DBNCE_TIME_SHIFT));
  1692	
  1693		ret = of_property_read_u32(np, "cirrus,ts-dbnc-fall", &val);
  1694	
  1695		if (!ret) {
  1696			switch (val) {
  1697			case CS42L42_TS_DBNCE_0:
  1698			case CS42L42_TS_DBNCE_125:
  1699			case CS42L42_TS_DBNCE_250:
  1700			case CS42L42_TS_DBNCE_500:
  1701			case CS42L42_TS_DBNCE_750:
  1702			case CS42L42_TS_DBNCE_1000:
  1703			case CS42L42_TS_DBNCE_1250:
  1704			case CS42L42_TS_DBNCE_1500:
  1705				cs42l42->ts_dbnc_fall = val;
  1706				break;
  1707			default:
  1708				dev_err(&i2c_client->dev,
  1709					"Wrong cirrus,ts-dbnc-fall DT value %d\n",
  1710					val);
  1711				cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1712			}
  1713		} else {
  1714			cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1715		}
  1716	
  1717		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1718				CS42L42_TS_FALL_DBNCE_TIME_MASK,
  1719				(cs42l42->ts_dbnc_fall <<
  1720				CS42L42_TS_FALL_DBNCE_TIME_SHIFT));
  1721	
  1722		ret = of_property_read_u32(np, "cirrus,btn-det-init-dbnce", &val);
  1723	
  1724		if (!ret) {
  1725			if (val <= CS42L42_BTN_DET_INIT_DBNCE_MAX)
  1726				cs42l42->btn_det_init_dbnce = val;
  1727			else {
  1728				dev_err(&i2c_client->dev,
  1729					"Wrong cirrus,btn-det-init-dbnce DT value %d\n",
  1730					val);
  1731				cs42l42->btn_det_init_dbnce =
  1732					CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1733			}
  1734		} else {
  1735			cs42l42->btn_det_init_dbnce =
  1736				CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1737		}
  1738	
  1739		ret = of_property_read_u32(np, "cirrus,btn-det-event-dbnce", &val);
  1740	
  1741		if (!ret) {
  1742			if (val <= CS42L42_BTN_DET_EVENT_DBNCE_MAX)
  1743				cs42l42->btn_det_event_dbnce = val;
  1744			else {
  1745				dev_err(&i2c_client->dev,
  1746				"Wrong cirrus,btn-det-event-dbnce DT value %d\n", val);
  1747				cs42l42->btn_det_event_dbnce =
  1748					CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1749			}
  1750		} else {
  1751			cs42l42->btn_det_event_dbnce =
  1752				CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1753		}
  1754	
  1755		ret = of_property_read_u32_array(np, "cirrus,bias-lvls",
  1756					   (u32 *)thresholds, CS42L42_NUM_BIASES);
  1757	
  1758		if (!ret) {
  1759			for (i = 0; i < CS42L42_NUM_BIASES; i++) {
  1760				if (thresholds[i] <= CS42L42_HS_DET_LEVEL_MAX)
  1761					cs42l42->bias_thresholds[i] = thresholds[i];
  1762				else {
  1763					dev_err(&i2c_client->dev,
  1764					"Wrong cirrus,bias-lvls[%d] DT value %d\n", i,
  1765						thresholds[i]);
  1766					cs42l42->bias_thresholds[i] =
  1767						threshold_defaults[i];
  1768				}
  1769			}
  1770		} else {
  1771			for (i = 0; i < CS42L42_NUM_BIASES; i++)
  1772				cs42l42->bias_thresholds[i] = threshold_defaults[i];
  1773		}
  1774	
  1775		ret = of_property_read_u32(np, "cirrus,hs-bias-ramp-rate", &val);
  1776	
  1777		if (!ret) {
  1778			switch (val) {
  1779			case CS42L42_HSBIAS_RAMP_FAST_RISE_SLOW_FALL:
  1780				cs42l42->hs_bias_ramp_rate = val;
  1781				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME0;
  1782				break;
  1783			case CS42L42_HSBIAS_RAMP_FAST:
  1784				cs42l42->hs_bias_ramp_rate = val;
  1785				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME1;
  1786				break;
  1787			case CS42L42_HSBIAS_RAMP_SLOW:
  1788				cs42l42->hs_bias_ramp_rate = val;
  1789				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1790				break;
  1791			case CS42L42_HSBIAS_RAMP_SLOWEST:
  1792				cs42l42->hs_bias_ramp_rate = val;
  1793				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME3;
  1794				break;
  1795			default:
  1796				dev_err(&i2c_client->dev,
  1797					"Wrong cirrus,hs-bias-ramp-rate DT value %d\n",
  1798					val);
  1799				cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1800				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1801			}
  1802		} else {
  1803			cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1804			cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1805		}
  1806	
  1807		regmap_update_bits(cs42l42->regmap, CS42L42_HS_BIAS_CTL,
  1808				CS42L42_HSBIAS_RAMP_MASK,
  1809				(cs42l42->hs_bias_ramp_rate <<
  1810				CS42L42_HSBIAS_RAMP_SHIFT));
  1811	
> 1812		ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
  1813		if (!ret) {
  1814			switch (val) {
  1815			case CS42L42_HSBIAS_SENSE_OFF:
  1816			case CS42L42_HSBIAS_SENSE_ON:
  1817				cs42l42->hs_bias_sense_en = val;
  1818				break;
  1819			default:
  1820				dev_err(dev,
  1821					"Wrong cirrus,hs-bias-sense-en DT value %d\n",
  1822					val);
  1823				cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1824				break;
  1825			}
  1826		} else {
  1827			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1828		}
  1829	
  1830		return 0;
  1831	}
  1832	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37207 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 18:17   ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-05-07 18:17 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9120 bytes --]

Hi Lucas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20210507]
[cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: x86_64-randconfig-a013-20210507 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a3a8a1a15b524d91b5308db68e9d293b34cd88dd)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/17dc415a57a00d44b8be8db4791a2843daee7db1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
        git checkout 17dc415a57a00d44b8be8db4791a2843daee7db1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> sound/soc/codecs/cs42l42.c:1812:33: error: use of undeclared identifier 'dev'
           ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
                                          ^
   sound/soc/codecs/cs42l42.c:1820:12: error: use of undeclared identifier 'dev'
                           dev_err(dev,
                                   ^
   2 errors generated.


vim +/dev +1812 sound/soc/codecs/cs42l42.c

  1632	
  1633	static int cs42l42_handle_device_data(struct i2c_client *i2c_client,
  1634						struct cs42l42_private *cs42l42)
  1635	{
  1636		struct device_node *np = i2c_client->dev.of_node;
  1637		unsigned int val;
  1638		unsigned int thresholds[CS42L42_NUM_BIASES];
  1639		int ret;
  1640		int i;
  1641	
  1642		ret = of_property_read_u32(np, "cirrus,ts-inv", &val);
  1643	
  1644		if (!ret) {
  1645			switch (val) {
  1646			case CS42L42_TS_INV_EN:
  1647			case CS42L42_TS_INV_DIS:
  1648				cs42l42->ts_inv = val;
  1649				break;
  1650			default:
  1651				dev_err(&i2c_client->dev,
  1652					"Wrong cirrus,ts-inv DT value %d\n",
  1653					val);
  1654				cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1655			}
  1656		} else {
  1657			cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1658		}
  1659	
  1660		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1661				CS42L42_TS_INV_MASK,
  1662				(cs42l42->ts_inv << CS42L42_TS_INV_SHIFT));
  1663	
  1664		ret = of_property_read_u32(np, "cirrus,ts-dbnc-rise", &val);
  1665	
  1666		if (!ret) {
  1667			switch (val) {
  1668			case CS42L42_TS_DBNCE_0:
  1669			case CS42L42_TS_DBNCE_125:
  1670			case CS42L42_TS_DBNCE_250:
  1671			case CS42L42_TS_DBNCE_500:
  1672			case CS42L42_TS_DBNCE_750:
  1673			case CS42L42_TS_DBNCE_1000:
  1674			case CS42L42_TS_DBNCE_1250:
  1675			case CS42L42_TS_DBNCE_1500:
  1676				cs42l42->ts_dbnc_rise = val;
  1677				break;
  1678			default:
  1679				dev_err(&i2c_client->dev,
  1680					"Wrong cirrus,ts-dbnc-rise DT value %d\n",
  1681					val);
  1682				cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1683			}
  1684		} else {
  1685			cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1686		}
  1687	
  1688		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1689				CS42L42_TS_RISE_DBNCE_TIME_MASK,
  1690				(cs42l42->ts_dbnc_rise <<
  1691				CS42L42_TS_RISE_DBNCE_TIME_SHIFT));
  1692	
  1693		ret = of_property_read_u32(np, "cirrus,ts-dbnc-fall", &val);
  1694	
  1695		if (!ret) {
  1696			switch (val) {
  1697			case CS42L42_TS_DBNCE_0:
  1698			case CS42L42_TS_DBNCE_125:
  1699			case CS42L42_TS_DBNCE_250:
  1700			case CS42L42_TS_DBNCE_500:
  1701			case CS42L42_TS_DBNCE_750:
  1702			case CS42L42_TS_DBNCE_1000:
  1703			case CS42L42_TS_DBNCE_1250:
  1704			case CS42L42_TS_DBNCE_1500:
  1705				cs42l42->ts_dbnc_fall = val;
  1706				break;
  1707			default:
  1708				dev_err(&i2c_client->dev,
  1709					"Wrong cirrus,ts-dbnc-fall DT value %d\n",
  1710					val);
  1711				cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1712			}
  1713		} else {
  1714			cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1715		}
  1716	
  1717		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1718				CS42L42_TS_FALL_DBNCE_TIME_MASK,
  1719				(cs42l42->ts_dbnc_fall <<
  1720				CS42L42_TS_FALL_DBNCE_TIME_SHIFT));
  1721	
  1722		ret = of_property_read_u32(np, "cirrus,btn-det-init-dbnce", &val);
  1723	
  1724		if (!ret) {
  1725			if (val <= CS42L42_BTN_DET_INIT_DBNCE_MAX)
  1726				cs42l42->btn_det_init_dbnce = val;
  1727			else {
  1728				dev_err(&i2c_client->dev,
  1729					"Wrong cirrus,btn-det-init-dbnce DT value %d\n",
  1730					val);
  1731				cs42l42->btn_det_init_dbnce =
  1732					CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1733			}
  1734		} else {
  1735			cs42l42->btn_det_init_dbnce =
  1736				CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1737		}
  1738	
  1739		ret = of_property_read_u32(np, "cirrus,btn-det-event-dbnce", &val);
  1740	
  1741		if (!ret) {
  1742			if (val <= CS42L42_BTN_DET_EVENT_DBNCE_MAX)
  1743				cs42l42->btn_det_event_dbnce = val;
  1744			else {
  1745				dev_err(&i2c_client->dev,
  1746				"Wrong cirrus,btn-det-event-dbnce DT value %d\n", val);
  1747				cs42l42->btn_det_event_dbnce =
  1748					CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1749			}
  1750		} else {
  1751			cs42l42->btn_det_event_dbnce =
  1752				CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1753		}
  1754	
  1755		ret = of_property_read_u32_array(np, "cirrus,bias-lvls",
  1756					   (u32 *)thresholds, CS42L42_NUM_BIASES);
  1757	
  1758		if (!ret) {
  1759			for (i = 0; i < CS42L42_NUM_BIASES; i++) {
  1760				if (thresholds[i] <= CS42L42_HS_DET_LEVEL_MAX)
  1761					cs42l42->bias_thresholds[i] = thresholds[i];
  1762				else {
  1763					dev_err(&i2c_client->dev,
  1764					"Wrong cirrus,bias-lvls[%d] DT value %d\n", i,
  1765						thresholds[i]);
  1766					cs42l42->bias_thresholds[i] =
  1767						threshold_defaults[i];
  1768				}
  1769			}
  1770		} else {
  1771			for (i = 0; i < CS42L42_NUM_BIASES; i++)
  1772				cs42l42->bias_thresholds[i] = threshold_defaults[i];
  1773		}
  1774	
  1775		ret = of_property_read_u32(np, "cirrus,hs-bias-ramp-rate", &val);
  1776	
  1777		if (!ret) {
  1778			switch (val) {
  1779			case CS42L42_HSBIAS_RAMP_FAST_RISE_SLOW_FALL:
  1780				cs42l42->hs_bias_ramp_rate = val;
  1781				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME0;
  1782				break;
  1783			case CS42L42_HSBIAS_RAMP_FAST:
  1784				cs42l42->hs_bias_ramp_rate = val;
  1785				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME1;
  1786				break;
  1787			case CS42L42_HSBIAS_RAMP_SLOW:
  1788				cs42l42->hs_bias_ramp_rate = val;
  1789				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1790				break;
  1791			case CS42L42_HSBIAS_RAMP_SLOWEST:
  1792				cs42l42->hs_bias_ramp_rate = val;
  1793				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME3;
  1794				break;
  1795			default:
  1796				dev_err(&i2c_client->dev,
  1797					"Wrong cirrus,hs-bias-ramp-rate DT value %d\n",
  1798					val);
  1799				cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1800				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1801			}
  1802		} else {
  1803			cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1804			cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1805		}
  1806	
  1807		regmap_update_bits(cs42l42->regmap, CS42L42_HS_BIAS_CTL,
  1808				CS42L42_HSBIAS_RAMP_MASK,
  1809				(cs42l42->hs_bias_ramp_rate <<
  1810				CS42L42_HSBIAS_RAMP_SHIFT));
  1811	
> 1812		ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
  1813		if (!ret) {
  1814			switch (val) {
  1815			case CS42L42_HSBIAS_SENSE_OFF:
  1816			case CS42L42_HSBIAS_SENSE_ON:
  1817				cs42l42->hs_bias_sense_en = val;
  1818				break;
  1819			default:
  1820				dev_err(dev,
  1821					"Wrong cirrus,hs-bias-sense-en DT value %d\n",
  1822					val);
  1823				cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1824				break;
  1825			}
  1826		} else {
  1827			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1828		}
  1829	
  1830		return 0;
  1831	}
  1832	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37207 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
  2021-05-07 14:17 ` Lucas Tanure
  (?)
@ 2021-05-07 18:14   ` kernel test robot
  -1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-05-07 18:14 UTC (permalink / raw)
  To: Lucas Tanure, James Schulman, David Rhodes, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: kbuild-all, alsa-devel, patches, linux-kernel, Vitaly Rodionov

[-- Attachment #1: Type: text/plain, Size: 8886 bytes --]

Hi Lucas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20210507]
[cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: arc-randconfig-s031-20210506 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/17dc415a57a00d44b8be8db4791a2843daee7db1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
        git checkout 17dc415a57a00d44b8be8db4791a2843daee7db1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   sound/soc/codecs/cs42l42.c: In function 'cs42l42_handle_device_data':
>> sound/soc/codecs/cs42l42.c:1812:33: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1812 |  ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
         |                                 ^~~
         |                                 cdev
   sound/soc/codecs/cs42l42.c:1812:33: note: each undeclared identifier is reported only once for each function it appears in


vim +1812 sound/soc/codecs/cs42l42.c

  1632	
  1633	static int cs42l42_handle_device_data(struct i2c_client *i2c_client,
  1634						struct cs42l42_private *cs42l42)
  1635	{
  1636		struct device_node *np = i2c_client->dev.of_node;
  1637		unsigned int val;
  1638		unsigned int thresholds[CS42L42_NUM_BIASES];
  1639		int ret;
  1640		int i;
  1641	
  1642		ret = of_property_read_u32(np, "cirrus,ts-inv", &val);
  1643	
  1644		if (!ret) {
  1645			switch (val) {
  1646			case CS42L42_TS_INV_EN:
  1647			case CS42L42_TS_INV_DIS:
  1648				cs42l42->ts_inv = val;
  1649				break;
  1650			default:
  1651				dev_err(&i2c_client->dev,
  1652					"Wrong cirrus,ts-inv DT value %d\n",
  1653					val);
  1654				cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1655			}
  1656		} else {
  1657			cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1658		}
  1659	
  1660		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1661				CS42L42_TS_INV_MASK,
  1662				(cs42l42->ts_inv << CS42L42_TS_INV_SHIFT));
  1663	
  1664		ret = of_property_read_u32(np, "cirrus,ts-dbnc-rise", &val);
  1665	
  1666		if (!ret) {
  1667			switch (val) {
  1668			case CS42L42_TS_DBNCE_0:
  1669			case CS42L42_TS_DBNCE_125:
  1670			case CS42L42_TS_DBNCE_250:
  1671			case CS42L42_TS_DBNCE_500:
  1672			case CS42L42_TS_DBNCE_750:
  1673			case CS42L42_TS_DBNCE_1000:
  1674			case CS42L42_TS_DBNCE_1250:
  1675			case CS42L42_TS_DBNCE_1500:
  1676				cs42l42->ts_dbnc_rise = val;
  1677				break;
  1678			default:
  1679				dev_err(&i2c_client->dev,
  1680					"Wrong cirrus,ts-dbnc-rise DT value %d\n",
  1681					val);
  1682				cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1683			}
  1684		} else {
  1685			cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1686		}
  1687	
  1688		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1689				CS42L42_TS_RISE_DBNCE_TIME_MASK,
  1690				(cs42l42->ts_dbnc_rise <<
  1691				CS42L42_TS_RISE_DBNCE_TIME_SHIFT));
  1692	
  1693		ret = of_property_read_u32(np, "cirrus,ts-dbnc-fall", &val);
  1694	
  1695		if (!ret) {
  1696			switch (val) {
  1697			case CS42L42_TS_DBNCE_0:
  1698			case CS42L42_TS_DBNCE_125:
  1699			case CS42L42_TS_DBNCE_250:
  1700			case CS42L42_TS_DBNCE_500:
  1701			case CS42L42_TS_DBNCE_750:
  1702			case CS42L42_TS_DBNCE_1000:
  1703			case CS42L42_TS_DBNCE_1250:
  1704			case CS42L42_TS_DBNCE_1500:
  1705				cs42l42->ts_dbnc_fall = val;
  1706				break;
  1707			default:
  1708				dev_err(&i2c_client->dev,
  1709					"Wrong cirrus,ts-dbnc-fall DT value %d\n",
  1710					val);
  1711				cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1712			}
  1713		} else {
  1714			cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1715		}
  1716	
  1717		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1718				CS42L42_TS_FALL_DBNCE_TIME_MASK,
  1719				(cs42l42->ts_dbnc_fall <<
  1720				CS42L42_TS_FALL_DBNCE_TIME_SHIFT));
  1721	
  1722		ret = of_property_read_u32(np, "cirrus,btn-det-init-dbnce", &val);
  1723	
  1724		if (!ret) {
  1725			if (val <= CS42L42_BTN_DET_INIT_DBNCE_MAX)
  1726				cs42l42->btn_det_init_dbnce = val;
  1727			else {
  1728				dev_err(&i2c_client->dev,
  1729					"Wrong cirrus,btn-det-init-dbnce DT value %d\n",
  1730					val);
  1731				cs42l42->btn_det_init_dbnce =
  1732					CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1733			}
  1734		} else {
  1735			cs42l42->btn_det_init_dbnce =
  1736				CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1737		}
  1738	
  1739		ret = of_property_read_u32(np, "cirrus,btn-det-event-dbnce", &val);
  1740	
  1741		if (!ret) {
  1742			if (val <= CS42L42_BTN_DET_EVENT_DBNCE_MAX)
  1743				cs42l42->btn_det_event_dbnce = val;
  1744			else {
  1745				dev_err(&i2c_client->dev,
  1746				"Wrong cirrus,btn-det-event-dbnce DT value %d\n", val);
  1747				cs42l42->btn_det_event_dbnce =
  1748					CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1749			}
  1750		} else {
  1751			cs42l42->btn_det_event_dbnce =
  1752				CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1753		}
  1754	
  1755		ret = of_property_read_u32_array(np, "cirrus,bias-lvls",
  1756					   (u32 *)thresholds, CS42L42_NUM_BIASES);
  1757	
  1758		if (!ret) {
  1759			for (i = 0; i < CS42L42_NUM_BIASES; i++) {
  1760				if (thresholds[i] <= CS42L42_HS_DET_LEVEL_MAX)
  1761					cs42l42->bias_thresholds[i] = thresholds[i];
  1762				else {
  1763					dev_err(&i2c_client->dev,
  1764					"Wrong cirrus,bias-lvls[%d] DT value %d\n", i,
  1765						thresholds[i]);
  1766					cs42l42->bias_thresholds[i] =
  1767						threshold_defaults[i];
  1768				}
  1769			}
  1770		} else {
  1771			for (i = 0; i < CS42L42_NUM_BIASES; i++)
  1772				cs42l42->bias_thresholds[i] = threshold_defaults[i];
  1773		}
  1774	
  1775		ret = of_property_read_u32(np, "cirrus,hs-bias-ramp-rate", &val);
  1776	
  1777		if (!ret) {
  1778			switch (val) {
  1779			case CS42L42_HSBIAS_RAMP_FAST_RISE_SLOW_FALL:
  1780				cs42l42->hs_bias_ramp_rate = val;
  1781				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME0;
  1782				break;
  1783			case CS42L42_HSBIAS_RAMP_FAST:
  1784				cs42l42->hs_bias_ramp_rate = val;
  1785				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME1;
  1786				break;
  1787			case CS42L42_HSBIAS_RAMP_SLOW:
  1788				cs42l42->hs_bias_ramp_rate = val;
  1789				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1790				break;
  1791			case CS42L42_HSBIAS_RAMP_SLOWEST:
  1792				cs42l42->hs_bias_ramp_rate = val;
  1793				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME3;
  1794				break;
  1795			default:
  1796				dev_err(&i2c_client->dev,
  1797					"Wrong cirrus,hs-bias-ramp-rate DT value %d\n",
  1798					val);
  1799				cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1800				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1801			}
  1802		} else {
  1803			cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1804			cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1805		}
  1806	
  1807		regmap_update_bits(cs42l42->regmap, CS42L42_HS_BIAS_CTL,
  1808				CS42L42_HSBIAS_RAMP_MASK,
  1809				(cs42l42->hs_bias_ramp_rate <<
  1810				CS42L42_HSBIAS_RAMP_SHIFT));
  1811	
> 1812		ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
  1813		if (!ret) {
  1814			switch (val) {
  1815			case CS42L42_HSBIAS_SENSE_OFF:
  1816			case CS42L42_HSBIAS_SENSE_ON:
  1817				cs42l42->hs_bias_sense_en = val;
  1818				break;
  1819			default:
  1820				dev_err(dev,
  1821					"Wrong cirrus,hs-bias-sense-en DT value %d\n",
  1822					val);
  1823				cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1824				break;
  1825			}
  1826		} else {
  1827			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1828		}
  1829	
  1830		return 0;
  1831	}
  1832	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23834 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 18:14   ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-05-07 18:14 UTC (permalink / raw)
  To: Lucas Tanure, James Schulman, David Rhodes, Liam Girdwood,
	Mark Brown, Jaroslav Kysela, Takashi Iwai
  Cc: Vitaly Rodionov, patches, alsa-devel, kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 8886 bytes --]

Hi Lucas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20210507]
[cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: arc-randconfig-s031-20210506 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/17dc415a57a00d44b8be8db4791a2843daee7db1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
        git checkout 17dc415a57a00d44b8be8db4791a2843daee7db1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   sound/soc/codecs/cs42l42.c: In function 'cs42l42_handle_device_data':
>> sound/soc/codecs/cs42l42.c:1812:33: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1812 |  ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
         |                                 ^~~
         |                                 cdev
   sound/soc/codecs/cs42l42.c:1812:33: note: each undeclared identifier is reported only once for each function it appears in


vim +1812 sound/soc/codecs/cs42l42.c

  1632	
  1633	static int cs42l42_handle_device_data(struct i2c_client *i2c_client,
  1634						struct cs42l42_private *cs42l42)
  1635	{
  1636		struct device_node *np = i2c_client->dev.of_node;
  1637		unsigned int val;
  1638		unsigned int thresholds[CS42L42_NUM_BIASES];
  1639		int ret;
  1640		int i;
  1641	
  1642		ret = of_property_read_u32(np, "cirrus,ts-inv", &val);
  1643	
  1644		if (!ret) {
  1645			switch (val) {
  1646			case CS42L42_TS_INV_EN:
  1647			case CS42L42_TS_INV_DIS:
  1648				cs42l42->ts_inv = val;
  1649				break;
  1650			default:
  1651				dev_err(&i2c_client->dev,
  1652					"Wrong cirrus,ts-inv DT value %d\n",
  1653					val);
  1654				cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1655			}
  1656		} else {
  1657			cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1658		}
  1659	
  1660		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1661				CS42L42_TS_INV_MASK,
  1662				(cs42l42->ts_inv << CS42L42_TS_INV_SHIFT));
  1663	
  1664		ret = of_property_read_u32(np, "cirrus,ts-dbnc-rise", &val);
  1665	
  1666		if (!ret) {
  1667			switch (val) {
  1668			case CS42L42_TS_DBNCE_0:
  1669			case CS42L42_TS_DBNCE_125:
  1670			case CS42L42_TS_DBNCE_250:
  1671			case CS42L42_TS_DBNCE_500:
  1672			case CS42L42_TS_DBNCE_750:
  1673			case CS42L42_TS_DBNCE_1000:
  1674			case CS42L42_TS_DBNCE_1250:
  1675			case CS42L42_TS_DBNCE_1500:
  1676				cs42l42->ts_dbnc_rise = val;
  1677				break;
  1678			default:
  1679				dev_err(&i2c_client->dev,
  1680					"Wrong cirrus,ts-dbnc-rise DT value %d\n",
  1681					val);
  1682				cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1683			}
  1684		} else {
  1685			cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1686		}
  1687	
  1688		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1689				CS42L42_TS_RISE_DBNCE_TIME_MASK,
  1690				(cs42l42->ts_dbnc_rise <<
  1691				CS42L42_TS_RISE_DBNCE_TIME_SHIFT));
  1692	
  1693		ret = of_property_read_u32(np, "cirrus,ts-dbnc-fall", &val);
  1694	
  1695		if (!ret) {
  1696			switch (val) {
  1697			case CS42L42_TS_DBNCE_0:
  1698			case CS42L42_TS_DBNCE_125:
  1699			case CS42L42_TS_DBNCE_250:
  1700			case CS42L42_TS_DBNCE_500:
  1701			case CS42L42_TS_DBNCE_750:
  1702			case CS42L42_TS_DBNCE_1000:
  1703			case CS42L42_TS_DBNCE_1250:
  1704			case CS42L42_TS_DBNCE_1500:
  1705				cs42l42->ts_dbnc_fall = val;
  1706				break;
  1707			default:
  1708				dev_err(&i2c_client->dev,
  1709					"Wrong cirrus,ts-dbnc-fall DT value %d\n",
  1710					val);
  1711				cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1712			}
  1713		} else {
  1714			cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1715		}
  1716	
  1717		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1718				CS42L42_TS_FALL_DBNCE_TIME_MASK,
  1719				(cs42l42->ts_dbnc_fall <<
  1720				CS42L42_TS_FALL_DBNCE_TIME_SHIFT));
  1721	
  1722		ret = of_property_read_u32(np, "cirrus,btn-det-init-dbnce", &val);
  1723	
  1724		if (!ret) {
  1725			if (val <= CS42L42_BTN_DET_INIT_DBNCE_MAX)
  1726				cs42l42->btn_det_init_dbnce = val;
  1727			else {
  1728				dev_err(&i2c_client->dev,
  1729					"Wrong cirrus,btn-det-init-dbnce DT value %d\n",
  1730					val);
  1731				cs42l42->btn_det_init_dbnce =
  1732					CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1733			}
  1734		} else {
  1735			cs42l42->btn_det_init_dbnce =
  1736				CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1737		}
  1738	
  1739		ret = of_property_read_u32(np, "cirrus,btn-det-event-dbnce", &val);
  1740	
  1741		if (!ret) {
  1742			if (val <= CS42L42_BTN_DET_EVENT_DBNCE_MAX)
  1743				cs42l42->btn_det_event_dbnce = val;
  1744			else {
  1745				dev_err(&i2c_client->dev,
  1746				"Wrong cirrus,btn-det-event-dbnce DT value %d\n", val);
  1747				cs42l42->btn_det_event_dbnce =
  1748					CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1749			}
  1750		} else {
  1751			cs42l42->btn_det_event_dbnce =
  1752				CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1753		}
  1754	
  1755		ret = of_property_read_u32_array(np, "cirrus,bias-lvls",
  1756					   (u32 *)thresholds, CS42L42_NUM_BIASES);
  1757	
  1758		if (!ret) {
  1759			for (i = 0; i < CS42L42_NUM_BIASES; i++) {
  1760				if (thresholds[i] <= CS42L42_HS_DET_LEVEL_MAX)
  1761					cs42l42->bias_thresholds[i] = thresholds[i];
  1762				else {
  1763					dev_err(&i2c_client->dev,
  1764					"Wrong cirrus,bias-lvls[%d] DT value %d\n", i,
  1765						thresholds[i]);
  1766					cs42l42->bias_thresholds[i] =
  1767						threshold_defaults[i];
  1768				}
  1769			}
  1770		} else {
  1771			for (i = 0; i < CS42L42_NUM_BIASES; i++)
  1772				cs42l42->bias_thresholds[i] = threshold_defaults[i];
  1773		}
  1774	
  1775		ret = of_property_read_u32(np, "cirrus,hs-bias-ramp-rate", &val);
  1776	
  1777		if (!ret) {
  1778			switch (val) {
  1779			case CS42L42_HSBIAS_RAMP_FAST_RISE_SLOW_FALL:
  1780				cs42l42->hs_bias_ramp_rate = val;
  1781				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME0;
  1782				break;
  1783			case CS42L42_HSBIAS_RAMP_FAST:
  1784				cs42l42->hs_bias_ramp_rate = val;
  1785				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME1;
  1786				break;
  1787			case CS42L42_HSBIAS_RAMP_SLOW:
  1788				cs42l42->hs_bias_ramp_rate = val;
  1789				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1790				break;
  1791			case CS42L42_HSBIAS_RAMP_SLOWEST:
  1792				cs42l42->hs_bias_ramp_rate = val;
  1793				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME3;
  1794				break;
  1795			default:
  1796				dev_err(&i2c_client->dev,
  1797					"Wrong cirrus,hs-bias-ramp-rate DT value %d\n",
  1798					val);
  1799				cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1800				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1801			}
  1802		} else {
  1803			cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1804			cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1805		}
  1806	
  1807		regmap_update_bits(cs42l42->regmap, CS42L42_HS_BIAS_CTL,
  1808				CS42L42_HSBIAS_RAMP_MASK,
  1809				(cs42l42->hs_bias_ramp_rate <<
  1810				CS42L42_HSBIAS_RAMP_SHIFT));
  1811	
> 1812		ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
  1813		if (!ret) {
  1814			switch (val) {
  1815			case CS42L42_HSBIAS_SENSE_OFF:
  1816			case CS42L42_HSBIAS_SENSE_ON:
  1817				cs42l42->hs_bias_sense_en = val;
  1818				break;
  1819			default:
  1820				dev_err(dev,
  1821					"Wrong cirrus,hs-bias-sense-en DT value %d\n",
  1822					val);
  1823				cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1824				break;
  1825			}
  1826		} else {
  1827			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1828		}
  1829	
  1830		return 0;
  1831	}
  1832	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 23834 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 18:14   ` kernel test robot
  0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2021-05-07 18:14 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9135 bytes --]

Hi Lucas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on asoc/for-next]
[also build test ERROR on next-20210507]
[cannot apply to v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
config: arc-randconfig-s031-20210506 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/17dc415a57a00d44b8be8db4791a2843daee7db1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs42l42-make-HSBIAS_SENSE_EN-optional/20210507-221954
        git checkout 17dc415a57a00d44b8be8db4791a2843daee7db1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   sound/soc/codecs/cs42l42.c: In function 'cs42l42_handle_device_data':
>> sound/soc/codecs/cs42l42.c:1812:33: error: 'dev' undeclared (first use in this function); did you mean 'cdev'?
    1812 |  ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
         |                                 ^~~
         |                                 cdev
   sound/soc/codecs/cs42l42.c:1812:33: note: each undeclared identifier is reported only once for each function it appears in


vim +1812 sound/soc/codecs/cs42l42.c

  1632	
  1633	static int cs42l42_handle_device_data(struct i2c_client *i2c_client,
  1634						struct cs42l42_private *cs42l42)
  1635	{
  1636		struct device_node *np = i2c_client->dev.of_node;
  1637		unsigned int val;
  1638		unsigned int thresholds[CS42L42_NUM_BIASES];
  1639		int ret;
  1640		int i;
  1641	
  1642		ret = of_property_read_u32(np, "cirrus,ts-inv", &val);
  1643	
  1644		if (!ret) {
  1645			switch (val) {
  1646			case CS42L42_TS_INV_EN:
  1647			case CS42L42_TS_INV_DIS:
  1648				cs42l42->ts_inv = val;
  1649				break;
  1650			default:
  1651				dev_err(&i2c_client->dev,
  1652					"Wrong cirrus,ts-inv DT value %d\n",
  1653					val);
  1654				cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1655			}
  1656		} else {
  1657			cs42l42->ts_inv = CS42L42_TS_INV_DIS;
  1658		}
  1659	
  1660		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1661				CS42L42_TS_INV_MASK,
  1662				(cs42l42->ts_inv << CS42L42_TS_INV_SHIFT));
  1663	
  1664		ret = of_property_read_u32(np, "cirrus,ts-dbnc-rise", &val);
  1665	
  1666		if (!ret) {
  1667			switch (val) {
  1668			case CS42L42_TS_DBNCE_0:
  1669			case CS42L42_TS_DBNCE_125:
  1670			case CS42L42_TS_DBNCE_250:
  1671			case CS42L42_TS_DBNCE_500:
  1672			case CS42L42_TS_DBNCE_750:
  1673			case CS42L42_TS_DBNCE_1000:
  1674			case CS42L42_TS_DBNCE_1250:
  1675			case CS42L42_TS_DBNCE_1500:
  1676				cs42l42->ts_dbnc_rise = val;
  1677				break;
  1678			default:
  1679				dev_err(&i2c_client->dev,
  1680					"Wrong cirrus,ts-dbnc-rise DT value %d\n",
  1681					val);
  1682				cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1683			}
  1684		} else {
  1685			cs42l42->ts_dbnc_rise = CS42L42_TS_DBNCE_1000;
  1686		}
  1687	
  1688		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1689				CS42L42_TS_RISE_DBNCE_TIME_MASK,
  1690				(cs42l42->ts_dbnc_rise <<
  1691				CS42L42_TS_RISE_DBNCE_TIME_SHIFT));
  1692	
  1693		ret = of_property_read_u32(np, "cirrus,ts-dbnc-fall", &val);
  1694	
  1695		if (!ret) {
  1696			switch (val) {
  1697			case CS42L42_TS_DBNCE_0:
  1698			case CS42L42_TS_DBNCE_125:
  1699			case CS42L42_TS_DBNCE_250:
  1700			case CS42L42_TS_DBNCE_500:
  1701			case CS42L42_TS_DBNCE_750:
  1702			case CS42L42_TS_DBNCE_1000:
  1703			case CS42L42_TS_DBNCE_1250:
  1704			case CS42L42_TS_DBNCE_1500:
  1705				cs42l42->ts_dbnc_fall = val;
  1706				break;
  1707			default:
  1708				dev_err(&i2c_client->dev,
  1709					"Wrong cirrus,ts-dbnc-fall DT value %d\n",
  1710					val);
  1711				cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1712			}
  1713		} else {
  1714			cs42l42->ts_dbnc_fall = CS42L42_TS_DBNCE_0;
  1715		}
  1716	
  1717		regmap_update_bits(cs42l42->regmap, CS42L42_TSENSE_CTL,
  1718				CS42L42_TS_FALL_DBNCE_TIME_MASK,
  1719				(cs42l42->ts_dbnc_fall <<
  1720				CS42L42_TS_FALL_DBNCE_TIME_SHIFT));
  1721	
  1722		ret = of_property_read_u32(np, "cirrus,btn-det-init-dbnce", &val);
  1723	
  1724		if (!ret) {
  1725			if (val <= CS42L42_BTN_DET_INIT_DBNCE_MAX)
  1726				cs42l42->btn_det_init_dbnce = val;
  1727			else {
  1728				dev_err(&i2c_client->dev,
  1729					"Wrong cirrus,btn-det-init-dbnce DT value %d\n",
  1730					val);
  1731				cs42l42->btn_det_init_dbnce =
  1732					CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1733			}
  1734		} else {
  1735			cs42l42->btn_det_init_dbnce =
  1736				CS42L42_BTN_DET_INIT_DBNCE_DEFAULT;
  1737		}
  1738	
  1739		ret = of_property_read_u32(np, "cirrus,btn-det-event-dbnce", &val);
  1740	
  1741		if (!ret) {
  1742			if (val <= CS42L42_BTN_DET_EVENT_DBNCE_MAX)
  1743				cs42l42->btn_det_event_dbnce = val;
  1744			else {
  1745				dev_err(&i2c_client->dev,
  1746				"Wrong cirrus,btn-det-event-dbnce DT value %d\n", val);
  1747				cs42l42->btn_det_event_dbnce =
  1748					CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1749			}
  1750		} else {
  1751			cs42l42->btn_det_event_dbnce =
  1752				CS42L42_BTN_DET_EVENT_DBNCE_DEFAULT;
  1753		}
  1754	
  1755		ret = of_property_read_u32_array(np, "cirrus,bias-lvls",
  1756					   (u32 *)thresholds, CS42L42_NUM_BIASES);
  1757	
  1758		if (!ret) {
  1759			for (i = 0; i < CS42L42_NUM_BIASES; i++) {
  1760				if (thresholds[i] <= CS42L42_HS_DET_LEVEL_MAX)
  1761					cs42l42->bias_thresholds[i] = thresholds[i];
  1762				else {
  1763					dev_err(&i2c_client->dev,
  1764					"Wrong cirrus,bias-lvls[%d] DT value %d\n", i,
  1765						thresholds[i]);
  1766					cs42l42->bias_thresholds[i] =
  1767						threshold_defaults[i];
  1768				}
  1769			}
  1770		} else {
  1771			for (i = 0; i < CS42L42_NUM_BIASES; i++)
  1772				cs42l42->bias_thresholds[i] = threshold_defaults[i];
  1773		}
  1774	
  1775		ret = of_property_read_u32(np, "cirrus,hs-bias-ramp-rate", &val);
  1776	
  1777		if (!ret) {
  1778			switch (val) {
  1779			case CS42L42_HSBIAS_RAMP_FAST_RISE_SLOW_FALL:
  1780				cs42l42->hs_bias_ramp_rate = val;
  1781				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME0;
  1782				break;
  1783			case CS42L42_HSBIAS_RAMP_FAST:
  1784				cs42l42->hs_bias_ramp_rate = val;
  1785				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME1;
  1786				break;
  1787			case CS42L42_HSBIAS_RAMP_SLOW:
  1788				cs42l42->hs_bias_ramp_rate = val;
  1789				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1790				break;
  1791			case CS42L42_HSBIAS_RAMP_SLOWEST:
  1792				cs42l42->hs_bias_ramp_rate = val;
  1793				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME3;
  1794				break;
  1795			default:
  1796				dev_err(&i2c_client->dev,
  1797					"Wrong cirrus,hs-bias-ramp-rate DT value %d\n",
  1798					val);
  1799				cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1800				cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1801			}
  1802		} else {
  1803			cs42l42->hs_bias_ramp_rate = CS42L42_HSBIAS_RAMP_SLOW;
  1804			cs42l42->hs_bias_ramp_time = CS42L42_HSBIAS_RAMP_TIME2;
  1805		}
  1806	
  1807		regmap_update_bits(cs42l42->regmap, CS42L42_HS_BIAS_CTL,
  1808				CS42L42_HSBIAS_RAMP_MASK,
  1809				(cs42l42->hs_bias_ramp_rate <<
  1810				CS42L42_HSBIAS_RAMP_SHIFT));
  1811	
> 1812		ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
  1813		if (!ret) {
  1814			switch (val) {
  1815			case CS42L42_HSBIAS_SENSE_OFF:
  1816			case CS42L42_HSBIAS_SENSE_ON:
  1817				cs42l42->hs_bias_sense_en = val;
  1818				break;
  1819			default:
  1820				dev_err(dev,
  1821					"Wrong cirrus,hs-bias-sense-en DT value %d\n",
  1822					val);
  1823				cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1824				break;
  1825			}
  1826		} else {
  1827			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
  1828		}
  1829	
  1830		return 0;
  1831	}
  1832	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 23834 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
  2021-05-07 14:17 ` Lucas Tanure
@ 2021-05-07 15:38   ` Mark Brown
  -1 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2021-05-07 15:38 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: James Schulman, David Rhodes, Liam Girdwood, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, patches, linux-kernel, Vitaly Rodionov

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

On Fri, May 07, 2021 at 03:17:48PM +0100, Lucas Tanure wrote:

> +  - cirrus,hs-bias-sense-en: Configures HSBIAS output current sense through
> +  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
> +  the potential pop noise during the headset plug out slowly. But on some
> +  platforms ESD voltage will affect it causing test to fail, especially
> +  with CTIA headset type. For different hardware setups, a designer might
> +  want to tweak default behavior.
> +
> +  0 - disabled
> +  1 - enabled
> +  Default = 1

A boolean property would generally be present/absent rather than having
a value...

> +	ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);

...and read using device_property_read_bool().

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 15:38   ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2021-05-07 15:38 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: alsa-devel, Liam Girdwood, Vitaly Rodionov, patches,
	Takashi Iwai, James Schulman, David Rhodes, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

On Fri, May 07, 2021 at 03:17:48PM +0100, Lucas Tanure wrote:

> +  - cirrus,hs-bias-sense-en: Configures HSBIAS output current sense through
> +  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
> +  the potential pop noise during the headset plug out slowly. But on some
> +  platforms ESD voltage will affect it causing test to fail, especially
> +  with CTIA headset type. For different hardware setups, a designer might
> +  want to tweak default behavior.
> +
> +  0 - disabled
> +  1 - enabled
> +  Default = 1

A boolean property would generally be present/absent rather than having
a value...

> +	ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);

...and read using device_property_read_bool().

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 14:17 ` Lucas Tanure
  0 siblings, 0 replies; 14+ messages in thread
From: Lucas Tanure @ 2021-05-07 14:17 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, patches, linux-kernel, Vitaly Rodionov, Lucas Tanure

From: Vitaly Rodionov <vitalyr@opensource.cirrus.com>

HSBIAS_SENSE_EN configures HSBIAS output current sense through
the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
the potential pop noise during the headset plug out slowly. But on some
platforms ESD voltage will affect it causing test to fail, especially
with CTIA headset type. For different hardware setups, a designer might
want to tweak default behavior.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
---
 .../devicetree/bindings/sound/cs42l42.txt     | 10 ++++++++++
 include/dt-bindings/sound/cs42l42.h           |  3 +++
 sound/soc/codecs/cs42l42.c                    | 20 ++++++++++++++++++-
 sound/soc/codecs/cs42l42.h                    |  1 +
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/cs42l42.txt b/Documentation/devicetree/bindings/sound/cs42l42.txt
index 7dfaa2ab906f..e75f191d2945 100644
--- a/Documentation/devicetree/bindings/sound/cs42l42.txt
+++ b/Documentation/devicetree/bindings/sound/cs42l42.txt
@@ -81,6 +81,16 @@ Optional properties:
   < x1 x2 x3 x4 >
   Default = < 15 8 4 1>
 
+  - cirrus,hs-bias-sense-en: Configures HSBIAS output current sense through
+  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
+  the potential pop noise during the headset plug out slowly. But on some
+  platforms ESD voltage will affect it causing test to fail, especially
+  with CTIA headset type. For different hardware setups, a designer might
+  want to tweak default behavior.
+
+  0 - disabled
+  1 - enabled
+  Default = 1
 
 Example:
 
diff --git a/include/dt-bindings/sound/cs42l42.h b/include/dt-bindings/sound/cs42l42.h
index f25d83c6188b..788e1598b15f 100644
--- a/include/dt-bindings/sound/cs42l42.h
+++ b/include/dt-bindings/sound/cs42l42.h
@@ -66,4 +66,7 @@
 #define CS42L42_HSBIAS_RAMP_TIME2			90
 #define CS42L42_HSBIAS_RAMP_TIME3			170
 
+#define CS42L42_HSBIAS_SENSE_ON  1
+#define CS42L42_HSBIAS_SENSE_OFF 0
+
 #endif /* __DT_CS42L42_H */
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index d9f8da7a68d0..139245c6b720 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -1032,7 +1032,7 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
 			CS42L42_AUTO_HSBIAS_HIZ_MASK |
 			CS42L42_TIP_SENSE_EN_MASK |
 			CS42L42_HSBIAS_SENSE_TRIP_MASK,
-			(1 << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
+			(cs42l42->hs_bias_sense_en << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
 			(1 << CS42L42_AUTO_HSBIAS_HIZ_SHIFT) |
 			(0 << CS42L42_TIP_SENSE_EN_SHIFT) |
 			(3 << CS42L42_HSBIAS_SENSE_TRIP_SHIFT));
@@ -1807,6 +1807,24 @@ static int cs42l42_handle_device_data(struct device *dev,
 			(cs42l42->hs_bias_ramp_rate <<
 			CS42L42_HSBIAS_RAMP_SHIFT));
 
+	ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
+	if (!ret) {
+		switch (val) {
+		case CS42L42_HSBIAS_SENSE_OFF:
+		case CS42L42_HSBIAS_SENSE_ON:
+			cs42l42->hs_bias_sense_en = val;
+			break;
+		default:
+			dev_err(dev,
+				"Wrong cirrus,hs-bias-sense-en DT value %d\n",
+				val);
+			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
+			break;
+		}
+	} else {
+		cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
+	}
+
 	return 0;
 }
 
diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h
index 2e0d3836bd7e..24f7be228d5f 100644
--- a/sound/soc/codecs/cs42l42.h
+++ b/sound/soc/codecs/cs42l42.h
@@ -787,6 +787,7 @@ struct  cs42l42_private {
 	u8 bias_thresholds[CS42L42_NUM_BIASES];
 	u8 hs_bias_ramp_rate;
 	u8 hs_bias_ramp_time;
+	u8 hs_bias_sense_en;
 	u8 stream_use;
 };
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional
@ 2021-05-07 14:17 ` Lucas Tanure
  0 siblings, 0 replies; 14+ messages in thread
From: Lucas Tanure @ 2021-05-07 14:17 UTC (permalink / raw)
  To: James Schulman, David Rhodes, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: Vitaly Rodionov, patches, alsa-devel, linux-kernel, Lucas Tanure

From: Vitaly Rodionov <vitalyr@opensource.cirrus.com>

HSBIAS_SENSE_EN configures HSBIAS output current sense through
the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
the potential pop noise during the headset plug out slowly. But on some
platforms ESD voltage will affect it causing test to fail, especially
with CTIA headset type. For different hardware setups, a designer might
want to tweak default behavior.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
---
 .../devicetree/bindings/sound/cs42l42.txt     | 10 ++++++++++
 include/dt-bindings/sound/cs42l42.h           |  3 +++
 sound/soc/codecs/cs42l42.c                    | 20 ++++++++++++++++++-
 sound/soc/codecs/cs42l42.h                    |  1 +
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/cs42l42.txt b/Documentation/devicetree/bindings/sound/cs42l42.txt
index 7dfaa2ab906f..e75f191d2945 100644
--- a/Documentation/devicetree/bindings/sound/cs42l42.txt
+++ b/Documentation/devicetree/bindings/sound/cs42l42.txt
@@ -81,6 +81,16 @@ Optional properties:
   < x1 x2 x3 x4 >
   Default = < 15 8 4 1>
 
+  - cirrus,hs-bias-sense-en: Configures HSBIAS output current sense through
+  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
+  the potential pop noise during the headset plug out slowly. But on some
+  platforms ESD voltage will affect it causing test to fail, especially
+  with CTIA headset type. For different hardware setups, a designer might
+  want to tweak default behavior.
+
+  0 - disabled
+  1 - enabled
+  Default = 1
 
 Example:
 
diff --git a/include/dt-bindings/sound/cs42l42.h b/include/dt-bindings/sound/cs42l42.h
index f25d83c6188b..788e1598b15f 100644
--- a/include/dt-bindings/sound/cs42l42.h
+++ b/include/dt-bindings/sound/cs42l42.h
@@ -66,4 +66,7 @@
 #define CS42L42_HSBIAS_RAMP_TIME2			90
 #define CS42L42_HSBIAS_RAMP_TIME3			170
 
+#define CS42L42_HSBIAS_SENSE_ON  1
+#define CS42L42_HSBIAS_SENSE_OFF 0
+
 #endif /* __DT_CS42L42_H */
diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index d9f8da7a68d0..139245c6b720 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -1032,7 +1032,7 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
 			CS42L42_AUTO_HSBIAS_HIZ_MASK |
 			CS42L42_TIP_SENSE_EN_MASK |
 			CS42L42_HSBIAS_SENSE_TRIP_MASK,
-			(1 << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
+			(cs42l42->hs_bias_sense_en << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
 			(1 << CS42L42_AUTO_HSBIAS_HIZ_SHIFT) |
 			(0 << CS42L42_TIP_SENSE_EN_SHIFT) |
 			(3 << CS42L42_HSBIAS_SENSE_TRIP_SHIFT));
@@ -1807,6 +1807,24 @@ static int cs42l42_handle_device_data(struct device *dev,
 			(cs42l42->hs_bias_ramp_rate <<
 			CS42L42_HSBIAS_RAMP_SHIFT));
 
+	ret = device_property_read_u32(dev, "cirrus,hs-bias-sense-en", &val);
+	if (!ret) {
+		switch (val) {
+		case CS42L42_HSBIAS_SENSE_OFF:
+		case CS42L42_HSBIAS_SENSE_ON:
+			cs42l42->hs_bias_sense_en = val;
+			break;
+		default:
+			dev_err(dev,
+				"Wrong cirrus,hs-bias-sense-en DT value %d\n",
+				val);
+			cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
+			break;
+		}
+	} else {
+		cs42l42->hs_bias_sense_en = CS42L42_HSBIAS_SENSE_ON;
+	}
+
 	return 0;
 }
 
diff --git a/sound/soc/codecs/cs42l42.h b/sound/soc/codecs/cs42l42.h
index 2e0d3836bd7e..24f7be228d5f 100644
--- a/sound/soc/codecs/cs42l42.h
+++ b/sound/soc/codecs/cs42l42.h
@@ -787,6 +787,7 @@ struct  cs42l42_private {
 	u8 bias_thresholds[CS42L42_NUM_BIASES];
 	u8 hs_bias_ramp_rate;
 	u8 hs_bias_ramp_time;
+	u8 hs_bias_sense_en;
 	u8 stream_use;
 };
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-05-12 19:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 14:52 [PATCH] ASoC: cs42l42: make HSBIAS_SENSE_EN optional Vitaly Rodionov
2021-05-11 14:52 ` Vitaly Rodionov
2021-05-12 17:04 ` Mark Brown
2021-05-12 17:04   ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2021-05-07 14:17 Lucas Tanure
2021-05-07 14:17 ` Lucas Tanure
2021-05-07 15:38 ` Mark Brown
2021-05-07 15:38   ` Mark Brown
2021-05-07 18:14 ` kernel test robot
2021-05-07 18:14   ` kernel test robot
2021-05-07 18:14   ` kernel test robot
2021-05-07 18:17 ` kernel test robot
2021-05-07 18:17   ` kernel test robot
2021-05-07 18:17   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.