ASoC: fsl_sai: Add bus clock and mclks with clock controls
Subsystems (4)
v2 cover ASoC: fsl_sai: Add bus clock and mclks with clock controls
This series of patches add clock controls to fsl_sai driver and updates the vf610.dtsi accordingly.
Changelog
v2:
* Appended two extra mclks to the driver since SAI actually has three.
* Renamed clock name to 'bus' and 'mclk' according to the reference manual.
Nicolin Chen (2):
ASoC: fsl_sai: Add clock controls for SAI
ARM: dts: Append clock bindings for sai2 on VF610 platform
.../devicetree/bindings/sound/fsl-sai.txt | 8 ++-- arch/arm/boot/dts/vf610.dtsi | 6 ++- sound/soc/fsl/fsl_sai.c | 50 ++++++++++++++++++++-- sound/soc/fsl/fsl_sai.h | 4 ++ 4 files changed, 59 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.4
PATCH v2 1/2 ASoC: fsl_sai: Add clock controls for SAI
The SAI mainly has the following clocks:
bus clock
control and configuration registers and to generate synchronous interrupts and DMA requests.
mclk1, mclk2, mclk3
to generate the bit clock when the receiver or transmitter is configured for an internally generated bit clock.
So this patch adds these clocks to the driver and their clock controls.
--- .../devicetree/bindings/sound/fsl-sai.txt | 8 ++-- sound/soc/fsl/fsl_sai.c | 50 ++++++++++++++++++++-- sound/soc/fsl/fsl_sai.h | 4 ++ 3 files changed, 55 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/sound/fsl-sai.txt +5 -3
@@ -10,7 +10,8 @@ Required properties: - compatible: Compatible list, contains "fsl,vf610-sai" or "fsl,imx6sx-sai". - reg: Offset and length of the register set for the device. - clocks: Must contain an entry for each entry in clock-names. -- clock-names : Must include the "sai" entry. +- clock-names : Must include the "bus" for register access and "mclk1" "mclk2" + "mclk3" for bit clock and frame clock providing. - dmas : Generic dma devicetree binding as described in Documentation/devicetree/bindings/dma/dma.txt. - dma-names : Two dmas have to be defined, "tx" and "rx".
@@ -30,8 +31,9 @@ sai2: sai@40031000 { reg = <0x40031000 0x1000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sai2_1>; - clocks = <&clks VF610_CLK_SAI2>; - clock-names = "sai"; + clocks = <&clks VF610_CLK_SAI2>, <&clks VF610_CLK_SAI2> + <&clks 0>, <&clks 0>; + clock-names = "bus", "mclk1", "mclk2", "mclk3"; dma-names = "tx", "rx"; dmas = <&edma0 0 VF610_EDMA_MUXID0_SAI2_TX>, <&edma0 0 VF610_EDMA_MUXID0_SAI2_RX>;
sound/soc/fsl/fsl_sai.c +46 -4
91 lines not on this page · raw message
sound/soc/fsl/fsl_sai.h +4 -0
@@ -119,6 +119,8 @@#define FSL_SAI_CLK_MAST2 2#define FSL_SAI_CLK_MAST3 3 +#define FSL_SAI_MCLK_MAX 3 +/* SAI data transfer numbers per DMA request */ #define FSL_SAI_MAXBURST_TX 6#define FSL_SAI_MAXBURST_RX 6
@@ -126,6 +128,8 @@struct fsl_sai {struct platform_device *pdev;struct regmap *regmap; +struct clk *bus_clk; +struct clk *mclk_clk[FSL_SAI_MCLK_MAX ];bool big_endian_regs;bool big_endian_data;
Signature · 1 line
1.8.4
Mark Brown
maintainerRe: [PATCH v2 1/2] ASoC: fsl_sai: Add clock controls for SAI
Quoted 3 lines · Nicolin Chen
-- clock-names : Must include the "sai" entry.
+- clock-names : Must include the "bus" for register access and "mclk1" "mclk2" + "mclk3" for bit clock and frame clock providing.
This breaks compatibilty with old DTs - it just removes the "sai" name. It's OK to deprecate the "sai" clock name but you need to keep support for DTs that only specify that, there's no code for that left in the driver.
Re: [PATCH v2 1/2] ASoC: fsl_sai: Add clock controls for SAI
Quoted 10 lines · Mark Brown
Quoted 3 lines · Nicolin Chen
-- clock-names : Must include the "sai" entry.
+- clock-names : Must include the "bus" for register access and "mclk1" "mclk2" + "mclk3" for bit clock and frame clock providing.This breaks compatibilty with old DTs - it just removes the "sai" name. It's OK to deprecate the "sai" clock name but you need to keep support for DTs that only specify that, there's no code for that left in the driver.
Sir, you've already applied the v6 of this patch last week :) And I can still find it in topic/fsl-sai.
ca3e35c ASoC: fsl_sai: Add clock controls for SAI
And regarding the old DTs compatibilty, Shawn has already reminded me in his comments against one of the version. I took his advice and made the patch compatible with the old 'sai' clock binding within that v6.
Thank you,
Nicolin
PATCH v2 2/2 ARM: dts: Append clock bindings for sai2 on VF610 platform
In reply to Nicolin ChenSince we added fours clock to the DT binding, we should update the current SAI dts/dtsi so as not to break their functions.
--- arch/arm/boot/dts/vf610.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/boot/dts/vf610.dtsi +4 -2
@@ -139,8 +139,10 @@ compatible = "fsl,vf610-sai"; reg = <0x40031000 0x1000>; interrupts = <0 86 0x04>; - clocks = <&clks VF610_CLK_SAI2>; - clock-names = "sai"; + clocks = <&clks VF610_CLK_SAI2>, + <&clks VF610_CLK_SAI2>, + <&clks 0>, <&clks 0>; + clock-names = "bus", "mclk1", "mclk2", "mclk3"; status = "disabled"; };
Signature · 1 line
1.8.4
Re: [PATCH v2 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Quoted 13 lines · Nicolin Chen
Since we added fours clock to the DT binding, we should update the current SAI dts/dtsi so as not to break their functions.
Signed-off-by Nicolin Chen <[email protected]>--- arch/arm/boot/dts/vf610.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/arm/boot/dts/vf610.dtsi +0
-0
arch/arm/boot/dts/vf610.dtsi line 144
Quoted 8 lines
arch/arm/boot/dts/vf610.dtsi +3
-2@@ -139,8 +139,10 @@ compatible = "fsl,vf610-sai"; reg = <0x40031000 0x1000>; interrupts = <0 86 0x04>; - clocks = <&clks VF610_CLK_SAI2>; - clock-names = "sai"; + clocks = <&clks VF610_CLK_SAI2>, + <&clks VF610_CLK_SAI2>, + <&clks 0>, <&clks 0>;
So it seems that SAI on vf610 does work with only one clock. So the driver change will break old DTB for vf610? If that's case, we will have to need a new compatible for cases where 4 clocks are needed.
Shawn
Quoted 8 lines
arch/arm/boot/dts/vf610.dtsi +1
-0+ clock-names = "bus", "mclk1", "mclk2", "mclk3"; status = "disabled"; };Signature · 1 line
1.8.4
Re: [PATCH v2 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Hi Shawn,
Thanks for the comments, but...
Quoted 18 lines · Shawn Guo
Quoted 17 lines · Nicolin Chen
Since we added fours clock to the DT binding, we should update the current SAI dts/dtsi so as not to break their functions.
Signed-off-by Nicolin Chen <[email protected]>--- arch/arm/boot/dts/vf610.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/arm/boot/dts/vf610.dtsi +0
-1@@ -139,8 +139,10 @@ compatible = "fsl,vf610-sai"; reg = <0x40031000 0x1000>; interrupts = <0 86 0x04>; - clocks = <&clks VF610_CLK_SAI2>;
Quoted 8 lines
arch/arm/boot/dts/vf610.dtsi line 144
Quoted 4 lines
arch/arm/boot/dts/vf610.dtsi +3
-1- clock-names = "sai"; + clocks = <&clks VF610_CLK_SAI2>, + <&clks VF610_CLK_SAI2>, + <&clks 0>, <&clks 0>;So it seems that SAI on vf610 does work with only one clock. So the driver change will break old DTB for vf610? If that's case, we will have to need a new compatible for cases where 4 clocks are needed.
According to Vybrid's RM Chapter 9.11.12 SAI clocking, the SoC actually connects SAI with two clocks: SAI_CLK and Platform Bus Clock. So the DT binding here still needs to be corrected even if ignoring driver change.
Besides, I've checked both SAI on imx and vf610 and found that they are seemly identical, especially for the clock part -- "The transmitter and receiver can independently select between the bus clock and up to three audio master clocks to generate the bit clock." And the driver that was designed for vf610 already contains the code to switch the clock between Bus Clock and Three MCLKs. What I want to say is, even if SAI on vf610 does work with only one clock, it still doesn't have the full function on vf610 -- driving clock from Platform Bus Clock unless we make this improvement to the DT binding.
So I think it's fair to complete the code here for both platforms, even though we might take the risk of merging conflict. And I understand your point to avoid function break on those platform both of us aren't convenient to test. But I've already involved Xiubo in the list. And we can wait for his test result.
Hope you can understand the circumstance,
Nicolin
RE: [PATCH v2 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Quoted 50 lines
Subject: Re: [PATCH v2 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Hi Shawn,
Thanks for the comments, but...
Quoted 18 lines · Shawn Guo
Quoted 17 lines · Nicolin Chen
Since we added fours clock to the DT binding, we should update the current SAI dts/dtsi so as not to break their functions.
Signed-off-by Nicolin Chen <[email protected]>--- arch/arm/boot/dts/vf610.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)arch/arm/boot/dts/vf610.dtsi +0
-1@@ -139,8 +139,10 @@ compatible = "fsl,vf610-sai"; reg = <0x40031000 0x1000>; interrupts = <0 86 0x04>; - clocks = <&clks VF610_CLK_SAI2>;Quoted 8 lines
arch/arm/boot/dts/vf610.dtsi line 144
Quoted 4 lines
arch/arm/boot/dts/vf610.dtsi +3
-1- clock-names = "sai"; + clocks = <&clks VF610_CLK_SAI2>, + <&clks VF610_CLK_SAI2>, + <&clks 0>, <&clks 0>;So it seems that SAI on vf610 does work with only one clock. So the driver change will break old DTB for vf610? If that's case, we will have to need a new compatible for cases where 4 clocks are needed.
According to Vybrid's RM Chapter 9.11.12 SAI clocking, the SoC actually connects SAI with two clocks:
SAI_CLKand Platform Bus Clock. So the DT binding here still needs to be corrected even if ignoring driver change.Besides, I've checked both SAI on imx and vf610 and found that they are seemly identical, especially for the clock part -- "The transmitter and receiver can independently select between the bus clock and up to three audio master clocks to generate the bit clock." And the driver that was designed for vf610 already contains the code to switch the clock between Bus Clock and Three MCLKs. What I want to say is, even if SAI on vf610 does work with only one clock, it still doesn't have the full function on vf610 -- driving clock from Platform Bus Clock unless we make this improvement to the DT binding.
Quoted 6 lines
So I think it's fair to complete the code here for both platforms, even though we might take the risk of merging conflict. And I understand your point to avoid function break on those platform both of us aren't convenient to test. But I've already involved Xiubo in the list. And we can wait for his test result.
This has been test on my Vybird-TWR board and it's fine.
Thanks,
Brs
Xiubo
Quoted 2 lines
Hope you can understand the circumstance,
Nicolin
Mark Brown
maintainerRe: [PATCH v2 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
In reply to Nicolin ChenQuoted 2 lines · Nicolin Chen
Since we added fours clock to the DT binding, we should update the current SAI dts/dtsi so as not to break their functions.
This doesn't apply against v3.15-rc1, can you please check and resend?
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Quoted 5 lines · Mark Brown
Quoted 2 lines · Nicolin Chen
Since we added fours clock to the DT binding, we should update the current SAI dts/dtsi so as not to break their functions.
This doesn't apply against v3.15-rc1, can you please check and resend?
Please disregard this patch, since my v6 patch was compatible with the old binding, the patch here is provisionally useless and I can later send it via Shawn's tree.
Thank you,
Nicolin