Skip to content

Commit

Permalink
ASoC: pcm3168a: add .auto_selectable_formats support
Browse files Browse the repository at this point in the history
By this patch, DAI format might be automatically selected
(Depends on paired DAI).

Link: https://lore.kernel.org/r/[email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Kuninori Morimoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
morimoto authored and broonie committed Jun 7, 2021
1 parent c50f381 commit bea63e8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sound/soc/codecs/pcm3168a.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,39 @@ static int pcm3168a_hw_params(struct snd_pcm_substream *substream,
return 0;
}

static u64 pcm3168a_dai_formats[] = {
/*
* Select below from Sound Card, not here
* SND_SOC_DAIFMT_CBC_CFC
* SND_SOC_DAIFMT_CBP_CFP
*/

/*
* First Priority
*/
SND_SOC_POSSIBLE_DAIFMT_I2S |
SND_SOC_POSSIBLE_DAIFMT_LEFT_J,
/*
* Second Priority
*
* These have picky limitation.
* see
* pcm3168a_hw_params()
*/
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |
SND_SOC_POSSIBLE_DAIFMT_DSP_A |
SND_SOC_POSSIBLE_DAIFMT_DSP_B,
};

static const struct snd_soc_dai_ops pcm3168a_dai_ops = {
.set_fmt = pcm3168a_set_dai_fmt,
.set_sysclk = pcm3168a_set_dai_sysclk,
.hw_params = pcm3168a_hw_params,
.mute_stream = pcm3168a_mute,
.set_tdm_slot = pcm3168a_set_tdm_slot,
.no_capture_mute = 1,
.auto_selectable_formats = pcm3168a_dai_formats,
.num_auto_selectable_formats = ARRAY_SIZE(pcm3168a_dai_formats),
};

static struct snd_soc_dai_driver pcm3168a_dais[] = {
Expand Down

0 comments on commit bea63e8

Please sign in to comment.