ASoC: fsl_sai: Add bus clock and mclks with clock controls
Subsystems (4)
v3 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
v3:
* Use int type for ret instead of u32.
* Added Acked-by and Tested-by from Xiubo Li.
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 | 51 ++++++++++++++++++++-- sound/soc/fsl/fsl_sai.h | 4 ++ 4 files changed, 60 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.4
PATCH v3 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 | 51 ++++++++++++++++++++-- sound/soc/fsl/fsl_sai.h | 4 ++ 3 files changed, 56 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 +47 -4
92 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
PATCH v3 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 v3 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
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.
If so, shouldn't the change be in the same patch as driver change?
Shawn
Quoted 28 lines
Signed-off-by Nicolin Chen <[email protected]>Tested-by Xiubo Li <[email protected]>--- 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 v3 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Quoted 5 lines · Shawn Guo
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.
If so, shouldn't the change be in the same patch as driver change?
Okay..I'd like to merge them into one patch.
Thank you,
Nicolin
Quoted 27 lines
Shawn
Quoted 24 lines
Signed-off-by Nicolin Chen <[email protected]>Tested-by Xiubo Li <[email protected]>--- 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"; };
Quoted 5 lines
Quoted 4 lines
Signature · 1 line
1.8.4
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v3 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.
For the record, you're asking my ACK to have the dts change go via sound tree for not breaking vf610 function on the sound branch, while ignoring the fact that the existing DTB will break with the new kernel anyway.
I'm not completely happy with the approach, but considering that the existing binding is incorrect, I'm fine with it as long as people agree to go this way.
Shawn
Quoted 28 lines
Signed-off-by Nicolin Chen <[email protected]>Tested-by Xiubo Li <[email protected]>--- 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 v3 2/2] ARM: dts: Append clock bindings for sai2 on VF610 platform
Hi Shawn,
Quoted 4 lines · Shawn Guo
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.
Quoted 8 lines
For the record, you're asking my ACK to have the dts change go via sound tree for not breaking vf610 function on the sound branch, while ignoring the fact that the existing DTB will break with the new kernel anyway.
I'm not completely happy with the approach, but considering that the existing binding is incorrect, I'm fine with it as long as people agree to go this way.
Although I'm not a big fan of explaining, yet, I still want to say that actually I've balanced this way and your last suggestion against the v1.
It'd be surely better to distinguish two platforms as you suggested if we are looking at this change alone since the change is nearly tiny and the code to specify them wouldn't be quite a lot. However, there's more work to do based on this patch, an auto-selecting clock source mechanism for SAI as a DAI master for example, which would need to drop the existing code and to add the new one. If vf610 is still using the old one, it would not benefit from the further feature and the code would be definitely ugly as we would have to add too many platform checks. So personally I prefer this reasonable change than the little sacrifice we're going to make here.
Right now I feel grateful for what Sascha suggested to the DT bindings of fsl-spdif. It was a painstaking experience when getting it upstream last year but what's done at that moment makes the driver more flexible. So I think we should do the strict and comprehensive review for the clock part to every module from now on since an once-defined-DT-binding would be so painful to improved for us.
Thank you,
Nicolin
Quoted 32 lines
Shawn
Quoted 28 lines
Signed-off-by Nicolin Chen <[email protected]>Tested-by Xiubo Li <[email protected]>--- 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