Skip to content

Commit 3b64fd2

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: ipc4-topology/pcm: Rename sof_ipc4_copier_is_single_format()
Rename the sof_ipc4_copier_is_single_format() to sof_ipc4_copier_is_single_bitdepth() to clear the confusion of the use of 'format' when we are querying information on the bit depth. Format is used to describe a combination of parameters (rate, channels, sample format / bit depth). Rename the flags used to store the result at the same time. Signed-off-by: Peter Ujfalusi <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Reviewed-by: Seppo Ingalsuo <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 2a865c9 commit 3b64fd2

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

sound/soc/sof/ipc4-pcm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
650650
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
651651
struct sof_ipc4_audio_format *ipc4_fmt;
652652
struct sof_ipc4_copier *ipc4_copier;
653-
bool single_fmt = false;
653+
bool single_bitdepth = false;
654654
u32 valid_bits = 0;
655655
int dir, ret;
656656

@@ -682,18 +682,18 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
682682
return 0;
683683

684684
if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
685-
if (sof_ipc4_copier_is_single_format(sdev,
685+
if (sof_ipc4_copier_is_single_bitdepth(sdev,
686686
available_fmt->output_pin_fmts,
687687
available_fmt->num_output_formats)) {
688688
ipc4_fmt = &available_fmt->output_pin_fmts->audio_fmt;
689-
single_fmt = true;
689+
single_bitdepth = true;
690690
}
691691
} else {
692-
if (sof_ipc4_copier_is_single_format(sdev,
692+
if (sof_ipc4_copier_is_single_bitdepth(sdev,
693693
available_fmt->input_pin_fmts,
694694
available_fmt->num_input_formats)) {
695695
ipc4_fmt = &available_fmt->input_pin_fmts->audio_fmt;
696-
single_fmt = true;
696+
single_bitdepth = true;
697697
}
698698
}
699699
}
@@ -703,7 +703,7 @@ static int sof_ipc4_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
703703
if (ret)
704704
return ret;
705705

706-
if (single_fmt) {
706+
if (single_bitdepth) {
707707
snd_mask_none(fmt);
708708
valid_bits = SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(ipc4_fmt->fmt_cfg);
709709
dev_dbg(component->dev, "Set %s to %d bit format\n", dai->name, valid_bits);

sound/soc/sof/ipc4-topology.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ static int snd_sof_get_hw_config_params(struct snd_sof_dev *sdev, struct snd_sof
14231423

14241424
static int
14251425
snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
1426-
bool single_format,
1426+
bool single_bitdepth,
14271427
struct snd_pcm_hw_params *params, u32 dai_index,
14281428
u32 linktype, u8 dir, u32 **dst, u32 *len)
14291429
{
@@ -1446,7 +1446,7 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
14461446
* Look for 32-bit blob first instead of 16-bit if copier
14471447
* supports multiple formats
14481448
*/
1449-
if (bit_depth == 16 && !single_format) {
1449+
if (bit_depth == 16 && !single_bitdepth) {
14501450
dev_dbg(sdev->dev, "Looking for 32-bit blob first for DMIC\n");
14511451
format_change = true;
14521452
bit_depth = 32;
@@ -1494,7 +1494,7 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
14941494
bit_depth = params_width(params);
14951495
format_change = false;
14961496
get_new_blob = true;
1497-
} else if (linktype == SOF_DAI_INTEL_DMIC && !single_format) {
1497+
} else if (linktype == SOF_DAI_INTEL_DMIC && !single_bitdepth) {
14981498
/*
14991499
* The requested 32-bit blob (no format change for the
15001500
* blob request) was not found in NHLT table, try to
@@ -1550,17 +1550,17 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
15501550
#else
15511551
static int
15521552
snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
1553-
bool single_format,
1553+
bool single_bitdepth,
15541554
struct snd_pcm_hw_params *params, u32 dai_index,
15551555
u32 linktype, u8 dir, u32 **dst, u32 *len)
15561556
{
15571557
return 0;
15581558
}
15591559
#endif
15601560

1561-
bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev,
1562-
struct sof_ipc4_pin_format *pin_fmts,
1563-
u32 pin_fmts_size)
1561+
bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev,
1562+
struct sof_ipc4_pin_format *pin_fmts,
1563+
u32 pin_fmts_size)
15641564
{
15651565
struct sof_ipc4_audio_format *fmt;
15661566
u32 valid_bits;
@@ -1591,7 +1591,7 @@ sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
15911591
struct snd_pcm_hw_params dai_params = *params;
15921592
struct sof_ipc4_copier_data *copier_data;
15931593
struct sof_ipc4_copier *ipc4_copier;
1594-
bool single_format;
1594+
bool single_bitdepth;
15951595
int ret;
15961596

15971597
ipc4_copier = dai->private;
@@ -1605,25 +1605,25 @@ sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
16051605
* format lookup
16061606
*/
16071607
if (dir == SNDRV_PCM_STREAM_PLAYBACK) {
1608-
single_format = sof_ipc4_copier_is_single_format(sdev,
1608+
single_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev,
16091609
available_fmt->output_pin_fmts,
16101610
available_fmt->num_output_formats);
16111611

16121612
/* Update the dai_params with the only supported format */
1613-
if (single_format) {
1613+
if (single_bitdepth) {
16141614
ret = sof_ipc4_update_hw_params(sdev, &dai_params,
16151615
&available_fmt->output_pin_fmts[0].audio_fmt,
16161616
BIT(SNDRV_PCM_HW_PARAM_FORMAT));
16171617
if (ret)
16181618
return ret;
16191619
}
16201620
} else {
1621-
single_format = sof_ipc4_copier_is_single_format(sdev,
1621+
single_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev,
16221622
available_fmt->input_pin_fmts,
16231623
available_fmt->num_input_formats);
16241624

16251625
/* Update the dai_params with the only supported format */
1626-
if (single_format) {
1626+
if (single_bitdepth) {
16271627
ret = sof_ipc4_update_hw_params(sdev, &dai_params,
16281628
&available_fmt->input_pin_fmts[0].audio_fmt,
16291629
BIT(SNDRV_PCM_HW_PARAM_FORMAT));
@@ -1632,7 +1632,7 @@ sof_ipc4_prepare_dai_copier(struct snd_sof_dev *sdev, struct snd_sof_dai *dai,
16321632
}
16331633
}
16341634

1635-
ret = snd_sof_get_nhlt_endpoint_data(sdev, dai, single_format,
1635+
ret = snd_sof_get_nhlt_endpoint_data(sdev, dai, single_bitdepth,
16361636
&dai_params,
16371637
ipc4_copier->dai_index,
16381638
ipc4_copier->dai_type, dir,
@@ -1667,7 +1667,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
16671667
u32 out_ref_rate, out_ref_channels;
16681668
u32 deep_buffer_dma_ms = 0;
16691669
int output_fmt_index;
1670-
bool single_output_format;
1670+
bool single_output_bitdepth;
16711671
int i;
16721672

16731673
dev_dbg(sdev->dev, "copier %s, type %d", swidget->widget->name, swidget->id);
@@ -1804,9 +1804,9 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
18041804
return ret;
18051805

18061806
/* set the reference params for output format selection */
1807-
single_output_format = sof_ipc4_copier_is_single_format(sdev,
1808-
available_fmt->output_pin_fmts,
1809-
available_fmt->num_output_formats);
1807+
single_output_bitdepth = sof_ipc4_copier_is_single_bitdepth(sdev,
1808+
available_fmt->output_pin_fmts,
1809+
available_fmt->num_output_formats);
18101810
switch (swidget->id) {
18111811
case snd_soc_dapm_aif_in:
18121812
case snd_soc_dapm_dai_out:
@@ -1818,7 +1818,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
18181818
out_ref_rate = in_fmt->sampling_frequency;
18191819
out_ref_channels = SOF_IPC4_AUDIO_FORMAT_CFG_CHANNELS_COUNT(in_fmt->fmt_cfg);
18201820

1821-
if (!single_output_format)
1821+
if (!single_output_bitdepth)
18221822
out_ref_valid_bits =
18231823
SOF_IPC4_AUDIO_FORMAT_CFG_V_BIT_DEPTH(in_fmt->fmt_cfg);
18241824
break;
@@ -1827,7 +1827,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
18271827
case snd_soc_dapm_dai_in:
18281828
out_ref_rate = params_rate(fe_params);
18291829
out_ref_channels = params_channels(fe_params);
1830-
if (!single_output_format) {
1830+
if (!single_output_bitdepth) {
18311831
out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params);
18321832
if (out_ref_valid_bits < 0)
18331833
return out_ref_valid_bits;
@@ -1845,7 +1845,7 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
18451845
* if the output format is the same across all available output formats, choose
18461846
* that as the reference.
18471847
*/
1848-
if (single_output_format) {
1848+
if (single_output_bitdepth) {
18491849
struct sof_ipc4_audio_format *out_fmt;
18501850

18511851
out_fmt = &available_fmt->output_pin_fmts[0].audio_fmt;

sound/soc/sof/ipc4-topology.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ struct sof_ipc4_process {
476476
u32 init_config;
477477
};
478478

479-
bool sof_ipc4_copier_is_single_format(struct snd_sof_dev *sdev,
480-
struct sof_ipc4_pin_format *pin_fmts,
481-
u32 pin_fmts_size);
479+
bool sof_ipc4_copier_is_single_bitdepth(struct snd_sof_dev *sdev,
480+
struct sof_ipc4_pin_format *pin_fmts,
481+
u32 pin_fmts_size);
482482
#endif

0 commit comments

Comments
 (0)