clk: rockchip: rk3399: fix clk_i2sout parent selection bits
Subsystems (2)
PATCH 1/2 clk: rockchip: rk3399: fix clk_i2sout parent selection bits
From: Alberto Panizzo <alberto-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Register, shift and mask were wrong according to datasheet.
--- drivers/clk/rockchip/clk-rk3399.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3399.c +1 -1
@@ -631,7 +631,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {MUX (0 ,"clk_i2sout_src" , mux_i2sch_p,CLK_SET_RATE_PARENT ,RK3399_CLKSEL_CON (31 ),0 ,2 ,MFLAGS ),COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p,CLK_SET_RATE_PARENT , -RK3399_CLKSEL_CON (30 ),8 ,2 ,MFLAGS , +RK3399_CLKSEL_CON (31 ),2 ,1 ,MFLAGS , RK3399_CLKGATE_CON(8), 12, GFLAGS),/* uart */
Signature · 1 line
2.7.4
PATCH 2/2 clk: rockchip: rk3399: fix returning correct value on clk_i2sout get_rate
In reply to a message not in the archiveFrom: Alberto Panizzo <alberto-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
clk_i2sout can be used as codec mclk.
On simple audio card clk_i2sout is just enabled/disabled while the rate is decided on parent clock by i2s driver.
Without setting CLK_GET_RATE_NOCACHE flag, the get_rate function on clk_i2sout would return incorrect values after clk_i2sout's parents update.
--- drivers/clk/rockchip/clk-rk3399.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3399.c +2 -1
@@ -630,7 +630,8 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {MUX (0 ,"clk_i2sout_src" , mux_i2sch_p,CLK_SET_RATE_PARENT ,RK3399_CLKSEL_CON (31 ),0 ,2 ,MFLAGS ), -COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p,CLK_SET_RATE_PARENT , +COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p, +CLK_SET_RATE_PARENT |CLK_GET_RATE_NOCACHE ,RK3399_CLKSEL_CON (31 ),2 ,1 ,MFLAGS , RK3399_CLKGATE_CON(8), 12, GFLAGS),
Signature · 1 line
2.7.4
Am Freitag, 6. Juli 2018, 15:18:51 CEST schrieb Anthony Brandon:
Quoted 6 lines
From: Alberto Panizzo <alberto-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
Register, shift and mask were wrong according to datasheet.
applied for 4.19, after double-checking against the TRM
Thanks for catching this
Heiko
Heiko Stuebner
maintainerRe: [PATCH 2/2] clk: rockchip: rk3399: fix returning correct value on clk_i2sout get_rate [with GET_RATE_NOCACHE]
In reply to Anthony BrandonHi,
Am Freitag, 6. Juli 2018, 15:18:52 CEST schrieb Anthony Brandon:
Quoted 8 lines
From: Alberto Panizzo <[email protected]>
clk_i2soutcan be used as codec mclk.
On simple audio cardclk_i2soutis just enabled/disabled while the rate is decided on parent clock by i2s driver.
Without settingCLK_GET_RATE_NOCACHEflag, theget_ratefunction onclk_i2soutwould return incorrect values after clk_i2sout's parents update.
Can you elaborate a bit more on the issue you see please? Because as far as I remember the clock-framework should already update child-clocks when the rate of their parent changed.
So even the cached rate should be correct after the parent changes, so I don't really understand in what case you would get a wrong rate.
Heiko
Quoted 21 lines
Signed-off-by Alberto Panizzo <[email protected]>Signed-off-by Anthony Brandon <[email protected]>--- drivers/clk/rockchip/clk-rk3399.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/clk/rockchip/clk-rk3399.c +2
-1@@ -630,7 +630,8 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {MUX (0 ,"clk_i2sout_src" , mux_i2sch_p,CLK_SET_RATE_PARENT ,RK3399_CLKSEL_CON (31 ),0 ,2 ,MFLAGS ), -COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p,CLK_SET_RATE_PARENT , +COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p, +CLK_SET_RATE_PARENT |CLK_GET_RATE_NOCACHE ,RK3399_CLKSEL_CON (31 ),2 ,1 ,MFLAGS , RK3399_CLKGATE_CON(8), 12, GFLAGS),
Re: [PATCH 2/2] clk: rockchip: rk3399: fix returning correct value on clk_i2sout get_rate [with GET_RATE_NOCACHE]
Hi Heiko,
Quoted 12 lines · Heiko Stuebner
Hi,
Am Freitag, 6. Juli 2018, 15:18:52 CEST schrieb Anthony Brandon:
Quoted 8 lines
From: Alberto Panizzo <[email protected]>
clk_i2soutcan be used as codec mclk.
On simple audio cardclk_i2soutis just enabled/disabled while the rate is decided on parent clock by i2s driver.
Without settingCLK_GET_RATE_NOCACHEflag, theget_ratefunction onclk_i2soutwould return incorrect values after clk_i2sout's parents update.
Quoted 8 lines
Can you elaborate a bit more on the issue you see please? Because as far as I remember the clock-framework should already update child-clocks when the rate of their parent changed.
So even the cached rate should be correct after the parent changes, so I don't really understand in what case you would get a wrong rate.
You are right, I'm sorry this patch were coming from days of long test and checks
to understand why clk_get_rate were returning 0 while parents clocks were set.
(And working with a codec which does not offer deterministic results)
Especially, after having found and fixed the bits misconfigurations, a clk_get_rate
on clk_i2sout before the first clk_i2s0 set_rate is returning 0.
But clk_i2s0_mux results unparented before first clk_i2s0 set_rate and with or without
NOCACHE, until a set_rate is called on clk_i2s0, a get_rate on clk_i2sout will return 0.
This does not prevent good behavior after first _hw_params() so please, drop this patch.
But patch 1/2 is necessary, please apply.
Thanks,
Alberto Panizzo
--
Amarula Solutions SRL Via le Canevare 30 31100 Treviso
Italy
Amarula Solutions BV Cruquiuskade 47 Amsterdam 1018 AM The
Netherlands
Phone. +31(0)851119171 Fax. +31(0)204106211
www.amarulasolutions.com
Quoted 31 lines
Review
Quoted 9 lines
Signed-off-by Alberto Panizzo <[email protected]>Signed-off-by Anthony Brandon <[email protected]>--- drivers/clk/rockchip/clk-rk3399.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/clk/rockchip/clk-rk3399.cdrivers/clk/rockchip/clk-rk3399.c static struct rockchip_clk_branch
Quoted 4 lines
index 2a8634a..6073479 100644
drivers/clk/rockchip/clk-rk3399.c +0
-0@@ -630,7 +630,8 @@ static struct rockchip_clk_branchrk3399_clk_branches[]
__initdata= {drivers/clk/rockchip/clk-rk3399.c static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
Quoted 4 lines
drivers/clk/rockchip/clk-rk3399.c +0
-1MUX (0 ,"clk_i2sout_src" , mux_i2sch_p,CLK_SET_RATE_PARENT , RK3399_CLKSEL_CON(31), 0, 2, MFLAGS), - COMPOSITE_NODIV(SCLK_I2S_8CH_OUT, "clk_i2sout", mux_i2sout_p,
CLK_SET_RATE_PARENT,Quoted 6 lines
drivers/clk/rockchip/clk-rk3399.c +2
-0+COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p, +CLK_SET_RATE_PARENT |CLK_GET_RATE_NOCACHE ,RK3399_CLKSEL_CON (31 ),2 ,1 ,MFLAGS , RK3399_CLKGATE_CON(8), 12, GFLAGS),
Re: [PATCH 2/2] clk: rockchip: rk3399: fix returning correct value on clk_i2sout get_rate [with GET_RATE_NOCACHE]
In reply to Heiko StuebnerHi Heiko,
Quoted 12 lines · Heiko Stuebner
Hi,
Am Freitag, 6. Juli 2018, 15:18:52 CEST schrieb Anthony Brandon:
Quoted 8 lines
From: Alberto Panizzo <[email protected]>
clk_i2soutcan be used as codec mclk.
On simple audio cardclk_i2soutis just enabled/disabled while the rate is decided on parent clock by i2s driver.
Without settingCLK_GET_RATE_NOCACHEflag, theget_ratefunction onclk_i2soutwould return incorrect values after clk_i2sout's parents update.
Quoted 7 lines
Can you elaborate a bit more on the issue you see please? Because as far as I remember the clock-framework should already update child-clocks when the rate of their parent changed.
So even the cached rate should be correct after the parent changes, so I don't really understand in what case you would get a wrong rate.
You are right, I'm sorry this patch were coming from days of long test and checks to understand why clk_get_rate were returning 0 while parents clocks were set.
(And working with a codec which does not offer deterministic results)
Especially, after having found and fixed the bits misconfigurations, a clk_get_rate on clk_i2sout before the first clk_i2s0 set_rate is returning 0.
But clk_i2s0_mux results unparented before first clk_i2s0 set_rate and with or without NOCACHE, until a set_rate is called on clk_i2s0, a get_rate on clk_i2sout will return 0.
This does not prevent good behavior after first _hw_params() so please, drop this patch.
But patch 1/2 is necessary, please apply.
Thanks,
Alberto Panizzo
--
Amarula Solutions SRL Via le Canevare 30 31100 Treviso Italy
Amarula Solutions BV Cruquiuskade 47 Amsterdam 1018 AM The Netherlands
Phone. +31(0)851119171 Fax. +31(0)204106211 www.amarulasolutions.com
Quoted 27 lines
Quoted 23 lines
Signed-off-by Alberto Panizzo <[email protected]>Signed-off-by Anthony Brandon <[email protected]>--- drivers/clk/rockchip/clk-rk3399.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/clk/rockchip/clk-rk3399.c +2
-1@@ -630,7 +630,8 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {MUX (0 ,"clk_i2sout_src" , mux_i2sch_p,CLK_SET_RATE_PARENT ,RK3399_CLKSEL_CON (31 ),0 ,2 ,MFLAGS ), -COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p,CLK_SET_RATE_PARENT , +COMPOSITE_NODIV (SCLK_I2S_8CH_OUT ,"clk_i2sout" , mux_i2sout_p, +CLK_SET_RATE_PARENT |CLK_GET_RATE_NOCACHE ,RK3399_CLKSEL_CON (31 ),2 ,1 ,MFLAGS , RK3399_CLKGATE_CON(8), 12, GFLAGS),
Signature · 3 lines
Amarula Solutions SRL Via le Canevare 30 31100 Treviso Italy Amarula Solutions BV Cruquiuskade 47 Amsterdam 1018 AM The Netherlands Phone. +31(0)851119171 Fax. +31(0)204106211 www.amarulasolutions.com
Heiko Stübner
maintainerRe: [PATCH 2/2] clk: rockchip: rk3399: fix returning correct value on clk_i2sout get_rate [with GET_RATE_NOCACHE]
Am Montag, 9. Juli 2018, 18:16:21 CEST schrieb Alberto Panizzo:
Quoted 31 lines
Hi Heiko,
Quoted 12 lines · Heiko Stuebner
Hi,
Am Freitag, 6. Juli 2018, 15:18:52 CEST schrieb Anthony Brandon:
Quoted 8 lines
From: Alberto Panizzo <[email protected]>
clk_i2soutcan be used as codec mclk.
On simple audio cardclk_i2soutis just enabled/disabled while the rate is decided on parent clock by i2s driver.
Without settingCLK_GET_RATE_NOCACHEflag, theget_ratefunction onclk_i2soutwould return incorrect values after clk_i2sout's parents update.Quoted 6 lines
Can you elaborate a bit more on the issue you see please? Because as far as I remember the clock-framework should already update child-clocks when the rate of their parent changed.
So even the cached rate should be correct after the parent changes, so I don't really understand in what case you would get a wrong rate.
You are right, I'm sorry this patch were coming from days of long test and checks to understand why
clk_get_ratewere returning 0 while parents clocks were set.
(And working with a codec which does not offer deterministic results)Especially, after having found and fixed the bits misconfigurations, a
clk_get_rateonclk_i2soutbefore the firstclk_i2s0set_rateis returning 0.
Quoted 6 lines
But
clk_i2s0_muxresults unparented before firstclk_i2s0set_rateand with or without NOCACHE, until aset_rateis called onclk_i2s0, aget_rateonclk_i2soutwill return 0.This does not prevent good behavior after first
_hw_params()so please, drop this patch.
great to hear that :-)
Quoted 1 line
But patch 1/2 is necessary, please apply.
already done yesterday.
Heiko