Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging
@ 2022-07-11  9:52 Andy Shevchenko
  2022-07-11  9:52 ` [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-07-11  9:52 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Richard Fitzgerald, James Schulman, David Rhodes, Takashi Iwai

Drop duplicate print of returned value in the messages and use pattern
return dev_err_probe(...) where it's possible.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 sound/pci/hda/cs35l41_hda.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
index cce27a86267f..23a97ada7272 100644
--- a/sound/pci/hda/cs35l41_hda.c
+++ b/sound/pci/hda/cs35l41_hda.c
@@ -460,10 +460,8 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
 	dev_set_drvdata(dev, cs35l41);
 
 	ret = cs35l41_hda_read_acpi(cs35l41, device_name, id);
-	if (ret) {
-		dev_err_probe(cs35l41->dev, ret, "Platform not supported %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(cs35l41->dev, ret, "Platform not supported\n");
 
 	if (IS_ERR(cs35l41->reset_gpio)) {
 		ret = PTR_ERR(cs35l41->reset_gpio);
@@ -471,7 +469,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
 		if (ret == -EBUSY) {
 			dev_info(cs35l41->dev, "Reset line busy, assuming shared reset\n");
 		} else {
-			dev_err_probe(cs35l41->dev, ret, "Failed to get reset GPIO: %d\n", ret);
+			dev_err_probe(cs35l41->dev, ret, "Failed to get reset GPIO\n");
 			goto err;
 		}
 	}
-- 
2.35.1


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

* [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations
  2022-07-11  9:52 [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Andy Shevchenko
@ 2022-07-11  9:52 ` Andy Shevchenko
  2022-07-12  4:38   ` kernel test robot
  2022-07-11  9:52 ` [PATCH v1 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2022-07-11  9:52 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Richard Fitzgerald, James Schulman, David Rhodes, Takashi Iwai

ACPI is needed only for functioning of this codec on some platforms,
there is no compilation dependency, so make it optional

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 sound/pci/hda/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 79ade4787d95..e86cf80bdf96 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -97,7 +97,7 @@ config SND_HDA_SCODEC_CS35L41
 config SND_HDA_SCODEC_CS35L41_I2C
 	tristate "Build CS35L41 HD-audio side codec support for I2C Bus"
 	depends on I2C
-	depends on ACPI
+	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
 	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
@@ -113,7 +113,7 @@ comment "Set to Y if you want auto-loading the side codec driver"
 config SND_HDA_SCODEC_CS35L41_SPI
 	tristate "Build CS35L41 HD-audio codec support for SPI Bus"
 	depends on SPI_MASTER
-	depends on ACPI
+	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
 	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
-- 
2.35.1


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

* [PATCH v1 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR()
  2022-07-11  9:52 [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Andy Shevchenko
  2022-07-11  9:52 ` [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
@ 2022-07-11  9:52 ` Andy Shevchenko
  2022-07-11  9:52 ` [PATCH v1 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 Andy Shevchenko
  2022-07-12  9:18 ` [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Takashi Iwai
  3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-07-11  9:52 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Richard Fitzgerald, James Schulman, David Rhodes, Takashi Iwai

ACPI_PTR() is more harmful than helpful. For example, in this case
if CONFIG_ACPI=n, the ID table left unused which is not what we want.

Instead of adding ifdeffery or attribute here and there, drop ACPI_PTR().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 sound/pci/hda/cs35l41_hda_i2c.c | 8 +++-----
 sound/pci/hda/cs35l41_hda_spi.c | 8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sound/pci/hda/cs35l41_hda_i2c.c b/sound/pci/hda/cs35l41_hda_i2c.c
index e810b278fb91..5cfb5aac37ac 100644
--- a/sound/pci/hda/cs35l41_hda_i2c.c
+++ b/sound/pci/hda/cs35l41_hda_i2c.c
@@ -6,9 +6,9 @@
 //
 // Author: Lucas Tanure <tanureal@opensource.cirrus.com>
 
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
-#include <linux/acpi.h>
 
 #include "cs35l41_hda.h"
 
@@ -42,19 +42,17 @@ static const struct i2c_device_id cs35l41_hda_i2c_id[] = {
 	{}
 };
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id cs35l41_acpi_hda_match[] = {
 	{"CLSA0100", 0 },
 	{"CSC3551", 0 },
-	{ },
+	{}
 };
 MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);
-#endif
 
 static struct i2c_driver cs35l41_i2c_driver = {
 	.driver = {
 		.name		= "cs35l41-hda",
-		.acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match),
+		.acpi_match_table = cs35l41_acpi_hda_match,
 	},
 	.id_table	= cs35l41_hda_i2c_id,
 	.probe		= cs35l41_hda_i2c_probe,
diff --git a/sound/pci/hda/cs35l41_hda_spi.c b/sound/pci/hda/cs35l41_hda_spi.c
index 22e088f28438..c9a61675c4fd 100644
--- a/sound/pci/hda/cs35l41_hda_spi.c
+++ b/sound/pci/hda/cs35l41_hda_spi.c
@@ -6,7 +6,7 @@
 //
 // Author: Lucas Tanure <tanureal@opensource.cirrus.com>
 
-#include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/spi/spi.h>
 
@@ -38,18 +38,16 @@ static const struct spi_device_id cs35l41_hda_spi_id[] = {
 	{}
 };
 
-#ifdef CONFIG_ACPI
 static const struct acpi_device_id cs35l41_acpi_hda_match[] = {
 	{ "CSC3551", 0 },
-	{},
+	{}
 };
 MODULE_DEVICE_TABLE(acpi, cs35l41_acpi_hda_match);
-#endif
 
 static struct spi_driver cs35l41_spi_driver = {
 	.driver = {
 		.name		= "cs35l41-hda",
-		.acpi_match_table = ACPI_PTR(cs35l41_acpi_hda_match),
+		.acpi_match_table = cs35l41_acpi_hda_match,
 	},
 	.id_table	= cs35l41_hda_spi_id,
 	.probe		= cs35l41_hda_spi_probe,
-- 
2.35.1


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

* [PATCH v1 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41
  2022-07-11  9:52 [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Andy Shevchenko
  2022-07-11  9:52 ` [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
  2022-07-11  9:52 ` [PATCH v1 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() Andy Shevchenko
@ 2022-07-11  9:52 ` Andy Shevchenko
  2022-07-12  9:18 ` [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Takashi Iwai
  3 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-07-11  9:52 UTC (permalink / raw)
  To: Takashi Iwai, Lucas Tanure, Andy Shevchenko, alsa-devel,
	linux-kernel, patches
  Cc: Richard Fitzgerald, James Schulman, David Rhodes, Takashi Iwai

Selections can be propagated via selections, while dependencies are not.
Hence, consolidate selections under the SND_HDA_SCODEC_CS35L41 option.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 sound/pci/hda/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index e86cf80bdf96..8b73a12d356f 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -93,16 +93,16 @@ config SND_HDA_PATCH_LOADER
 
 config SND_HDA_SCODEC_CS35L41
 	tristate
+	select SND_HDA_GENERIC
+	select REGMAP_IRQ
 
 config SND_HDA_SCODEC_CS35L41_I2C
 	tristate "Build CS35L41 HD-audio side codec support for I2C Bus"
 	depends on I2C
 	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
-	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
 	select SND_HDA_SCODEC_CS35L41
-	select REGMAP_IRQ
 	help
 	  Say Y or M here to include CS35L41 I2C HD-audio side codec support
 	  in snd-hda-intel driver, such as ALC287.
@@ -115,10 +115,8 @@ config SND_HDA_SCODEC_CS35L41_SPI
 	depends on SPI_MASTER
 	depends on ACPI || COMPILE_TEST
 	depends on SND_SOC
-	select SND_HDA_GENERIC
 	select SND_SOC_CS35L41_LIB
 	select SND_HDA_SCODEC_CS35L41
-	select REGMAP_IRQ
 	help
 	  Say Y or M here to include CS35L41 SPI HD-audio side codec support
 	  in snd-hda-intel driver, such as ALC287.
-- 
2.35.1


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

* Re: [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations
  2022-07-11  9:52 ` [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
@ 2022-07-12  4:38   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-07-12  4:38 UTC (permalink / raw)
  To: Andy Shevchenko, Takashi Iwai, Lucas Tanure, alsa-devel,
	linux-kernel, patches
  Cc: Richard Fitzgerald, David Rhodes, kbuild-all, James Schulman

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on linus/master v5.19-rc6 next-20220711]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/ALSA-hda-cs35l41-Improve-dev_err_probe-messaging/20220711-175606
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20220712/202207121250.pG2NiH2y-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 11.3.0
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
        # https://github.com/intel-lab-lkp/linux/commit/1822f133c760384365a12621de82e3a96e061ecf
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Andy-Shevchenko/ALSA-hda-cs35l41-Improve-dev_err_probe-messaging/20220711-175606
        git checkout 1822f133c760384365a12621de82e3a96e061ecf
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

   sound/pci/hda/cs35l41_hda.c: In function 'cs35l41_hda_read_acpi':
>> sound/pci/hda/cs35l41_hda.c:350:59: error: invalid use of undefined type 'struct acpi_device'
     350 |         cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index,
         |                                                           ^~


vim +350 sound/pci/hda/cs35l41_hda.c

7b2f3eb492dac76 Lucas Tanure   2021-12-17  299  
f7f207375d4e6eb Lucas Tanure   2022-04-13  300  static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, int id)
7b2f3eb492dac76 Lucas Tanure   2021-12-17  301  {
f7f207375d4e6eb Lucas Tanure   2022-04-13  302  	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  303  	u32 values[HDA_MAX_COMPONENTS];
7b2f3eb492dac76 Lucas Tanure   2021-12-17  304  	struct acpi_device *adev;
8c286a0f973a812 Lucas Tanure   2022-01-17  305  	struct device *physdev;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  306  	char *property;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  307  	size_t nval;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  308  	int i, ret;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  309  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  310  	adev = acpi_dev_get_first_match_dev(hid, NULL, -1);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  311  	if (!adev) {
7b2f3eb492dac76 Lucas Tanure   2021-12-17  312  		dev_err(cs35l41->dev, "Failed to find an ACPI device for %s\n", hid);
f7f207375d4e6eb Lucas Tanure   2022-04-13  313  		return -ENODEV;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  314  	}
7b2f3eb492dac76 Lucas Tanure   2021-12-17  315  
8c286a0f973a812 Lucas Tanure   2022-01-17  316  	physdev = get_device(acpi_get_first_physical_node(adev));
7b2f3eb492dac76 Lucas Tanure   2021-12-17  317  	acpi_dev_put(adev);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  318  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  319  	property = "cirrus,dev-index";
8c286a0f973a812 Lucas Tanure   2022-01-17  320  	ret = device_property_count_u32(physdev, property);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  321  	if (ret <= 0)
7b2f3eb492dac76 Lucas Tanure   2021-12-17  322  		goto no_acpi_dsd;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  323  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  324  	if (ret > ARRAY_SIZE(values)) {
7b2f3eb492dac76 Lucas Tanure   2021-12-17  325  		ret = -EINVAL;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  326  		goto err;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  327  	}
7b2f3eb492dac76 Lucas Tanure   2021-12-17  328  	nval = ret;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  329  
8c286a0f973a812 Lucas Tanure   2022-01-17  330  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  331  	if (ret)
7b2f3eb492dac76 Lucas Tanure   2021-12-17  332  		goto err;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  333  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  334  	cs35l41->index = -1;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  335  	for (i = 0; i < nval; i++) {
7b2f3eb492dac76 Lucas Tanure   2021-12-17  336  		if (values[i] == id) {
7b2f3eb492dac76 Lucas Tanure   2021-12-17  337  			cs35l41->index = i;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  338  			break;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  339  		}
7b2f3eb492dac76 Lucas Tanure   2021-12-17  340  	}
7b2f3eb492dac76 Lucas Tanure   2021-12-17  341  	if (cs35l41->index == -1) {
7b2f3eb492dac76 Lucas Tanure   2021-12-17  342  		dev_err(cs35l41->dev, "No index found in %s\n", property);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  343  		ret = -ENODEV;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  344  		goto err;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  345  	}
7b2f3eb492dac76 Lucas Tanure   2021-12-17  346  
8c286a0f973a812 Lucas Tanure   2022-01-17  347  	/* To use the same release code for all laptop variants we can't use devm_ version of
8c286a0f973a812 Lucas Tanure   2022-01-17  348  	 * gpiod_get here, as CLSA010* don't have a fully functional bios with an _DSD node
8c286a0f973a812 Lucas Tanure   2022-01-17  349  	 */
7b2f3eb492dac76 Lucas Tanure   2021-12-17 @350  	cs35l41->reset_gpio = fwnode_gpiod_get_index(&adev->fwnode, "reset", cs35l41->index,
7b2f3eb492dac76 Lucas Tanure   2021-12-17  351  						     GPIOD_OUT_LOW, "cs35l41-reset");
7b2f3eb492dac76 Lucas Tanure   2021-12-17  352  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  353  	property = "cirrus,speaker-position";
8c286a0f973a812 Lucas Tanure   2022-01-17  354  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  355  	if (ret)
f7f207375d4e6eb Lucas Tanure   2022-04-13  356  		goto err;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  357  	hw_cfg->spk_pos = values[cs35l41->index];
7b2f3eb492dac76 Lucas Tanure   2021-12-17  358  
00f87ec74c3c096 Stefan Binding 2022-05-09  359  	cs35l41->channel_index = 0;
00f87ec74c3c096 Stefan Binding 2022-05-09  360  	for (i = 0; i < cs35l41->index; i++)
00f87ec74c3c096 Stefan Binding 2022-05-09  361  		if (values[i] == hw_cfg->spk_pos)
00f87ec74c3c096 Stefan Binding 2022-05-09  362  			cs35l41->channel_index++;
00f87ec74c3c096 Stefan Binding 2022-05-09  363  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  364  	property = "cirrus,gpio1-func";
8c286a0f973a812 Lucas Tanure   2022-01-17  365  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  366  	if (ret)
f7f207375d4e6eb Lucas Tanure   2022-04-13  367  		goto err;
f7f207375d4e6eb Lucas Tanure   2022-04-13  368  	hw_cfg->gpio1.func = values[cs35l41->index];
2603c974b45dbfe Lucas Tanure   2022-04-13  369  	hw_cfg->gpio1.valid = true;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  370  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  371  	property = "cirrus,gpio2-func";
8c286a0f973a812 Lucas Tanure   2022-01-17  372  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  373  	if (ret)
f7f207375d4e6eb Lucas Tanure   2022-04-13  374  		goto err;
f7f207375d4e6eb Lucas Tanure   2022-04-13  375  	hw_cfg->gpio2.func = values[cs35l41->index];
2603c974b45dbfe Lucas Tanure   2022-04-13  376  	hw_cfg->gpio2.valid = true;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  377  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  378  	property = "cirrus,boost-peak-milliamp";
8c286a0f973a812 Lucas Tanure   2022-01-17  379  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  380  	if (ret == 0)
7b2f3eb492dac76 Lucas Tanure   2021-12-17  381  		hw_cfg->bst_ipk = values[cs35l41->index];
2603c974b45dbfe Lucas Tanure   2022-04-13  382  	else
2603c974b45dbfe Lucas Tanure   2022-04-13  383  		hw_cfg->bst_ipk = -1;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  384  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  385  	property = "cirrus,boost-ind-nanohenry";
8c286a0f973a812 Lucas Tanure   2022-01-17  386  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  387  	if (ret == 0)
7b2f3eb492dac76 Lucas Tanure   2021-12-17  388  		hw_cfg->bst_ind = values[cs35l41->index];
2603c974b45dbfe Lucas Tanure   2022-04-13  389  	else
2603c974b45dbfe Lucas Tanure   2022-04-13  390  		hw_cfg->bst_ind = -1;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  391  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  392  	property = "cirrus,boost-cap-microfarad";
8c286a0f973a812 Lucas Tanure   2022-01-17  393  	ret = device_property_read_u32_array(physdev, property, values, nval);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  394  	if (ret == 0)
7b2f3eb492dac76 Lucas Tanure   2021-12-17  395  		hw_cfg->bst_cap = values[cs35l41->index];
2603c974b45dbfe Lucas Tanure   2022-04-13  396  	else
2603c974b45dbfe Lucas Tanure   2022-04-13  397  		hw_cfg->bst_cap = -1;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  398  
b8388a1aba32bef Lucas Tanure   2022-04-13  399  	if (hw_cfg->bst_ind > 0 || hw_cfg->bst_cap > 0 || hw_cfg->bst_ipk > 0)
b8388a1aba32bef Lucas Tanure   2022-04-13  400  		hw_cfg->bst_type = CS35L41_INT_BOOST;
b8388a1aba32bef Lucas Tanure   2022-04-13  401  	else
b8388a1aba32bef Lucas Tanure   2022-04-13  402  		hw_cfg->bst_type = CS35L41_EXT_BOOST;
b8388a1aba32bef Lucas Tanure   2022-04-13  403  
2603c974b45dbfe Lucas Tanure   2022-04-13  404  	hw_cfg->valid = true;
8c286a0f973a812 Lucas Tanure   2022-01-17  405  	put_device(physdev);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  406  
f7f207375d4e6eb Lucas Tanure   2022-04-13  407  	return 0;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  408  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  409  err:
8c286a0f973a812 Lucas Tanure   2022-01-17  410  	put_device(physdev);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  411  	dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  412  
f7f207375d4e6eb Lucas Tanure   2022-04-13  413  	return ret;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  414  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  415  no_acpi_dsd:
7b2f3eb492dac76 Lucas Tanure   2021-12-17  416  	/*
7b2f3eb492dac76 Lucas Tanure   2021-12-17  417  	 * Device CLSA0100 doesn't have _DSD so a gpiod_get by the label reset won't work.
7b2f3eb492dac76 Lucas Tanure   2021-12-17  418  	 * And devices created by i2c-multi-instantiate don't have their device struct pointing to
8c286a0f973a812 Lucas Tanure   2022-01-17  419  	 * the correct fwnode, so acpi_dev must be used here.
7b2f3eb492dac76 Lucas Tanure   2021-12-17  420  	 * And devm functions expect that the device requesting the resource has the correct
8c286a0f973a812 Lucas Tanure   2022-01-17  421  	 * fwnode.
7b2f3eb492dac76 Lucas Tanure   2021-12-17  422  	 */
7b2f3eb492dac76 Lucas Tanure   2021-12-17  423  	if (strncmp(hid, "CLSA0100", 8) != 0)
f7f207375d4e6eb Lucas Tanure   2022-04-13  424  		return -EINVAL;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  425  
7b2f3eb492dac76 Lucas Tanure   2021-12-17  426  	/* check I2C address to assign the index */
7b2f3eb492dac76 Lucas Tanure   2021-12-17  427  	cs35l41->index = id == 0x40 ? 0 : 1;
775d667539a4dd8 Stefan Binding 2022-05-09  428  	cs35l41->hw_cfg.spk_pos = cs35l41->index;
00f87ec74c3c096 Stefan Binding 2022-05-09  429  	cs35l41->channel_index = 0;
8c286a0f973a812 Lucas Tanure   2022-01-17  430  	cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
b8388a1aba32bef Lucas Tanure   2022-04-13  431  	cs35l41->hw_cfg.bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
de8cab7b38d74e7 Stefan Binding 2022-05-09  432  	hw_cfg->gpio2.func = CS35L41_GPIO2_INT_OPEN_DRAIN;
de8cab7b38d74e7 Stefan Binding 2022-05-09  433  	hw_cfg->gpio2.valid = true;
2603c974b45dbfe Lucas Tanure   2022-04-13  434  	cs35l41->hw_cfg.valid = true;
8c286a0f973a812 Lucas Tanure   2022-01-17  435  	put_device(physdev);
7b2f3eb492dac76 Lucas Tanure   2021-12-17  436  
f7f207375d4e6eb Lucas Tanure   2022-04-13  437  	return 0;
7b2f3eb492dac76 Lucas Tanure   2021-12-17  438  }
7b2f3eb492dac76 Lucas Tanure   2021-12-17  439  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging
  2022-07-11  9:52 [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Andy Shevchenko
                   ` (2 preceding siblings ...)
  2022-07-11  9:52 ` [PATCH v1 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 Andy Shevchenko
@ 2022-07-12  9:18 ` Takashi Iwai
  2022-07-12 10:01   ` Andy Shevchenko
  3 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2022-07-12  9:18 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: alsa-devel, Lucas Tanure, patches, Takashi Iwai, linux-kernel,
	Richard Fitzgerald, James Schulman, David Rhodes

On Mon, 11 Jul 2022 11:52:16 +0200,
Andy Shevchenko wrote:
> 
> Drop duplicate print of returned value in the messages and use pattern
> return dev_err_probe(...) where it's possible.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied this one, but postpone the rest three patches, as there seems
a build regression according 0day bot.


thanks,

Takashi

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

* Re: [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging
  2022-07-12  9:18 ` [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Takashi Iwai
@ 2022-07-12 10:01   ` Andy Shevchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-07-12 10:01 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: ALSA Development Mailing List, Lucas Tanure, patches,
	Takashi Iwai, Linux Kernel Mailing List, Richard Fitzgerald,
	James Schulman, Andy Shevchenko, David Rhodes

On Tue, Jul 12, 2022 at 11:35 AM Takashi Iwai <tiwai@suse.de> wrote:
>
> On Mon, 11 Jul 2022 11:52:16 +0200,
> Andy Shevchenko wrote:
> >
> > Drop duplicate print of returned value in the messages and use pattern
> > return dev_err_probe(...) where it's possible.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Applied this one, but postpone the rest three patches, as there seems
> a build regression according 0day bot.

Thanks and sorry for that, something (mis)happens, I'll test it
carefully for v2.

-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2022-07-12 10:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-11  9:52 [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Andy Shevchenko
2022-07-11  9:52 ` [PATCH v1 2/4] ALSA: hda: cs35l41: Allow compilation test on non-ACPI configurations Andy Shevchenko
2022-07-12  4:38   ` kernel test robot
2022-07-11  9:52 ` [PATCH v1 3/4] ALSA: hda: cs35l41: Drop wrong use of ACPI_PTR() Andy Shevchenko
2022-07-11  9:52 ` [PATCH v1 4/4] ALSA: hda: cs35l41: Consolidate selections under SND_HDA_SCODEC_CS35L41 Andy Shevchenko
2022-07-12  9:18 ` [PATCH v1 1/4] ALSA: hda: cs35l41: Improve dev_err_probe() messaging Takashi Iwai
2022-07-12 10:01   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox