Skip to contentSkip to conversation

bcm2835 (Raspberry Pi) KMS driver

PATCH In review Eric Anholt 6 participants 26 messages Oct 9, 2015 – Oct 21, 2015

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

This is a respin of the Raspberry Pi KMS series. Now that we've got a real clock driver, I can actually set new video modes. Also in this version, most of the custom DT stuff from before is gone, thanks to finding exynos's platform_driver component matching code (I have sent separate patches to drivers/base to make helpers for doing it).

https://github.com/anholt/linux/tree/vc4-kms-squash-2

--
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

#1 lore raw

PATCH v3 1/7 drm/vc4: Add devicetree bindings for VC4.

VC4 is the GPU (display and 3D) subsystem present on the 2835 and some other Broadcom SoCs.

This binding follows the model of msm, imx, sti, and others, where there is a subsystem node for the whole GPU, with nodes for the individual HW components within it.

---

v2: Extend the commit message, fix several nits from Stephen Warren.
v3: Rename the compatibility strings, clean up node names, drop the
unnecessary lists of components. Use compatibility strings for choosing CRTC HVS channel numbers. Document the HDMI clock usage.

 .../devicetree/bindings/gpu/brcm,bcm-vc4.txt       | 64 ++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +64 -0
new file mode 100644
index 0000000..175bcde
@@ -0,0 +1,64 @@
+Broadcom VC4 GPU
+
+The VC4 device present on the Raspberry Pi includes a display system
+with HDMI output and the HVS scaler for compositing display planes.
+
+Required properties for VC4:
+- compatible:	Should be "brcm,bcm2835-vc4"
+
+Required properties for Pixel Valve:
+- compatible:	Should be one of "brcm,bcm2835-pixelvalve0",
+		"brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
+- reg:		Physical base address and length of the PV's registers
+- interrupts:	The interrupt number
+		  See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HVS:
+- compatible:	Should be "brcm,bcm2835-hvs"
+- reg:		Physical base address and length of the HVS's registers
+- interrupts:	The interrupt number
+		  See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HDMI
+- compatible:	Should be "brcm,bcm2835-hdmi"
+- reg:		Physical base address and length of the two register ranges
+		  ("HDMI" and "HD", in that order)
+- interrupts:	The interrupt numbers
+		  See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+- ddc:		phandle of the I2C controller used for DDC EDID probing
+- clocks:	a) hdmi: The HDMI state machine clock
+		b) pixel: The pixel clock.
+
+Optional properties for HDMI:
+- hpd-gpio:	The GPIO pin for HDMI hotplug detect (if it doesn't appear
+		  as an interrupt/status bit in the HDMI controller
+		  itself).  See bindings/pinctrl/brcm,bcm2835-gpio.txt
+
+Example:
+pixelvalve@7e807000 {
+	compatible = "brcm,bcm2835-pixelvalve2";
+	reg = <0x7e807000 0x100>;
+	interrupts = <2 10>; /* pixelvalve */
+};
+
+hvs@7e400000 {
+	compatible = "brcm,bcm2835-hvs";
+	reg = <0x7e400000 0x6000>;
+	interrupts = <2 1>;
+};
+
+hdmi: hdmi@7e902000 {
+	compatible = "brcm,bcm2835-hdmi";
+	reg = <0x7e902000 0x600>,
+	      <0x7e808000 0x100>;
+	interrupts = <2 8>, <2 9>;
+	ddc = <&i2c2>;
+	hpd-gpio = <&gpio 46 GPIO_ACTIVE_HIGH>;
+	clocks = <&clocks BCM2835_PLLH_PIX>,
+		 <&clocks BCM2835_CLOCK_HSM>;
+	clock-names = "pixel", "hdmi";
+};
+
+vc4: gpu@7e4c0000 {
+	compatible = "brcm,bcm2835-vc4";
+};
Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

PATCH v3 2/7 MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver.

In reply to Eric Anholt

---

v2: Mark it Supported, not Maintained.

 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 7ba7ab7..e331e46 100644
@@ -3653,6 +3653,12 @@ S:	Maintained
 F:	drivers/gpu/drm/sti
 F:	Documentation/devicetree/bindings/gpu/st,stih4xx.txt
 
+DRM DRIVERS FOR VC4
+M:	Eric Anholt <[email protected]>
+T:	git git://github.com/anholt/linux
+S:	Supported
+F:	drivers/gpu/drm/vc4/*
+
 DSBR100 USB FM RADIO DRIVER
 M:	Alexey Klimov <[email protected]>
 L:	[email protected]
Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

PATCH v3 3/7 drm/vc4: Add KMS support for Raspberry Pi.

In reply to Eric Anholt

This is enough for fbcon and bringing up X using xf86-video-modesetting. It doesn't support the 3D accelerator or power management yet.

---

v2: Drop FB_HELPER select thanks to Archit's patches. Do manual init
ordering instead of using the .load hook. Structure registration more like tegra's, but still using the typical "component" code. Drop no-op hooks for atomic_begin and mode_fixup() now that they're optional. Drop sentinel in Makefile. Fix minor style nits I noticed on another reread.

v3: Use the new bcm2835 clk driver to manage pixel/HSM clocks instead
of having a fixed video mode. Use exynos-style component driver matching instead of devicetree nodes to list the component driver instances. Rename compatibility strings to say bcm2835, and distinguish pv0/1/2. Clean up some h/vsync code, and add in interlaced mode setup. Fix up probe/bind error paths. Use bitops.h macros for vc4_regs.h

 drivers/gpu/drm/Kconfig           |   2 +
 drivers/gpu/drm/Makefile          |   1 +
 drivers/gpu/drm/vc4/Kconfig       |  13 +
 drivers/gpu/drm/vc4/Makefile      |  17 +
 drivers/gpu/drm/vc4/vc4_bo.c      |  52 +++
 drivers/gpu/drm/vc4/vc4_crtc.c    | 675 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_debugfs.c |  39 +++
 drivers/gpu/drm/vc4/vc4_drv.c     | 284 ++++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.h     | 115 +++++++
 drivers/gpu/drm/vc4/vc4_hdmi.c    | 588 +++++++++++++++++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_hvs.c     | 163 +++++++++
 drivers/gpu/drm/vc4/vc4_kms.c     |  54 +++
 drivers/gpu/drm/vc4/vc4_plane.c   | 320 ++++++++++++++++++
 drivers/gpu/drm/vc4/vc4_regs.h    | 570 ++++++++++++++++++++++++++++++++
 14 files changed, 2893 insertions(+)
 create mode 100644 drivers/gpu/drm/vc4/Kconfig
 create mode 100644 drivers/gpu/drm/vc4/Makefile
 create mode 100644 drivers/gpu/drm/vc4/vc4_bo.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_crtc.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_debugfs.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_drv.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_drv.h
 create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_hvs.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_kms.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_plane.c
 create mode 100644 drivers/gpu/drm/vc4/vc4_regs.h
drivers/gpu/drm/Kconfig +2 -0
index 1a0a8df..c4bf9a1 100644
@@ -264,3 +264,5 @@ source "drivers/gpu/drm/sti/Kconfig"
 source "drivers/gpu/drm/amd/amdkfd/Kconfig"
 
 source "drivers/gpu/drm/imx/Kconfig"
+
+source "drivers/gpu/drm/vc4/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 45e7719..0edc9e2 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga/
 obj-$(CONFIG_DRM_I810)	+= i810/
 obj-$(CONFIG_DRM_I915)  += i915/
 obj-$(CONFIG_DRM_MGAG200) += mgag200/
+obj-$(CONFIG_DRM_VC4)  += vc4/
 obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
 obj-$(CONFIG_DRM_SIS)   += sis/
 obj-$(CONFIG_DRM_SAVAGE)+= savage/
drivers/gpu/drm/vc4/Kconfig new file +13 -0
new file mode 100644
index 0000000..e810ef7
@@ -0,0 +1,13 @@
+config DRM_VC4
+	tristate "Broadcom VC4 Graphics"
+	depends on ARCH_BCM2835
+	depends on DRM
+	select DRM_KMS_HELPER
+	select DRM_KMS_CMA_HELPER
+	help
+	  Choose this option if you have a system that has a Broadcom
+	  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
+
+	  This driver requires that "avoid_warnings=2" be present in
+	  the config.txt for the firmware, to keep it from smashing
+	  our display setup.
drivers/gpu/drm/vc4/Makefile new file +17 -0
new file mode 100644
index 0000000..32b4f9c
@@ -0,0 +1,17 @@
+ccflags-y := -Iinclude/drm
+
+# Please keep these build lists sorted!
+
+# core driver code
+vc4-y := \
+	vc4_bo.o \
+	vc4_crtc.o \
+	vc4_drv.o \
+	vc4_kms.o \
+	vc4_hdmi.o \
+	vc4_hvs.o \
+	vc4_plane.o
+
+vc4-$(CONFIG_DEBUG_FS) += vc4_debugfs.o
+
+obj-$(CONFIG_DRM_VC4)  += vc4.o
drivers/gpu/drm/vc4/vc4_bo.c new file +52 -0

52 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_crtc.c new file +675 -0

675 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_debugfs.c new file +39 -0
new file mode 100644
index 0000000..4297b0a5
@@ -0,0 +1,39 @@
+/*
+ *  Copyright © 2014 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/seq_file.h>
+#include <linux/circ_buf.h>
+#include <linux/ctype.h>
+#include <linux/debugfs.h>
+#include <drm/drmP.h>
+
+#include "vc4_drv.h"
+#include "vc4_regs.h"
+
+static const struct drm_info_list vc4_debugfs_list[] = {
+	{"hdmi_regs", vc4_hdmi_debugfs_regs, 0},
+	{"hvs_regs", vc4_hvs_debugfs_regs, 0},
+	{"crtc0_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)0},
+	{"crtc1_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)1},
+	{"crtc2_regs", vc4_crtc_debugfs_regs, 0, (void *)(uintptr_t)2},
+};
+
+#define VC4_DEBUGFS_ENTRIES ARRAY_SIZE(vc4_debugfs_list)
+
+int
+vc4_debugfs_init(struct drm_minor *minor)
+{
+	return drm_debugfs_create_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES,
+					minor->debugfs_root, minor);
+}
+
+void
+vc4_debugfs_cleanup(struct drm_minor *minor)
+{
+	drm_debugfs_remove_files(vc4_debugfs_list, VC4_DEBUGFS_ENTRIES, minor);
+}
drivers/gpu/drm/vc4/vc4_drv.c new file +284 -0

284 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_drv.h new file +115 -0

115 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_hdmi.c new file +588 -0

588 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_hvs.c new file +163 -0

163 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_kms.c new file +54 -0

54 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_plane.c new file +320 -0

320 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_regs.h new file +570 -0

570 lines not on this page · raw message

Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

PATCH v3 4/7 drm/vc4: Use the fbdev_cma helpers

In reply to Eric Anholt

From: Derek Foreman <[email protected]>

Keep the fbdev_cma pointer around so we can use it on hotplog and close to ensure the frame buffer console is in a useful state.

---
 drivers/gpu/drm/vc4/vc4_drv.c | 14 ++++++++++++++
 drivers/gpu/drm/vc4/vc4_drv.h |  2 ++
 drivers/gpu/drm/vc4/vc4_kms.c | 18 +++++++++++++++---
 3 files changed, 31 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_drv.c +14 -0
index 3c3ccff..6e73060 100644
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include "drm_fb_cma_helper.h"
 
 #include "vc4_drv.h"
 #include "vc4_regs.h"
@@ -49,6 +50,14 @@ static void vc4_drm_preclose(struct drm_device *dev, struct drm_file *file)
 		vc4_cancel_page_flip(crtc, file);
 }
 
+static void vc4_lastclose(struct drm_device *dev)
+{
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+	if (vc4->fbdev)
+		drm_fbdev_cma_restore_mode(vc4->fbdev);
+}
+
 static const struct file_operations vc4_drm_fops = {
 	.owner = THIS_MODULE,
 	.open = drm_open,
@@ -71,6 +80,7 @@ static struct drm_driver vc4_drm_driver = {
 			    DRIVER_ATOMIC |
 			    DRIVER_GEM |
 			    DRIVER_PRIME),
+	.lastclose = vc4_lastclose,
 	.preclose = vc4_drm_preclose,
 
 	.enable_vblank = vc4_enable_vblank,
@@ -199,6 +209,10 @@ static void vc4_drm_unbind(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct drm_device *drm = platform_get_drvdata(pdev);
+	struct vc4_dev *vc4 = to_vc4_dev(drm);
+
+	if (vc4->fbdev)
+		drm_fbdev_cma_fini(vc4->fbdev);
 
 	drm_mode_config_cleanup(drm);
 
drivers/gpu/drm/vc4/vc4_drv.h +2 -0
index c710e03..23e7bac2 100644
@@ -15,6 +15,8 @@ struct vc4_dev {
 	struct vc4_hdmi *hdmi;
 	struct vc4_hvs *hvs;
 	struct vc4_crtc *crtc[3];
+
+	struct drm_fbdev_cma *fbdev;
 };
 
 static inline struct vc4_dev *
drivers/gpu/drm/vc4/vc4_kms.c +15 -3
index c241c8f..ee3e004 100644
@@ -21,7 +21,16 @@
 #include "drm_fb_cma_helper.h"
 #include "vc4_drv.h"
 
+static void vc4_output_poll_changed(struct drm_device *dev)
+{
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+
+	if (vc4->fbdev)
+		drm_fbdev_cma_hotplug_event(vc4->fbdev);
+}
+
 static const struct drm_mode_config_funcs vc4_mode_funcs = {
+	.output_poll_changed = vc4_output_poll_changed,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 	.fb_create = drm_fb_cma_create,
@@ -29,6 +38,7 @@ static const struct drm_mode_config_funcs vc4_mode_funcs = {
 
 int vc4_kms_load(struct drm_device *dev)
 {
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	int ret;
 
 	ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
@@ -44,9 +54,11 @@ int vc4_kms_load(struct drm_device *dev)
 
 	drm_mode_config_reset(dev);
 
-	drm_fbdev_cma_init(dev, 32,
-			   dev->mode_config.num_crtc,
-			   dev->mode_config.num_connector);
+	vc4->fbdev = drm_fbdev_cma_init(dev, 32,
+					dev->mode_config.num_crtc,
+					dev->mode_config.num_connector);
+	if (IS_ERR(vc4->fbdev))
+		vc4->fbdev = NULL;
 
 	drm_kms_helper_poll_init(dev);
 
Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#18 lore raw

PATCH v3 5/7 drm/vc4: Allow vblank to be disabled

In reply to Eric Anholt

From: Derek Foreman <[email protected]>

---
 drivers/gpu/drm/vc4/vc4_kms.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/vc4/vc4_kms.c +1 -0
index ee3e004..2e5597d 100644
@@ -51,6 +51,7 @@ int vc4_kms_load(struct drm_device *dev)
 	dev->mode_config.max_height = 2048;
 	dev->mode_config.funcs = &vc4_mode_funcs;
 	dev->mode_config.preferred_depth = 24;
+	dev->vblank_disable_allowed = true;
 
 	drm_mode_config_reset(dev);
 
Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#19 lore raw

PATCH v3 6/7 ARM: bcm2835: Add the DDC I2C controller to the device tree.

In reply to Eric Anholt

We need to use it for getting video modes over HDMI.

---

v2: Mark it as disabled by default, and enable it in bcm2835-rpi.

 arch/arm/boot/dts/bcm2835-rpi.dtsi |  4 ++++
 arch/arm/boot/dts/bcm2835.dtsi     | 10 ++++++++++
 2 files changed, 14 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +4 -0
index ab5474e..3572f03 100644
@@ -52,6 +52,10 @@
 	clock-frequency = <100000>;
 };
 
+&i2c2 {
+	status = "okay";
+};
+
 &sdhci {
 	status = "okay";
 	bus-width = <4>;
arch/arm/boot/dts/bcm2835.dtsi +10 -0
index a6a55b7..1e61eb7 100644
@@ -167,6 +167,16 @@
 			status = "disabled";
 		};
 
+		i2c2: i2c@7e805000 {
+			compatible = "brcm,bcm2835-i2c";
+			reg = <0x7e805000 0x1000>;
+			interrupts = <2 21>;
+			clocks = <&clocks BCM2835_CLOCK_VPU>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		usb@7e980000 {
 			compatible = "brcm,bcm2835-usb";
 			reg = <0x7e980000 0x10000>;
Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw

PATCH v3 7/7 ARM: bcm2835: Add VC4 to the device tree.

In reply to Eric Anholt

VC4 is the GPU (display and 3D) present on the 2835.

---

v2: Sort by register address, mark HDMI as disabled by default in the
SoC file and enable it from -rpi.

v3: Add references to the pixel/HSM clocks for HDMI. Rename
compatibility strings and clean up node names.

 arch/arm/boot/dts/bcm2835-rpi.dtsi |  4 ++++
 arch/arm/boot/dts/bcm2835.dtsi     | 42 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +4 -0
index 3572f03..dcaaee2 100644
@@ -56,6 +56,10 @@
 	status = "okay";
 };
 
+&hdmi {
+	status = "okay";
+};
+
 &sdhci {
 	status = "okay";
 	bus-width = <4>;
arch/arm/boot/dts/bcm2835.dtsi +42 -0

70 lines not on this page · raw message

Signature · 6 lines
2.1.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

Re: [PATCH v3 2/7] MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver.

In reply to Eric Anholt

Hi Eric,

Quoted 13 lines · Eric Anholt

---

v2: Mark it Supported, not Maintained.

 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +0 -0
index 7ba7ab7..e331e46 100644

MAINTAINERS S: Maintained · line 3658

Quoted 6 lines
MAINTAINERS +3 -0
@@ -3653,6 +3653,12 @@ S:       Maintained
 F:     drivers/gpu/drm/sti
 F:     Documentation/devicetree/bindings/gpu/st,stih4xx.txt
 
+DRM DRIVERS FOR VC4
+M:     Eric Anholt <[email protected]>
+T:     git git://github.com/anholt/linux

You might want to add dri-devel as mailing list, at least initially.

MAINTAINERS S: Maintained · line 3660

Quoted 2 lines
MAINTAINERS +2 -0
+S:     Supported
+F:     drivers/gpu/drm/vc4/*

Imho, the binding documentation should also be listed here.

Regards,
Emil

#11 lore raw

Re: [PATCH v3 2/7] MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver.

Quoted 19 lines · Emil Velikov

Hi Eric,

Quoted 16 lines · Eric Anholt

---

v2: Mark it Supported, not Maintained.

 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +0 -0
index 7ba7ab7..e331e46 100644
@@ -3653,6 +3653,12 @@ S:       Maintained
 F:     drivers/gpu/drm/sti
 F:     Documentation/devicetree/bindings/gpu/st,stih4xx.txt
 
Quoted 4 lines

MAINTAINERS S: Maintained · line 3658

Quoted 3 lines
MAINTAINERS +3 -0
+DRM DRIVERS FOR VC4
+M:     Eric Anholt <[email protected]>
+T:     git git://github.com/anholt/linux

You might want to add dri-devel as mailing list, at least initially.

I believe that's already implied by the general entry for dri-devel:

./scripts/get_maintainer.pl -f drivers/gpu/drm/vc4/vc4_drv.c Eric Anholt <[email protected]> (supporter:DRM DRIVERS FOR VC4) David Airlie <[email protected]> (maintainer:DRM DRIVERS) [email protected] (open list:DRM DRIVERS)

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

In reply to Eric Anholt

Hi,

Quoted 6 lines · Eric Anholt

VC4 is the GPU (display and 3D) subsystem present on the 2835 and some other Broadcom SoCs.

This binding follows the model of msm, imx, sti, and others, where there is a subsystem node for the whole GPU, with nodes for the individual HW components within it.

I think it would be useful to have the acronyms written out one time in the document (VC4, HVS).

-- Sebastian

#23 lore raw
In reply to Eric Anholt

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 9 lines

This is a respin of the Raspberry Pi KMS series. Now that we've got a real clock driver, I can actually set new video modes. Also in this version, most of the custom DT stuff from before is gone, thanks to finding exynos's platform_driver component matching code (I have sent separate patches to drivers/base to make helpers for doing it).

https://github.com/anholt/linux/tree/vc4-kms-squash-2

I want to point out that git format-patch could prepare a nice cover letter and usually the changelog should go there.

Regards
Stefan

--
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

#13 lore raw

Re: [PATCH v3 3/7] drm/vc4: Add KMS support for Raspberry Pi.

In reply to Eric Anholt

Hi Eric,

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 79 lines

This is enough for fbcon and bringing up X using xf86-video-modesetting. It doesn't support the 3D accelerator or power management yet.

---

v2: Drop FB_HELPER select thanks to Archit's patches. Do manual init
ordering instead of using the .load hook. Structure registration more like tegra's, but still using the typical "component" code. Drop no-op hooks for atomic_begin and mode_fixup() now that they're optional. Drop sentinel in Makefile. Fix minor style nits I noticed on another reread.

v3: Use the new bcm2835 clk driver to manage pixel/HSM clocks instead
of having a fixed video mode. Use exynos-style component driver matching instead of devicetree nodes to list the component driver instances. Rename compatibility strings to say bcm2835, and distinguish pv0/1/2. Clean up some h/vsync code, and add in interlaced mode setup. Fix up probe/bind error paths. Use bitops.h macros for vc4_regs.h

  drivers/gpu/drm/Kconfig           |   2 +
  drivers/gpu/drm/Makefile          |   1 +
  drivers/gpu/drm/vc4/Kconfig       |  13 +
  drivers/gpu/drm/vc4/Makefile      |  17 +
  drivers/gpu/drm/vc4/vc4_bo.c      |  52 +++
  drivers/gpu/drm/vc4/vc4_crtc.c    | 675 ++++++++++++++++++++++++++++++++++++++
  drivers/gpu/drm/vc4/vc4_debugfs.c |  39 +++
  drivers/gpu/drm/vc4/vc4_drv.c     | 284 ++++++++++++++++
  drivers/gpu/drm/vc4/vc4_drv.h     | 115 +++++++
  drivers/gpu/drm/vc4/vc4_hdmi.c    | 588 +++++++++++++++++++++++++++++++++
  drivers/gpu/drm/vc4/vc4_hvs.c     | 163 +++++++++
  drivers/gpu/drm/vc4/vc4_kms.c     |  54 +++
  drivers/gpu/drm/vc4/vc4_plane.c   | 320 ++++++++++++++++++
  drivers/gpu/drm/vc4/vc4_regs.h    | 570 ++++++++++++++++++++++++++++++++
  14 files changed, 2893 insertions(+)

create mode 100644 drivers/gpu/drm/vc4/Kconfig create mode 100644 drivers/gpu/drm/vc4/Makefile create mode 100644 drivers/gpu/drm/vc4/vc4_bo.c create mode 100644 drivers/gpu/drm/vc4/vc4_crtc.c create mode 100644 drivers/gpu/drm/vc4/vc4_debugfs.c create mode 100644 drivers/gpu/drm/vc4/vc4_drv.c create mode 100644 drivers/gpu/drm/vc4/vc4_drv.h create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.c create mode 100644 drivers/gpu/drm/vc4/vc4_hvs.c create mode 100644 drivers/gpu/drm/vc4/vc4_kms.c create mode 100644 drivers/gpu/drm/vc4/vc4_plane.c create mode 100644 drivers/gpu/drm/vc4/vc4_regs.h

drivers/gpu/drm/Kconfig +2 -0
index 1a0a8df..c4bf9a1 100644
@@ -264,3 +264,5 @@ source "drivers/gpu/drm/sti/Kconfig"
  source "drivers/gpu/drm/amd/amdkfd/Kconfig"
 
  source "drivers/gpu/drm/imx/Kconfig"
+
+source "drivers/gpu/drm/vc4/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 45e7719..0edc9e2 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga/
  obj-$(CONFIG_DRM_I810)	+= i810/
  obj-$(CONFIG_DRM_I915)  += i915/
  obj-$(CONFIG_DRM_MGAG200) += mgag200/
+obj-$(CONFIG_DRM_VC4)  += vc4/
  obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
  obj-$(CONFIG_DRM_SIS)   += sis/
  obj-$(CONFIG_DRM_SAVAGE)+= savage/
drivers/gpu/drm/vc4/Kconfig new file +0 -0
new file mode 100644
index 0000000..e810ef7

drivers/gpu/drm/vc4/Kconfig line 3

Quoted 3 lines
drivers/gpu/drm/vc4/Kconfig new file +3 -0
@@ -0,0 +1,13 @@
+config DRM_VC4
+	tristate "Broadcom VC4 Graphics"
+	depends on ARCH_BCM2835

depends on (ARCH_BCM2835 || COMPILE_TEST) ?

Quoted 17 lines
drivers/gpu/drm/vc4/Kconfig new file +17 -0
+	depends on DRM
+	select DRM_KMS_HELPER
+	select DRM_KMS_CMA_HELPER
+	help
+	  Choose this option if you have a system that has a Broadcom
+	  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
+
+	  This driver requires that "avoid_warnings=2" be present in
+	  the config.txt for the firmware, to keep it from smashing
+	  our display setup.
+ [...]
+static void vc4_crtc_disable(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
+	u32 chan = vc4_crtc->channel;

drivers/gpu/drm/vc4/Kconfig

Quoted 10 lines
drivers/gpu/drm/vc4/Kconfig new file +10 -0
+
+	require_hvs_enabled(dev);
+
+	CRTC_WRITE(PV_V_CONTROL,
+		   CRTC_READ(PV_V_CONTROL) & ~PV_VCONTROL_VIDEN);
+	while (CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_VIDEN)
+		cpu_relax();
+
+	/* Without a wait here, we end up with a black screen. */
+	msleep(30);

This looks a little bit strange. First we do a busy loop without any timeout and then a fixed msleep without reason for the exact duration.

Sorry for the possibly dumb questions:

Is it safe to read PV_V_CONTROL exactly after writing to them? No sleeping required?

How did you come to the 30 milli seconds?

Quoted 29 lines
drivers/gpu/drm/vc4/Kconfig new file +1 -0
+  [...]
drivers/gpu/drm/vc4/vc4_hdmi.c new file +22 -0
new file mode 100644
index 0000000..ae37fec
@@ -0,0 +1,588 @@
+/*
+ * Copyright (C) 2015 Broadcom
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ * Copyright (C) 2013 Red Hat
+ * Author: Rob Clark <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * DOC: VC4 Falcon HDMI module
+ *

drivers/gpu/drm/vc4/vc4_hdmi.c line 32

Quoted 10 lines
drivers/gpu/drm/vc4/vc4_hdmi.c new file +10 -0
+ * The HDMI core has a state machine and a PHY.  Most of the unit
+ * operates off of the HSM clock from CPRMAN.  It also internally uses
+ * the PLLH_PIX clock for the PHY.
+ */
+
+#include "drm_atomic_helper.h"
+#include "drm_crtc_helper.h"
+#include "drm_edid.h"
+#include "linux/clk.h"
+#include "linux/component.h"

#include "linux/i2c.h" ?

Quoted 11 lines
drivers/gpu/drm/vc4/vc4_hdmi.c new file +11 -0
+#include "linux/of_gpio.h"
+#include "linux/of_platform.h"
+#include "vc4_drv.h"
+#include "vc4_regs.h"
+
+/* General HDMI hardware state. */
+struct vc4_hdmi {
+	struct platform_device *pdev;
+
+	struct drm_encoder *encoder;
+	struct drm_connector *connector;

drivers/gpu/drm/vc4/vc4_hdmi.c line 53

Quoted 10 lines
drivers/gpu/drm/vc4/vc4_hdmi.c new file +10 -0
+
+	struct i2c_adapter *ddc;
+	void __iomem *hdmicore_regs;
+	void __iomem *hd_regs;
+	int hpd_gpio;
+
+	struct clk *pixel_clock;
+	struct clk *hsm_clock;
+};
+

Best regards
Stefan

--
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

#21 lore raw

Re: [PATCH v3 7/7] ARM: bcm2835: Add VC4 to the device tree.

In reply to Eric Anholt

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 41 lines

VC4 is the GPU (display and 3D) present on the 2835.

---

v2: Sort by register address, mark HDMI as disabled by default in the
SoC file and enable it from -rpi.

v3: Add references to the pixel/HSM clocks for HDMI. Rename
compatibility strings and clean up node names.

  arch/arm/boot/dts/bcm2835-rpi.dtsi |  4 ++++
  arch/arm/boot/dts/bcm2835.dtsi     | 42 ++++++++++++++++++++++++++++++++++++++
  2 files changed, 46 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +4 -0
index 3572f03..dcaaee2 100644
@@ -56,6 +56,10 @@
  	status = "okay";
  };
 
+&hdmi {
+	status = "okay";
+};
+
  &sdhci {
  	status = "okay";
  	bus-width = <4>;
arch/arm/boot/dts/bcm2835.dtsi +1 -0
index 1e61eb7..21e354a9 100644
@@ -1,4 +1,5 @@
  #include <dt-bindings/pinctrl/bcm2835.h>
+#include <dt-bindings/gpio/gpio.h>
  #include <dt-bindings/clock/bcm2835.h>
  #include "skeleton.dtsi"
 

arch/arm/boot/dts/bcm2835.dtsi line 156

Quoted 7 lines
arch/arm/boot/dts/bcm2835.dtsi +4 -0
@@ -149,6 +150,18 @@
  			status = "disabled";
  		};
 
+		pixelvalve@7e206000 {
+			compatible = "brcm,bcm2835-pixelvalve0";
+			reg = <0x7e206000 0x100>;
+			interrupts = <2 13>; /* pwa2 */

According to BCM2835-ARM-Peripherals this should be pwa0.

Is it just a typo?
What does pwa mean?

arch/arm/boot/dts/bcm2835.dtsi line 164

Quoted 8 lines
arch/arm/boot/dts/bcm2835.dtsi +8 -0
+		};
+
+		pixelvalve@7e207000 {
+			compatible = "brcm,bcm2835-pixelvalve1";
+			reg = <0x7e207000 0x100>;
+			interrupts = <2 14>; /* pwa1 */
+		};
+

Thanks

Stefan

#24 lore raw
In reply to Stefan Wahren
Quoted 11 lines · Stefan Wahren

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 7 lines

This is a respin of the Raspberry Pi KMS series. Now that we've got a real clock driver, I can actually set new video modes. Also in this version, most of the custom DT stuff from before is gone, thanks to finding exynos's platform_driver component matching code (I have sent separate patches to drivers/base to make helpers for doing it).

https://github.com/anholt/linux/tree/vc4-kms-squash-2

I want to point out that git format-patch could prepare a nice cover letter and usually the changelog should go there.

Well, I guess you could put it there, but that wouldn't remove the need to put the changelog in the individual patches too, so that reviewers don't have to switch back and forth between different messages just to find out what changed in each patch.

+1 on sending the cover letter using git format-patch/send-email thoughl; the threading here is a little odd.

#25 lore raw
Quoted 13 lines · Stephen Warren
Quoted 11 lines · Stefan Wahren

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 7 lines

This is a respin of the Raspberry Pi KMS series. Now that we've got a real clock driver, I can actually set new video modes. Also in this version, most of the custom DT stuff from before is gone, thanks to finding exynos's platform_driver component matching code (I have sent separate patches to drivers/base to make helpers for doing it).

https://github.com/anholt/linux/tree/vc4-kms-squash-2

I want to point out that git format-patch could prepare a nice cover letter and usually the changelog should go there.

Quoted 7 lines

Well, I guess you could put it there, but that wouldn't remove the need to put the changelog in the individual patches too, so that reviewers don't have to switch back and forth between different messages just to find out what changed in each patch.

+1 on sending the cover letter using git format-patch/send-email thoughl; the threading here is a little odd.

I was using git send-email --compose. I guess I'll play with format-patch --cover-letter, but it seems odd that threading would be any different between the two.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw

Re: [PATCH v3 7/7] ARM: bcm2835: Add VC4 to the device tree.

In reply to Stefan Wahren
Quoted 52 lines · Stefan Wahren

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 41 lines

VC4 is the GPU (display and 3D) present on the 2835.

---

v2: Sort by register address, mark HDMI as disabled by default in the
SoC file and enable it from -rpi.

v3: Add references to the pixel/HSM clocks for HDMI. Rename
compatibility strings and clean up node names.

  arch/arm/boot/dts/bcm2835-rpi.dtsi |  4 ++++
  arch/arm/boot/dts/bcm2835.dtsi     | 42 ++++++++++++++++++++++++++++++++++++++
  2 files changed, 46 insertions(+)
arch/arm/boot/dts/bcm2835-rpi.dtsi +4 -0
index 3572f03..dcaaee2 100644
@@ -56,6 +56,10 @@
  	status = "okay";
  };
 
+&hdmi {
+	status = "okay";
+};
+
  &sdhci {
  	status = "okay";
  	bus-width = <4>;
arch/arm/boot/dts/bcm2835.dtsi +1 -0
index 1e61eb7..21e354a9 100644
@@ -1,4 +1,5 @@
  #include <dt-bindings/pinctrl/bcm2835.h>
+#include <dt-bindings/gpio/gpio.h>
  #include <dt-bindings/clock/bcm2835.h>
  #include "skeleton.dtsi"
 

arch/arm/boot/dts/bcm2835.dtsi line 156

Quoted 7 lines
arch/arm/boot/dts/bcm2835.dtsi +4 -0
@@ -149,6 +150,18 @@
  			status = "disabled";
  		};
 
+		pixelvalve@7e206000 {
+			compatible = "brcm,bcm2835-pixelvalve0";
+			reg = <0x7e206000 0x100>;
+			interrupts = <2 13>; /* pwa2 */

According to BCM2835-ARM-Peripherals this should be pwa0.

Quoted 2 lines

Is it just a typo?
What does pwa mean?

Just a typo. I don't know what pwa means, either, it's just a string so you can search for it in the docs.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#4 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

In reply to Eric Anholt
Quoted 5 lines · Eric Anholt

VC4 is the GPU (display and 3D) subsystem present on the 2835 and some other Broadcom SoCs.

This binding follows the model of msm, imx, sti, and others, where there is a subsystem node for the whole GPU, with nodes for the

The subsystem node is gone now, right?

Quoted 11 lines

individual HW components within it.

---

v2: Extend the commit message, fix several nits from Stephen Warren.
v3: Rename the compatibility strings, clean up node names, drop the
unnecessary lists of components. Use compatibility strings for choosing CRTC HVS channel numbers. Document the HDMI clock usage.

 .../devicetree/bindings/gpu/brcm,bcm-vc4.txt       | 64 ++++++++++++++++++++++

Can you put this in bindings/display/ instead? Things are moving there in 4.4.

Quoted 9 lines
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +0 -0
new file mode 100644
index 0000000..175bcde

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +7 -0
@@ -0,0 +1,64 @@
+Broadcom VC4 GPU
+
+The VC4 device present on the Raspberry Pi includes a display system
+with HDMI output and the HVS scaler for compositing display planes.
+
+Required properties for VC4:
+- compatible:  Should be "brcm,bcm2835-vc4"

reg property? interrupts? clocks?

Quoted 5 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +5 -0
+
+Required properties for Pixel Valve:
+- compatible:  Should be one of "brcm,bcm2835-pixelvalve0",
+               "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
+- reg:         Physical base address and length of the PV's registers

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 22

Quoted 10 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +10 -0
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HVS:
+- compatible:  Should be "brcm,bcm2835-hvs"
+- reg:         Physical base address and length of the HVS's registers
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HDMI

Is HDMI the only output possibility? If not, then you should have OF graph nodes describing the connection between HDMI block and HVS (or PV?).

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 33

Quoted 11 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +11 -0
+- compatible:  Should be "brcm,bcm2835-hdmi"
+- reg:         Physical base address and length of the two register ranges
+                 ("HDMI" and "HD", in that order)
+- interrupts:  The interrupt numbers
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+- ddc:         phandle of the I2C controller used for DDC EDID probing
+- clocks:      a) hdmi: The HDMI state machine clock
+               b) pixel: The pixel clock.
+
+Optional properties for HDMI:
+- hpd-gpio:    The GPIO pin for HDMI hotplug detect (if it doesn't appear

*-gpio is deprecated, so "hpd-gpios".

Really, I think this and ddc should be in hdmi-connector binding node. What has been done for bindings so far is all over the map though.

Quoted 38 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +31 -1
+                 as an interrupt/status bit in the HDMI controller
+                 itself).  See bindings/pinctrl/brcm,bcm2835-gpio.txt
+
+Example:
+pixelvalve at 7e807000 {
+       compatible = "brcm,bcm2835-pixelvalve2";
+       reg = <0x7e807000 0x100>;
+       interrupts = <2 10>; /* pixelvalve */
+};
+
+hvs at 7e400000 {
+       compatible = "brcm,bcm2835-hvs";
+       reg = <0x7e400000 0x6000>;
+       interrupts = <2 1>;
+};
+
+hdmi: hdmi at 7e902000 {
+       compatible = "brcm,bcm2835-hdmi";
+       reg = <0x7e902000 0x600>,
+             <0x7e808000 0x100>;
+       interrupts = <2 8>, <2 9>;
+       ddc = <&i2c2>;
+       hpd-gpio = <&gpio 46 GPIO_ACTIVE_HIGH>;
+       clocks = <&clocks BCM2835_PLLH_PIX>,
+                <&clocks BCM2835_CLOCK_HSM>;
+       clock-names = "pixel", "hdmi";
+};
+
+vc4: gpu at 7e4c0000 {
+       compatible = "brcm,bcm2835-vc4";
+};
--

2.1.4

_______________________________________________
dri-devel mailing list
dri-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

In reply to Sebastian Reichel
Quoted 6 lines · Sebastian Reichel

Hi,

Quoted 3 lines · Eric Anholt

VC4 is the GPU (display and 3D) subsystem present on the 2835 and some other Broadcom SoCs.

Quoted 6 lines
Quoted 3 lines

This binding follows the model of msm, imx, sti, and others, where there is a subsystem node for the whole GPU, with nodes for the individual HW components within it.

I think it would be useful to have the acronyms written out one time in the document (VC4, HVS).

Done.

#5 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

In reply to Rob Herring
Quoted 11 lines · Rob Herring
Quoted 8 lines · Eric Anholt

---

v2: Extend the commit message, fix several nits from Stephen Warren.
v3: Rename the compatibility strings, clean up node names, drop the
unnecessary lists of components. Use compatibility strings for choosing CRTC HVS channel numbers. Document the HDMI clock usage.

 .../devicetree/bindings/gpu/brcm,bcm-vc4.txt       | 64 ++++++++++++++++++++++

Can you put this in bindings/display/ instead? Things are moving there in 4.4.

Sure.

Quoted 18 lines
Quoted 9 lines
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +0 -0
new file mode 100644
index 0000000..175bcde

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +7 -0
@@ -0,0 +1,64 @@
+Broadcom VC4 GPU
+
+The VC4 device present on the Raspberry Pi includes a display system
+with HDMI output and the HVS scaler for compositing display planes.
+
+Required properties for VC4:
+- compatible:  Should be "brcm,bcm2835-vc4"

reg property? interrupts? clocks?

This is the subsystem node. It has no other properties currently.

Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +10 -0
+Required properties for Pixel Valve:
+- compatible:  Should be one of "brcm,bcm2835-pixelvalve0",
+               "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
+- reg:         Physical base address and length of the PV's registers
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HVS:
+- compatible:  Should be "brcm,bcm2835-hvs"
+- reg:         Physical base address and length of the HVS's registers
Quoted 8 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 22

Quoted 4 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +4 -0
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HDMI

Is HDMI the only output possibility? If not, then you should have OF graph nodes describing the connection between HDMI block and HVS (or PV?).

I'm using compatible strings for the different instances of the module:
brcm,bcm2835-pixelvalve0/1/2. This lets the connections get wired up cleanly and understandably within the driver. I spent a long time trying to come up with an OF graph-based implementation, and I eventually gave up.

Quoted 14 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 33

Quoted 11 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +11 -0
+- compatible:  Should be "brcm,bcm2835-hdmi"
+- reg:         Physical base address and length of the two register ranges
+                 ("HDMI" and "HD", in that order)
+- interrupts:  The interrupt numbers
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+- ddc:         phandle of the I2C controller used for DDC EDID probing
+- clocks:      a) hdmi: The HDMI state machine clock
+               b) pixel: The pixel clock.
+
+Optional properties for HDMI:
+- hpd-gpio:    The GPIO pin for HDMI hotplug detect (if it doesn't appear

*-gpio is deprecated, so "hpd-gpios".

Quoted 2 lines

Really, I think this and ddc should be in hdmi-connector binding node. What has been done for bindings so far is all over the map though.

You say hpd-gpios is deprectated, but that I should use the hdmi-connector binding that uses hpd-gpios. Which one is it? If hpd-gpios deprecated, what is supposed to be used instead?

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#14 lore raw

Re: [PATCH v3 3/7] drm/vc4: Add KMS support for Raspberry Pi.

In reply to Stefan Wahren
Quoted 79 lines · Stefan Wahren

Hi Eric,

Am 09.10.2015 um 23:27 schrieb Eric Anholt:

Quoted 76 lines

This is enough for fbcon and bringing up X using xf86-video-modesetting. It doesn't support the 3D accelerator or power management yet.

---

v2: Drop FB_HELPER select thanks to Archit's patches. Do manual init
ordering instead of using the .load hook. Structure registration more like tegra's, but still using the typical "component" code. Drop no-op hooks for atomic_begin and mode_fixup() now that they're optional. Drop sentinel in Makefile. Fix minor style nits I noticed on another reread.

v3: Use the new bcm2835 clk driver to manage pixel/HSM clocks instead
of having a fixed video mode. Use exynos-style component driver matching instead of devicetree nodes to list the component driver instances. Rename compatibility strings to say bcm2835, and distinguish pv0/1/2. Clean up some h/vsync code, and add in interlaced mode setup. Fix up probe/bind error paths. Use bitops.h macros for vc4_regs.h

  drivers/gpu/drm/Kconfig           |   2 +
  drivers/gpu/drm/Makefile          |   1 +
  drivers/gpu/drm/vc4/Kconfig       |  13 +
  drivers/gpu/drm/vc4/Makefile      |  17 +
  drivers/gpu/drm/vc4/vc4_bo.c      |  52 +++
  drivers/gpu/drm/vc4/vc4_crtc.c    | 675 ++++++++++++++++++++++++++++++++++++++
  drivers/gpu/drm/vc4/vc4_debugfs.c |  39 +++
  drivers/gpu/drm/vc4/vc4_drv.c     | 284 ++++++++++++++++
  drivers/gpu/drm/vc4/vc4_drv.h     | 115 +++++++
  drivers/gpu/drm/vc4/vc4_hdmi.c    | 588 +++++++++++++++++++++++++++++++++
  drivers/gpu/drm/vc4/vc4_hvs.c     | 163 +++++++++
  drivers/gpu/drm/vc4/vc4_kms.c     |  54 +++
  drivers/gpu/drm/vc4/vc4_plane.c   | 320 ++++++++++++++++++
  drivers/gpu/drm/vc4/vc4_regs.h    | 570 ++++++++++++++++++++++++++++++++
  14 files changed, 2893 insertions(+)

create mode 100644 drivers/gpu/drm/vc4/Kconfig create mode 100644 drivers/gpu/drm/vc4/Makefile create mode 100644 drivers/gpu/drm/vc4/vc4_bo.c create mode 100644 drivers/gpu/drm/vc4/vc4_crtc.c create mode 100644 drivers/gpu/drm/vc4/vc4_debugfs.c create mode 100644 drivers/gpu/drm/vc4/vc4_drv.c create mode 100644 drivers/gpu/drm/vc4/vc4_drv.h create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.c create mode 100644 drivers/gpu/drm/vc4/vc4_hvs.c create mode 100644 drivers/gpu/drm/vc4/vc4_kms.c create mode 100644 drivers/gpu/drm/vc4/vc4_plane.c create mode 100644 drivers/gpu/drm/vc4/vc4_regs.h

drivers/gpu/drm/Kconfig +2 -0
index 1a0a8df..c4bf9a1 100644
@@ -264,3 +264,5 @@ source "drivers/gpu/drm/sti/Kconfig"
  source "drivers/gpu/drm/amd/amdkfd/Kconfig"
 
  source "drivers/gpu/drm/imx/Kconfig"
+
+source "drivers/gpu/drm/vc4/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 45e7719..0edc9e2 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga/
  obj-$(CONFIG_DRM_I810)	+= i810/
  obj-$(CONFIG_DRM_I915)  += i915/
  obj-$(CONFIG_DRM_MGAG200) += mgag200/
+obj-$(CONFIG_DRM_VC4)  += vc4/
  obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
  obj-$(CONFIG_DRM_SIS)   += sis/
  obj-$(CONFIG_DRM_SAVAGE)+= savage/
drivers/gpu/drm/vc4/Kconfig new file +0 -0
new file mode 100644
index 0000000..e810ef7
Quoted 8 lines

drivers/gpu/drm/vc4/Kconfig line 3

Quoted 6 lines
drivers/gpu/drm/vc4/Kconfig new file +3 -0
@@ -0,0 +1,13 @@
+config DRM_VC4
+	tristate "Broadcom VC4 Graphics"
+	depends on ARCH_BCM2835

depends on (ARCH_BCM2835 || COMPILE_TEST) ?

Done.

Quoted 31 lines
Quoted 17 lines
drivers/gpu/drm/vc4/Kconfig new file +17 -0
+	depends on DRM
+	select DRM_KMS_HELPER
+	select DRM_KMS_CMA_HELPER
+	help
+	  Choose this option if you have a system that has a Broadcom
+	  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
+
+	  This driver requires that "avoid_warnings=2" be present in
+	  the config.txt for the firmware, to keep it from smashing
+	  our display setup.
+ [...]
+static void vc4_crtc_disable(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
+	u32 chan = vc4_crtc->channel;

drivers/gpu/drm/vc4/Kconfig

Quoted 10 lines
drivers/gpu/drm/vc4/Kconfig new file +10 -0
+
+	require_hvs_enabled(dev);
+
+	CRTC_WRITE(PV_V_CONTROL,
+		   CRTC_READ(PV_V_CONTROL) & ~PV_VCONTROL_VIDEN);
+	while (CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_VIDEN)
+		cpu_relax();
+
+	/* Without a wait here, we end up with a black screen. */
+	msleep(30);

This looks a little bit strange. First we do a busy loop without any timeout and then a fixed msleep without reason for the exact duration.

Quoted 4 lines

Sorry for the possibly dumb questions:

Is it safe to read PV_V_CONTROL exactly after writing to them? No sleeping required?

Correct. We're waiting for the value to land, so you just read until it does.

I've pulled in a later change for doing waits with timouts.

Quoted 1 line

How did you come to the 30 milli seconds?

a bit more than a frame. The comment was there to document why the sleep was there. It looks like in retesting now that it's not required.

Quoted 33 lines
Quoted 33 lines
drivers/gpu/drm/vc4/Kconfig new file +1 -0
+  [...]
drivers/gpu/drm/vc4/vc4_hdmi.c new file +26 -0
new file mode 100644
index 0000000..ae37fec
@@ -0,0 +1,588 @@
+/*
+ * Copyright (C) 2015 Broadcom
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ * Copyright (C) 2013 Red Hat
+ * Author: Rob Clark <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * DOC: VC4 Falcon HDMI module
+ *
+ * The HDMI core has a state machine and a PHY.  Most of the unit
+ * operates off of the HSM clock from CPRMAN.  It also internally uses
+ * the PLLH_PIX clock for the PHY.
+ */
Quoted 8 lines

drivers/gpu/drm/vc4/vc4_hdmi.c line 32

Quoted 6 lines
drivers/gpu/drm/vc4/vc4_hdmi.c new file +6 -0
+
+#include "drm_atomic_helper.h"
+#include "drm_crtc_helper.h"
+#include "drm_edid.h"
+#include "linux/clk.h"
+#include "linux/component.h"

#include "linux/i2c.h" ?

Done.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

Re: [PATCH v3 3/7] drm/vc4: Add KMS support for Raspberry Pi.

Am 13.10.2015 um 20:19 schrieb Eric Anholt:

Quoted 14 lines
Quoted 11 lines · Stefan Wahren

drivers/gpu/drm/vc4/Kconfig line 3

Quoted 9 lines
drivers/gpu/drm/vc4/Kconfig new file +3 -0
new file mode 100644
index 0000000..e810ef7
@@ -0,0 +1,13 @@
+config DRM_VC4
+	tristate "Broadcom VC4 Graphics"
+	depends on ARCH_BCM2835

depends on (ARCH_BCM2835 || COMPILE_TEST) ?

Quoted 1 line

Done.

Sorry for the bad suggestion. The parentheses should be necessary.

Quoted 32 lines
Quoted 32 lines
Quoted 18 lines
drivers/gpu/drm/vc4/Kconfig new file +17 -0
+	depends on DRM
+	select DRM_KMS_HELPER
+	select DRM_KMS_CMA_HELPER
+	help
+	  Choose this option if you have a system that has a Broadcom
+	  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
+
+	  This driver requires that "avoid_warnings=2" be present in
+	  the config.txt for the firmware, to keep it from smashing
+	  our display setup.
+ [...]
+static void vc4_crtc_disable(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct vc4_dev *vc4 = to_vc4_dev(dev);
+	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
+	u32 chan = vc4_crtc->channel;

drivers/gpu/drm/vc4/Kconfig

Quoted 10 lines
drivers/gpu/drm/vc4/Kconfig new file +10 -0
+
+	require_hvs_enabled(dev);
+
+	CRTC_WRITE(PV_V_CONTROL,
+		   CRTC_READ(PV_V_CONTROL) & ~PV_VCONTROL_VIDEN);
+	while (CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_VIDEN)
+		cpu_relax();
+
+	/* Without a wait here, we end up with a black screen. */
+	msleep(30);

This looks a little bit strange. First we do a busy loop without any timeout and then a fixed msleep without reason for the exact duration.

Quoted 7 lines
Quoted 4 lines

Sorry for the possibly dumb questions:

Is it safe to read PV_V_CONTROL exactly after writing to them? No sleeping required?

Correct. We're waiting for the value to land, so you just read until it does.

The reason for my question was the possibility that writing to PV_V_CONTROL could take some time and reading directly after writing could return the old value. In such a case the busy loop has no effect.

But if it is not the case here everything is fine :-)

Quoted 7 lines

I've pulled in a later change for doing waits with timouts.

Quoted 1 line

How did you come to the 30 milli seconds?

a bit more than a frame. The comment was there to document why the sleep was there. It looks like in retesting now that it's not required.

Sounds better

Regards
Stefan

--
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

#16 lore raw

Re: [PATCH v3 3/7] drm/vc4: Add KMS support for Raspberry Pi.

Am 13.10.2015 um 20:50 schrieb Stefan Wahren:

Quoted 15 lines

Am 13.10.2015 um 20:19 schrieb Eric Anholt:

Quoted 14 lines
Quoted 11 lines · Stefan Wahren

drivers/gpu/drm/vc4/Kconfig line 3

Quoted 9 lines
drivers/gpu/drm/vc4/Kconfig new file +3 -0
new file mode 100644
index 0000000..e810ef7
@@ -0,0 +1,13 @@
+config DRM_VC4
+    tristate "Broadcom VC4 Graphics"
+    depends on ARCH_BCM2835

depends on (ARCH_BCM2835 || COMPILE_TEST) ?

Quoted 3 lines
Quoted 1 line

Done.

Sorry for the bad suggestion. The parentheses should be necessary.

The parentheses aren't necessary.

Sorry for the noise

Stefan

maintainer
#6 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

In reply to Eric Anholt
Quoted 35 lines · Eric Anholt
Quoted 11 lines · Rob Herring
Quoted 8 lines · Eric Anholt

---

v2: Extend the commit message, fix several nits from Stephen Warren.
v3: Rename the compatibility strings, clean up node names, drop the
unnecessary lists of components. Use compatibility strings for choosing CRTC HVS channel numbers. Document the HDMI clock usage.

 .../devicetree/bindings/gpu/brcm,bcm-vc4.txt       | 64 ++++++++++++++++++++++

Can you put this in bindings/display/ instead? Things are moving there in 4.4.

Sure.

Quoted 18 lines
Quoted 9 lines
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +0 -0
new file mode 100644
index 0000000..175bcde

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +7 -0
@@ -0,0 +1,64 @@
+Broadcom VC4 GPU
+
+The VC4 device present on the Raspberry Pi includes a display system
+with HDMI output and the HVS scaler for compositing display planes.
+
+Required properties for VC4:
+- compatible:  Should be "brcm,bcm2835-vc4"

reg property? interrupts? clocks?

Quoted 1 line

This is the subsystem node. It has no other properties currently.

In the example, it looks like the gpu. You also have a unit address which implies you need a reg property.

Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +10 -0
+Required properties for Pixel Valve:
+- compatible:  Should be one of "brcm,bcm2835-pixelvalve0",
+               "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
+- reg:         Physical base address and length of the PV's registers
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HVS:
+- compatible:  Should be "brcm,bcm2835-hvs"
+- reg:         Physical base address and length of the HVS's registers
Quoted 8 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 22

Quoted 4 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +4 -0
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HDMI

Is HDMI the only output possibility? If not, then you should have OF graph nodes describing the connection between HDMI block and HVS (or PV?).

Quoted 5 lines

I'm using compatible strings for the different instances of the module:
brcm,bcm2835-pixelvalve0/1/2. This lets the connections get wired up cleanly and understandably within the driver. I spent a long time trying to come up with an OF graph-based implementation, and I eventually gave up.

I missed that before, but sorry, that's not how you should be using compatible strings. What was your issue with OF graph? It can be difficult to parse. I'd like to improve that with more common parsing code.

Quoted 14 lines
Quoted 14 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 33

Quoted 11 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +11 -0
+- compatible:  Should be "brcm,bcm2835-hdmi"
+- reg:         Physical base address and length of the two register ranges
+                 ("HDMI" and "HD", in that order)
+- interrupts:  The interrupt numbers
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+- ddc:         phandle of the I2C controller used for DDC EDID probing
+- clocks:      a) hdmi: The HDMI state machine clock
+               b) pixel: The pixel clock.
+
+Optional properties for HDMI:
+- hpd-gpio:    The GPIO pin for HDMI hotplug detect (if it doesn't appear

*-gpio is deprecated, so "hpd-gpios".

Quoted 6 lines
Quoted 2 lines

Really, I think this and ddc should be in hdmi-connector binding node. What has been done for bindings so far is all over the map though.

You say hpd-gpios is deprectated, but that I should use the hdmi-connector binding that uses hpd-gpios. Which one is it? If hpd-gpios deprecated, what is supposed to be used instead?

No, I said "hpd-gpio" with no "s" is deprecated. In other words, always use -gpios whether it is 1 or more gpio.

The connector part is a separate issue of the location of these properties. If you think about it, the gpio line and I2C bus have nothing to do with the HDMI node. That's different than cases of HDMI bridges which have a HPD signal and dedicated I2C controller. Most examples in the kernel have not followed this and do as you have. I only have a desire to have common binding and code to handle connectors at this point, but that is the direction I want to go.

Rob

#7 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

Quoted 36 lines · Rob Herring
Quoted 35 lines · Eric Anholt
Quoted 11 lines · Rob Herring
Quoted 8 lines · Eric Anholt

---

v2: Extend the commit message, fix several nits from Stephen Warren.
v3: Rename the compatibility strings, clean up node names, drop the
unnecessary lists of components. Use compatibility strings for choosing CRTC HVS channel numbers. Document the HDMI clock usage.

 .../devicetree/bindings/gpu/brcm,bcm-vc4.txt       | 64 ++++++++++++++++++++++

Can you put this in bindings/display/ instead? Things are moving there in 4.4.

Sure.

Quoted 18 lines
Quoted 9 lines
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +0 -0
new file mode 100644
index 0000000..175bcde

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +7 -0
@@ -0,0 +1,64 @@
+Broadcom VC4 GPU
+
+The VC4 device present on the Raspberry Pi includes a display system
+with HDMI output and the HVS scaler for compositing display planes.
+
+Required properties for VC4:
+- compatible:  Should be "brcm,bcm2835-vc4"

reg property? interrupts? clocks?

Quoted 4 lines
Quoted 1 line

This is the subsystem node. It has no other properties currently.

In the example, it looks like the gpu. You also have a unit address which implies you need a reg property.

I'll drop the unit address.

Quoted 25 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +10 -0
+Required properties for Pixel Valve:
+- compatible:  Should be one of "brcm,bcm2835-pixelvalve0",
+               "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
+- reg:         Physical base address and length of the PV's registers
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HVS:
+- compatible:  Should be "brcm,bcm2835-hvs"
+- reg:         Physical base address and length of the HVS's registers
Quoted 8 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 22

Quoted 4 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +4 -0
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HDMI

Is HDMI the only output possibility? If not, then you should have OF graph nodes describing the connection between HDMI block and HVS (or PV?).

Quoted 5 lines

I'm using compatible strings for the different instances of the module:
brcm,bcm2835-pixelvalve0/1/2. This lets the connections get wired up cleanly and understandably within the driver. I spent a long time trying to come up with an OF graph-based implementation, and I eventually gave up.

Quoted 4 lines

I missed that before, but sorry, that's not how you should be using compatible strings. What was your issue with OF graph? It can be difficult to parse. I'd like to improve that with more common parsing code.

pv2 is definitely different hardware than pv0/1 (some different source files, not just connections at hw module instantiation). This seems to be an obvious case for compatible strings. I haven't looked enough into pv0/1 to tell if they're different at a hardware level, since I haven't added any support for the encoders using them yet.

OF graph: Doesn't appear to solve any problems that the driver has. The pv needs to know what kind of encoder is downstream to make choices about its programming. The bits in its documentation refer to encoders by name. I could write up a ton of DT bindings trying to generate an abstraction so that the driver could map back to what it has today, but it would just make the driver more obfuscated and error prone. It's much cleaner to let the two driver submodules talk to each other and sort it out.

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 33

Quoted 11 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +11 -0
+- compatible:  Should be "brcm,bcm2835-hdmi"
+- reg:         Physical base address and length of the two register ranges
+                 ("HDMI" and "HD", in that order)
+- interrupts:  The interrupt numbers
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+- ddc:         phandle of the I2C controller used for DDC EDID probing
+- clocks:      a) hdmi: The HDMI state machine clock
+               b) pixel: The pixel clock.
+
+Optional properties for HDMI:
+- hpd-gpio:    The GPIO pin for HDMI hotplug detect (if it doesn't appear

*-gpio is deprecated, so "hpd-gpios".

Really, I think this and ddc should be in hdmi-connector binding node. What has been done for bindings so far is all over the map though.

Quoted 6 lines
Quoted 3 lines

You say hpd-gpios is deprectated, but that I should use the hdmi-connector binding that uses hpd-gpios. Which one is it? If hpd-gpios deprecated, what is supposed to be used instead?

No, I said "hpd-gpio" with no "s" is deprecated. In other words, always use -gpios whether it is 1 or more gpio.

Fixed.

Quoted 7 lines

The connector part is a separate issue of the location of these properties. If you think about it, the gpio line and I2C bus have nothing to do with the HDMI node. That's different than cases of HDMI bridges which have a HPD signal and dedicated I2C controller. Most examples in the kernel have not followed this and do as you have. I only have a desire to have common binding and code to handle connectors at this point, but that is the direction I want to go.

If you come up with common code that makes driver development easier instead of harder, I'll be interested to see.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#8 lore raw

Re: [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4.

Quoted 6 lines · Eric Anholt
Quoted 4 lines · Rob Herring
Quoted 3 lines · Eric Anholt
Quoted 1 line · Rob Herring

On Fri, Oct 9, 2015 at 4:27 PM, Eric Anholt <[email protected]> wrote:

[...]

Quoted 30 lines
Quoted 25 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +10 -0
+Required properties for Pixel Valve:
+- compatible:  Should be one of "brcm,bcm2835-pixelvalve0",
+               "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2"
+- reg:         Physical base address and length of the PV's registers
+- interrupts:  The interrupt number
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HVS:
+- compatible:  Should be "brcm,bcm2835-hvs"
+- reg:         Physical base address and length of the HVS's registers
Quoted 8 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 22

Quoted 4 lines

+- interrupts: The interrupt number

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +3 -0
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+
+Required properties for HDMI

Is HDMI the only output possibility? If not, then you should have OF graph nodes describing the connection between HDMI block and HVS (or PV?).

Quoted 5 lines

I'm using compatible strings for the different instances of the module:
brcm,bcm2835-pixelvalve0/1/2. This lets the connections get wired up cleanly and understandably within the driver. I spent a long time trying to come up with an OF graph-based implementation, and I eventually gave up.

Quoted 4 lines

I missed that before, but sorry, that's not how you should be using compatible strings. What was your issue with OF graph? It can be difficult to parse. I'd like to improve that with more common parsing code.

Quoted 5 lines

pv2 is definitely different hardware than pv0/1 (some different source files, not just connections at hw module instantiation). This seems to be an obvious case for compatible strings. I haven't looked enough into pv0/1 to tell if they're different at a hardware level, since I haven't added any support for the encoders using them yet.

If you can come up with something more descriptive that would be good. Certain features or capabilities for example. If not, I guess this is okay. I worry that the numbering could be different in a future part, but the IP otherwise unchanged. Then you would not be able to use these compatible strings.

Quoted 8 lines

OF graph: Doesn't appear to solve any problems that the driver has. The pv needs to know what kind of encoder is downstream to make choices about its programming. The bits in its documentation refer to encoders by name. I could write up a ton of DT bindings trying to generate an abstraction so that the driver could map back to what it has today, but it would just make the driver more obfuscated and error prone. It's much cleaner to let the two driver submodules talk to each other and sort it out.

Okay.

Quoted 34 lines
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines

Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt line 33

Quoted 11 lines
+- compatible:  Should be "brcm,bcm2835-hdmi"
+- reg:         Physical base address and length of the two register ranges
Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt new file +9 -0
+                 ("HDMI" and "HD", in that order)
+- interrupts:  The interrupt numbers
+                 See bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+- ddc:         phandle of the I2C controller used for DDC EDID probing
+- clocks:      a) hdmi: The HDMI state machine clock
+               b) pixel: The pixel clock.
+
+Optional properties for HDMI:
+- hpd-gpio:    The GPIO pin for HDMI hotplug detect (if it doesn't appear

*-gpio is deprecated, so "hpd-gpios".

Really, I think this and ddc should be in hdmi-connector binding node. What has been done for bindings so far is all over the map though.

Quoted 6 lines
Quoted 3 lines

You say hpd-gpios is deprectated, but that I should use the hdmi-connector binding that uses hpd-gpios. Which one is it? If hpd-gpios deprecated, what is supposed to be used instead?

No, I said "hpd-gpio" with no "s" is deprecated. In other words, always use -gpios whether it is 1 or more gpio.

Fixed.

Quoted 7 lines

The connector part is a separate issue of the location of these properties. If you think about it, the gpio line and I2C bus have nothing to do with the HDMI node. That's different than cases of HDMI bridges which have a HPD signal and dedicated I2C controller. Most examples in the kernel have not followed this and do as you have. I only have a desire to have common binding and code to handle connectors at this point, but that is the direction I want to go.

Quoted 2 lines

If you come up with common code that makes driver development easier instead of harder, I'll be interested to see.

The start is common bindings. :)

Rob