forked from Minki/linux
ASoC: core: Add set_fmt_new callback that directly specifies provider
The original set_fmt callback always passes clock provider/consumer with respect to the CODEC. This made sense when the framework was directly broken down into platforms and CODECs. Now everything is componentised it simplifies things if each side of the link is just told if it is provider or consumer of the clocks. To start this migration add a new callback that can be used to receive a direct specification of clocking. As there are more CODEC drivers than platform drivers, we make the new flags identical to the old CODEC flags meaning CODEC drivers will not require an update. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
be1a63daff
commit
905f3a04e1
@ -124,6 +124,12 @@ struct snd_compr_stream;
|
||||
#define SND_SOC_DAIFMT_CBM_CFS SND_SOC_DAIFMT_CBP_CFC
|
||||
#define SND_SOC_DAIFMT_CBS_CFS SND_SOC_DAIFMT_CBC_CFC
|
||||
|
||||
/* when passed to set_fmt directly indicate if the device is provider or consumer */
|
||||
#define SND_SOC_DAIFMT_BP_FP SND_SOC_DAIFMT_CBP_CFP
|
||||
#define SND_SOC_DAIFMT_BC_FP SND_SOC_DAIFMT_CBC_CFP
|
||||
#define SND_SOC_DAIFMT_BP_FC SND_SOC_DAIFMT_CBP_CFC
|
||||
#define SND_SOC_DAIFMT_BC_FC SND_SOC_DAIFMT_CBC_CFC
|
||||
|
||||
/* Describes the possible PCM format */
|
||||
#define SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT 48
|
||||
#define SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_MASK (0xFFFFULL << SND_SOC_POSSIBLE_DAIFMT_CLOCK_PROVIDER_SHIFT)
|
||||
@ -282,6 +288,7 @@ struct snd_soc_dai_ops {
|
||||
* Called by soc_card drivers, normally in their hw_params.
|
||||
*/
|
||||
int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
|
||||
int (*set_fmt_new)(struct snd_soc_dai *dai, unsigned int fmt);
|
||||
int (*xlate_tdm_slot_mask)(unsigned int slots,
|
||||
unsigned int *tx_mask, unsigned int *rx_mask);
|
||||
int (*set_tdm_slot)(struct snd_soc_dai *dai,
|
||||
|
@ -1235,7 +1235,8 @@ int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
|
||||
for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
|
||||
unsigned int fmt = dai_fmt;
|
||||
|
||||
if (snd_soc_component_is_codec(cpu_dai->component))
|
||||
if (cpu_dai->driver->ops->set_fmt_new ||
|
||||
snd_soc_component_is_codec(cpu_dai->component))
|
||||
fmt = inv_dai_fmt;
|
||||
|
||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
||||
|
@ -209,7 +209,10 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
||||
int ret = -ENOTSUPP;
|
||||
|
||||
if (dai->driver->ops &&
|
||||
dai->driver->ops->set_fmt)
|
||||
dai->driver->ops->set_fmt_new)
|
||||
ret = dai->driver->ops->set_fmt_new(dai, fmt);
|
||||
else if (dai->driver->ops &&
|
||||
dai->driver->ops->set_fmt)
|
||||
ret = dai->driver->ops->set_fmt(dai, fmt);
|
||||
|
||||
return soc_dai_ret(dai, ret);
|
||||
|
Loading…
Reference in New Issue
Block a user