drm/vc4: DSI display output support
Subsystems (5)
cover drm/vc4: DSI display output support
This is a resend from a month ago of just two of the patches (several are accepted at this point) from the DSI series, hoping to collect an ack from DT. Ccing the clock folks as well, since this ends up being a clock provider.
Eric Anholt (2):
dt-bindings: Document the VC4 DSI module nodes.
drm/vc4: Add DSI driver
.../devicetree/bindings/display/brcm,bcm-vc4.txt | 35 + drivers/gpu/drm/vc4/Kconfig | 2 + drivers/gpu/drm/vc4/Makefile | 1 + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_drv.h | 5 + drivers/gpu/drm/vc4/vc4_dsi.c | 1725 ++++++++++++++++++++ 7 files changed, 1770 insertions(+) create mode 100644 drivers/gpu/drm/vc4/vc4_dsi.c
Signature · 1 line
2.11.0
PATCH 1/2 dt-bindings: Document the VC4 DSI module nodes.
These are part of the vc4 display pipeline.
--- .../devicetree/bindings/display/brcm,bcm-vc4.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+)
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +35 -0
@@ -56,6 +56,18 @@ Required properties for V3D: - interrupts: The interrupt number See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt +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 +- interrupts: The interrupt number + See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt +- clocks: a) phy: The DSI PLL clock feeding the DSI analog PHY + b) escape: The DSI ESC clock from CPRMAN + c) pixel: The DSI pixel clock from CPRMAN +- clock-output-names: + The 3 clocks output from the DSI analog PHY: dsi[01]_byte, + dsi[01]_ddr2, and dsi[01]_ddr + [1] Documentation/devicetree/bindings/media/video-interfaces.txt Example:
@@ -99,6 +111,29 @@ dpi: dpi@7e208000 { }; }; +dsi1: dsi@7e700000 { + compatible = "brcm,bcm2835-dsi1"; + reg = <0x7e700000 0x8c>; + interrupts = <2 12>; + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + + clocks = <&clocks BCM2835_PLLD_DSI1>, + <&clocks BCM2835_CLOCK_DSI1E>, + <&clocks BCM2835_CLOCK_DSI1P>; + clock-names = "phy", "escape", "pixel"; + + clock-output-names = "dsi1_byte", "dsi1_ddr2", "dsi1_ddr"; + + pitouchscreen: panel@0 { + compatible = "raspberrypi,touchscreen"; + reg = <0>; + + <...> + }; +}; + vec: vec@7e806000 { compatible = "brcm,bcm2835-vec"; reg = <0x7e806000 0x1000>;
Signature · 1 line
2.11.0
PATCH 2/2 drm/vc4: Add DSI driver
In reply to Eric AnholtThe DSI0 and DSI1 blocks on the 2835 are related hardware blocks. Some registers move around, and the featureset is slightly different, as DSI1 (the 4-lane DSI) is a later version of the hardware block. This driver doesn't yet enable DSI0, since we don't have any hardware to test against, but it does put a lot of the register definitions and code in place.
--- drivers/gpu/drm/vc4/Kconfig | 2 + drivers/gpu/drm/vc4/Makefile | 1 + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_drv.h | 5 + drivers/gpu/drm/vc4/vc4_dsi.c | 1725 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1735 insertions(+) create mode 100644 drivers/gpu/drm/vc4/vc4_dsi.c
drivers/gpu/drm/vc4/Kconfig +2 -0
@@ -2,10 +2,12 @@ config DRM_VC4 tristate "Broadcom VC4 Graphics" depends on ARCH_BCM2835 || COMPILE_TEST depends on DRM + depends on COMMON_CLK select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER select DRM_PANEL + select DRM_MIPI_DSI help Choose this option if you have a system that has a Broadcom VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
drivers/gpu/drm/vc4/Makefile +1 -0
@@ -8,6 +8,7 @@ vc4-y := \ vc4_crtc.o \ vc4_drv.o \ vc4_dpi.o \ + vc4_dsi.o \ vc4_kms.o \ vc4_gem.o \ vc4_hdmi.o \
drivers/gpu/drm/vc4/vc4_debugfs.c +1 -0
@@ -18,6 +18,7 @@static const struct drm_info_list vc4_debugfs_list[] = { {"bo_stats" , vc4_bo_stats_debugfs,0 }, {"dpi_regs" , vc4_dpi_debugfs_regs,0 }, + {"dsi1_regs" , vc4_dsi_debugfs_regs,0 , (void *)(uintptr_t )1 }, {"hdmi_regs" , vc4_hdmi_debugfs_regs,0 }, {"vec_regs" , vc4_vec_debugfs_regs,0 }, {"hvs_regs" , vc4_hvs_debugfs_regs,0 },
drivers/gpu/drm/vc4/vc4_drv.c +1 -0
@@ -296,6 +296,7 @@ static struct platform_driver *const component_drivers[] = { &vc4_hdmi_driver, &vc4_vec_driver, &vc4_dpi_driver, + &vc4_dsi_driver, &vc4_hvs_driver, &vc4_crtc_driver, &vc4_v3d_driver,
drivers/gpu/drm/vc4/vc4_drv.h +5 -0
@@ -17,6 +17,7 @@ struct vc4_dev {struct vc4_crtc *crtc[3 ];struct vc4_v3d *v3d;struct vc4_dpi *dpi; +struct vc4_dsi *dsi1;struct vc4_vec *vec;struct drm_fbdev_cma *fbdev;
@@ -465,6 +466,10 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);extern struct platform_driver vc4_dpi_driver;int vc4_dpi_debugfs_regs (struct seq_file *m,void *unused); +/* vc4_dsi.c */ +extern struct platform_driver vc4_dsi_driver; +int vc4_dsi_debugfs_regs (struct seq_file *m,void *unused); +/* vc4_gem.c */ void vc4_gem_init (struct drm_device *dev);void vc4_gem_destroy (struct drm_device *dev);
drivers/gpu/drm/vc4/vc4_dsi.c new file +1725 -0
1,725 lines not on this page · raw message
Signature · 1 line
2.11.0
Re: [PATCH 2/2] drm/vc4: Add DSI driver
Quoted 40 lines · Eric Anholt
drivers/gpu/drm/vc4/vc4_dsi.c new file +40
-0+static int +vc4_dsi_init_phy_clocks (struct vc4_dsi *dsi) +{ +struct device *dev = &dsi->pdev->dev; +const char *parent_name =__clk_get_name (dsi->pll_phy_clock); +static const struct { +const char *dsi0_name, *dsi1_name; +int div; + } phy_clocks[] = { + {"dsi0_byte" ,"dsi1_byte" ,8 }, + {"dsi0_ddr2" ,"dsi1_ddr2" ,4 }, + {"dsi0_ddr" ,"dsi1_ddr" ,2 }, + }; +int i; + + dsi->clk_onecell.clk_num =ARRAY_SIZE (phy_clocks); + dsi->clk_onecell.clks =devm_kcalloc (dev, + dsi->clk_onecell.clk_num, +sizeof (*dsi->clk_onecell.clks), +GFP_KERNEL ); +if (!dsi->clk_onecell.clks) +return -ENOMEM ; + +for (i =0 ; i <ARRAY_SIZE (phy_clocks); i++) { +struct clk_fixed_factor *fix = &dsi->phy_clocks[i]; +struct clk_init_data init; +struct clk *clk; + +/* We just use core fixed factor clock ops for the PHY +* clocks. The clocks are actually gated by the +* PHY_AFEC0_DDRCLK_EN bits, which we should be +* setting if we use the DDR/DDR2 clocks. However, +* vc4_dsi_encoder_enable() is setting up both AFEC0, +* setting both our parent DSI PLL's rate and this +* clock's rate, so it knows if DDR/DDR2 are going to +* be used and could enable the gates itself. +*/ + fix->mult =1 ; + fix->div = phy_clocks[i].div; + fix->hw.init = &init;
drivers/gpu/drm/vc4/vc4_dsi.c line 1516
Quoted 10 lines
drivers/gpu/drm/vc4/vc4_dsi.c new file +10
-0+ +memset (&init,0 ,sizeof (init)); + init.parent_names = &parent_name; + init.num_parents =1 ; +if (dsi->port ==1 ) + init.name = phy_clocks[i].dsi1_name; +else + init.name = phy_clocks[i].dsi0_name; + init.ops = &clk_fixed_factor_ops; + init.flags =CLK_IS_BASIC ;
Please don't use this flag unless you need it for something.
drivers/gpu/drm/vc4/vc4_dsi.c line 1518
Quoted 2 lines
drivers/gpu/drm/vc4/vc4_dsi.c new file +2
-0+ + clk =devm_clk_register (dev, &fix->hw);
Can you use devm_clk_hw_register() instead please?
drivers/gpu/drm/vc4/vc4_dsi.c line 1525
Quoted 7 lines
drivers/gpu/drm/vc4/vc4_dsi.c new file +7
-0+if (IS_ERR (clk)) +return PTR_ERR (clk); + + dsi->clk_onecell.clks[i] = clk; + } + + return of_clk_add_provider(dev->of_node,
And the of_clk_add_hw_provider() API too.
Quoted 4 lines
drivers/gpu/drm/vc4/vc4_dsi.c new file +4
-0+ of_clk_src_onecell_get, + &dsi->clk_onecell); +} +
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 1/2] dt-bindings: Document the VC4 DSI module nodes.
In reply to Eric AnholtNeed to cc DT list if you want it in my queue.
Quoted 12 lines · Eric Anholt
These are part of the vc4 display pipeline.
Signed-off-by Eric Anholt <[email protected]>--- .../devicetree/bindings/display/brcm,bcm-vc4.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+)Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +0
-0
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt Required properties for V3D: · line 60
Quoted 5 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +2
-0@@ -56,6 +56,18 @@ Required properties for V3D: - interrupts: The interrupt number See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt +Required properties for DSI: +- compatible: Should be "brcm,bcm2835-dsi0" or "brcm,bcm2835-dsi1"
Are the blocks different?
Quoted 46 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +33
-1+- reg: Physical base address and length of the DSI block's registers +- interrupts: The interrupt number + See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt +- clocks: a) phy: The DSI PLL clock feeding the DSI analog PHY + b) escape: The DSI ESC clock from CPRMAN + c) pixel: The DSI pixel clock from CPRMAN +- clock-output-names: + The 3 clocks output from the DSI analog PHY: dsi[01]_byte, + dsi[01]_ddr2, and dsi[01]_ddr + [1] Documentation/devicetree/bindings/media/video-interfaces.txt Example:@@ -99,6 +111,29 @@ dpi: dpi at 7e208000 { }; }; +dsi1: dsi at 7e700000 { + compatible = "brcm,bcm2835-dsi1"; + reg = <0x7e700000 0x8c>; + interrupts = <2 12>; + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + + clocks = <&clocks BCM2835_PLLD_DSI1>, + <&clocks BCM2835_CLOCK_DSI1E>, + <&clocks BCM2835_CLOCK_DSI1P>; + clock-names = "phy", "escape", "pixel"; + + clock-output-names = "dsi1_byte", "dsi1_ddr2", "dsi1_ddr"; + + pitouchscreen: panel at 0 { + compatible = "raspberrypi,touchscreen"; + reg = <0>; + + <...> + }; +}; + vec: vec at 7e806000 { compatible = "brcm,bcm2835-vec"; reg = <0x7e806000 0x1000>; --2.11.0
Re: [PATCH 1/2] dt-bindings: Document the VC4 DSI module nodes.
Quoted 18 lines · Rob Herring
Need to cc DT list if you want it in my queue.
Quoted 15 lines · Eric Anholt
These are part of the vc4 display pipeline.
Signed-off-by Eric Anholt <[email protected]>--- .../devicetree/bindings/display/brcm,bcm-vc4.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+)Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +0
-0@@ -56,6 +56,18 @@ Required properties for V3D: - interrupts: The interrupt number See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
Quoted 4 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt Required properties for V3D: · line 60
Quoted 2 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +2
-0+Required properties for DSI: +- compatible: Should be "brcm,bcm2835-dsi0" or "brcm,bcm2835-dsi1"Are the blocks different?
They are from the same lineage, but very different (old dsi0 is 1 lane,
dsi1 is 4 lanes). You can see how much the registers move around and
change in the dsi->port conditional blocks in the driver code.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170127/c3dd6a67/attachment.sig>
Rob Herring
Acked-byRe: [PATCH 1/2] dt-bindings: Document the VC4 DSI module nodes.
Quoted 20 lines · Eric Anholt
Quoted 18 lines · Rob Herring
Need to cc DT list if you want it in my queue.
Quoted 15 lines · Eric Anholt
These are part of the vc4 display pipeline.
Signed-off-by Eric Anholt <[email protected]>--- .../devicetree/bindings/display/brcm,bcm-vc4.txt | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+)Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +0
-0@@ -56,6 +56,18 @@ Required properties for V3D: - interrupts: The interrupt number See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
Quoted 8 lines
Quoted 4 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt Required properties for V3D: · line 60
Quoted 2 lines
Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +2
-0+Required properties for DSI: +- compatible: Should be "brcm,bcm2835-dsi0" or "brcm,bcm2835-dsi1"Are the blocks different?
They are from the same lineage, but very different (old dsi0 is 1 lane, dsi1 is 4 lanes). You can see how much the registers move around and change in the
dsi->portconditional blocks in the driver code.
Okay, can you add a note here with this detail. With that,
PATCH v2 2/2 drm/vc4: Add DSI driver
In reply to Eric AnholtThe DSI0 and DSI1 blocks on the 2835 are related hardware blocks. Some registers move around, and the featureset is slightly different, as DSI1 (the 4-lane DSI) is a later version of the hardware block. This driver doesn't yet enable DSI0, since we don't have any hardware to test against, but it does put a lot of the register definitions and code in place.
v2: Use the clk_hw interfaces, don't set CLK_IS_BASIC (from review by
Stephen Boyd)
--- drivers/gpu/drm/vc4/Kconfig | 2 + drivers/gpu/drm/vc4/Makefile | 1 + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_drv.h | 5 + drivers/gpu/drm/vc4/vc4_dsi.c | 1725 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1735 insertions(+) create mode 100644 drivers/gpu/drm/vc4/vc4_dsi.c
drivers/gpu/drm/vc4/Kconfig +2 -0
@@ -2,10 +2,12 @@ config DRM_VC4 tristate "Broadcom VC4 Graphics" depends on ARCH_BCM2835 || COMPILE_TEST depends on DRM + depends on COMMON_CLK select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER select DRM_PANEL + select DRM_MIPI_DSI help Choose this option if you have a system that has a Broadcom VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
drivers/gpu/drm/vc4/Makefile +1 -0
@@ -8,6 +8,7 @@ vc4-y := \ vc4_crtc.o \ vc4_drv.o \ vc4_dpi.o \ + vc4_dsi.o \ vc4_kms.o \ vc4_gem.o \ vc4_hdmi.o \
drivers/gpu/drm/vc4/vc4_debugfs.c +1 -0
@@ -18,6 +18,7 @@static const struct drm_info_list vc4_debugfs_list[] = { {"bo_stats" , vc4_bo_stats_debugfs,0 }, {"dpi_regs" , vc4_dpi_debugfs_regs,0 }, + {"dsi1_regs" , vc4_dsi_debugfs_regs,0 , (void *)(uintptr_t )1 }, {"hdmi_regs" , vc4_hdmi_debugfs_regs,0 }, {"vec_regs" , vc4_vec_debugfs_regs,0 }, {"hvs_regs" , vc4_hvs_debugfs_regs,0 },
drivers/gpu/drm/vc4/vc4_drv.c +1 -0
@@ -296,6 +296,7 @@ static struct platform_driver *const component_drivers[] = { &vc4_hdmi_driver, &vc4_vec_driver, &vc4_dpi_driver, + &vc4_dsi_driver, &vc4_hvs_driver, &vc4_crtc_driver, &vc4_v3d_driver,
drivers/gpu/drm/vc4/vc4_drv.h +5 -0
@@ -17,6 +17,7 @@ struct vc4_dev {struct vc4_crtc *crtc[3 ];struct vc4_v3d *v3d;struct vc4_dpi *dpi; +struct vc4_dsi *dsi1;struct vc4_vec *vec;struct drm_fbdev_cma *fbdev;
@@ -465,6 +466,10 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);extern struct platform_driver vc4_dpi_driver;int vc4_dpi_debugfs_regs (struct seq_file *m,void *unused); +/* vc4_dsi.c */ +extern struct platform_driver vc4_dsi_driver; +int vc4_dsi_debugfs_regs (struct seq_file *m,void *unused); +/* vc4_gem.c */ void vc4_gem_init (struct drm_device *dev);void vc4_gem_destroy (struct drm_device *dev);
drivers/gpu/drm/vc4/vc4_dsi.c new file +1725 -0
1,725 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v2 2/2 drm/vc4: Add DSI driver
The DSI0 and DSI1 blocks on the 2835 are related hardware blocks. Some registers move around, and the featureset is slightly different, as DSI1 (the 4-lane DSI) is a later version of the hardware block. This driver doesn't yet enable DSI0, since we don't have any hardware to test against, but it does put a lot of the register definitions and code in place.
v2: Use the clk_hw interfaces, don't set CLK_IS_BASIC (from review by
Stephen Boyd)
--- drivers/gpu/drm/vc4/Kconfig | 2 + drivers/gpu/drm/vc4/Makefile | 1 + drivers/gpu/drm/vc4/vc4_debugfs.c | 1 + drivers/gpu/drm/vc4/vc4_drv.c | 1 + drivers/gpu/drm/vc4/vc4_drv.h | 5 + drivers/gpu/drm/vc4/vc4_dsi.c | 1725 +++++++++++++++++++++++++++++++++++++ 6 files changed, 1735 insertions(+) create mode 100644 drivers/gpu/drm/vc4/vc4_dsi.c
drivers/gpu/drm/vc4/Kconfig +2 -0
@@ -2,10 +2,12 @@ config DRM_VC4 tristate "Broadcom VC4 Graphics" depends on ARCH_BCM2835 || COMPILE_TEST depends on DRM + depends on COMMON_CLK select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER select DRM_PANEL + select DRM_MIPI_DSI help Choose this option if you have a system that has a Broadcom VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
drivers/gpu/drm/vc4/Makefile +1 -0
@@ -8,6 +8,7 @@ vc4-y := \ vc4_crtc.o \ vc4_drv.o \ vc4_dpi.o \ + vc4_dsi.o \ vc4_kms.o \ vc4_gem.o \ vc4_hdmi.o \
drivers/gpu/drm/vc4/vc4_debugfs.c +1 -0
@@ -18,6 +18,7 @@static const struct drm_info_list vc4_debugfs_list[] = { {"bo_stats" , vc4_bo_stats_debugfs,0 }, {"dpi_regs" , vc4_dpi_debugfs_regs,0 }, + {"dsi1_regs" , vc4_dsi_debugfs_regs,0 , (void *)(uintptr_t )1 }, {"hdmi_regs" , vc4_hdmi_debugfs_regs,0 }, {"vec_regs" , vc4_vec_debugfs_regs,0 }, {"hvs_regs" , vc4_hvs_debugfs_regs,0 },
drivers/gpu/drm/vc4/vc4_drv.c +1 -0
@@ -296,6 +296,7 @@ static struct platform_driver *const component_drivers[] = { &vc4_hdmi_driver, &vc4_vec_driver, &vc4_dpi_driver, + &vc4_dsi_driver, &vc4_hvs_driver, &vc4_crtc_driver, &vc4_v3d_driver,
drivers/gpu/drm/vc4/vc4_drv.h +5 -0
@@ -17,6 +17,7 @@ struct vc4_dev {struct vc4_crtc *crtc[3 ];struct vc4_v3d *v3d;struct vc4_dpi *dpi; +struct vc4_dsi *dsi1;struct vc4_vec *vec;struct drm_fbdev_cma *fbdev;
@@ -465,6 +466,10 @@ void __iomem *vc4_ioremap_regs(struct platform_device *dev, int index);extern struct platform_driver vc4_dpi_driver;int vc4_dpi_debugfs_regs (struct seq_file *m,void *unused); +/* vc4_dsi.c */ +extern struct platform_driver vc4_dsi_driver; +int vc4_dsi_debugfs_regs (struct seq_file *m,void *unused); +/* vc4_gem.c */ void vc4_gem_init (struct drm_device *dev);void vc4_gem_destroy (struct drm_device *dev);
drivers/gpu/drm/vc4/vc4_dsi.c new file +1725 -0
1,725 lines not on this page · raw message
Signature · 1 line
2.11.0