Skip to contentSkip to conversation

ASoC: cs35l41: Steam Deck Shared boost properties quirk

PATCH Superseded Lucas Tanure 4 participants 5 messages Mar 1, 2023 – Mar 2, 2023

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ASoC: cs35l41: Steam Deck Shared boost properties quirk

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.

---
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(-)
sound/soc/codecs/cs35l41.c +9 -3
index c223d83e02cf..a9e1a7469b45 100644
@@ -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)
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 3 lines · Lucas Tanure

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
#2 lore raw
Quoted 9 lines · Mark Brown
Quoted 3 lines · Lucas Tanure

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’?

Quoted 9 lines
  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.

maintainer
#3 lore raw
In reply to Lucas Tanure
Quoted 2 lines · Lucas Tanure

+ 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

#4 lore raw
In reply to Lucas Tanure
I love your patch! Yet something to improve:

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/[email protected]/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 <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests