Skip to content

Commit 5ab0997

Browse files
committed
ASoC: SOF: ipc4-topology: Print for format type in dbg_audio_format
8 and 32 bit formats can have different types, print them in debug information to have complete view of the supported formats. Fixes: c04c2e8 ("ASoC: SOF: ipc4-topology: Add support for 8-bit formats") Cc: stable@vger.kernel.org Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent a3a5425 commit 5ab0997

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,23 @@ struct snd_sof_widget *sof_ipc4_find_swidget_by_ids(struct snd_sof_dev *sdev,
238238
return NULL;
239239
}
240240

241+
static u32 sof_ipc4_fmt_cfg_to_type(u32 fmt_cfg)
242+
{
243+
/* Fetch the sample type from the fmt for 8 and 32 bit formats */
244+
u32 __bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt_cfg);
245+
246+
if (__bits == 8 || __bits == 32)
247+
return SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE(fmt_cfg);
248+
249+
/*
250+
* Return LSB integer type for 20 and 24 formats as the firmware is
251+
* handling the LSB/MSB alignment internally, for the kernel this
252+
* should not be taken into account, we treat them as LSB to match with
253+
* the format we support on the PCM side.
254+
*/
255+
return SOF_IPC4_TYPE_LSB_INTEGER;
256+
}
257+
241258
static void sof_ipc4_dbg_audio_format(struct device *dev, struct sof_ipc4_pin_format *pin_fmt,
242259
int num_formats)
243260
{
@@ -246,8 +263,9 @@ static void sof_ipc4_dbg_audio_format(struct device *dev, struct sof_ipc4_pin_fo
246263
for (i = 0; i < num_formats; i++) {
247264
struct sof_ipc4_audio_format *fmt = &pin_fmt[i].audio_fmt;
248265
dev_dbg(dev,
249-
"Pin #%d: %uHz, %ubit, %luch (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n",
266+
"Pin #%d: %uHz, %ubit (type: %u), %luch (ch_map %#x ch_cfg %u interleaving_style %u fmt_cfg %#x) buffer size %d\n",
250267
pin_fmt[i].pin_index, fmt->sampling_frequency, fmt->bit_depth,
268+
sof_ipc4_fmt_cfg_to_type(fmt->fmt_cfg),
251269
SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(fmt->fmt_cfg),
252270
fmt->ch_map, fmt->ch_cfg, fmt->interleaving_style, fmt->fmt_cfg,
253271
pin_fmt[i].buffer_size);
@@ -1363,23 +1381,6 @@ static int sof_ipc4_widget_assign_instance_id(struct snd_sof_dev *sdev,
13631381
return 0;
13641382
}
13651383

1366-
static u32 sof_ipc4_fmt_cfg_to_type(u32 fmt_cfg)
1367-
{
1368-
/* Fetch the sample type from the fmt for 8 and 32 bit formats */
1369-
u32 __bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(fmt_cfg);
1370-
1371-
if (__bits == 8 || __bits == 32)
1372-
return SOF_IPC4_AUDIO_FORMAT_CFG_SAMPLE_TYPE(fmt_cfg);
1373-
1374-
/*
1375-
* Return LSB integer type for 20 and 24 formats as the firmware is
1376-
* handling the LSB/MSB alignment internally, for the kernel this
1377-
* should not be taken into account, we treat them as LSB to match with
1378-
* the format we support on the PCM side.
1379-
*/
1380-
return SOF_IPC4_TYPE_LSB_INTEGER;
1381-
}
1382-
13831384
/* update hw_params based on the audio stream format */
13841385
static int sof_ipc4_update_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_hw_params *params,
13851386
struct sof_ipc4_audio_format *fmt, u32 param_to_update)

0 commit comments

Comments
 (0)