aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/generic
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-06-09 11:26:00 +0100
committerMark Brown <broonie@kernel.org>2022-06-09 11:56:32 +0100
commitd3d8feadcc54c28015b62436a1f69d1080b85fb5 (patch)
tree1313057e514a83f76cb86fc687e4fca6b1488fee /sound/soc/generic
parentASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode (diff)
parentASoC: simple-card-utils: Move snd_soc_component_is_codec to be local (diff)
downloadlinux-dev-d3d8feadcc54c28015b62436a1f69d1080b85fb5.tar.xz
linux-dev-d3d8feadcc54c28015b62436a1f69d1080b85fb5.zip
Specify clock provider directly to CPU DAIs
Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>: Currently the 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. However, as things are now broken down into components which can be connected as either the CPU or CODEC side of a DAI link it simplifies things if each side of the link is just told if it is provider or consumer of the clocks. Making this change allows us to remove one of the last parts of the ASoC core that needs to know if a driver is a CODEC driver, where it flips the clock format specifier if a CODEC driver is used on the CPU side of a DAI link, as well as just being conceptually more consistent with componentisation. The basic idea of this patch chain is to change the set_fmt callback from specifying if the CODEC is provider/consumer into directly specifying if the component is provider/consumer. To do this we add some new defines, and then to preserve bisectability, the migration is done by adding a new callback, converting over all existing CPU side drivers, converting the core, and then finally reverting back to the old callback. Converting the platform drivers makes sense as the existing defines are from the perspective of the CODEC and there are more CODEC drivers than platform drivers. Obviously a fair amount of this patch chain I was only able to build test, so any testing that can be done would be greatly appreciated.
Diffstat (limited to 'sound/soc/generic')
-rw-r--r--sound/soc/generic/simple-card-utils.c7
-rw-r--r--sound/soc/generic/test-component.c18
2 files changed, 15 insertions, 10 deletions
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 0beda9739ebe..7be84c7840cb 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -513,6 +513,11 @@ static int asoc_simple_init_dai(struct snd_soc_dai *dai,
return 0;
}
+static inline int asoc_simple_component_is_codec(struct snd_soc_component *component)
+{
+ return component->driver->endianness;
+}
+
static int asoc_simple_init_for_codec2codec(struct snd_soc_pcm_runtime *rtd,
struct simple_dai_props *dai_props)
{
@@ -524,7 +529,7 @@ static int asoc_simple_init_for_codec2codec(struct snd_soc_pcm_runtime *rtd,
/* Only Codecs */
for_each_rtd_components(rtd, i, component) {
- if (!snd_soc_component_is_codec(component))
+ if (!asoc_simple_component_is_codec(component))
return 0;
}
diff --git a/sound/soc/generic/test-component.c b/sound/soc/generic/test-component.c
index 5da4725d9e16..d28712fabe3f 100644
--- a/sound/soc/generic/test-component.c
+++ b/sound/soc/generic/test-component.c
@@ -66,7 +66,7 @@ static int test_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
unsigned int format = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
unsigned int clock = fmt & SND_SOC_DAIFMT_CLOCK_MASK;
unsigned int inv = fmt & SND_SOC_DAIFMT_INV_MASK;
- unsigned int master = fmt & SND_SOC_DAIFMT_MASTER_MASK;
+ unsigned int master = fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
char *str;
dev_info(dai->dev, "name : %s", dai->name);
@@ -105,16 +105,16 @@ static int test_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
str = "unknown";
switch (master) {
- case SND_SOC_DAIFMT_CBP_CFP:
+ case SND_SOC_DAIFMT_BP_FP:
str = "clk provider, frame provider";
break;
- case SND_SOC_DAIFMT_CBC_CFP:
+ case SND_SOC_DAIFMT_BC_FP:
str = "clk consumer, frame provider";
break;
- case SND_SOC_DAIFMT_CBP_CFC:
+ case SND_SOC_DAIFMT_BP_FC:
str = "clk provider, frame consumer";
break;
- case SND_SOC_DAIFMT_CBC_CFC:
+ case SND_SOC_DAIFMT_BC_FC:
str = "clk consumer, frame consumer";
break;
}
@@ -192,10 +192,10 @@ static int test_dai_bespoke_trigger(struct snd_pcm_substream *substream,
static u64 test_dai_formats =
/*
* Select below from Sound Card, not auto
- * SND_SOC_POSSIBLE_DAIFMT_CBP_CFP
- * SND_SOC_POSSIBLE_DAIFMT_CBC_CFP
- * SND_SOC_POSSIBLE_DAIFMT_CBP_CFC
- * SND_SOC_POSSIBLE_DAIFMT_CBC_CFC
+ * SND_SOC_POSSIBLE_DAIFMT_BP_FP
+ * SND_SOC_POSSIBLE_DAIFMT_BC_FP
+ * SND_SOC_POSSIBLE_DAIFMT_BP_FC
+ * SND_SOC_POSSIBLE_DAIFMT_BC_FC
*/
SND_SOC_POSSIBLE_DAIFMT_I2S |
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |