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