From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3971582556220202306==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v5 07/10] hda: cs35l41: Add support for CS35L41 in HDA systems Date: Fri, 17 Dec 2021 00:29:09 +0800 Message-ID: <202112170043.mK2wMAmZ-lkp@intel.com> In-Reply-To: <20211216114332.153409-8-tanureal@opensource.cirrus.com> List-Id: --===============3971582556220202306== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Lucas, I love your patch! Yet something to improve: [auto build test ERROR on next-20211215] [cannot apply to broonie-sound/for-next tiwai-sound/for-next rafael-pm/linu= x-next linus/master v5.16-rc5 v5.16-rc4 v5.16-rc3 v5.16-rc5] [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/Add-support-f= or-CS35L41-in-HDA-systems/20211216-194807 base: 93bf6eee76c0e716f6b32de690b1c52991547bb4 config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20211217/2= 02112170043.mK2wMAmZ-lkp(a)intel.com/config) compiler: sh4-linux-gcc (GCC) 11.2.0 reproduce (this is a W=3D1 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/0day-ci/linux/commit/40112a770ed88d6d545d83a80= 0fb9b125204272a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Lucas-Tanure/Add-support-for-CS35L= 41-in-HDA-systems/20211216-194807 git checkout 40112a770ed88d6d545d83a800fb9b125204272a # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dgcc-11.2.0 make.cross= O=3Dbuild_dir ARCH=3Dsh SHELL=3D/bin/bash sound/pci/hda/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): >> sound/pci/hda/cs35l41_hda.c:180:5: warning: no previous prototype for 'c= s35l41_hda_bind' [-Wmissing-prototypes] 180 | int cs35l41_hda_bind(struct device *dev, struct device *master, = void *master_data) | ^~~~~~~~~~~~~~~~ sound/pci/hda/cs35l41_hda.c: In function 'cs35l41_hda_read_acpi': >> sound/pci/hda/cs35l41_hda.c:315:59: error: invalid use of undefined type= 'struct acpi_device' 315 | cs35l41->reset_gpio =3D fwnode_gpiod_get_index(&adev->fw= node, "reset", cs35l41->index, | ^~ vim +315 sound/pci/hda/cs35l41_hda.c 179 = > 180 int cs35l41_hda_bind(struct device *dev, struct device *master, void= *master_data) 181 { 182 struct cs35l41_hda *cs35l41 =3D dev_get_drvdata(dev); 183 struct hda_component *comps =3D master_data; 184 = 185 if (comps && cs35l41->index >=3D 0 && cs35l41->index < HDA_MAX_COMP= ONENTS) 186 comps =3D &comps[cs35l41->index]; 187 else 188 return -EINVAL; 189 = 190 if (!comps->dev) { 191 comps->dev =3D dev; 192 strscpy(comps->name, dev_name(dev), sizeof(comps->name)); 193 comps->playback_hook =3D cs35l41_hda_playback_hook; 194 comps->set_channel_map =3D cs35l41_hda_channel_map; 195 return 0; 196 } 197 = 198 return -EBUSY; 199 } 200 = 201 static void cs35l41_hda_unbind(struct device *dev, struct device *ma= ster, void *master_data) 202 { 203 struct cs35l41_hda *cs35l41 =3D dev_get_drvdata(dev); 204 struct hda_component *comps =3D master_data; 205 = 206 if (comps[cs35l41->index].dev =3D=3D dev) 207 memset(&comps[cs35l41->index], 0, sizeof(*comps)); 208 } 209 = 210 static const struct component_ops cs35l41_hda_comp_ops =3D { 211 .bind =3D cs35l41_hda_bind, 212 .unbind =3D cs35l41_hda_unbind, 213 }; 214 = 215 static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41, 216 const struct cs35l41_hda_hw_config *hw_cfg) 217 { 218 bool internal_boost =3D false; 219 int ret; 220 = 221 if (!hw_cfg) { 222 cs35l41->reg_seq =3D &cs35l41_hda_reg_seq_no_bst; 223 return 0; 224 } 225 = 226 if (hw_cfg->bst_ind || hw_cfg->bst_cap || hw_cfg->bst_ipk) 227 internal_boost =3D true; 228 = 229 switch (hw_cfg->gpio1_func) { 230 case CS35l41_VSPK_SWITCH: 231 regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, 232 CS35L41_GPIO1_CTRL_MASK, 1 << CS35L41_GPIO1_CTRL_SHIFT); 233 break; 234 case CS35l41_SYNC: 235 regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, 236 CS35L41_GPIO1_CTRL_MASK, 2 << CS35L41_GPIO1_CTRL_SHIFT); 237 break; 238 } 239 = 240 switch (hw_cfg->gpio2_func) { 241 case CS35L41_INTERRUPT: 242 regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, 243 CS35L41_GPIO2_CTRL_MASK, 2 << CS35L41_GPIO2_CTRL_SHIFT); 244 break; 245 } 246 = 247 if (internal_boost) { 248 cs35l41->reg_seq =3D &cs35l41_hda_reg_seq_int_bst; 249 if (!(hw_cfg->bst_ind && hw_cfg->bst_cap && hw_cfg->bst_ipk)) 250 return -EINVAL; 251 ret =3D cs35l41_boost_config(cs35l41->dev, cs35l41->regmap, 252 hw_cfg->bst_ind, hw_cfg->bst_cap, hw_cfg->bst_ipk); 253 if (ret) 254 return ret; 255 } else { 256 cs35l41->reg_seq =3D &cs35l41_hda_reg_seq_ext_bst; 257 } 258 = 259 ret =3D cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, (unsigned= int *)&hw_cfg->spk_pos); 260 if (ret) 261 return ret; 262 = 263 return 0; 264 } 265 = 266 static struct cs35l41_hda_hw_config *cs35l41_hda_read_acpi(struct cs= 35l41_hda *cs35l41, 267 const char *hid, int id) 268 { 269 struct cs35l41_hda_hw_config *hw_cfg; 270 u32 values[HDA_MAX_COMPONENTS]; 271 struct acpi_device *adev; 272 struct device *acpi_dev; 273 char *property; 274 size_t nval; 275 int i, ret; 276 = 277 adev =3D acpi_dev_get_first_match_dev(hid, NULL, -1); 278 if (!adev) { 279 dev_err(cs35l41->dev, "Failed to find an ACPI device for %s\n", hi= d); 280 return ERR_PTR(-ENODEV); 281 } 282 = 283 acpi_dev =3D get_device(acpi_get_first_physical_node(adev)); 284 acpi_dev_put(adev); 285 = 286 property =3D "cirrus,dev-index"; 287 ret =3D device_property_count_u32(acpi_dev, property); 288 if (ret <=3D 0) 289 goto no_acpi_dsd; 290 = 291 if (ret > ARRAY_SIZE(values)) { 292 ret =3D -EINVAL; 293 goto err; 294 } 295 nval =3D ret; 296 = 297 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 298 if (ret) 299 goto err; 300 = 301 cs35l41->index =3D -1; 302 for (i =3D 0; i < nval; i++) { 303 if (values[i] =3D=3D id) { 304 cs35l41->index =3D i; 305 break; 306 } 307 } 308 if (cs35l41->index =3D=3D -1) { 309 dev_err(cs35l41->dev, "No index found in %s\n", property); 310 ret =3D -ENODEV; 311 goto err; 312 } 313 = 314 /* No devm_ version as CLSA0100, in no_acpi_dsd case, can't use dev= m version */ > 315 cs35l41->reset_gpio =3D fwnode_gpiod_get_index(&adev->fwnode, "rese= t", cs35l41->index, 316 GPIOD_OUT_LOW, "cs35l41-reset"); 317 = 318 hw_cfg =3D kzalloc(sizeof(*hw_cfg), GFP_KERNEL); 319 if (!hw_cfg) { 320 ret =3D -ENOMEM; 321 goto err; 322 } 323 = 324 property =3D "cirrus,speaker-position"; 325 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 326 if (ret) 327 goto err_free; 328 hw_cfg->spk_pos =3D values[cs35l41->index]; 329 = 330 property =3D "cirrus,gpio1-func"; 331 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 332 if (ret) 333 goto err_free; 334 hw_cfg->gpio1_func =3D values[cs35l41->index]; 335 = 336 property =3D "cirrus,gpio2-func"; 337 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 338 if (ret) 339 goto err_free; 340 hw_cfg->gpio2_func =3D values[cs35l41->index]; 341 = 342 property =3D "cirrus,boost-peak-milliamp"; 343 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 344 if (ret =3D=3D 0) 345 hw_cfg->bst_ipk =3D values[cs35l41->index]; 346 = 347 property =3D "cirrus,boost-ind-nanohenry"; 348 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 349 if (ret =3D=3D 0) 350 hw_cfg->bst_ind =3D values[cs35l41->index]; 351 = 352 property =3D "cirrus,boost-cap-microfarad"; 353 ret =3D device_property_read_u32_array(acpi_dev, property, values, = nval); 354 if (ret =3D=3D 0) 355 hw_cfg->bst_cap =3D values[cs35l41->index]; 356 = 357 put_device(acpi_dev); 358 = 359 return hw_cfg; 360 = 361 err_free: 362 kfree(hw_cfg); 363 err: 364 put_device(acpi_dev); 365 dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret); 366 = 367 return ERR_PTR(ret); 368 = 369 no_acpi_dsd: 370 /* 371 * Device CLSA0100 doesn't have _DSD so a gpiod_get by the label re= set won't work. 372 * And devices created by i2c-multi-instantiate don't have their de= vice struct pointing to 373 * the correct fwnode, so acpi_dev must be used here 374 * And devm functions expect that the device requesting the resourc= e has the correct 375 * fwnode 376 */ 377 if (strncmp(hid, "CLSA0100", 8) !=3D 0) 378 return ERR_PTR(-EINVAL); 379 = 380 /* check I2C address to assign the index */ 381 cs35l41->index =3D id =3D=3D 0x40 ? 0 : 1; 382 cs35l41->reset_gpio =3D gpiod_get_index(acpi_dev, NULL, 0, GPIOD_OU= T_HIGH); 383 cs35l41->vspk_always_on =3D true; 384 put_device(acpi_dev); 385 = 386 return NULL; 387 } 388 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============3971582556220202306==--