drm/vc4: Turn the V3D clock on at runtime.
Subsystems (4)
PATCH v4 1/3 drm/vc4: Turn the V3D clock on at runtime.
For the Raspberry Pi's bindings, the power domain also implicitly turns on the clock and deasserts reset, but for the new Cygnus port we start representing the clock in the devicetree.
v2: Document the clock-names property, check for -ENOENT for no clock
in DT.
v3: Drop NULL checks around clk calls which embed NULL checks.
v4: Drop clk-names (feedback by Rob Herring)
--- .../devicetree/bindings/display/brcm,bcm-vc4.txt | 3 +++ drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_v3d.c | 31 +++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +3 -0
@@ -59,6 +59,9 @@ Required properties for V3D: - interrupts: The interrupt number See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt +Optional properties for V3D: +- clocks: The clock the unit runs on + Required properties for DSI: - compatible: Should be "brcm,bcm2835-dsi0" or "brcm,bcm2835-dsi1" - reg: Physical base address and length of the DSI block's registers
drivers/gpu/drm/vc4/vc4_drv.h +1 -0
@@ -200,6 +200,7 @@ struct vc4_v3d {struct vc4_dev *vc4;struct platform_device *pdev;void __iomem *regs; +struct clk *clk; };struct vc4_hvs {
drivers/gpu/drm/vc4/vc4_v3d.c +30 -1
@@ -16,6 +16,7 @@* this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "linux/clk.h" #include "linux/component.h" #include "linux/pm_runtime.h" #include "vc4_drv.h"
@@ -305,6 +306,8 @@ static int vc4_v3d_runtime_suspend(struct device *dev)drm_gem_object_put_unlocked (&vc4->bin_bo->base.base); vc4->bin_bo =NULL ; +clk_disable_unprepare (v3d->clk); +return 0 ; }
@@ -318,6 +321,10 @@ static int vc4_v3d_runtime_resume(struct device *dev)if (ret)return ret; + ret =clk_prepare_enable (v3d->clk); +if (ret !=0 ) +return ret; +vc4_v3d_init_hw (vc4->dev);vc4_irq_postinstall (vc4->dev);
@@ -348,15 +355,37 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) vc4->v3d = v3d; v3d->vc4 = vc4; + v3d->clk =devm_clk_get (dev,NULL ); +if (IS_ERR (v3d->clk)) { +int ret =PTR_ERR (v3d->clk); + +if (ret == -ENOENT ) { +/* bcm2835 didn't have a clock reference in the DT. */ + ret =0 ; + v3d->clk =NULL ; + }else { +if (ret != -EPROBE_DEFER ) +dev_err (dev,"Failed to get V3D clock: %d\n" , + ret); +return ret; + } + } +if (V3D_READ (V3D_IDENT0 ) !=V3D_EXPECTED_IDENT0 ) {DRM_ERROR ("V3D_IDENT0 read 0x%08x instead of 0x%08x\n" ,V3D_READ (V3D_IDENT0 ),V3D_EXPECTED_IDENT0 );return -EINVAL ; } + ret =clk_prepare_enable (v3d->clk); +if (ret !=0 ) +return ret; + ret =vc4_allocate_bin_bo (drm); -if (ret) +if (ret) { +clk_disable_unprepare (v3d->clk);return ret; + }/* Reset the binner overflow address/size at setup, to be sure * we don't reuse an old one.
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 2/3 drm/vc4: Don't try to initialize FBDEV if we're only bound to V3D.
The FBDEV initialization would throw an error in dmesg, when we just want to silently not initialize fbdev on a V3D-only VC4 instance.
--- drivers/gpu/drm/vc4/vc4_kms.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_kms.c +6 -4
@@ -230,10 +230,12 @@ int vc4_kms_load(struct drm_device *dev)drm_mode_config_reset (dev); - vc4->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_connector); -if (IS_ERR (vc4->fbdev)) - vc4->fbdev =NULL ; +if (dev->mode_config.num_connector) { + vc4->fbdev =drm_fbdev_cma_init (dev,32 , + dev->mode_config.num_connector); +if (IS_ERR (vc4->fbdev)) + vc4->fbdev =NULL ; + }drm_kms_helper_poll_init (dev);
Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 3/3 drm/vc4: Add specific compatible strings for Cygnus.
In reply to Eric AnholtCygnus has V3D 2.6 instead of 2.1, and doesn't use the VC4 display modules. The V3D can be uniquely identified by the IDENT[01] registers, and there's nothing to key off of for the display change other than the lack of DT nodes for the display components, but it's convention to have new compatible strings anyway.
--- Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt | 4 ++-- drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_v3d.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +2 -2
@@ -5,7 +5,7 @@ with HDMI output and the HVS (Hardware Video Scaler) for compositing display planes. Required properties for VC4: -- compatible: Should be "brcm,bcm2835-vc4" +- compatible: Should be "brcm,bcm2835-vc4" or "brcm,cygnus-vc4" Required properties for Pixel Valve: - compatible: Should be one of "brcm,bcm2835-pixelvalve0",
@@ -54,7 +54,7 @@ Required properties for VEC: See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt Required properties for V3D: -- compatible: Should be "brcm,bcm2835-v3d" +- compatible: Should be "brcm,bcm2835-v3d" or "brcm,cygnus-v3d" - reg: Physical base address and length of the V3D's registers - interrupts: The interrupt number See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
drivers/gpu/drm/vc4/vc4_drv.c +1 -0
@@ -335,6 +335,7 @@ static int vc4_platform_drm_remove(struct platform_device *pdev)static const struct of_device_id vc4_of_match[] = { { .compatible ="brcm,bcm2835-vc4" , }, + { .compatible ="brcm,cygnus-vc4" , }, {}, };MODULE_DEVICE_TABLE (of, vc4_of_match);
drivers/gpu/drm/vc4/vc4_v3d.c +1 -0
@@ -450,6 +450,7 @@ static int vc4_v3d_dev_remove(struct platform_device *pdev)static const struct of_device_id vc4_v3d_dt_match[] = { { .compatible ="brcm,bcm2835-v3d" }, + { .compatible ="brcm,cygnus-v3d" }, { .compatible ="brcm,vc4-v3d" }, {} };
Signature · 6 lines
2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Eric Anholt
For the Raspberry Pi's bindings, the power domain also implicitly turns on the clock and deasserts reset, but for the new Cygnus port we start representing the clock in the devicetree.
v2: Document the clock-names property, check for
-ENOENTfor no clock
in DT.
v3: Drop NULL checks around clk calls which embed NULL checks.
v4: Drop clk-names (feedback by Rob Herring)
Quoted 6 lines
Signed-off-by Eric Anholt <[email protected]>--- .../devicetree/bindings/display/brcm,bcm-vc4.txt | 3 +++ drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_v3d.c | 31 +++++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 2/3] drm/vc4: Don't try to initialize FBDEV if we're only bound to V3D.
In reply to Eric AnholtQuoted 4 lines · Eric Anholt
The FBDEV initialization would throw an error in dmesg, when we just want to silently not initialize fbdev on a V3D-only VC4 instance.
Signed-off-by Eric Anholt <[email protected]>
With the commit message updated that passing num_connector is the bug that throws the error (and not that we set up a no-op fbdev):
Still kinda hoping for a follow-up to entirely get rid fo num_connector in the fbdev init funcs.
-Daniel
Quoted 32 lines
--- drivers/gpu/drm/vc4/vc4_kms.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)drivers/gpu/drm/vc4/vc4_kms.c +6
-4@@ -230,10 +230,12 @@ int vc4_kms_load(struct drm_device *dev)drm_mode_config_reset (dev); - vc4->fbdev =drm_fbdev_cma_init (dev,32 , - dev->mode_config.num_connector); -if (IS_ERR (vc4->fbdev)) - vc4->fbdev =NULL ; +if (dev->mode_config.num_connector) { + vc4->fbdev =drm_fbdev_cma_init (dev,32 , + dev->mode_config.num_connector); +if (IS_ERR (vc4->fbdev)) + vc4->fbdev =NULL ; + }drm_kms_helper_poll_init (dev);Signature · 6 lines
2.11.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 2/3] drm/vc4: Don't try to initialize FBDEV if we're only bound to V3D.
Quoted 6 lines · Daniel Vetter
Quoted 4 lines · Eric Anholt
The FBDEV initialization would throw an error in dmesg, when we just want to silently not initialize fbdev on a V3D-only VC4 instance.
Signed-off-by Eric Anholt <[email protected]>
Quoted 7 lines
With the commit message updated that passing
num_connectoris the bug that throws the error (and not that we set up a no-op fbdev):Reviewed-by Daniel Vetter <daniel.vetter-/[email protected]>Still kinda hoping for a follow-up to entirely get rid fo
num_connectorin the fbdev init funcs.
New commit message:
drm/vc4: Don't try to initialize FBDEV if we're only bound to V3D.
There's no sense in having an fbdev if there's no display, since connectors don't get hotplugged to this hardware. On Cygnus we were getting a dmesg error from passing in num_connectors (0), when that argument is supposed to be the maximum number of cloned connectors per CRTC (1).
Still no drm-misc acks on the other two patches, so I don't think I can merge them.