[PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk

Lucas Tanure posted 1 patch 2 years, 6 months ago
There is a newer version of this series
sound/soc/codecs/cs35l41.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
[PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk
Posted by Lucas Tanure 2 years, 6 months ago
Add support for Steam Deck bios old properties. If a Steam deck didn't
upgrade the BIOS, the driver should be able to handle the previous
properties for shared boost types.

Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since V2:
 - sent the wrong patch with missing fixed lines
Changes since V1:
 - else in same line as {
---
 sound/soc/codecs/cs35l41.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index c223d83e02cf..a9e1a7469b45 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -1037,9 +1037,15 @@ static int cs35l41_handle_pdata(struct device *dev, struct cs35l41_hw_cfg *hw_cf
 	unsigned int val;
 	int ret;
 
-	ret = device_property_read_u32(dev, "cirrus,boost-type", &val);
-	if (ret >= 0)
-		hw_cfg->bst_type = val;
+	if (device_property_read_bool(dev, "cirrus,shared-boost-active")){
+		hw_cfg->bst_type = CS35L41_SHD_BOOST_ACTV;
+	} else if (device_property_read_bool(dev, "cirrus,shared-boost-passive")) {
+		hw_cfg->bst_type = CS35L41_SHD_BOOST_PASS;
+	} else {
+		ret = device_property_read_u32(dev, "cirrus,boost-type", &val);
+		if (ret >= 0)
+			hw_cfg->bst_type = val;
+	}
 
 	ret = device_property_read_u32(dev, "cirrus,boost-peak-milliamp", &val);
 	if (ret >= 0)
-- 
2.39.2
Re: [PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk
Posted by kernel test robot 2 years, 6 months ago
Hi Lucas,

I love your patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.2 next-20230302]
[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/Lucas-Tanure/ASoC-cs35l41-Steam-Deck-Shared-boost-properties-quirk/20230301-204645
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/20230301124447.17672-1-lucas.tanure%40collabora.com
patch subject: [PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk
config: arm-randconfig-r031-20230302 (https://download.01.org/0day-ci/archive/20230302/202303021005.N2ff5BAJ-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/72d9f3ad356badf4a65161004a8160fb89a13669
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Lucas-Tanure/ASoC-cs35l41-Steam-Deck-Shared-boost-properties-quirk/20230301-204645
        git checkout 72d9f3ad356badf4a65161004a8160fb89a13669
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/char/tpm/ sound/soc/codecs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303021005.N2ff5BAJ-lkp@intel.com/

All errors (new ones prefixed by >>):

>> sound/soc/codecs/cs35l41.c:1041:22: error: use of undeclared identifier 'CS35L41_SHD_BOOST_ACTV'
                   hw_cfg->bst_type = CS35L41_SHD_BOOST_ACTV;
                                      ^
>> sound/soc/codecs/cs35l41.c:1043:22: error: use of undeclared identifier 'CS35L41_SHD_BOOST_PASS'
                   hw_cfg->bst_type = CS35L41_SHD_BOOST_PASS;
                                      ^
   2 errors generated.


vim +/CS35L41_SHD_BOOST_ACTV +1041 sound/soc/codecs/cs35l41.c

  1032	
  1033	static int cs35l41_handle_pdata(struct device *dev, struct cs35l41_hw_cfg *hw_cfg)
  1034	{
  1035		struct cs35l41_gpio_cfg *gpio1 = &hw_cfg->gpio1;
  1036		struct cs35l41_gpio_cfg *gpio2 = &hw_cfg->gpio2;
  1037		unsigned int val;
  1038		int ret;
  1039	
  1040		if (device_property_read_bool(dev, "cirrus,shared-boost-active")){
> 1041			hw_cfg->bst_type = CS35L41_SHD_BOOST_ACTV;
  1042		} else if (device_property_read_bool(dev, "cirrus,shared-boost-passive")) {
> 1043			hw_cfg->bst_type = CS35L41_SHD_BOOST_PASS;
  1044		} else {
  1045			ret = device_property_read_u32(dev, "cirrus,boost-type", &val);
  1046			if (ret >= 0)
  1047				hw_cfg->bst_type = val;
  1048		}
  1049	
  1050		ret = device_property_read_u32(dev, "cirrus,boost-peak-milliamp", &val);
  1051		if (ret >= 0)
  1052			hw_cfg->bst_ipk = val;
  1053		else
  1054			hw_cfg->bst_ipk = -1;
  1055	
  1056		ret = device_property_read_u32(dev, "cirrus,boost-ind-nanohenry", &val);
  1057		if (ret >= 0)
  1058			hw_cfg->bst_ind = val;
  1059		else
  1060			hw_cfg->bst_ind = -1;
  1061	
  1062		ret = device_property_read_u32(dev, "cirrus,boost-cap-microfarad", &val);
  1063		if (ret >= 0)
  1064			hw_cfg->bst_cap = val;
  1065		else
  1066			hw_cfg->bst_cap = -1;
  1067	
  1068		ret = device_property_read_u32(dev, "cirrus,asp-sdout-hiz", &val);
  1069		if (ret >= 0)
  1070			hw_cfg->dout_hiz = val;
  1071		else
  1072			hw_cfg->dout_hiz = -1;
  1073	
  1074		/* GPIO1 Pin Config */
  1075		gpio1->pol_inv = device_property_read_bool(dev, "cirrus,gpio1-polarity-invert");
  1076		gpio1->out_en = device_property_read_bool(dev, "cirrus,gpio1-output-enable");
  1077		ret = device_property_read_u32(dev, "cirrus,gpio1-src-select", &val);
  1078		if (ret >= 0) {
  1079			gpio1->func = val;
  1080			gpio1->valid = true;
  1081		}
  1082	
  1083		/* GPIO2 Pin Config */
  1084		gpio2->pol_inv = device_property_read_bool(dev, "cirrus,gpio2-polarity-invert");
  1085		gpio2->out_en = device_property_read_bool(dev, "cirrus,gpio2-output-enable");
  1086		ret = device_property_read_u32(dev, "cirrus,gpio2-src-select", &val);
  1087		if (ret >= 0) {
  1088			gpio2->func = val;
  1089			gpio2->valid = true;
  1090		}
  1091	
  1092		hw_cfg->valid = true;
  1093	
  1094		return 0;
  1095	}
  1096	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
Re: [PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk
Posted by David Rhodes 2 years, 6 months ago
On Wed, Mar 01, 2023 at 12:44:47PM +0000, Lucas Tanure wrote:
>+ if (device_property_read_bool(dev, "cirrus,shared-boost-active")){
>+ hw_cfg->bst_type = CS35L41_SHD_BOOST_ACTV;

Missing a space before the opening brace.
Check your CC list, this doesn't appear to be going to alsa-devel.

Thanks,
David

Re: [PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk
Posted by Mark Brown 2 years, 6 months ago
On Wed, Mar 01, 2023 at 12:44:47PM +0000, Lucas Tanure wrote:
> Add support for Steam Deck bios old properties. If a Steam deck didn't
> upgrade the BIOS, the driver should be able to handle the previous
> properties for shared boost types.

This doesn't build:

/build/stage/linux/sound/soc/codecs/cs35l41.c: In function ‘cs35l41_handle_pdata’:
/build/stage/linux/sound/soc/codecs/cs35l41.c:1041:36: error: ‘CS35L41_SHD_BOOST_ACTV’ undeclared (first use in this function); did you mean ‘CS35L41_EXT_BOOST’?
 1041 |                 hw_cfg->bst_type = CS35L41_SHD_BOOST_ACTV;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~
      |                                    CS35L41_EXT_BOOST
/build/stage/linux/sound/soc/codecs/cs35l41.c:1041:36: note: each undeclared identifier is reported only once for each function it appears in
/build/stage/linux/sound/soc/codecs/cs35l41.c:1043:36: error: ‘CS35L41_SHD_BOOST_PASS’ undeclared (first use in this function); did you mean ‘CS35L41_EXT_BOOST’?
 1043 |                 hw_cfg->bst_type = CS35L41_SHD_BOOST_PASS;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~
      |                                    CS35L41_EXT_BOOST

Re: [PATCH v3] ASoC: cs35l41: Steam Deck Shared boost properties quirk
Posted by Lucas Tanure 2 years, 6 months ago
On 01-03-2023 14:50, Mark Brown wrote:
> On Wed, Mar 01, 2023 at 12:44:47PM +0000, Lucas Tanure wrote:
>> Add support for Steam Deck bios old properties. If a Steam deck didn't
>> upgrade the BIOS, the driver should be able to handle the previous
>> properties for shared boost types.
> 
> This doesn't build:
> 
> /build/stage/linux/sound/soc/codecs/cs35l41.c: In function ‘cs35l41_handle_pdata’:
> /build/stage/linux/sound/soc/codecs/cs35l41.c:1041:36: error: ‘CS35L41_SHD_BOOST_ACTV’ undeclared (first use in this function); did you mean ‘CS35L41_EXT_BOOST’?
>   1041 |                 hw_cfg->bst_type = CS35L41_SHD_BOOST_ACTV;
>        |                                    ^~~~~~~~~~~~~~~~~~~~~~
>        |                                    CS35L41_EXT_BOOST
> /build/stage/linux/sound/soc/codecs/cs35l41.c:1041:36: note: each undeclared identifier is reported only once for each function it appears in
> /build/stage/linux/sound/soc/codecs/cs35l41.c:1043:36: error: ‘CS35L41_SHD_BOOST_PASS’ undeclared (first use in this function); did you mean ‘CS35L41_EXT_BOOST’?
>   1043 |                 hw_cfg->bst_type = CS35L41_SHD_BOOST_PASS;
>        |                                    ^~~~~~~~~~~~~~~~~~~~~~
>        |                                    CS35L41_EXT_BOOST
> 
My mistake, it seems I checkout the wrong tree here with the Shared 
boost patches already merged.
This patches needed the previous Shared boost series merged.
I will wait for that patches series to be merged.
Sorry About that.