All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ASoC: cpcap: new codec
@ 2021-01-22  8:35 Dan Carpenter
  2021-01-23 17:29   ` Sebastian Reichel
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2021-01-22  8:35 UTC (permalink / raw)
  To: sre; +Cc: alsa-devel

Hello Sebastian Reichel,

The patch f6cdf2d3445d: "ASoC: cpcap: new codec" from Feb 23, 2018,
leads to the following static checker warning:

	sound/soc/codecs/cpcap.c:1276 cpcap_voice_hw_params()
	warn: 'CPCAP_BIT_MIC1_RX_TIMESLOT0' is a shifter (not for '|=').

	sound/soc/codecs/cpcap.c:1279 cpcap_voice_hw_params()
	warn: 'CPCAP_BIT_MIC2_TIMESLOT0' is a shifter (not for '|=').

sound/soc/codecs/cpcap.c
  1253  static int cpcap_voice_hw_params(struct snd_pcm_substream *substream,
  1254                                   struct snd_pcm_hw_params *params,
  1255                                   struct snd_soc_dai *dai)
  1256  {
  1257          struct snd_soc_component *component = dai->component;
  1258          struct device *dev = component->dev;
  1259          struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component);
  1260          static const u16 reg_cdi = CPCAP_REG_CDI;
  1261          int rate = params_rate(params);
  1262          int channels = params_channels(params);
  1263          int direction = substream->stream;
  1264          u16 val, mask;
  1265          int err;
  1266  
  1267          dev_dbg(dev, "Voice setup HW params: rate=%d, direction=%d, chan=%d",
  1268                  rate, direction, channels);
  1269  
  1270          err = cpcap_set_samprate(cpcap, CPCAP_DAI_VOICE, rate);
  1271          if (err)
  1272                  return err;
  1273  
  1274          if (direction == SNDRV_PCM_STREAM_CAPTURE) {
  1275                  mask = 0x0000;
  1276                  mask |= CPCAP_BIT_MIC1_RX_TIMESLOT0;
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
This should probably be BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0).


  1277                  mask |= CPCAP_BIT_MIC1_RX_TIMESLOT1;
  1278                  mask |= CPCAP_BIT_MIC1_RX_TIMESLOT2;
  1279                  mask |= CPCAP_BIT_MIC2_TIMESLOT0;
                                ^^^^^^^^^^^^^^^^^^^^^^^^

Same for all the others as well I guess.

  1280                  mask |= CPCAP_BIT_MIC2_TIMESLOT1;
  1281                  mask |= CPCAP_BIT_MIC2_TIMESLOT2;
  1282                  val = 0x0000;
  1283                  if (channels >= 2)
  1284                          val = BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0);
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Here it's BIT(CPCAP_BIT_MIC1_RX_TIMESLOT0).

  1285                  err = regmap_update_bits(cpcap->regmap, reg_cdi, mask, val);
  1286                  if (err)
  1287                          return err;
  1288          }
  1289  
  1290          return 0;
  1291  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-01 16:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22  8:35 [bug report] ASoC: cpcap: new codec Dan Carpenter
2021-01-23 17:29 ` [PATCHv1] ASoC: cpcap: fix microphone timeslot mask Sebastian Reichel
2021-01-23 17:29   ` Sebastian Reichel
2021-01-30 14:36   ` Tony Lindgren
2021-01-30 14:36     ` Tony Lindgren
2021-02-01 16:45   ` Mark Brown
2021-02-01 16:45     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.