public inbox for [email protected]
 help / color / mirror / Atom feed
From: kernel test robot <[email protected]>
To: Raphael-Xu <[email protected]>
Cc: [email protected],
	GNU/Weeb Mailing List <[email protected]>,
	[email protected], Mark Brown <[email protected]>
Subject: [ammarfaizi2-block:broonie/sound/for-next 368/430] sound/soc/codecs/tas2780.c:160:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
Date: Wed, 13 Jul 2022 09:21:34 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

tree:   https://github.com/ammarfaizi2/linux-block broonie/sound/for-next
head:   f1416233aa125b29375bc2980e225e77b11d79f4
commit: eae9f9ce181be4f47dcba1ee93185b71cac3f312 [368/430] ASoC: add tas2780 driver
config: arm-randconfig-s031-20220712 (https://download.01.org/0day-ci/archive/20220713/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/ammarfaizi2/linux-block/commit/eae9f9ce181be4f47dcba1ee93185b71cac3f312
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block broonie/sound/for-next
        git checkout eae9f9ce181be4f47dcba1ee93185b71cac3f312
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash sound/soc/codecs/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)
>> sound/soc/codecs/tas2780.c:160:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
   sound/soc/codecs/tas2780.c:167:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
   sound/soc/codecs/tas2780.c:174:14: sparse: sparse: restricted snd_pcm_format_t degrades to integer
>> sound/soc/codecs/tas2780.c:288:58: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected int bitwidth @@     got restricted snd_pcm_format_t @@
   sound/soc/codecs/tas2780.c:288:58: sparse:     expected int bitwidth
   sound/soc/codecs/tas2780.c:288:58: sparse:     got restricted snd_pcm_format_t

vim +160 sound/soc/codecs/tas2780.c

   150	
   151	static int tas2780_set_bitwidth(struct tas2780_priv *tas2780, int bitwidth)
   152	{
   153		struct snd_soc_component *component = tas2780->component;
   154		int sense_en;
   155		int val;
   156		int ret;
   157		int slot_size;
   158	
   159		switch (bitwidth) {
 > 160		case SNDRV_PCM_FORMAT_S16_LE:
   161			ret = snd_soc_component_update_bits(component,
   162				TAS2780_TDM_CFG2,
   163				TAS2780_TDM_CFG2_RXW_MASK,
   164				TAS2780_TDM_CFG2_RXW_16BITS);
   165			slot_size = TAS2780_TDM_CFG2_RXS_16BITS;
   166			break;
   167		case SNDRV_PCM_FORMAT_S24_LE:
   168			ret = snd_soc_component_update_bits(component,
   169				TAS2780_TDM_CFG2,
   170				TAS2780_TDM_CFG2_RXW_MASK,
   171				TAS2780_TDM_CFG2_RXW_24BITS);
   172			slot_size = TAS2780_TDM_CFG2_RXS_24BITS;
   173			break;
   174		case SNDRV_PCM_FORMAT_S32_LE:
   175			ret = snd_soc_component_update_bits(component,
   176				TAS2780_TDM_CFG2,
   177				TAS2780_TDM_CFG2_RXW_MASK,
   178				TAS2780_TDM_CFG2_RXW_32BITS);
   179			slot_size = TAS2780_TDM_CFG2_RXS_32BITS;
   180			break;
   181	
   182		default:
   183			ret = -EINVAL;
   184		}
   185	
   186		if (ret < 0) {
   187			dev_err(tas2780->dev, "%s:errCode:0x%x set bitwidth error\n",
   188				__func__, ret);
   189			goto err;
   190		}
   191	
   192		ret = snd_soc_component_update_bits(component, TAS2780_TDM_CFG2,
   193			TAS2780_TDM_CFG2_RXS_MASK, slot_size);
   194		if (ret < 0) {
   195			dev_err(tas2780->dev,
   196				"%s:errCode:0x%x set RX slot size error\n",
   197				__func__, ret);
   198			goto err;
   199		}
   200	
   201		val = snd_soc_component_read(tas2780->component, TAS2780_PWR_CTRL);
   202		if (val < 0) {
   203			dev_err(tas2780->dev, "%s:errCode:0x%x read PWR_CTRL error\n",
   204				__func__, val);
   205			ret = val;
   206			goto err;
   207		}
   208	
   209		if (val & (1 << TAS2780_VSENSE_POWER_EN))
   210			sense_en = 0;
   211		else
   212			sense_en = TAS2780_TDM_CFG5_VSNS_ENABLE;
   213	
   214		ret = snd_soc_component_update_bits(tas2780->component,
   215			TAS2780_TDM_CFG5, TAS2780_TDM_CFG5_VSNS_ENABLE, sense_en);
   216		if (ret < 0) {
   217			dev_err(tas2780->dev, "%s:errCode:0x%x enable vSNS error\n",
   218				__func__, ret);
   219			goto err;
   220		}
   221	
   222		if (val & (1 << TAS2780_ISENSE_POWER_EN))
   223			sense_en = 0;
   224		else
   225			sense_en = TAS2780_TDM_CFG6_ISNS_ENABLE;
   226	
   227		ret = snd_soc_component_update_bits(tas2780->component,
   228			TAS2780_TDM_CFG6, TAS2780_TDM_CFG6_ISNS_ENABLE, sense_en);
   229		if (ret < 0) {
   230			dev_err(tas2780->dev, "%s:errCode:0x%x enable iSNS error\n",
   231				__func__, ret);
   232			goto err;
   233		}
   234		ret = 0;
   235	err:
   236		return ret;
   237	}
   238	
   239	static int tas2780_set_samplerate(
   240		struct tas2780_priv *tas2780, int samplerate)
   241	{
   242		struct snd_soc_component *component = tas2780->component;
   243		int ramp_rate_val;
   244		int ret;
   245	
   246		switch (samplerate) {
   247		case 48000:
   248			ramp_rate_val = TAS2780_TDM_CFG0_SMP_48KHZ |
   249					TAS2780_TDM_CFG0_44_1_48KHZ;
   250			break;
   251		case 44100:
   252			ramp_rate_val = TAS2780_TDM_CFG0_SMP_44_1KHZ |
   253					TAS2780_TDM_CFG0_44_1_48KHZ;
   254			break;
   255		case 96000:
   256			ramp_rate_val = TAS2780_TDM_CFG0_SMP_48KHZ |
   257					TAS2780_TDM_CFG0_88_2_96KHZ;
   258			break;
   259		case 88200:
   260			ramp_rate_val = TAS2780_TDM_CFG0_SMP_44_1KHZ |
   261					TAS2780_TDM_CFG0_88_2_96KHZ;
   262			break;
   263		default:
   264			return -EINVAL;
   265		}
   266		ret = snd_soc_component_update_bits(component, TAS2780_TDM_CFG0,
   267			TAS2780_TDM_CFG0_SMP_MASK | TAS2780_TDM_CFG0_MASK,
   268			ramp_rate_val);
   269		if (ret < 0) {
   270			dev_err(tas2780->dev,
   271				"%s:errCode:0x%x Failed to set ramp_rate_val\n",
   272				__func__, ret);
   273			goto err;
   274		}
   275		ret = 0;
   276	err:
   277		return ret;
   278	}
   279	
   280	static int tas2780_hw_params(struct snd_pcm_substream *substream,
   281		struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
   282	{
   283		struct snd_soc_component *component = dai->component;
   284		struct tas2780_priv *tas2780 =
   285			snd_soc_component_get_drvdata(component);
   286		int ret;
   287	
 > 288		ret = tas2780_set_bitwidth(tas2780, params_format(params));
   289		if (ret < 0)
   290			return ret;
   291	
   292		return tas2780_set_samplerate(tas2780, params_rate(params));
   293	}
   294	

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

                 reply	other threads:[~2022-07-13  1:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox