Skip to content

Commit

Permalink
ASoC: intel: Fix snd_pcm_format_t handling
Browse files Browse the repository at this point in the history
As sparse warns, the PCM format type can't be dealt as integer as
found in Intel SST driver codes.

Fix them in the following two ways:

- The open code with snd_mask_set() and params->masks reference is
  replaced with params_set_format()

- The rest codes with snd_mask_set(fmt, SNDRV_PCM_FORMAT_XXX) are
  replaced with the new helper, snd_mask_set_format().

Reported-by: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
tiwai authored and broonie committed Jul 26, 2018
1 parent 533a927 commit b5453e8
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions sound/soc/intel/boards/bdw-rt5677.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ static int broadwell_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,
channels->min = channels->max = 2;

/* set SSP0 to 16 bit */
snd_mask_set(&params->masks[SNDRV_PCM_HW_PARAM_FORMAT -
SNDRV_PCM_HW_PARAM_FIRST_MASK],
SNDRV_PCM_FORMAT_S16_LE);
params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/bxt_da7219_max98357a.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd,

/* set SSP to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/bxt_rt298.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int broxton_ssp5_fixup(struct snd_soc_pcm_runtime *rtd,

/* set SSP5 to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/kbl_da7219_max98357a.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,

/* set SSP to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/intel/boards/kbl_rt5663_max98927.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,14 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
}
/*
* The speaker on the SSP0 supports S16_LE and not S24_LE.
* thus changing the mask here
*/
if (!strcmp(be_dai_link->name, "SSP0-Codec"))
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
rate->min = rate->max = 48000;
channels->min = channels->max = 2;
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
} else if (!strcmp(fe_dai_link->name, "Kbl Audio DMIC cap")) {
if (params_channels(params) == 2 ||
DMIC_CH(dmic_constraints) == 2)
Expand All @@ -320,7 +320,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
* thus changing the mask here
*/
if (!strcmp(be_dai_link->name, "SSP0-Codec"))
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/skl_nau88l25_max98357a.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,

/* set SSP0 to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/skl_nau88l25_ssm4567.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ static int skylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd,

/* set SSP0 to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/skl_rt286.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int skylake_ssp0_fixup(struct snd_soc_pcm_runtime *rtd,

/* set SSP0 to 24 bit */
snd_mask_none(fmt);
snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE);
snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S24_LE);
return 0;
}

Expand Down

0 comments on commit b5453e8

Please sign in to comment.