Skip to content

Commit 41bceb1

Browse files
Olivier Moysanbroonie
authored andcommitted
ASoC: stm32: dfsdm: add actual resolution trace
Add a trace to report actual resolution of audio samples. Signed-off-by: Olivier Moysan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6101bf7 commit 41bceb1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

drivers/iio/adc/stm32-dfsdm-adc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ static int stm32_dfsdm_compute_osrs(struct stm32_dfsdm_filter *fl,
293293
max >>= flo->rshift;
294294
}
295295
flo->max = (s32)max;
296+
flo->bits = bits;
296297

297298
pr_debug("%s: fast %d, fosr %d, iosr %d, res 0x%llx/%d bits, rshift %d, lshift %d\n",
298299
__func__, fast, flo->fosr, flo->iosr,
@@ -476,6 +477,9 @@ static int stm32_dfsdm_channels_configure(struct iio_dev *indio_dev,
476477
if (!flo->res)
477478
return -EINVAL;
478479

480+
dev_dbg(&indio_dev->dev, "Samples actual resolution: %d bits",
481+
min(flo->bits, (u32)DFSDM_DATA_RES - 1));
482+
479483
for_each_set_bit(bit, &adc->smask,
480484
sizeof(adc->smask) * BITS_PER_BYTE) {
481485
chan = indio_dev->channels + bit;

drivers/iio/adc/stm32-dfsdm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ enum stm32_dfsdm_sinc_order {
249249
* @rshift: output sample right shift (hardware shift)
250250
* @lshift: output sample left shift (software shift)
251251
* @res: output sample resolution
252+
* @bits: output sample resolution in bits
252253
* @max: output sample maximum positive value
253254
*/
254255
struct stm32_dfsdm_filter_osr {
@@ -257,6 +258,7 @@ struct stm32_dfsdm_filter_osr {
257258
unsigned int rshift;
258259
unsigned int lshift;
259260
u64 res;
261+
u32 bits;
260262
s32 max;
261263
};
262264

0 commit comments

Comments
 (0)