drm/sun4i: backend: Make sure we enforce the clock rate
PATCH 2/2 drm/sun4i: drc: Make sure we enforce the clock rate
In reply to Maxime RipardThe DRC needs to run at 300MHz to be functional. This was done so far using assigned-clocks in the device tree, but that is easy to forget, and dosen't provide any other guarantee than the rate is going to be roughly the one requested at probe time.
Therefore it's pretty fragile, so let's just use the exclusive clock API to enforce it.
--- drivers/gpu/drm/sun4i/sun6i_drc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/sun4i/sun6i_drc.c +2 -0
@@ -57,6 +57,7 @@ static int sun6i_drc_bind(struct device *dev, struct device *master, goto err_disable_bus_clk; }clk_prepare_enable (drc->mod_clk); +clk_set_rate_exclusive (drc->mod_clk,300000000 );return 0 ;
@@ -72,6 +73,7 @@ static void sun6i_drc_unbind(struct device *dev, struct device *master, {struct sun6i_drc *drc =dev_get_drvdata (dev); +clk_rate_exclusive_put (drc->mod_clk);clk_disable_unprepare (drc->mod_clk);clk_disable_unprepare (drc->bus_clk);reset_control_assert (drc->reset);
Signature · 7 lines
2.23.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/2 drm/sun4i: backend: Make sure we enforce the clock rate
The backend needs to run at 300MHz to be functional. This was done so far using assigned-clocks in the device tree, but that is easy to forget, and dosen't provide any other guarantee than the rate is going to be roughly the one requested at probe time.
Therefore it's pretty fragile, so let's just use the exclusive clock API to enforce it.
--- drivers/gpu/drm/sun4i/sun4i_backend.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/sun4i/sun4i_backend.c +3 -0
@@ -857,6 +857,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master, goto err_disable_bus_clk; }clk_prepare_enable (backend->mod_clk); +clk_set_rate_exclusive (backend->mod_clk,300000000 ); backend->ram_clk =devm_clk_get (dev,"ram" );if (IS_ERR (backend->ram_clk)) {
@@ -932,6 +933,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master, err_disable_ram_clk:clk_disable_unprepare (backend->ram_clk); err_disable_mod_clk: +clk_rate_exclusive_put (backend->mod_clk);clk_disable_unprepare (backend->mod_clk); err_disable_bus_clk:clk_disable_unprepare (backend->bus_clk);
@@ -952,6 +954,7 @@ static void sun4i_backend_unbind(struct device *dev, struct device *master,sun4i_backend_free_sat (dev);clk_disable_unprepare (backend->ram_clk); +clk_rate_exclusive_put (backend->mod_clk);clk_disable_unprepare (backend->mod_clk);clk_disable_unprepare (backend->bus_clk);reset_control_assert (backend->reset);
Signature · 7 lines
2.23.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 10 lines · Maxime Ripard
The backend needs to run at 300MHz to be functional. This was done so far using assigned-clocks in the device tree, but that is easy to forget, and dosen't provide any other guarantee than the rate is going to be roughly the one requested at probe time.
Therefore it's pretty fragile, so let's just use the exclusive clock API to enforce it.
Signed-off-by Maxime Ripard <[email protected]>
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/sun4i: drc: Make sure we enforce the clock rate
In reply to Maxime RipardQuoted 10 lines · Maxime Ripard
The DRC needs to run at 300MHz to be functional. This was done so far using assigned-clocks in the device tree, but that is easy to forget, and dosen't provide any other guarantee than the rate is going to be roughly the one requested at probe time.
Therefore it's pretty fragile, so let's just use the exclusive clock API to enforce it.
Signed-off-by Maxime Ripard <[email protected]>
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/2] drm/sun4i: drc: Make sure we enforce the clock rate
In reply to Maxime RipardQuoted 19 lines · Maxime Ripard
The DRC needs to run at 300MHz to be functional. This was done so far using assigned-clocks in the device tree, but that is easy to forget, and dosen't provide any other guarantee than the rate is going to be roughly the one requested at probe time.
Therefore it's pretty fragile, so let's just use the exclusive clock API to enforce it.
Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/sun4i/sun6i_drc.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/sun4i/sun6i_drc.c +0
-0
drivers/gpu/drm/sun4i/sun6i_drc.c static int sun6i_drc_bind(struct device *dev, struct device *master, · line 60
Quoted 4 lines
drivers/gpu/drm/sun4i/sun6i_drc.c +1
-0@@ -57,6 +57,7 @@ static int sun6i_drc_bind(struct device *dev, struct device *master, goto err_disable_bus_clk; }clk_prepare_enable (drc->mod_clk); +clk_set_rate_exclusive (drc->mod_clk,300000000 );
I wonder what would happen if this fails...
drivers/gpu/drm/sun4i/sun6i_drc.c static void sun6i_drc_unbind(struct device *dev, struct device *master, · line 76
Quoted 8 lines
drivers/gpu/drm/sun4i/sun6i_drc.c +1
-0return 0 ;@@ -72,6 +73,7 @@ static void sun6i_drc_unbind(struct device *dev, struct device *master, {struct sun6i_drc *drc =dev_get_drvdata (dev); +clk_rate_exclusive_put (drc->mod_clk);
and we try to do the put regardless...
ChenYu
Quoted 6 lines
drivers/gpu/drm/sun4i/sun6i_drc.c +0
-1clk_disable_unprepare (drc->mod_clk);clk_disable_unprepare (drc->bus_clk);reset_control_assert (drc->reset); --2.23.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel