* [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff
@ 2016-02-15 3:32 Shawn Lin
2016-02-15 3:33 ` [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:32 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
Happy Chinese new year, Rockchipers!
This patchset fix some trivial things for rockchip clk/pm
driver when learning clk stuff which I'm interested in during the
holiday.
All of them is based on Heiko's tree(master branch):
git://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git
Shawn Lin (6):
clk: rockchip: handle alt_parent in err cases when registering cpuclk
clk: rockchip: check grf when waiting pll lock
clk: rockchip: don't return NULL when registering inverter fails
clk: rockchip: don't return NULL when registering mmc branch fails
clk: rockchip: fix coding style for clk-cpu.c
soc: rockchip: power-domain: check the existing of regmap
drivers/clk/rockchip/clk-cpu.c | 8 +++++---
drivers/clk/rockchip/clk-inverter.c | 8 ++------
drivers/clk/rockchip/clk-mmc-phase.c | 8 ++------
drivers/clk/rockchip/clk-pll.c | 8 +++++++-
drivers/soc/rockchip/pm_domains.c | 4 ++++
5 files changed, 20 insertions(+), 16 deletions(-)
--
2.3.7
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
@ 2016-02-15 3:33 ` Shawn Lin
2016-02-15 21:39 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 2/6] clk: rockchip: check grf when waiting pll lock Shawn Lin
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:33 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
Add clk_disable_unprepare to handle cpuclk->alt_parent if
rockchip_clk_register_cpuclk fails.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/clk/rockchip/clk-cpu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
index d07374f..68a2a87 100644
--- a/drivers/clk/rockchip/clk-cpu.c
+++ b/drivers/clk/rockchip/clk-cpu.c
@@ -290,14 +290,14 @@ struct clk *rockchip_clk_register_cpuclk(const char *name,
pr_err("%s: could not lookup parent clock %s\n",
__func__, parent_names[0]);
ret = -EINVAL;
- goto free_cpuclk;
+ goto free_alt_parent;
}
ret = clk_notifier_register(clk, &cpuclk->clk_nb);
if (ret) {
pr_err("%s: failed to register clock notifier for %s\n",
__func__, name);
- goto free_cpuclk;
+ goto free_alt_parent;
}
if (nrates > 0) {
@@ -326,6 +326,8 @@ free_rate_table:
kfree(cpuclk->rate_table);
unregister_notifier:
clk_notifier_unregister(clk, &cpuclk->clk_nb);
+free_alt_parent:
+ clk_disable_unprepare(cpuclk->alt_parent);
free_cpuclk:
kfree(cpuclk);
return ERR_PTR(ret);
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] clk: rockchip: check grf when waiting pll lock
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
2016-02-15 3:33 ` [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin
@ 2016-02-15 3:33 ` Shawn Lin
2016-02-15 21:40 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails Shawn Lin
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:33 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
rockchip_clk_get_grf pass on return value from
syscon_regmap_lookup_by_phandle, so we check grf to
make sure whether to do the following things or not.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/clk/rockchip/clk-pll.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
index b7e66c9..dddbc29 100644
--- a/drivers/clk/rockchip/clk-pll.c
+++ b/drivers/clk/rockchip/clk-pll.c
@@ -90,10 +90,16 @@ static long rockchip_pll_round_rate(struct clk_hw *hw,
*/
static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll)
{
- struct regmap *grf = rockchip_clk_get_grf();
+ struct regmap *grf;
unsigned int val;
int delay = 24000000, ret;
+ grf = rockchip_clk_get_grf();
+ if (IS_ERR(grf)) {
+ pr_err("%s: grf regmap not available\n", __func__);
+ return -ENODEV;
+ }
+
while (delay > 0) {
ret = regmap_read(grf, pll->lock_offset, &val);
if (ret) {
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
2016-02-15 3:33 ` [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin
2016-02-15 3:33 ` [PATCH 2/6] clk: rockchip: check grf when waiting pll lock Shawn Lin
@ 2016-02-15 3:33 ` Shawn Lin
2016-02-15 22:41 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Shawn Lin
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:33 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
Avoid return NULL if rockchip_clk_register_inverter fails, otherwise
rockchip_clk_register_branches print "unknown clock type". The acutal
case is that it's a known clock type but we fail to regiser it, which
may makes user confuse the reason of failure.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/clk/rockchip/clk-inverter.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/rockchip/clk-inverter.c b/drivers/clk/rockchip/clk-inverter.c
index 7cbf43b..dcb6e37 100644
--- a/drivers/clk/rockchip/clk-inverter.c
+++ b/drivers/clk/rockchip/clk-inverter.c
@@ -90,7 +90,7 @@ struct clk *rockchip_clk_register_inverter(const char *name,
inv_clock = kmalloc(sizeof(*inv_clock), GFP_KERNEL);
if (!inv_clock)
- return NULL;
+ return ERR_PTR(-ENOMEM);
init.name = name;
init.num_parents = num_parents;
@@ -106,11 +106,7 @@ struct clk *rockchip_clk_register_inverter(const char *name,
clk = clk_register(NULL, &inv_clock->hw);
if (IS_ERR(clk))
- goto err_free;
+ kfree(inv_clock);
return clk;
-
-err_free:
- kfree(inv_clock);
- return NULL;
}
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
` (2 preceding siblings ...)
2016-02-15 3:33 ` [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails Shawn Lin
@ 2016-02-15 3:33 ` Shawn Lin
2016-02-15 22:42 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c Shawn Lin
2016-02-15 3:33 ` [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap Shawn Lin
5 siblings, 1 reply; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:33 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
Avoid return NULL if rockchip_clk_register_mmc fails, otherwise
rockchip_clk_register_branches print "unknown clock type". The acutal
case is that it's a known clock type but we fail to regiser it, which
may makes user confuse the reason of failure.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/clk/rockchip/clk-mmc-phase.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c
index 2685644..e0dc7e8 100644
--- a/drivers/clk/rockchip/clk-mmc-phase.c
+++ b/drivers/clk/rockchip/clk-mmc-phase.c
@@ -150,7 +150,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,
mmc_clock = kmalloc(sizeof(*mmc_clock), GFP_KERNEL);
if (!mmc_clock)
- return NULL;
+ return ERR_PTR(-ENOMEM);
init.name = name;
init.num_parents = num_parents;
@@ -172,11 +172,7 @@ struct clk *rockchip_clk_register_mmc(const char *name,
clk = clk_register(NULL, &mmc_clock->hw);
if (IS_ERR(clk))
- goto err_free;
+ kfree(mmc_clock);
return clk;
-
-err_free:
- kfree(mmc_clock);
- return NULL;
}
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
` (3 preceding siblings ...)
2016-02-15 3:33 ` [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Shawn Lin
@ 2016-02-15 3:33 ` Shawn Lin
2016-02-15 22:42 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap Shawn Lin
5 siblings, 1 reply; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:33 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
Fix the issue reported by checkpatch:
ERROR: space prohibited before that ',' (ctx:WxW)
+ writel(clksel->val , cpuclk->reg_base + clksel->reg);
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/clk/rockchip/clk-cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
index 68a2a87..4e73ed5 100644
--- a/drivers/clk/rockchip/clk-cpu.c
+++ b/drivers/clk/rockchip/clk-cpu.c
@@ -116,7 +116,7 @@ static void rockchip_cpuclk_set_dividers(struct rockchip_cpuclk *cpuclk,
pr_debug("%s: setting reg 0x%x to 0x%x\n",
__func__, clksel->reg, clksel->val);
- writel(clksel->val , cpuclk->reg_base + clksel->reg);
+ writel(clksel->val, cpuclk->reg_base + clksel->reg);
}
}
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
` (4 preceding siblings ...)
2016-02-15 3:33 ` [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c Shawn Lin
@ 2016-02-15 3:33 ` Shawn Lin
2016-02-15 21:26 ` Heiko Stuebner
5 siblings, 1 reply; 13+ messages in thread
From: Shawn Lin @ 2016-02-15 3:33 UTC (permalink / raw)
To: Heiko Stuebner, Michael Turquette, Stephen Boyd
Cc: linux-clk, linux-rockchip, linux-kernel, Shawn Lin
Check return value of syscon_node_to_regmap for
rockchip_pm_domain_probe. If err value is returned, probe
procedure should abort.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/soc/rockchip/pm_domains.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
index 534c589..3c4a44d 100644
--- a/drivers/soc/rockchip/pm_domains.c
+++ b/drivers/soc/rockchip/pm_domains.c
@@ -402,6 +402,10 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
}
pmu->regmap = syscon_node_to_regmap(parent->of_node);
+ if (IS_ERR(pmu->regmap)) {
+ dev_err(dev, "no regmap available\n");
+ return -ENODEV;
+ }
/*
* Configure power up and down transition delays for CORE
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap
2016-02-15 3:33 ` [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap Shawn Lin
@ 2016-02-15 21:26 ` Heiko Stuebner
0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2016-02-15 21:26 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-rockchip, linux-kernel
Am Montag, 15. Februar 2016, 11:33:57 schrieb Shawn Lin:
> Check return value of syscon_node_to_regmap for
> rockchip_pm_domain_probe. If err value is returned, probe
> procedure should abort.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my armsoc/drivers branch for 4.6 with one change below
> ---
>
> drivers/soc/rockchip/pm_domains.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/soc/rockchip/pm_domains.c
> b/drivers/soc/rockchip/pm_domains.c index 534c589..3c4a44d 100644
> --- a/drivers/soc/rockchip/pm_domains.c
> +++ b/drivers/soc/rockchip/pm_domains.c
> @@ -402,6 +402,10 @@ static int rockchip_pm_domain_probe(struct
> platform_device *pdev) }
>
> pmu->regmap = syscon_node_to_regmap(parent->of_node);
> + if (IS_ERR(pmu->regmap)) {
> + dev_err(dev, "no regmap available\n");
> + return -ENODEV;
Instead of returning ENODEV I did go with
return PTR_ERR(pmu->regmap);
the error from trying to grab the regmap.
Heiko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk
2016-02-15 3:33 ` [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin
@ 2016-02-15 21:39 ` Heiko Stuebner
0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2016-02-15 21:39 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-rockchip, linux-kernel
Am Montag, 15. Februar 2016, 11:33:15 schrieb Shawn Lin:
> Add clk_disable_unprepare to handle cpuclk->alt_parent if
> rockchip_clk_register_cpuclk fails.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my clk branch for 4.6
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/6] clk: rockchip: check grf when waiting pll lock
2016-02-15 3:33 ` [PATCH 2/6] clk: rockchip: check grf when waiting pll lock Shawn Lin
@ 2016-02-15 21:40 ` Heiko Stuebner
0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2016-02-15 21:40 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-rockchip, linux-kernel
Am Montag, 15. Februar 2016, 11:33:25 schrieb Shawn Lin:
> rockchip_clk_get_grf pass on return value from
> syscon_regmap_lookup_by_phandle, so we check grf to
> make sure whether to do the following things or not.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my clk-branch for 4.6 with one change below
> ---
>
> drivers/clk/rockchip/clk-pll.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/rockchip/clk-pll.c
> b/drivers/clk/rockchip/clk-pll.c index b7e66c9..dddbc29 100644
> --- a/drivers/clk/rockchip/clk-pll.c
> +++ b/drivers/clk/rockchip/clk-pll.c
> @@ -90,10 +90,16 @@ static long rockchip_pll_round_rate(struct clk_hw *hw,
> */
> static int rockchip_pll_wait_lock(struct rockchip_clk_pll *pll)
> {
> - struct regmap *grf = rockchip_clk_get_grf();
> + struct regmap *grf;
> unsigned int val;
> int delay = 24000000, ret;
>
> + grf = rockchip_clk_get_grf();
> + if (IS_ERR(grf)) {
> + pr_err("%s: grf regmap not available\n", __func__);
> + return -ENODEV;
I've changed that to PTR_ERR(grf), similar to the preexisting checks
Heiko
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails
2016-02-15 3:33 ` [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails Shawn Lin
@ 2016-02-15 22:41 ` Heiko Stuebner
0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2016-02-15 22:41 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-rockchip, linux-kernel
Am Montag, 15. Februar 2016, 11:33:33 schrieb Shawn Lin:
> Avoid return NULL if rockchip_clk_register_inverter fails, otherwise
> rockchip_clk_register_branches print "unknown clock type". The acutal
> case is that it's a known clock type but we fail to regiser it, which
> may makes user confuse the reason of failure.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my clk-branch for 4.6
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails
2016-02-15 3:33 ` [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Shawn Lin
@ 2016-02-15 22:42 ` Heiko Stuebner
0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2016-02-15 22:42 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-rockchip, linux-kernel
Am Montag, 15. Februar 2016, 11:33:41 schrieb Shawn Lin:
> Avoid return NULL if rockchip_clk_register_mmc fails, otherwise
> rockchip_clk_register_branches print "unknown clock type". The acutal
> case is that it's a known clock type but we fail to regiser it, which
> may makes user confuse the reason of failure.
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my clk-branch for 4.6
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c
2016-02-15 3:33 ` [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c Shawn Lin
@ 2016-02-15 22:42 ` Heiko Stuebner
0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stuebner @ 2016-02-15 22:42 UTC (permalink / raw)
To: Shawn Lin
Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-rockchip, linux-kernel
Am Montag, 15. Februar 2016, 11:33:50 schrieb Shawn Lin:
> Fix the issue reported by checkpatch:
> ERROR: space prohibited before that ',' (ctx:WxW)
> + writel(clksel->val , cpuclk->reg_base + clksel->reg);
>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
applied to my clk-branch for 4.6
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-02-15 22:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-15 3:32 [PATCH 0/6] Some trivial fixes for rockchip clk/pm stuff Shawn Lin
2016-02-15 3:33 ` [PATCH 1/6] clk: rockchip: handle alt_parent in err cases when registering cpuclk Shawn Lin
2016-02-15 21:39 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 2/6] clk: rockchip: check grf when waiting pll lock Shawn Lin
2016-02-15 21:40 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 3/6] clk: rockchip: don't return NULL when registering inverter fails Shawn Lin
2016-02-15 22:41 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 4/6] clk: rockchip: don't return NULL when registering mmc branch fails Shawn Lin
2016-02-15 22:42 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 5/6] clk: rockchip: fix coding style for clk-cpu.c Shawn Lin
2016-02-15 22:42 ` Heiko Stuebner
2016-02-15 3:33 ` [PATCH 6/6] soc: rockchip: power-domain: check the existing of regmap Shawn Lin
2016-02-15 21:26 ` Heiko Stuebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.