Message ID | 20220519154318.2153729-1-ckeepax@opensource.cirrus.com |
---|---|
Headers | show |
Series | Specify clock provider directly to CPU DAIs | expand |
On 5/19/22 10:42 AM, Charles Keepax wrote: > As part of updating the core to directly tell drivers if they are clock > provider or consumer update these CPU side drivers to use the new direct > callback. > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > --- > sound/soc/sunxi/sun4i-i2s.c | 20 ++++++++++---------- > sound/soc/sunxi/sun8i-codec.c | 8 ++++---- > 2 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > index 7047f71629ab3..872838d3e0a94 100644 > --- a/sound/soc/sunxi/sun4i-i2s.c > +++ b/sound/soc/sunxi/sun4i-i2s.c > @@ -702,13 +702,13 @@ static int sun4i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, > SUN4I_I2S_FMT0_FMT_MASK, val); > > /* DAI clock master masks */ > - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { > - case SND_SOC_DAIFMT_CBS_CFS: > + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { > + case SND_SOC_DAIFMT_BP_FP: > /* BCLK and LRCLK master */ > val = SUN4I_I2S_CTRL_MODE_MASTER; > break; > > - case SND_SOC_DAIFMT_CBM_CFM: > + case SND_SOC_DAIFMT_BC_FC: > /* BCLK and LRCLK slave */ > val = SUN4I_I2S_CTRL_MODE_SLAVE; > break; > @@ -802,13 +802,13 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, > SUN8I_I2S_TX_CHAN_OFFSET(offset)); > > /* DAI clock master masks */ > - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { > - case SND_SOC_DAIFMT_CBS_CFS: > + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { > + case SND_SOC_DAIFMT_BP_FP: > /* BCLK and LRCLK master */ > val = SUN8I_I2S_CTRL_BCLK_OUT | SUN8I_I2S_CTRL_LRCK_OUT; > break; > > - case SND_SOC_DAIFMT_CBM_CFM: > + case SND_SOC_DAIFMT_BC_FC: > /* BCLK and LRCLK slave */ > val = 0; > break; > @@ -909,13 +909,13 @@ static int sun50i_h6_i2s_set_soc_fmt(const struct sun4i_i2s *i2s, > SUN50I_H6_I2S_TX_CHAN_SEL_OFFSET(offset)); > > /* DAI clock master masks */ > - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { > - case SND_SOC_DAIFMT_CBS_CFS: > + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { > + case SND_SOC_DAIFMT_BP_FP: > /* BCLK and LRCLK master */ > val = SUN8I_I2S_CTRL_BCLK_OUT | SUN8I_I2S_CTRL_LRCK_OUT; > break; > > - case SND_SOC_DAIFMT_CBM_CFM: > + case SND_SOC_DAIFMT_BC_FC: > /* BCLK and LRCLK slave */ > val = 0; > break; > @@ -1081,7 +1081,7 @@ static int sun4i_i2s_set_tdm_slot(struct snd_soc_dai *dai, > > static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { > .hw_params = sun4i_i2s_hw_params, > - .set_fmt = sun4i_i2s_set_fmt, > + .set_fmt_new = sun4i_i2s_set_fmt, > .set_sysclk = sun4i_i2s_set_sysclk, > .set_tdm_slot = sun4i_i2s_set_tdm_slot, > .trigger = sun4i_i2s_trigger, > diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c > index 0bea2162f68d9..6e9ef948d6621 100644 > --- a/sound/soc/sunxi/sun8i-codec.c > +++ b/sound/soc/sunxi/sun8i-codec.c > @@ -286,11 +286,11 @@ static int sun8i_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) > u32 dsp_format, format, invert, value; > > /* clock masters */ > - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { > - case SND_SOC_DAIFMT_CBS_CFS: /* Codec slave, DAI master */ > + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { > + case SND_SOC_DAIFMT_BP_FP: /* Codec slave, DAI master */ This is a codec driver, and it is only ever used on the codec end of a link, so I would not expect it to be changed. Regards, Samuel > value = 0x1; > break; > - case SND_SOC_DAIFMT_CBM_CFM: /* Codec Master, DAI slave */ > + case SND_SOC_DAIFMT_BC_FC: /* Codec Master, DAI slave */ > value = 0x0; > break; > default: > @@ -630,7 +630,7 @@ static int sun8i_codec_hw_free(struct snd_pcm_substream *substream, > } > > static const struct snd_soc_dai_ops sun8i_codec_dai_ops = { > - .set_fmt = sun8i_codec_set_fmt, > + .set_fmt_new = sun8i_codec_set_fmt, > .set_tdm_slot = sun8i_codec_set_tdm_slot, > .startup = sun8i_codec_startup, > .hw_params = sun8i_codec_hw_params, >
On Fri, May 20, 2022 at 01:02:33AM +0000, Kuninori Morimoto wrote: > > Hi > > This is not related to this patch, but... > > > -static inline int snd_soc_component_is_codec(struct snd_soc_component *component) > > -{ > > - return component->driver->non_legacy_dai_naming; > > -} > (snip) > > +static inline int asoc_simple_component_is_codec(struct snd_soc_component *component) > > +{ > > + return component->driver->endianness; > > +} > > I have added "endianness" "non_legacy_dai_naming" to component > when convert old "Codec style" into current "Component style". > All codec needs to have these 2. > > 69941bab7c7aeaa7bf7e84397e294c17f0b7c6df > ("ASoC: snd_soc_component_driver has non_legacy_dai_naming") > > 273d778ef38a8861f880e9df5799029dc82bd55d > ("ASoC: snd_soc_component_driver has endianness") > > The reason why I didn't use "codec" was that try to keep > original style as much as possible. > But it seems this is good time to use "codec" for it ? > I think the code will be more understandable. > > - .endianness > - .non_legacy_dai_naming > + .is_codec Yeah I considered this but it didn't really feel like the right way to go to me. Firstly, at this stage we almost certainly need to keep the endianness and non_legacy_dai_naming flags, there are corner cases when endianness probably shouldn't be applied to CODECs (as noted in my endianness series), and there are platform drivers that use non_legacy_dai_naming. We could add an is_codec flag along side the other two. But it means a whole extra flag and means the the core is still requiring a concept of what is a CODEC driver, which really we want to get rid of as part of componentisation. My thinking was that, whilst making this function local to the driver isn't perfect, simple card will be used with simple CODECs that are likely to exist on a standard audio bus, and thus have endianness and the newer graph cards don't require specific identification of what is a CODEC driver. So it probably works as a solution for now. > > Thank you for your help !! Absolutely no problem, thank you for all the work you have done on this over the years. Thanks, Charles
Hi > > - .endianness > > - .non_legacy_dai_naming > > + .is_codec > > Yeah I considered this but it didn't really feel like the right > way to go to me. Firstly, at this stage we almost certainly need > to keep the endianness and non_legacy_dai_naming flags, there are > corner cases when endianness probably shouldn't be applied to CODECs > (as noted in my endianness series), and there are platform drivers > that use non_legacy_dai_naming. Oops, yes indeed :) Thank you for pointing it. > We could add an is_codec flag along side the other two. But it > means a whole extra flag and means the the core is still requiring > a concept of what is a CODEC driver, which really we want to get > rid of as part of componentisation. Hmm... yes, indeed. Thank you for your help !! Best regards --- Kuninori Morimoto
On Thu, 19 May 2022 16:42:22 +0100, Charles Keepax wrote: > 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. > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [01/56] ASoC: core: Add set_fmt_new callback that directly specifies provider commit: 905f3a04e184854555fc248ca4e692fdbf2f2547 [02/56] ASoC: amd: vangogh: Update to use set_fmt_new callback commit: ab890e0f83a65624d20b0ca4a7cb6306b8511558 [03/56] ASoC: atmel: Update to use set_fmt_new callback commit: 0fd054a577180cd807992e32c7cd394e54c85903 [04/56] ASoC: au1x: Update to use set_fmt_new callback commit: fee11f70849b21a244e6e27d281f3858b671bfea [05/56] ASoC: bcm: Update to use set_fmt_new callback commit: 04ea2404468b7885c560c3673f6f2fd368f305a2 [06/56] ASoC: ep93xx: Update to use set_fmt_new callback commit: 5d6124e58d56818249a6266f56d9c3739e72e1bd [07/56] ASoC: dwc: Update to use set_fmt_new callback commit: ca0444f1f7b228ae3b8d1a5c0f0d1b4463171f98 [08/56] ASoC: fsl: Update to use set_fmt_new callback commit: 3b14c15a333b8225ea38479e13c0366539d3374a [09/56] ASoC: hisilicon: Update to use set_fmt_new callback commit: 0f362524dd3face4865077a4f7e7e640a95702aa [10/56] ASoC: img: Update to use set_fmt_new callback commit: ed2b384082a678a0c4c8c56deff9e5f46d5e3fca [11/56] ASoC: Intel: Update to use set_fmt_new callback commit: add9ee8c64c617f561a309cdda50104e9e2c12f6 [12/56] ASoC: js4740-i2s: Update to use set_fmt_new callback commit: cbb3a19f090d5a41b822caf9ff2058e1c6bc7ea3 [13/56] ASoC: mediatek: Update to use set_fmt_new callback commit: 3af99430f8d948a41556156155b0295dec274d41 [14/56] ASoC: meson: Update to use set_fmt_new callback commit: f60442bf6eab47aa4ab127aab88afdcc29a09a73 [15/56] ASoC: mxs-saif: Update to use set_fmt_new callback commit: f3c0064f1f8e358799c70c7905a09d15c5ec5e5a [16/56] ASoC: pxa: Update to use set_fmt_new callback commit: 84c5b47c8ce4d5059d5e7539d3b44922cc0390e9 [17/56] ASoC: qcom: Update to use set_fmt_new callback commit: 1148e16b335f341f36475b646c692b4a71a1855e [18/56] ASoC: rockchip: Update to use set_fmt_new callback commit: 27646d265da1745b2d1d10fec18465631cb1135f [19/56] ASoC: samsung: Update to use set_fmt_new callback commit: 0b491c7c1b2555ef08285fd49a8567f2f9f34ff8 [20/56] ASoC: sh: Update to use set_fmt_new callback commit: 2d4dd776e902546389f2d7808ece7fd815aa829c [21/56] ASoC: stm: Update to use set_fmt_new callback commit: 0092dac91ec1c404787841bdd9ecbf3404d1a41c [22/56] ASoC: sunxi: Update to use set_fmt_new callback commit: 7cc3965fde74c9c725ed01de4ac35bc7d562d16a [23/56] ASoC: tegra: Update to use set_fmt_new callback commit: d92ad6633fa77f9496840b77c8effeaa13ac78dc [24/56] ASoC: test-component: Update to use set_fmt_new callback commit: d444c8d246a62392c0d249b1030c3ca271d47649 [25/56] ASoC: ti: Update to use set_fmt_new callback commit: 563ff63dc9fbb8ef4b8f145a53c84a5489bbd789 [26/56] ASoC: ux500: Update to use set_fmt_new callback commit: ce3467c78478e33927aea9043bf20f46fa4d5688 [27/56] ASoC: xtensa: Update to use set_fmt_new callback commit: e945206a0a448ac81dde0609578508368946f7a6 [28/56] ASoC: core: Always send the CPU DAI a direct clock specifier commit: 6c076273a326cc5b5162451aacf7b7744bb03c66 [29/56] ASoC: amd: vangogh: Rename set_fmt_new back to set_fmt commit: 346f47e784cd48b456f267a66e0daf1ef10d21b3 [30/56] ASoC: atmel: Rename set_fmt_new back to set_fmt commit: a839a53b9dc70f94032a671ee019599884612d4a [31/56] ASoC: au1x: Rename set_fmt_new back to set_fmt commit: 2c73f5fd20a845fcb48173578b7c83dbcbacdeda [32/56] ASoC: bcm: Rename set_fmt_new back to set_fmt commit: 1a267dd98c246237be00587b6e71f969bf75f10d [33/56] ASoC: ep93xx: Rename set_fmt_new back to set_fmt commit: 324a4db8de05290237793dc3d7da887846ae90c1 [34/56] ASoC: dwc: Rename set_fmt_new back to set_fmt commit: 765fb623a2cd925c550370f73efe2137c52a1b25 [35/56] ASoC: fsl: Rename set_fmt_new back to set_fmt commit: 00778276cf4c611882219ab7aba9664c48981f1a [36/56] ASoC: hisilicon: Rename set_fmt_new back to set_fmt commit: b9a7972818b84a15d46505df7808fd86c3fba5bb [37/56] ASoC: img: Rename set_fmt_new back to set_fmt commit: 1830a30ec4cf1642a429e80dbbeb86aa7825c71a [38/56] ASoC: Intel: Rename set_fmt_new back to set_fmt commit: c14a6ce9848571cf67faff206b02e212bec82761 [39/56] ASoC: jz4740-i2s: Rename set_fmt_new back to set_fmt commit: 1724cc38e7685ad8b01413acd70a4a731fc105ae [40/56] ASoC: mediatek: Rename set_fmt_new back to set_fmt commit: 00ca2d152ef0fa9f4beb2a590e176499440de8fe [41/56] ASoC: meson: Rename set_fmt_new back to set_fmt commit: eee6b5b9f3af0e906085022713ef41e56d03eca8 [42/56] ASoC: mxs-saif: Rename set_fmt_new back to set_fmt commit: 1a805faeb4915496671cd24bd2a75cc97a85dfc8 [43/56] ASoC: pxa: Rename set_fmt_new back to set_fmt commit: 8e2cc2b241bc0bb905231f301e6dfc80dc79f8a8 [44/56] ASoC: qcom: Rename set_fmt_new back to set_fmt commit: f1bd2fae856384f9377ca3faed0583d929002640 [45/56] ASoC: rockchip: Rename set_fmt_new back to set_fmt commit: 059f16bc0e02164617312435c31dffdc419f113f [46/56] ASoC: samsung: Rename set_fmt_new back to set_fmt commit: b99d00c724bcf395558cb3028e823bd8f554fee6 [47/56] ASoC: sh: Rename set_fmt_new back to set_fmt commit: adced68031f96642272fae4e8c36d45d13797306 [48/56] ASoC: stm: Rename set_fmt_new back to set_fmt commit: 02ba0d9680feee645a321d65012f38d0a368b559 [49/56] ASoC: sunxi: Rename set_fmt_new back to set_fmt commit: 15011b2388d020a6cdb323539fc69c31b04d9f21 [50/56] ASoC: tegra: Rename set_fmt_new back to set_fmt commit: 475f2af6a2ff33e828900601a162e324b9986f9a [51/56] ASoC: test-component: Rename set_fmt_new back to set_fmt commit: 408c122ef9de99220f7919594ab8af98194a19e8 [52/56] ASoC: ti: Rename set_fmt_new back to set_fmt commit: 9ff1836023ae19013c01f230e6a091fad6835213 [53/56] ASoC: ux500: Rename set_fmt_new back to set_fmt commit: e24ba1a21e244e7174e75ca0c4020beaff0ad369 [54/56] ASoC: xtensa: Rename set_fmt_new back to set_fmt commit: 58e23e21d18532aaa404e1db87ec92762e1fecd5 [55/56] ASoC: soc-dai: Remove set_fmt_new callback commit: 19423951a4b5c4f0ca107d6a4bed23f3f63718ca [56/56] ASoC: simple-card-utils: Move snd_soc_component_is_codec to be local commit: 28086d05ada6d03daa886aad0e469854b811311c All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark