Skip to contentSkip to conversation

drm: Add Grain Media GM12U320 kms driver

PATCH In review Hans de Goede 3 participants 4 messages Jun 3, 2016

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

PATCH v2 1/1 drm: Add Grain Media GM12U320 kms driver

Grain-media GM12U320 based devices are mini video projectors using USB for both power and video data transport.

This commit adds a kms driver for these devices, including prime support.

This driver is based on the existing udl kms driver, and the gm12u320 fb driver by Viacheslav Nurmekhamitov <[email protected]>.

---
Changes in v2:
-Rebase on 4.7-rc1
-Sync with udl, bring in any fixes done to udl since v1

---
 MAINTAINERS                                   |   6 +
 drivers/gpu/drm/Kconfig                       |   2 +
 drivers/gpu/drm/Makefile                      |   1 +
 drivers/gpu/drm/gm12u320/Kconfig              |  16 +
 drivers/gpu/drm/gm12u320/Makefile             |   7 +
 drivers/gpu/drm/gm12u320/gm12u320_connector.c | 151 ++++++++
 drivers/gpu/drm/gm12u320/gm12u320_dmabuf.c    | 283 ++++++++++++++
 drivers/gpu/drm/gm12u320/gm12u320_drv.c       | 160 ++++++++
 drivers/gpu/drm/gm12u320/gm12u320_drv.h       | 129 +++++++
 drivers/gpu/drm/gm12u320/gm12u320_encoder.c   |  75 ++++
 drivers/gpu/drm/gm12u320/gm12u320_fb.c        | 345 ++++++++++++++++++
 drivers/gpu/drm/gm12u320/gm12u320_gem.c       | 237 ++++++++++++
 drivers/gpu/drm/gm12u320/gm12u320_main.c      | 507 ++++++++++++++++++++++++++
 drivers/gpu/drm/gm12u320/gm12u320_modeset.c   | 144 ++++++++
 14 files changed, 2063 insertions(+)
 create mode 100644 drivers/gpu/drm/gm12u320/Kconfig
 create mode 100644 drivers/gpu/drm/gm12u320/Makefile
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_connector.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_dmabuf.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_drv.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_drv.h
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_encoder.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_fb.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_gem.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_main.c
 create mode 100644 drivers/gpu/drm/gm12u320/gm12u320_modeset.c
MAINTAINERS +6 -0
index 216d447..5c05af2 100644
@@ -3904,6 +3904,12 @@ S:	Supported
 F:	drivers/gpu/drm/nouveau/
 F:	include/uapi/drm/nouveau_drm.h
 
+DRM DRIVERS FOR GRAIN-MEDIA GM12U320
+M:	Hans de Goede <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	drivers/gpu/drm/gm12u320/
+
 DRM DRIVERS FOR NVIDIA TEGRA
 M:	Thierry Reding <[email protected]>
 L:	[email protected]
drivers/gpu/drm/Kconfig +2 -0
index fc35731..1380e4a 100644
@@ -290,3 +290,5 @@ source "drivers/gpu/drm/arc/Kconfig"
 source "drivers/gpu/drm/hisilicon/Kconfig"
 
 source "drivers/gpu/drm/mediatek/Kconfig"
+
+source "drivers/gpu/drm/gm12u320/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index be43afb..2e06396 100644
@@ -75,6 +75,7 @@ obj-$(CONFIG_DRM_TEGRA) += tegra/
 obj-$(CONFIG_DRM_STI) += sti/
 obj-$(CONFIG_DRM_IMX) += imx/
 obj-$(CONFIG_DRM_MEDIATEK) += mediatek/
+obj-$(CONFIG_DRM_GM12U320) += gm12u320/
 obj-y			+= i2c/
 obj-y			+= panel/
 obj-y			+= bridge/
drivers/gpu/drm/gm12u320/Kconfig new file +16 -0
new file mode 100644
index 0000000..cfecaac
@@ -0,0 +1,16 @@
+config DRM_GM12U320
+	tristate "Grain Media GM12U320 based mini projectors"
+	depends on DRM
+	depends on USB_SUPPORT
+	depends on USB_ARCH_HAS_HCD
+	select USB
+	select FB_SYS_FILLRECT
+	select FB_SYS_COPYAREA
+	select FB_SYS_IMAGEBLIT
+	select FB_DEFERRED_IO
+	select DRM_KMS_HELPER
+        select DRM_KMS_FB_HELPER
+	help
+	  This is a KMS driver for Grain Media GM12U320 based usb mini video
+	  projectors, such as the Acer C120.
+	  Say M/Y to add support for these devices via drm/kms interfaces.
drivers/gpu/drm/gm12u320/Makefile new file +7 -0
new file mode 100644
index 0000000..6234473
@@ -0,0 +1,7 @@
+ccflags-y := -Iinclude/drm
+
+gm12u320-y :=	gm12u320_drv.o gm12u320_modeset.o gm12u320_connector.o \
+		gm12u320_encoder.o gm12u320_main.o gm12u320_fb.o \
+		gm12u320_gem.o gm12u320_dmabuf.o
+
+obj-$(CONFIG_DRM_GM12U320) += gm12u320.o
drivers/gpu/drm/gm12u320/gm12u320_connector.c new file +151 -0

151 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_dmabuf.c new file +283 -0

283 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +160 -0

160 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_drv.h new file +129 -0

129 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_encoder.c new file +75 -0

75 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_fb.c new file +345 -0

345 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_gem.c new file +237 -0

237 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_main.c new file +507 -0

507 lines not on this page · raw message

drivers/gpu/drm/gm12u320/gm12u320_modeset.c new file +144 -0

144 lines not on this page · raw message

Signature · 6 lines
2.7.4

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

Review

Quoted 13 lines · Hans de Goede

Grain-media GM12U320 based devices are mini video projectors using USB for both power and video data transport.

This commit adds a kms driver for these devices, including prime support.

This driver is based on the existing udl kms driver, and the gm12u320 fb driver by Viacheslav Nurmekhamitov <[email protected]>.

---
Changes in v2:

(quoted diff) +0 -2
-Rebase on 4.7-rc1
-Sync with udl, bring in any fixes done to udl since v1

This sounds a little nightmarish in the long term. From a cursory look this duplicates a bunch of code that's present in UDL, where the main differences are EDID handling and data transfer. I wonder if we can't find a better way of reusing code than duplicating it.

Quoted 1 line
drivers/gpu/drm/gm12u320/gm12u320_connector.c +0 -0

[...]

Quoted 49 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +49 -0
+/*
+ * Note this assumes this driver is only ever used with the Acer C120, if we
+ * add support for other devices the vendor and model should be parameterized.
+ */
+static struct edid gm12u320_edid = {
+	.header		= { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 },
+	.mfg_id		= { 0x04, 0x72 },	/* "ACR" */
+	.prod_code	= { 0x20, 0xc1 },	/* C120h */
+	.mfg_week	= 1,
+	.mfg_year	= 1,
+	.version	= 1,			/* EDID 1.3 */
+	.revision	= 3,			/* EDID 1.3 */
+	.input		= 0x80,			/* Digital input */
+	.features	= 0x02,			/* Pref timing in DTD 1 */
+	.standard_timings = { { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 },
+			      { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 } },
+	.detailed_timings = { {
+		.pixel_clock = 3383,
+		/* hactive = 852, hblank = 256 */
+		.data.pixel_data.hactive_lo = 0x54,
+		.data.pixel_data.hblank_lo = 0x00,
+		.data.pixel_data.hactive_hblank_hi = 0x31,
+		/* vactive = 480, vblank = 28 */
+		.data.pixel_data.vactive_lo = 0xe0,
+		.data.pixel_data.vblank_lo = 0x1c,
+		.data.pixel_data.vactive_vblank_hi = 0x10,
+		/* hsync offset 40 pw 128, vsync offset 1 pw 4 */
+		.data.pixel_data.hsync_offset_lo = 0x28,
+		.data.pixel_data.hsync_pulse_width_lo = 0x80,
+		.data.pixel_data.vsync_offset_pulse_width_lo = 0x14,
+		.data.pixel_data.hsync_vsync_offset_pulse_width_hi = 0x00,
+		/* Digital separate syncs, hsync+, vsync+ */
+		.data.pixel_data.misc = 0x1e,
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfd, /* Monitor ranges */
+		.data.other_data.data.range.min_vfreq = 59,
+		.data.other_data.data.range.max_vfreq = 61,
+		.data.other_data.data.range.min_hfreq_khz = 29,
+		.data.other_data.data.range.max_hfreq_khz = 32,
+		.data.other_data.data.range.pixel_clock_mhz = 4, /* 40 MHz */
+		.data.other_data.data.range.flags = 0,
+		.data.other_data.data.range.formula.cvt = {
+			0xa0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfc, /* Model string */
+		.data.other_data.data.str.str = {
+			'C', '1', '2', '0', 'P', 'r', 'o', 'j', 'e', 'c',

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 79

Quoted 10 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +10 -0
+			't', 'o', 'r' },
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfe, /* Unspecified text / padding */
+		.data.other_data.data.str.str = {
+			'\n', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+			' ', ' ',  ' ' },
+	} },
+	.checksum = 0x40,
+};

Where did you get this from? Doesn't this device have a chip that you can query at runtime?

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 109

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+static int gm12u320_connector_set_property(struct drm_connector *connector,
+					   struct drm_property *property,
+					   uint64_t val)
+{
+	return 0;
+}

Just drop it if it doesn't do anything.

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 141

Quoted 11 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +11 -0
+int gm12u320_connector_init(struct drm_device *dev,
+			    struct drm_encoder *encoder)
+{
+	struct drm_connector *connector;
+
+	connector = kzalloc(sizeof(struct drm_connector), GFP_KERNEL);
+	if (!connector)
+		return -ENOMEM;
+
+	drm_connector_init(dev, connector, &gm12u320_connector_funcs,
+			   DRM_MODE_CONNECTOR_Unknown);

According to the Grain Media website this chip is a USB 3.0-to-HDMI bridge, so DRM_MODE_CONNECTOR_HDMIA might be a better choice here.

Quoted 1 line
drivers/gpu/drm/gm12u320/gm12u320_drv.c +0 -0

[...]

Quoted 12 lines

new file mode 100644
index 0000000..eff3a44

drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +7 -0
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2012-2016 Red Hat Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License v2. See the file COPYING in the main directory of this archive for
+ * more details.
+ */

drivers/gpu/drm/gm12u320/gm12u320_drv.c line 17

Quoted 10 lines
drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +10 -0
+
+#include <linux/module.h>
+#include <drm/drmP.h>
+#include <drm/drm_crtc_helper.h>
+#include "gm12u320_drv.h"
+
+static int gm12u320_driver_set_busid(struct drm_device *d, struct drm_master *m)
+{
+	return 0;
+}

This is optional, you can drop it.

Thierry

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

#2 lore raw

Hi,

Thanks for the review!

Quoted 9 lines · Thierry Reding
Quoted 8 lines · Hans de Goede

Grain-media GM12U320 based devices are mini video projectors using USB for both power and video data transport.

This commit adds a kms driver for these devices, including prime support.

This driver is based on the existing udl kms driver, and the gm12u320 fb driver by Viacheslav Nurmekhamitov <[email protected]>.

Quoted 10 lines

Review

Quoted 5 lines

---
Changes in v2:

(quoted diff) +0 -2
-Rebase on 4.7-rc1
-Sync with udl, bring in any fixes done to udl since v1

This sounds a little nightmarish in the long term. From a cursory look this duplicates a bunch of code that's present in UDL, where the main differences are EDID handling and data transfer. I wonder if we can't find a better way of reusing code than duplicating it.

I was planning on eventually moving the shared code to some kms-usb helper lib, I was thinking it would be good to have more then one user first, but if people prefer me first factoring out some code from udl into a lib I can do that instead.

Quoted 55 lines
Quoted 1 line
drivers/gpu/drm/gm12u320/gm12u320_connector.c +0 -0

[...]

Quoted 53 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +53 -0
+/*
+ * Note this assumes this driver is only ever used with the Acer C120, if we
+ * add support for other devices the vendor and model should be parameterized.
+ */
+static struct edid gm12u320_edid = {
+	.header		= { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 },
+	.mfg_id		= { 0x04, 0x72 },	/* "ACR" */
+	.prod_code	= { 0x20, 0xc1 },	/* C120h */
+	.mfg_week	= 1,
+	.mfg_year	= 1,
+	.version	= 1,			/* EDID 1.3 */
+	.revision	= 3,			/* EDID 1.3 */
+	.input		= 0x80,			/* Digital input */
+	.features	= 0x02,			/* Pref timing in DTD 1 */
+	.standard_timings = { { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 },
+			      { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 } },
+	.detailed_timings = { {
+		.pixel_clock = 3383,
+		/* hactive = 852, hblank = 256 */
+		.data.pixel_data.hactive_lo = 0x54,
+		.data.pixel_data.hblank_lo = 0x00,
+		.data.pixel_data.hactive_hblank_hi = 0x31,
+		/* vactive = 480, vblank = 28 */
+		.data.pixel_data.vactive_lo = 0xe0,
+		.data.pixel_data.vblank_lo = 0x1c,
+		.data.pixel_data.vactive_vblank_hi = 0x10,
+		/* hsync offset 40 pw 128, vsync offset 1 pw 4 */
+		.data.pixel_data.hsync_offset_lo = 0x28,
+		.data.pixel_data.hsync_pulse_width_lo = 0x80,
+		.data.pixel_data.vsync_offset_pulse_width_lo = 0x14,
+		.data.pixel_data.hsync_vsync_offset_pulse_width_hi = 0x00,
+		/* Digital separate syncs, hsync+, vsync+ */
+		.data.pixel_data.misc = 0x1e,
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfd, /* Monitor ranges */
+		.data.other_data.data.range.min_vfreq = 59,
+		.data.other_data.data.range.max_vfreq = 61,
+		.data.other_data.data.range.min_hfreq_khz = 29,
+		.data.other_data.data.range.max_hfreq_khz = 32,
+		.data.other_data.data.range.pixel_clock_mhz = 4, /* 40 MHz */
+		.data.other_data.data.range.flags = 0,
+		.data.other_data.data.range.formula.cvt = {
+			0xa0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfc, /* Model string */
+		.data.other_data.data.str.str = {
+			'C', '1', '2', '0', 'P', 'r', 'o', 'j', 'e', 'c',
+			't', 'o', 'r' },
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfe, /* Unspecified text / padding */
Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 79

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+		.data.other_data.data.str.str = {
+			'\n', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+			' ', ' ',  ' ' },
+	} },
+	.checksum = 0x40,
+};

Where did you get this from?

I completely made it up, other then for the resolution which is the native resolution of the lcd in the projector

Quoted 1 line

Doesn't this device have a chip that you can query at runtime?

Not to my knowledge.

Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 109

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+static int gm12u320_connector_set_property(struct drm_connector *connector,
+					   struct drm_property *property,
+					   uint64_t val)
+{
+	return 0;
+}

Just drop it if it doesn't do anything.

Ok, then it should probably be dropped from udl too, I'll check and submit a separate patch for this.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+int gm12u320_connector_init(struct drm_device *dev,
+			    struct drm_encoder *encoder)
+{
+	struct drm_connector *connector;
+
+	connector = kzalloc(sizeof(struct drm_connector), GFP_KERNEL);
Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 141

Quoted 5 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +5 -0
+	if (!connector)
+		return -ENOMEM;
+
+	drm_connector_init(dev, connector, &gm12u320_connector_funcs,
+			   DRM_MODE_CONNECTOR_Unknown);

According to the Grain Media website this chip is a USB 3.0-to-HDMI bridge, so DRM_MODE_CONNECTOR_HDMIA might be a better choice here.

Hmm, where did you find this ? Note I've never actually verified the gm12u320 name this comes from previous reverse engineering work done on the projector.

HDMI for what is in essence a lcd panel seems wrong, maybe lvds if you want to avoid Unknown ?

Quoted 18 lines
Quoted 1 line
drivers/gpu/drm/gm12u320/gm12u320_drv.c +0 -0

[...]

Quoted 16 lines

new file mode 100644
index 0000000..eff3a44

drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +11 -0
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2012-2016 Red Hat Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License v2. See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#include <linux/module.h>
+#include <drm/drmP.h>
+#include <drm/drm_crtc_helper.h>
Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_drv.c line 17

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +6 -0
+#include "gm12u320_drv.h"
+
+static int gm12u320_driver_set_busid(struct drm_device *d, struct drm_master *m)
+{
+	return 0;
+}

This is optional, you can drop it.

Idem. as above, then it should probably be dropped from udl too, I'll check and submit a separate patch for this.

Regards,

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

#3 lore raw
Quoted 25 lines · Hans de Goede

Hi,

Thanks for the review!

Quoted 9 lines · Thierry Reding
Quoted 8 lines · Hans de Goede

Grain-media GM12U320 based devices are mini video projectors using USB for both power and video data transport.

This commit adds a kms driver for these devices, including prime support.

This driver is based on the existing udl kms driver, and the gm12u320 fb driver by Viacheslav Nurmekhamitov <[email protected]>.

Quoted 10 lines

Review

Quoted 5 lines

---
Changes in v2:

(quoted diff) +0 -2
-Rebase on 4.7-rc1
-Sync with udl, bring in any fixes done to udl since v1

This sounds a little nightmarish in the long term. From a cursory look this duplicates a bunch of code that's present in UDL, where the main differences are EDID handling and data transfer. I wonder if we can't find a better way of reusing code than duplicating it.

Quoted 4 lines

I was planning on eventually moving the shared code to some kms-usb helper lib, I was thinking it would be good to have more then one user first, but if people prefer me first factoring out some code from udl into a lib I can do that instead.

Yeah I think waiting for more usb drivers is probably better. I don't want to resurrect all the drm_bus mistakes once more, we're still working to get rid of them all.

The other bit: Can I haz this in atomic, plz?

And when you look at atomic, it would probably be worth it to check out Noralf's drm_simple_display_pipe helpers. They're made exactly for dumb devices like this one here. It would cut out a lof of code.

The one thing you might need on top of Noralf's patches is some super-simple support for cursors. That should be easy to add though. -Daniel

Quoted 143 lines
Quoted 56 lines
Quoted 2 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +0 -0

[...]

Quoted 53 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +53 -0
+/*
+ * Note this assumes this driver is only ever used with the Acer C120, if we
+ * add support for other devices the vendor and model should be parameterized.
+ */
+static struct edid gm12u320_edid = {
+	.header		= { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 },
+	.mfg_id		= { 0x04, 0x72 },	/* "ACR" */
+	.prod_code	= { 0x20, 0xc1 },	/* C120h */
+	.mfg_week	= 1,
+	.mfg_year	= 1,
+	.version	= 1,			/* EDID 1.3 */
+	.revision	= 3,			/* EDID 1.3 */
+	.input		= 0x80,			/* Digital input */
+	.features	= 0x02,			/* Pref timing in DTD 1 */
+	.standard_timings = { { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 },
+			      { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 } },
+	.detailed_timings = { {
+		.pixel_clock = 3383,
+		/* hactive = 852, hblank = 256 */
+		.data.pixel_data.hactive_lo = 0x54,
+		.data.pixel_data.hblank_lo = 0x00,
+		.data.pixel_data.hactive_hblank_hi = 0x31,
+		/* vactive = 480, vblank = 28 */
+		.data.pixel_data.vactive_lo = 0xe0,
+		.data.pixel_data.vblank_lo = 0x1c,
+		.data.pixel_data.vactive_vblank_hi = 0x10,
+		/* hsync offset 40 pw 128, vsync offset 1 pw 4 */
+		.data.pixel_data.hsync_offset_lo = 0x28,
+		.data.pixel_data.hsync_pulse_width_lo = 0x80,
+		.data.pixel_data.vsync_offset_pulse_width_lo = 0x14,
+		.data.pixel_data.hsync_vsync_offset_pulse_width_hi = 0x00,
+		/* Digital separate syncs, hsync+, vsync+ */
+		.data.pixel_data.misc = 0x1e,
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfd, /* Monitor ranges */
+		.data.other_data.data.range.min_vfreq = 59,
+		.data.other_data.data.range.max_vfreq = 61,
+		.data.other_data.data.range.min_hfreq_khz = 29,
+		.data.other_data.data.range.max_hfreq_khz = 32,
+		.data.other_data.data.range.pixel_clock_mhz = 4, /* 40 MHz */
+		.data.other_data.data.range.flags = 0,
+		.data.other_data.data.range.formula.cvt = {
+			0xa0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 },
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfc, /* Model string */
+		.data.other_data.data.str.str = {
+			'C', '1', '2', '0', 'P', 'r', 'o', 'j', 'e', 'c',
+			't', 'o', 'r' },
+	}, {
+		.pixel_clock = 0,
+		.data.other_data.type = 0xfe, /* Unspecified text / padding */
Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 79

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+		.data.other_data.data.str.str = {
+			'\n', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+			' ', ' ',  ' ' },
+	} },
+	.checksum = 0x40,
+};

Where did you get this from?

I completely made it up, other then for the resolution which is the native resolution of the lcd in the projector

Quoted 1 line

Doesn't this device have a chip that you can query at runtime?

Not to my knowledge.

Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 109

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+static int gm12u320_connector_set_property(struct drm_connector *connector,
+					   struct drm_property *property,
+					   uint64_t val)
+{
+	return 0;
+}

Just drop it if it doesn't do anything.

Ok, then it should probably be dropped from udl too, I'll check and submit a separate patch for this.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +6 -0
+int gm12u320_connector_init(struct drm_device *dev,
+			    struct drm_encoder *encoder)
+{
+	struct drm_connector *connector;
+
+	connector = kzalloc(sizeof(struct drm_connector), GFP_KERNEL);
Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_connector.c line 141

Quoted 5 lines
drivers/gpu/drm/gm12u320/gm12u320_connector.c +5 -0
+	if (!connector)
+		return -ENOMEM;
+
+	drm_connector_init(dev, connector, &gm12u320_connector_funcs,
+			   DRM_MODE_CONNECTOR_Unknown);

According to the Grain Media website this chip is a USB 3.0-to-HDMI bridge, so DRM_MODE_CONNECTOR_HDMIA might be a better choice here.

Hmm, where did you find this ? Note I've never actually verified the gm12u320 name this comes from previous reverse engineering work done on the projector.

HDMI for what is in essence a lcd panel seems wrong, maybe lvds if you want to avoid Unknown ?

Quoted 18 lines
Quoted 1 line
drivers/gpu/drm/gm12u320/gm12u320_drv.c +0 -0

[...]

Quoted 16 lines

new file mode 100644
index 0000000..eff3a44

drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +11 -0
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2012-2016 Red Hat Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License v2. See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#include <linux/module.h>
+#include <drm/drmP.h>
+#include <drm/drm_crtc_helper.h>
Quoted 8 lines

drivers/gpu/drm/gm12u320/gm12u320_drv.c line 17

Quoted 6 lines
drivers/gpu/drm/gm12u320/gm12u320_drv.c new file +6 -0
+#include "gm12u320_drv.h"
+
+static int gm12u320_driver_set_busid(struct drm_device *d, struct drm_master *m)
+{
+	return 0;
+}

This is optional, you can drop it.

Idem. as above, then it should probably be dropped from udl too, I'll check and submit a separate patch for this.

Regards,

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