Skip to contentSkip to conversation

video: ARM CLCD: Move registers to a separate header.

PATCH Superseded Eric Anholt 3 participants 6 messages Mar 20, 2017 – Mar 21, 2017

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 video: ARM CLCD: Move registers to a separate header.

We'd like to reuse these register definitions for the DRM CLCD driver, but there's a bunch of fbdev-specific code in the current header.

---
 include/linux/amba/clcd-regs.h | 76 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/amba/clcd.h      | 68 +------------------------------------
 2 files changed, 77 insertions(+), 67 deletions(-)
 create mode 100644 include/linux/amba/clcd-regs.h
include/linux/amba/clcd-regs.h new file +76 -0
new file mode 100644
index 000000000000..1b924c4a63ab
@@ -0,0 +1,76 @@
+/*
+ * David A Rusling
+ *
+ * Copyright (C) 2001 ARM Limited
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+/*
+ * CLCD Controller Internal Register addresses
+ */
+#define CLCD_TIM0		0x00000000
+#define CLCD_TIM1 		0x00000004
+#define CLCD_TIM2 		0x00000008
+#define CLCD_TIM3 		0x0000000c
+#define CLCD_UBAS 		0x00000010
+#define CLCD_LBAS 		0x00000014
+
+#define CLCD_PL110_IENB		0x00000018
+#define CLCD_PL110_CNTL		0x0000001c
+#define CLCD_PL110_STAT		0x00000020
+#define CLCD_PL110_INTR 	0x00000024
+#define CLCD_PL110_UCUR		0x00000028
+#define CLCD_PL110_LCUR		0x0000002C
+
+#define CLCD_PL111_CNTL		0x00000018
+#define CLCD_PL111_IENB		0x0000001c
+#define CLCD_PL111_RIS		0x00000020
+#define CLCD_PL111_MIS		0x00000024
+#define CLCD_PL111_ICR		0x00000028
+#define CLCD_PL111_UCUR		0x0000002c
+#define CLCD_PL111_LCUR		0x00000030
+
+#define CLCD_PALL 		0x00000200
+#define CLCD_PALETTE		0x00000200
+
+#define TIM2_CLKSEL		(1 << 5)
+#define TIM2_IVS		(1 << 11)
+#define TIM2_IHS		(1 << 12)
+#define TIM2_IPC		(1 << 13)
+#define TIM2_IOE		(1 << 14)
+#define TIM2_BCD		(1 << 26)
+
+#define CNTL_LCDEN		(1 << 0)
+#define CNTL_LCDBPP1		(0 << 1)
+#define CNTL_LCDBPP2		(1 << 1)
+#define CNTL_LCDBPP4		(2 << 1)
+#define CNTL_LCDBPP8		(3 << 1)
+#define CNTL_LCDBPP16		(4 << 1)
+#define CNTL_LCDBPP16_565	(6 << 1)
+#define CNTL_LCDBPP16_444	(7 << 1)
+#define CNTL_LCDBPP24		(5 << 1)
+#define CNTL_LCDBW		(1 << 4)
+#define CNTL_LCDTFT		(1 << 5)
+#define CNTL_LCDMONO8		(1 << 6)
+#define CNTL_LCDDUAL		(1 << 7)
+#define CNTL_BGR		(1 << 8)
+#define CNTL_BEBO		(1 << 9)
+#define CNTL_BEPO		(1 << 10)
+#define CNTL_LCDPWR		(1 << 11)
+#define CNTL_LCDVCOMP(x)	((x) << 12)
+#define CNTL_LDMAFIFOTIME	(1 << 15)
+#define CNTL_WATERMARK		(1 << 16)
+
+/* ST Microelectronics variant bits */
+#define CNTL_ST_1XBPP_444	0x0
+#define CNTL_ST_1XBPP_5551	(1 << 17)
+#define CNTL_ST_1XBPP_565	(1 << 18)
+#define CNTL_ST_CDWID_12	0x0
+#define CNTL_ST_CDWID_16	(1 << 19)
+#define CNTL_ST_CDWID_18	(1 << 20)
+#define CNTL_ST_CDWID_24	((1 << 19)|(1 << 20))
+#define CNTL_ST_CEAEN		(1 << 21)
+#define CNTL_ST_LCDBPP24_PACKED	(6 << 1)
include/linux/amba/clcd.h +1 -67

74 lines not on this page · raw message

Signature · 6 lines
2.11.0

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

PATCH v3 2/3 drm/pl111: Initial drm/kms driver for pl111

From: Tom Cooksey <[email protected]>

This is a modesetting driver for the pl111 CLCD display controller found on various ARM platforms such as the Versatile Express. The driver has only been tested on the bcm911360_entphn platform so far, with PRIME-based buffer sharing between vc4 and clcd.

It reuses the existing devicetree binding, while not using quite as many of its properties as the fbdev driver does (those are left for future work).

v2: Nearly complete rewrite by anholt, cutting 2/3 of the code thanks
to DRM core's excellent new helpers.
v3: Don't match pl110 any more, don't attach if we don't have a DRM
panel, use DRM_GEM_CMA_FOPS, update MAINTAINERS, use the simple display helper, use drm_gem_cma_dumb_create (same as our wrapper).

---
 Documentation/gpu/index.rst             |   1 +
 Documentation/gpu/pl111.rst             |   6 +
 MAINTAINERS                             |   6 +
 drivers/gpu/drm/Kconfig                 |   2 +
 drivers/gpu/drm/Makefile                |   1 +
 drivers/gpu/drm/pl111/Kconfig           |  12 ++
 drivers/gpu/drm/pl111/Makefile          |   5 +
 drivers/gpu/drm/pl111/pl111_connector.c | 127 ++++++++++++
 drivers/gpu/drm/pl111/pl111_display.c   | 338 ++++++++++++++++++++++++++++++++
 drivers/gpu/drm/pl111/pl111_drm.h       |  56 ++++++
 drivers/gpu/drm/pl111/pl111_drv.c       | 273 ++++++++++++++++++++++++++
 11 files changed, 827 insertions(+)
 create mode 100644 Documentation/gpu/pl111.rst
 create mode 100644 drivers/gpu/drm/pl111/Kconfig
 create mode 100644 drivers/gpu/drm/pl111/Makefile
 create mode 100644 drivers/gpu/drm/pl111/pl111_connector.c
 create mode 100644 drivers/gpu/drm/pl111/pl111_display.c
 create mode 100644 drivers/gpu/drm/pl111/pl111_drm.h
 create mode 100644 drivers/gpu/drm/pl111/pl111_drv.c
Documentation/gpu/index.rst +1 -0
index e998ee0d0dd5..71bf510d47e8 100644
@@ -11,6 +11,7 @@ Linux GPU Driver Developer's Guide
    drm-kms-helpers
    drm-uapi
    i915
+   pl111
    tinydrm
    vc4
    vga-switcheroo
Documentation/gpu/pl111.rst new file +6 -0
new file mode 100644
index 000000000000..9b03736d33dd
@@ -0,0 +1,6 @@
+==========================================
+ drm/pl111 ARM PrimeCell PL111 CLCD Driver
+==========================================
+
+.. kernel-doc:: drivers/gpu/drm/pl111/pl111_drv.c
+   :doc: ARM PrimeCell PL111 CLCD Driver
MAINTAINERS +6 -0
index e88154f2226c..ed71b0271ea5 100644
@@ -4160,6 +4160,12 @@ F:	drivers/gpu/drm/*
 F:	include/drm/drm*
 F:	include/uapi/drm/drm*
 
+DRM DRIVER FOR ARM PL111 CLCD
+M:	Eric Anholt <[email protected]>
+T:	git git://anongit.freedesktop.org/drm/drm-misc
+S:	Supported
+F:	drivers/gpu/drm/pl111/
+
 DRM DRIVER FOR AST SERVER GRAPHICS CHIPS
 M:	Dave Airlie <[email protected]>
 S:	Odd Fixes
drivers/gpu/drm/Kconfig +2 -0
index 78d7fc0ebb57..d1c6c12199b7 100644
@@ -274,6 +274,8 @@ source "drivers/gpu/drm/meson/Kconfig"
 
 source "drivers/gpu/drm/tinydrm/Kconfig"
 
+source "drivers/gpu/drm/pl111/Kconfig"
+
 # Keep legacy drivers last
 
 menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
index 59aae43005ee..99810a529bb0 100644
@@ -95,3 +95,4 @@ obj-y			+= hisilicon/
 obj-$(CONFIG_DRM_ZTE)	+= zte/
 obj-$(CONFIG_DRM_MXSFB)	+= mxsfb/
 obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
+obj-$(CONFIG_DRM_PL111) += pl111/
drivers/gpu/drm/pl111/Kconfig new file +12 -0
new file mode 100644
index 000000000000..ede49efd531f
@@ -0,0 +1,12 @@
+config DRM_PL111
+	tristate "DRM Support for PL111 CLCD Controller"
+	depends on DRM
+	depends on ARM || ARM64 || COMPILE_TEST
+	select DRM_KMS_HELPER
+	select DRM_KMS_CMA_HELPER
+	select DRM_GEM_CMA_HELPER
+	select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE
+	help
+	  Choose this option for DRM support for the PL111 CLCD controller.
+	  If M is selected the module will be called pl111_drm.
+
drivers/gpu/drm/pl111/Makefile new file +5 -0
new file mode 100644
index 000000000000..01caee727c13
@@ -0,0 +1,5 @@
+pl111_drm-y +=	pl111_connector.o \
+		pl111_display.o \
+		pl111_drv.o
+
+obj-$(CONFIG_DRM_PL111) += pl111_drm.o
drivers/gpu/drm/pl111/pl111_connector.c new file +127 -0

127 lines not on this page · raw message

drivers/gpu/drm/pl111/pl111_display.c new file +338 -0

338 lines not on this page · raw message

drivers/gpu/drm/pl111/pl111_drm.h new file +56 -0

56 lines not on this page · raw message

drivers/gpu/drm/pl111/pl111_drv.c new file +273 -0

273 lines not on this page · raw message

Signature · 6 lines
2.11.0

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

Re: [PATCH v3 2/3] drm/pl111: Initial drm/kms driver for pl111

drivers/gpu/drm/pl111/pl111_drv.c line 260

Quoted 3 lines · Eric Anholt
drivers/gpu/drm/pl111/pl111_drv.c new file +3 -0
+static struct amba_driver pl111_amba_driver = {
+	.drv = {
+		.name = "clcd-pl11x",

either:

		.name = "clcd-pl111",

or:

		.name = "drm-clcd-pl111",

otherwise the driver names will clash in sysfs - driver names must be unique.

drivers/gpu/drm/pl111/pl111_drv.c line 273

Quoted 13 lines
drivers/gpu/drm/pl111/pl111_drv.c new file +13 -0
+	},
+	.probe = pl111_amba_probe,
+	.remove = pl111_amba_remove,
+	.id_table = pl111_id_table,
+};
+#endif /* CONFIG_ARM_AMBA */
+
+module_amba_driver(pl111_amba_driver);
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_AUTHOR("ARM Ltd.");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pl111_drm");

Does the platform alias make sense for an OF-only driver?

Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#3 lore raw

Re: [PATCH v3 2/3] drm/pl111: Initial drm/kms driver for pl111

Quoted 16 lines · Russell King - ARM Linux

drivers/gpu/drm/pl111/pl111_drv.c line 260

Quoted 3 lines · Eric Anholt
drivers/gpu/drm/pl111/pl111_drv.c new file +3 -0
+static struct amba_driver pl111_amba_driver = {
+	.drv = {
+		.name = "clcd-pl11x",

either:

		.name = "clcd-pl111",

or:

		.name = "drm-clcd-pl111",

otherwise the driver names will clash in sysfs - driver names must be unique.

Quoted 15 lines

drivers/gpu/drm/pl111/pl111_drv.c line 273

Quoted 13 lines
drivers/gpu/drm/pl111/pl111_drv.c new file +13 -0
+	},
+	.probe = pl111_amba_probe,
+	.remove = pl111_amba_remove,
+	.id_table = pl111_id_table,
+};
+#endif /* CONFIG_ARM_AMBA */
+
+module_amba_driver(pl111_amba_driver);
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_AUTHOR("ARM Ltd.");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pl111_drm");

Does the platform alias make sense for an OF-only driver?

Not sure, this is left over from the original submission.

If I renamed to drm-clcd-pl111 and dropped the alias, would that get your ack?

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

#4 lore raw

PATCH v3 3/3 drm: Clarify the role of plane_state argument to drm_simple update().

In reply to Eric Anholt

Like the atomic update hook it's wrapping, the plane_state is the old one, and the new one is in plane->state. Both msxfb and tinydrm use it correctly, but I mistook it for the new state in pl111 due to its naming.

---
 drivers/gpu/drm/drm_simple_kms_helper.c | 4 ++--
 include/drm/drm_simple_kms_helper.h     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_simple_kms_helper.c +2 -2
index 16789faa9291..e084f9f8ca66 100644
@@ -114,7 +114,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 }
 
 static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane,
-					struct drm_plane_state *pstate)
+					struct drm_plane_state *old_pstate)
 {
 	struct drm_simple_display_pipe *pipe;
 
@@ -122,7 +122,7 @@ static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane,
 	if (!pipe->funcs || !pipe->funcs->update)
 		return;
 
-	pipe->funcs->update(pipe, pstate);
+	pipe->funcs->update(pipe, old_pstate);
 }
 
 static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane,
include/drm/drm_simple_kms_helper.h +1 -1
index fffbb95a0915..2d36538e4a17 100644
@@ -72,7 +72,7 @@ struct drm_simple_display_pipe_funcs {
 	 * the hardware lacks vblank support entirely.
 	 */
 	void (*update)(struct drm_simple_display_pipe *pipe,
-		       struct drm_plane_state *plane_state);
+		       struct drm_plane_state *old_plane_state);
 
 	/**
 	 * @prepare_fb:
Signature · 6 lines
2.11.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v3 3/3
#5 lore raw

Re: [PATCH v3 3/3] drm: Clarify the role of plane_state argument to drm_simple update().

Quoted 6 lines · Eric Anholt

Like the atomic update hook it's wrapping, the plane_state is the old one, and the new one is in plane->state. Both msxfb and tinydrm use it correctly, but I mistook it for the new state in pl111 due to its naming.

We could do the same rename in mxsfb, and maybe extend the kernel-doc a bit more to document the parameters. But this is a good change already, so

Quoted 47 lines
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 4 ++--
 include/drm/drm_simple_kms_helper.h     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_simple_kms_helper.c +2 -2
index 16789faa9291..e084f9f8ca66 100644
@@ -114,7 +114,7 @@ static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
 }
 
 static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane,
-					struct drm_plane_state *pstate)
+					struct drm_plane_state *old_pstate)
 {
 	struct drm_simple_display_pipe *pipe;
 
@@ -122,7 +122,7 @@ static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane,
 	if (!pipe->funcs || !pipe->funcs->update)
 		return;
 
-	pipe->funcs->update(pipe, pstate);
+	pipe->funcs->update(pipe, old_pstate);
 }
 
 static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane,
include/drm/drm_simple_kms_helper.h +1 -1
index fffbb95a0915..2d36538e4a17 100644
@@ -72,7 +72,7 @@ struct drm_simple_display_pipe_funcs {
 	 * the hardware lacks vblank support entirely.
 	 */
 	void (*update)(struct drm_simple_display_pipe *pipe,
-		       struct drm_plane_state *plane_state);
+		       struct drm_plane_state *old_plane_state);
 
 	/**
 	 * @prepare_fb:
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