Skip to contentSkip to conversation

Add DRM SoC framework

RFC New Thierry Reding 1 participant 3 messages Jul 6, 2012

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

cover Add DRM SoC framework

This series adds an initial framework that allows to register a graphics complex as found on many SoCs with the DRM/KMS subsystem. Patch 1 adds the actual framework and patch 2 implements a very rudimentary skeleton driver on top of it. It's really just to show off how to use the DRM/SoC API and of no use otherwise.

The reason for implementing this is that the approach currently used by many SoC DRM drivers is to instantiate a dummy platform device for the DRM driver to bind against, which is somewhat of a kludge. The proposal in this series takes care of this implicitly and instantiates only what is really needed to make the DRM core happy.

I fully realize that this may not be that much of an improvement over using the drm_platform_init()/drm_platform_exit() functions, but I'm still interested in what people think about it.

Thierry

Thierry Reding (2):
drm: Add SoC framework
drm: Add SoC skeleton driver

 drivers/gpu/drm/Kconfig       |   6 ++
 drivers/gpu/drm/Makefile      |   3 +
 drivers/gpu/drm/drm_soc.c     | 151 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/soc/Kconfig   |  13 ++++
 drivers/gpu/drm/soc/Makefile  |   6 ++
 drivers/gpu/drm/soc/soc-drv.c | 166 ++++++++++++++++++++++++++++++++++++++++++
 include/drm/drmP.h            |   5 ++
 7 files changed, 350 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_soc.c
 create mode 100644 drivers/gpu/drm/soc/Kconfig
 create mode 100644 drivers/gpu/drm/soc/Makefile
 create mode 100644 drivers/gpu/drm/soc/soc-drv.c
Signature · 1 line
1.7.11.1
#1 lore raw

RFC 1/2 drm: Add SoC framework

This commit adds an initial framework that can be used to plug SoC graphics devices into the DRM/KMS subsystem.

SoCs often don't have a dedicated device to which a DRM driver can bind, but instead the graphics complex typically consists of several platform- type devices that work together. The DRM SoC support code therefore adds a dummy device that is associated with the DRM driver, which typically provides some kind of API for other drivers to register with.

---
 drivers/gpu/drm/Kconfig   |   4 ++
 drivers/gpu/drm/Makefile  |   2 +
 drivers/gpu/drm/drm_soc.c | 151 ++++++++++++++++++++++++++++++++++++++++++++++
 include/drm/drmP.h        |   5 ++
 4 files changed, 162 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_soc.c
drivers/gpu/drm/Kconfig +4 -0
index 23120c0..529dede 100644
@@ -24,6 +24,10 @@ config DRM_USB
 	depends on DRM
 	select USB
 
+config DRM_SOC
+	tristate
+	depends on DRM
+
 config DRM_KMS_HELPER
 	tristate
 	depends on DRM
drivers/gpu/drm/Makefile +2 -0
index f65f65e..4731cbc 100644
@@ -17,6 +17,7 @@ drm-y       :=	drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 
 drm-usb-y   := drm_usb.o
+drm-soc-y   := drm_soc.o
 
 drm_kms_helper-y := drm_fb_helper.o drm_crtc_helper.o drm_dp_i2c_helper.o
 drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
@@ -27,6 +28,7 @@ CFLAGS_drm_trace_points.o := -I$(src)
 
 obj-$(CONFIG_DRM)	+= drm.o
 obj-$(CONFIG_DRM_USB)   += drm_usb.o
+obj-$(CONFIG_DRM_SOC)	+= drm-soc.o
 obj-$(CONFIG_DRM_TTM)	+= ttm/
 obj-$(CONFIG_DRM_TDFX)	+= tdfx/
 obj-$(CONFIG_DRM_R128)	+= r128/
drivers/gpu/drm/drm_soc.c new file +151 -0

151 lines not on this page · raw message

include/drm/drmP.h +5 -0
index 31ad880..bc1edd1 100644
@@ -156,6 +156,7 @@ int drm_err(const char *func, const char *format, ...);
 #define DRIVER_BUS_PCI 0x1
 #define DRIVER_BUS_PLATFORM 0x2
 #define DRIVER_BUS_USB 0x3
+#define DRIVER_BUS_SOC 0x4
 
 /***********************************************************************/
 /** \name Begin the DRM... */
@@ -1769,6 +1770,10 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_device
 extern int drm_get_platform_dev(struct platform_device *pdev,
 				struct drm_driver *driver);
 
+/* SoC section */
+extern int drm_soc_init(struct drm_driver *driver, const char *name);
+extern void drm_soc_exit(struct drm_driver *driver);
+
 /* returns true if currently okay to sleep */
 static __inline__ bool drm_can_sleep(void)
 {
Signature · 1 line
1.7.11.1
#2 lore raw

RFC 2/2 drm: Add SoC skeleton driver

In reply to Thierry Reding

This is a skeleton driver for the DRM/SoC framework.

---
 drivers/gpu/drm/Kconfig       |   2 +
 drivers/gpu/drm/Makefile      |   1 +
 drivers/gpu/drm/soc/Kconfig   |  13 ++++
 drivers/gpu/drm/soc/Makefile  |   6 ++
 drivers/gpu/drm/soc/soc-drv.c | 166 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 188 insertions(+)
 create mode 100644 drivers/gpu/drm/soc/Kconfig
 create mode 100644 drivers/gpu/drm/soc/Makefile
 create mode 100644 drivers/gpu/drm/soc/soc-drv.c
drivers/gpu/drm/Kconfig +2 -0
index 529dede..a23b436 100644
@@ -196,3 +196,5 @@ source "drivers/gpu/drm/ast/Kconfig"
 source "drivers/gpu/drm/mgag200/Kconfig"
 
 source "drivers/gpu/drm/cirrus/Kconfig"
+
+source "drivers/gpu/drm/soc/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index 4731cbc..b7dde4e 100644
@@ -47,4 +47,5 @@ obj-$(CONFIG_DRM_EXYNOS) +=exynos/
 obj-$(CONFIG_DRM_GMA500) += gma500/
 obj-$(CONFIG_DRM_UDL) += udl/
 obj-$(CONFIG_DRM_AST) += ast/
+obj-$(CONFIG_DRM_SOC_TEST) += soc/
 obj-y			+= i2c/
drivers/gpu/drm/soc/Kconfig new file +13 -0
new file mode 100644
index 0000000..c983bfe
@@ -0,0 +1,13 @@
+config DRM_SOC_TEST
+	tristate "SoC DRM"
+	depends on DRM
+	select DRM_SOC
+
+if DRM_SOC_TEST
+
+config DRM_SOC_TEST_DEBUG
+	bool "SoC DRM debug support"
+	help
+	  Say Y here to enable debugging support.
+
+endif
drivers/gpu/drm/soc/Makefile new file +6 -0
new file mode 100644
index 0000000..c42f540
@@ -0,0 +1,6 @@
+ccflags-y := -Iinclude/drm
+ccflags-$(CONFIG_DRM_SOC_TEST_DEBUG) += -DDEBUG
+
+soc-drm-y := soc-drv.o
+
+obj-$(CONFIG_DRM_SOC_TEST) += soc-drm.o
drivers/gpu/drm/soc/soc-drv.c new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
1.7.11.1