Content-Type: multipart/mixed; boundary="===============3325740221052248453==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: Re: [PATCH v3] ASoC: adds component driver for TAS575xM digital amplifiers Date: Thu, 13 Jan 2022 02:42:47 +0800 Message-ID: <202201130224.PtfT1pHZ-lkp@intel.com> In-Reply-To: <20220110084554.2228-1-joerg@hifiberry.com> List-Id: --===============3325740221052248453== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Joerg, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on broonie-sound/for-next] [also build test WARNING on v5.16 next-20220112] [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/Joerg-Schambacher/ASoC-add= s-component-driver-for-TAS575xM-digital-amplifiers/20220110-164852 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git f= or-next config: arm-randconfig-r034-20220112 (https://download.01.org/0day-ci/archi= ve/20220113/202201130224.PtfT1pHZ-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 244dd2= 913a43a200f5a6544d424cdc37b771028b) 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 # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://github.com/0day-ci/linux/commit/194435492a87ace959d74aae1= cecb27f16ad8966 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Joerg-Schambacher/ASoC-adds-compon= ent-driver-for-TAS575xM-digital-amplifiers/20220110-164852 git checkout 194435492a87ace959d74aae1cecb27f16ad8966 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross W=3D= 1 O=3Dbuild_dir ARCH=3Darm SHELL=3D/bin/bash sound/soc/codecs/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> sound/soc/codecs/tas5754m.c:273:5: warning: no previous prototype for fu= nction 'tas5754m_set_clock_tree_master' [-Wmissing-prototypes] int tas5754m_set_clock_tree_master(struct snd_soc_dai *dai, ^ sound/soc/codecs/tas5754m.c:273:1: note: declare 'static' if the functio= n is not intended to be used outside of this translation unit int tas5754m_set_clock_tree_master(struct snd_soc_dai *dai, ^ static = >> sound/soc/codecs/tas5754m.c:346:5: warning: no previous prototype for fu= nction 'tas5754m_set_dai_mode' [-Wmissing-prototypes] int tas5754m_set_dai_mode(struct snd_soc_dai *dai) ^ sound/soc/codecs/tas5754m.c:346:1: note: declare 'static' if the functio= n is not intended to be used outside of this translation unit int tas5754m_set_dai_mode(struct snd_soc_dai *dai) ^ static = >> sound/soc/codecs/tas5754m.c:417:23: warning: converting the result of '<= <' to a boolean always evaluates to true [-Wtautological-constant-compare] !TAS5754M_RLRK | !TAS5754M_RBCK, ^ sound/soc/codecs/tas5754m.h:145:32: note: expanded from macro 'TAS5754M_= RBCK' #define TAS5754M_RBCK (1 << 1) ^ sound/soc/codecs/tas5754m.c:417:6: warning: converting the result of '<<= ' to a boolean always evaluates to true [-Wtautological-constant-compare] !TAS5754M_RLRK | !TAS5754M_RBCK, ^ sound/soc/codecs/tas5754m.h:143:32: note: expanded from macro 'TAS5754M_= RLRK' #define TAS5754M_RLRK (1 << 0) ^ >> sound/soc/codecs/tas5754m.c:395:5: warning: no previous prototype for fu= nction 'tas5754m_set_dividers_master' [-Wmissing-prototypes] int tas5754m_set_dividers_master(struct snd_soc_dai *dai, ^ sound/soc/codecs/tas5754m.c:395:1: note: declare 'static' if the functio= n is not intended to be used outside of this translation unit int tas5754m_set_dividers_master(struct snd_soc_dai *dai, ^ static = >> sound/soc/codecs/tas5754m.c:608:6: warning: variable 'ret' is uninitiali= zed when used here [-Wuninitialized] if (ret !=3D 0) { ^~~ sound/soc/codecs/tas5754m.c:597:9: note: initialize the variable 'ret' t= o silence this warning int ret; ^ =3D 0 6 warnings generated. vim +/tas5754m_set_clock_tree_master +273 sound/soc/codecs/tas5754m.c 272 = > 273 int tas5754m_set_clock_tree_master(struct snd_soc_dai *dai, 274 struct snd_pcm_hw_params *params) 275 { 276 struct snd_soc_component *component =3D dai->component; 277 struct tas5754m_priv *tas5754m =3D 278 snd_soc_component_get_drvdata(component); 279 static const struct reg_sequence pll_settings[] =3D { 280 { TAS5754M_PLL_COEFF_P, 0x01 }, // P=3D2 281 { TAS5754M_PLL_COEFF_J, 0x08 }, // J=3D8 282 { TAS5754M_PLL_COEFF_DL, 0x00 }, // D12-8 =3D 0 283 { TAS5754M_PLL_COEFF_DH, 0x00 }, // D7-0 =3D 0 284 { TAS5754M_PLL_COEFF_R, 0x00 }, // R=3D1 285 }; 286 int ret; 287 = 288 /* disable PLL before any clock tree change */ 289 ret =3D regmap_update_bits(tas5754m->regmap, TAS5754M_PLL_EN, 290 TAS5754M_PLLE, 0); 291 if (ret !=3D 0) { 292 dev_err(component->dev, "Failed to disable PLL: %d\n", ret); 293 return ret; 294 } 295 = 296 /* set DAC clock source to MCLK */ 297 ret =3D regmap_write(tas5754m->regmap, TAS5754M_DAC_REF, 0x30); 298 if (ret !=3D 0) { 299 dev_err(component->dev, "Failed to set DAC ref\n"); 300 return ret; 301 } 302 = 303 /* run PLL at fixed ratio to MCLK */ 304 ret =3D regmap_multi_reg_write(tas5754m->regmap, pll_settings, 305 ARRAY_SIZE(pll_settings)); 306 if (ret !=3D 0) { 307 dev_err(component->dev, "Failed to set PLL ratio\n"); 308 return ret; 309 } 310 = 311 /* set DSP divider to 2 =3D> reg 0x01 */ 312 ret =3D regmap_write(tas5754m->regmap, TAS5754M_DSP_CLKDIV, 1); 313 if (ret !=3D 0) { 314 dev_err(component->dev, "Failed to set DSP divider\n"); 315 return ret; 316 } 317 /* set DAC divider to 4 =3D> reg 0x03*/ 318 ret =3D regmap_write(tas5754m->regmap, TAS5754M_DAC_CLKDIV, 3); 319 if (ret !=3D 0) { 320 dev_err(component->dev, "Failed to set OSDACR divider\n"); 321 return ret; 322 } 323 /* set OSR divider to 1 */ 324 ret =3D regmap_write(tas5754m->regmap, TAS5754M_OSR_CLKDIV, 0); 325 if (ret !=3D 0) { 326 dev_err(component->dev, "Failed to set OSR divider\n"); 327 return ret; 328 } 329 /* set CP divider to 4 =3D> reg 0x03*/ 330 ret =3D regmap_write(tas5754m->regmap, TAS5754M_NCP_CLKDIV, 3); 331 if (ret !=3D 0) { 332 dev_err(component->dev, "Failed to set CP divider\n"); 333 return ret; 334 } 335 /* finally enable PLL */ 336 ret =3D regmap_update_bits(tas5754m->regmap, TAS5754M_PLL_EN, 337 TAS5754M_PLLE, 1); 338 if (ret !=3D 0) { 339 dev_err(component->dev, "Failed to enable PLL: %d\n", ret); 340 return ret; 341 } 342 = 343 return 0; 344 } 345 = > 346 int tas5754m_set_dai_mode(struct snd_soc_dai *dai) 347 { 348 struct snd_soc_component *component =3D dai->component; 349 struct tas5754m_priv *tas5754m =3D 350 snd_soc_component_get_drvdata(component); 351 int fmt =3D tas5754m->fmt; 352 = 353 /* only I2S MASTER mode implemented */ 354 if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) !=3D SND_SOC_DAIFMT_I2S)) { 355 dev_err(component->dev, 356 "DAI format not supported (I2S master only)\n"); 357 return -EINVAL; 358 } 359 /* TAS5754/6m do not support inverted clocks in MASTER mode */ 360 if (((fmt & SND_SOC_DAIFMT_CLOCK_MASK) !=3D SND_SOC_DAIFMT_NB_NF)) { 361 dev_err(component->dev, "Inverted clocks not supported\n"); 362 return -EINVAL; 363 } 364 = 365 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 366 case SND_SOC_DAIFMT_CBM_CFM: 367 regmap_update_bits(tas5754m->regmap, 368 TAS5754M_BCLK_LRCLK_CFG, 369 TAS5754M_LRKO | TAS5754M_BCKO, 370 TAS5754M_LRKO | TAS5754M_BCKO); 371 /* reset CLK dividers */ 372 regmap_update_bits(tas5754m->regmap, 373 TAS5754M_MASTER_MODE, 374 0x00, 375 TAS5754M_RLRK | TAS5754M_RBCK); 376 /* ignore all clock error detection but MCLK */ 377 regmap_update_bits(tas5754m->regmap, 378 TAS5754M_ERROR_DETECT, 379 TAS5754M_IPLK | TAS5754M_DCAS | 380 TAS5754M_IDCM | TAS5754M_IDSK | 381 TAS5754M_IDBK | TAS5754M_IDFS, 382 TAS5754M_IPLK | TAS5754M_DCAS | 383 TAS5754M_IDCM | TAS5754M_IDSK | 384 TAS5754M_IDBK | TAS5754M_IDFS); 385 break; 386 case SND_SOC_DAIFMT_CBS_CFS: 387 case SND_SOC_DAIFMT_CBM_CFS: 388 default: 389 return -EINVAL; 390 } 391 = 392 return 0; 393 } 394 = > 395 int tas5754m_set_dividers_master(struct snd_soc_dai *dai, 396 struct snd_pcm_hw_params *params) 397 { 398 struct snd_soc_component *component =3D dai->component; 399 struct tas5754m_priv *tas5754m =3D 400 snd_soc_component_get_drvdata(component); 401 unsigned long bclk; 402 unsigned long mclk; 403 int bclk_div; 404 int lrclk_div; 405 int osr; 406 int ret; 407 = 408 mclk =3D clk_get_rate(tas5754m->sclk); 409 bclk =3D tas5754m->sample_len * 2 * params_rate(params); 410 bclk_div =3D mclk / bclk; 411 lrclk_div =3D tas5754m->sample_len * 2; 412 osr =3D mclk / 4 / params_rate(params) / 16; 413 = 414 // stop LR / SCLK clocks 415 ret =3D regmap_update_bits(tas5754m->regmap, 416 TAS5754M_MASTER_MODE, > 417 !TAS5754M_RLRK | !TAS5754M_RBCK, 418 TAS5754M_RLRK | TAS5754M_RBCK); 419 if (ret !=3D 0) { 420 dev_err(component->dev, "Failed to stop PLL\n"); 421 return ret; 422 } 423 = 424 // set SCLK divider 425 ret =3D regmap_write(tas5754m->regmap, TAS5754M_MASTER_SCLKDIV, 426 bclk_div - 1); 427 if (ret !=3D 0) { 428 dev_err(component->dev, "Failed to set SCLK divider\n"); 429 return ret; 430 } 431 = 432 // set LRCLK divider 433 ret =3D regmap_write(tas5754m->regmap, TAS5754M_MASTER_LRCLKDIV, 434 lrclk_div - 1); 435 if (ret !=3D 0) { 436 dev_err(component->dev, "Failed to set LRCLK divider\n"); 437 return ret; 438 } 439 = 440 ret =3D regmap_write(tas5754m->regmap, 441 TAS5754M_OSR_CLKDIV, osr - 1); 442 if (ret !=3D 0) { 443 dev_err(component->dev, "Failed to set OSR divider\n"); 444 return ret; 445 } 446 = 447 // restart LR / SCLK clocks 448 ret =3D regmap_update_bits(tas5754m->regmap, 449 TAS5754M_MASTER_MODE, 450 TAS5754M_RLRK | TAS5754M_RBCK, 451 TAS5754M_RLRK | TAS5754M_RBCK); 452 if (ret !=3D 0) { 453 dev_err(component->dev, "Failed to restart PLL\n"); 454 return ret; 455 } 456 = 457 return 0; 458 } 459 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============3325740221052248453==--