From: Dan Carpenter <dan.carpenter@oracle.com>
To: sre@kernel.org
Cc: alsa-devel@alsa-project.org
Subject: [bug report] ASoC: cpcap: new codec
Date: Fri, 22 Jan 2021 11:35:22 +0300 [thread overview]
Message-ID: <YAqOSg2z24NpjKDh@mwanda> (raw)
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
next reply other threads:[~2021-01-22 8:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-22 8:35 Dan Carpenter [this message]
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
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 \
--in-reply-to=YAqOSg2z24NpjKDh@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=sre@kernel.org \
/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 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.