From 3f9238ed77bf41b1bbdde75b9d16fdd670b79c8c Mon Sep 17 00:00:00 2001 From: parazyd Date: Wed, 14 Feb 2018 15:13:25 +0100 Subject: [PATCH] Add and rebase sre's droid4 patches for linux 4.16-rc1. --- ...-omap-remove-unused-function-defines.patch | 31 - ...map-add-framedone-interrupt-support.patch} | 64 +- ...0002-drm-omap-drop-incorrect-comment.patch | 33 - ...-add-manual-update-detection-helper.patch} | 29 +- ...-plane-update-fifo-size-on-ovl-setup.patch | 52 - ...pport-for-manually-updated-displays.patch} | 51 +- ...common-document-orientation-property.patch | 57 + ...ientation-hints-from-display-drivers.patch | 59 + ...panel-dsi-cm-add-orientation-support.patch | 55 + ...port-for-physical-size-hints-from-di.patch | 50 - ...4-add-lcd-panel-orientation-property.patch | 31 + ...008-drm-omap-panel-dsi-cm-fix-driver.patch | 124 -- ...-plane-update-fifo-size-on-ovl-setup.patch | 125 ++ ...p-panel-dsi-cm-add-regulator-support.patch | 135 -- ...-dts-omap4-droid4-update-touchscreen.patch | 67 + ...nel-dsi-cm-add-physical-size-support.patch | 67 - ...si-cm-add-external-backlight-support.patch | 247 ---- ...rm-omap-panel-dsi-cm-switch-to-gpiod.patch | 172 --- ...omap4-droid4-improve-LCD-description.patch | 39 - ...014-ARM-dts-n950-add-display-support.patch | 122 -- ...cklight-add-ti-lmu-backlight-binding.patch | 89 -- ...acklight-add-TI-LMU-backlight-driver.patch | 1222 ----------------- .../0017-droid4-hdmi-on-4.14-rc4.patch | 102 -- extra/patches/linux-droid4-patches/README | 61 + 24 files changed, 519 insertions(+), 2565 deletions(-) delete mode 100644 extra/patches/linux-droid4-patches/0001-drm-omap-remove-unused-function-defines.patch rename extra/patches/linux-droid4-patches/{0004-drm-omap-add-framedone-interrupt-support.patch => 0001_drm-omap-add-framedone-interrupt-support.patch} (75%) delete mode 100644 extra/patches/linux-droid4-patches/0002-drm-omap-drop-incorrect-comment.patch rename extra/patches/linux-droid4-patches/{0005-drm-omap-add-manual-update-detection-helper.patch => 0002_drm-omap-add-manual-update-detection-helper.patch} (55%) delete mode 100644 extra/patches/linux-droid4-patches/0003-drm-omap-plane-update-fifo-size-on-ovl-setup.patch rename extra/patches/linux-droid4-patches/{0006-drm-omap-add-support-for-manually-updated-displays.patch => 0003_drm-omap-add-support-for-manually-updated-displays.patch} (82%) create mode 100644 extra/patches/linux-droid4-patches/0004_dt-bindings-panel-common-document-orientation-property.patch create mode 100644 extra/patches/linux-droid4-patches/0005_drm-omap-add-support-for-orientation-hints-from-display-drivers.patch create mode 100644 extra/patches/linux-droid4-patches/0006_drm-omap-panel-dsi-cm-add-orientation-support.patch delete mode 100644 extra/patches/linux-droid4-patches/0007-drm-omap-add-support-for-physical-size-hints-from-di.patch create mode 100644 extra/patches/linux-droid4-patches/0007_arm-dts-omap4-droid4-add-lcd-panel-orientation-property.patch delete mode 100644 extra/patches/linux-droid4-patches/0008-drm-omap-panel-dsi-cm-fix-driver.patch create mode 100644 extra/patches/linux-droid4-patches/0008_drm-omap-plane-update-fifo-size-on-ovl-setup.patch delete mode 100644 extra/patches/linux-droid4-patches/0009-drm-omap-panel-dsi-cm-add-regulator-support.patch create mode 100644 extra/patches/linux-droid4-patches/0009_arm-dts-omap4-droid4-update-touchscreen.patch delete mode 100644 extra/patches/linux-droid4-patches/0010-drm-omap-panel-dsi-cm-add-physical-size-support.patch delete mode 100644 extra/patches/linux-droid4-patches/0011-drm-omap-panel-dsi-cm-add-external-backlight-support.patch delete mode 100644 extra/patches/linux-droid4-patches/0012-drm-omap-panel-dsi-cm-switch-to-gpiod.patch delete mode 100644 extra/patches/linux-droid4-patches/0013-ARM-dts-omap4-droid4-improve-LCD-description.patch delete mode 100644 extra/patches/linux-droid4-patches/0014-ARM-dts-n950-add-display-support.patch delete mode 100644 extra/patches/linux-droid4-patches/0015-dt-bindings-backlight-add-ti-lmu-backlight-binding.patch delete mode 100644 extra/patches/linux-droid4-patches/0016-backlight-add-TI-LMU-backlight-driver.patch delete mode 100644 extra/patches/linux-droid4-patches/0017-droid4-hdmi-on-4.14-rc4.patch create mode 100644 extra/patches/linux-droid4-patches/README diff --git a/extra/patches/linux-droid4-patches/0001-drm-omap-remove-unused-function-defines.patch b/extra/patches/linux-droid4-patches/0001-drm-omap-remove-unused-function-defines.patch deleted file mode 100644 index 8ff9326..0000000 --- a/extra/patches/linux-droid4-patches/0001-drm-omap-remove-unused-function-defines.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a7129365bbffa136d3987e9ae8480337882f753a Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:32:58 +0200 -Subject: [PATCH 01/17] drm/omap: remove unused function defines - -Remove driver (un)register API defines. They do not even exist -anymore. - -Signed-off-by: Sebastian Reichel -Acked-by: Pavel Machek ---- - drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h -index 47a3316..3d25359 100644 ---- a/drivers/gpu/drm/omapdrm/dss/omapdss.h -+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h -@@ -584,9 +584,6 @@ struct omap_dss_driver { - - bool omapdss_is_initialized(void); - --int omap_dss_register_driver(struct omap_dss_driver *); --void omap_dss_unregister_driver(struct omap_dss_driver *); -- - int omapdss_register_display(struct omap_dss_device *dssdev); - void omapdss_unregister_display(struct omap_dss_device *dssdev); - --- -2.1.4 - diff --git a/extra/patches/linux-droid4-patches/0004-drm-omap-add-framedone-interrupt-support.patch b/extra/patches/linux-droid4-patches/0001_drm-omap-add-framedone-interrupt-support.patch similarity index 75% rename from extra/patches/linux-droid4-patches/0004-drm-omap-add-framedone-interrupt-support.patch rename to extra/patches/linux-droid4-patches/0001_drm-omap-add-framedone-interrupt-support.patch index fba570a..aefd3a9 100644 --- a/extra/patches/linux-droid4-patches/0004-drm-omap-add-framedone-interrupt-support.patch +++ b/extra/patches/linux-droid4-patches/0001_drm-omap-add-framedone-interrupt-support.patch @@ -1,23 +1,19 @@ -From 8af6ec6efc7607cc5af52af895ac7f8e63820f80 Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:33:01 +0200 -Subject: [PATCH 04/17] drm/omap: add framedone interrupt support - This prepares framedone interrupt handling for manual display update support. -Signed-off-by: Sebastian Reichel +Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_crtc.c | 48 +++++++++++++++++++++++++++++++++++++ - drivers/gpu/drm/omapdrm/omap_drv.h | 2 ++ + drivers/gpu/drm/omapdrm/omap_crtc.h | 1 + drivers/gpu/drm/omapdrm/omap_irq.c | 24 +++++++++++++++++++ - 3 files changed, 74 insertions(+) + drivers/gpu/drm/omapdrm/omap_irq.h | 1 + + 4 files changed, 74 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c -index cc85c16..dee9b6e 100644 +index 1b8154e58d18..2278e3433008 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c -@@ -52,6 +52,9 @@ struct omap_crtc { +@@ -51,6 +51,9 @@ struct omap_crtc { bool pending; wait_queue_head_t pending_wait; struct drm_pending_vblank_event *event; @@ -27,7 +23,7 @@ index cc85c16..dee9b6e 100644 }; /* ----------------------------------------------------------------------------- -@@ -248,6 +251,17 @@ static int omap_crtc_dss_register_framedone( +@@ -247,6 +250,17 @@ static int omap_crtc_dss_register_framedone( enum omap_channel channel, void (*handler)(void *), void *data) { @@ -45,7 +41,7 @@ index cc85c16..dee9b6e 100644 return 0; } -@@ -255,6 +269,16 @@ static void omap_crtc_dss_unregister_framedone( +@@ -254,6 +268,16 @@ static void omap_crtc_dss_unregister_framedone( enum omap_channel channel, void (*handler)(void *), void *data) { @@ -62,7 +58,7 @@ index cc85c16..dee9b6e 100644 } static const struct dss_mgr_ops mgr_ops = { -@@ -322,6 +346,30 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc) +@@ -321,6 +345,30 @@ void omap_crtc_vblank_irq(struct drm_crtc *crtc) DBG("%s: apply done", omap_crtc->name); } @@ -93,31 +89,22 @@ index cc85c16..dee9b6e 100644 static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) { struct omap_drm_private *priv = crtc->dev->dev_private; -diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h -index 4bd1e90..22f3d94 100644 ---- a/drivers/gpu/drm/omapdrm/omap_drv.h -+++ b/drivers/gpu/drm/omapdrm/omap_drv.h -@@ -97,6 +97,7 @@ void omap_gem_describe_objects(struct list_head *list, struct seq_file *m); - int omap_gem_resume(struct device *dev); - #endif - -+int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable); - int omap_irq_enable_vblank(struct drm_crtc *crtc); - void omap_irq_disable_vblank(struct drm_crtc *crtc); - void omap_drm_irq_uninstall(struct drm_device *dev); -@@ -124,6 +125,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, +diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h +index ad7b007c6174..bd316bc0b6f4 100644 +--- a/drivers/gpu/drm/omapdrm/omap_crtc.h ++++ b/drivers/gpu/drm/omapdrm/omap_crtc.h +@@ -39,5 +39,6 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, int omap_crtc_wait_pending(struct drm_crtc *crtc); void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus); void omap_crtc_vblank_irq(struct drm_crtc *crtc); +void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus); - struct drm_plane *omap_plane_init(struct drm_device *dev, - int idx, enum drm_plane_type type, + #endif /* __OMAPDRM_CRTC_H__ */ diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c -index 013b0bb..301c0e7 100644 +index 53ba424823b2..354df3583229 100644 --- a/drivers/gpu/drm/omapdrm/omap_irq.c +++ b/drivers/gpu/drm/omapdrm/omap_irq.c -@@ -87,6 +87,27 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait, +@@ -85,6 +85,27 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait, return ret == 0 ? -1 : 0; } @@ -145,7 +132,7 @@ index 013b0bb..301c0e7 100644 /** * enable_vblank - enable vblank interrupt events * @dev: DRM device -@@ -217,6 +238,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg) +@@ -215,6 +236,9 @@ static irqreturn_t omap_irq_handler(int irq, void *arg) if (irqstatus & priv->dispc_ops->mgr_get_sync_lost_irq(channel)) omap_crtc_error_irq(crtc, irqstatus); @@ -155,6 +142,17 @@ index 013b0bb..301c0e7 100644 } omap_irq_ocp_error_handler(dev, irqstatus); +diff --git a/drivers/gpu/drm/omapdrm/omap_irq.h b/drivers/gpu/drm/omapdrm/omap_irq.h +index 606c09932bc0..69f4ff80a0e4 100644 +--- a/drivers/gpu/drm/omapdrm/omap_irq.h ++++ b/drivers/gpu/drm/omapdrm/omap_irq.h +@@ -27,6 +27,7 @@ struct drm_device; + struct omap_irq_wait; + + int omap_irq_enable_vblank(struct drm_crtc *crtc); ++int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable); + void omap_irq_disable_vblank(struct drm_crtc *crtc); + void omap_drm_irq_uninstall(struct drm_device *dev); + int omap_drm_irq_install(struct drm_device *dev); -- -2.1.4 - +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0002-drm-omap-drop-incorrect-comment.patch b/extra/patches/linux-droid4-patches/0002-drm-omap-drop-incorrect-comment.patch deleted file mode 100644 index f11655a..0000000 --- a/extra/patches/linux-droid4-patches/0002-drm-omap-drop-incorrect-comment.patch +++ /dev/null @@ -1,33 +0,0 @@ -From faf0e2475147bd8e755dbce7f9f1a0fb8e731e4f Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:32:59 +0200 -Subject: [PATCH 02/17] drm/omap: drop incorrect comment - -The wrappers have been removed in commit 5a35876e2830 -(drm: omapdrm: Remove manual update display support) -and will not be reintroduced, since the normal sys -functions properly call the dirty callback. - -Signed-off-by: Sebastian Reichel -Acked-by: Pavel Machek ---- - drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c -index 9273118..e037818 100644 ---- a/drivers/gpu/drm/omapdrm/omap_fbdev.c -+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c -@@ -84,9 +84,6 @@ static struct fb_ops omap_fb_ops = { - .owner = THIS_MODULE, - DRM_FB_HELPER_DEFAULT_OPS, - -- /* Note: to properly handle manual update displays, we wrap the -- * basic fbdev ops which write to the framebuffer -- */ - .fb_read = drm_fb_helper_sys_read, - .fb_write = drm_fb_helper_sys_write, - .fb_fillrect = drm_fb_helper_sys_fillrect, --- -2.1.4 - diff --git a/extra/patches/linux-droid4-patches/0005-drm-omap-add-manual-update-detection-helper.patch b/extra/patches/linux-droid4-patches/0002_drm-omap-add-manual-update-detection-helper.patch similarity index 55% rename from extra/patches/linux-droid4-patches/0005-drm-omap-add-manual-update-detection-helper.patch rename to extra/patches/linux-droid4-patches/0002_drm-omap-add-manual-update-detection-helper.patch index 030ec95..68764f5 100644 --- a/extra/patches/linux-droid4-patches/0005-drm-omap-add-manual-update-detection-helper.patch +++ b/extra/patches/linux-droid4-patches/0002_drm-omap-add-manual-update-detection-helper.patch @@ -1,23 +1,18 @@ -From 6dae0575adf3b15c51832bfa8c0320e8526e9b8e Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:33:02 +0200 -Subject: [PATCH 05/17] drm/omap: add manual update detection helper - In preparation for manually updated display support, such as DSI command mode panels, this adds a simple helper to see if a connector is manually updated. -Signed-off-by: Sebastian Reichel +Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_connector.c | 8 ++++++++ - drivers/gpu/drm/omapdrm/omap_drv.h | 1 + + drivers/gpu/drm/omapdrm/omap_connector.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c -index aa5ba9a..4f4c7ef 100644 +index a0d7b1d905e8..a33b51484b2d 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c -@@ -59,6 +59,14 @@ bool omap_connector_get_hdmi_mode(struct drm_connector *connector) +@@ -57,6 +57,14 @@ bool omap_connector_get_hdmi_mode(struct drm_connector *connector) return omap_connector->hdmi_mode; } @@ -32,18 +27,16 @@ index aa5ba9a..4f4c7ef 100644 static enum drm_connector_status omap_connector_detect( struct drm_connector *connector, bool force) { -diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h -index 22f3d94..f6c48f2 100644 ---- a/drivers/gpu/drm/omapdrm/omap_drv.h -+++ b/drivers/gpu/drm/omapdrm/omap_drv.h -@@ -142,6 +142,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, +diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h b/drivers/gpu/drm/omapdrm/omap_connector.h +index 98bbc779b302..652136d167f5 100644 +--- a/drivers/gpu/drm/omapdrm/omap_connector.h ++++ b/drivers/gpu/drm/omapdrm/omap_connector.h +@@ -33,5 +33,6 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, struct drm_encoder *omap_connector_attached_encoder( struct drm_connector *connector); bool omap_connector_get_hdmi_mode(struct drm_connector *connector); +bool omap_connector_get_manually_updated(struct drm_connector *connector); - struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, - struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd); + #endif /* __OMAPDRM_CONNECTOR_H__ */ -- -2.1.4 - +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0003-drm-omap-plane-update-fifo-size-on-ovl-setup.patch b/extra/patches/linux-droid4-patches/0003-drm-omap-plane-update-fifo-size-on-ovl-setup.patch deleted file mode 100644 index d117879..0000000 --- a/extra/patches/linux-droid4-patches/0003-drm-omap-plane-update-fifo-size-on-ovl-setup.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 8bb3dd3ffe60be576bd6a843ebb65979e49e3e25 Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:33:00 +0200 -Subject: [PATCH 03/17] drm/omap: plane: update fifo size on ovl setup - -This is a workaround for a hardware bug occuring on OMAP3 -with manually updated panels. Details about the HW bug are -unknown to me, but without this fix the panel refresh does -not work at all on Nokia N950. - -Signed-off-by: Sebastian Reichel ---- - drivers/gpu/drm/omapdrm/dss/dispc.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c -index 0f4fdb2..d5d2d3c 100644 ---- a/drivers/gpu/drm/omapdrm/dss/dispc.c -+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c -@@ -1491,6 +1491,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane, - } - } - -+void dispc_ovl_set_manual_fifo_threshold(enum omap_plane_id plane) -+{ -+ u32 fifo_low, fifo_high; -+ bool use_fifo_merge = false; -+ bool use_manual_update = true; -+ -+ dispc_ovl_compute_fifo_thresholds(plane, &fifo_low, &fifo_high, -+ use_fifo_merge, use_manual_update); -+ -+ dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high); -+} -+ - static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable) - { - int bit; -@@ -2654,6 +2666,10 @@ static int dispc_ovl_setup(enum omap_plane_id plane, - oi->zorder, oi->pre_mult_alpha, oi->global_alpha, - oi->rotation_type, replication, vm, mem_to_mem); - -+ /* manual mode needs other fifo thresholds */ -+ if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE)) -+ dispc_ovl_set_manual_fifo_threshold(plane); -+ - return r; - } - --- -2.1.4 - diff --git a/extra/patches/linux-droid4-patches/0006-drm-omap-add-support-for-manually-updated-displays.patch b/extra/patches/linux-droid4-patches/0003_drm-omap-add-support-for-manually-updated-displays.patch similarity index 82% rename from extra/patches/linux-droid4-patches/0006-drm-omap-add-support-for-manually-updated-displays.patch rename to extra/patches/linux-droid4-patches/0003_drm-omap-add-support-for-manually-updated-displays.patch index 86822c0..1f89dce 100644 --- a/extra/patches/linux-droid4-patches/0006-drm-omap-add-support-for-manually-updated-displays.patch +++ b/extra/patches/linux-droid4-patches/0003_drm-omap-add-support-for-manually-updated-displays.patch @@ -1,8 +1,3 @@ -From 2a51a11e2f2705bbf7642e2e08ae6b2f1372d79c Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:33:03 +0200 -Subject: [PATCH 06/17] drm/omap: add support for manually updated displays - This adds the required infrastructure for manually updated displays, such as DSI command mode panels. @@ -16,18 +11,18 @@ console and for Xorg. Weston currently does not implement this and is known not to work on manually updated displays. -Signed-off-by: Sebastian Reichel +Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_crtc.c | 110 +++++++++++++++++++++++++++++++++--- - drivers/gpu/drm/omapdrm/omap_drv.h | 1 + + drivers/gpu/drm/omapdrm/omap_crtc.h | 1 + drivers/gpu/drm/omapdrm/omap_fb.c | 20 +++++++ 3 files changed, 123 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c -index dee9b6e..8255241 100644 +index 2278e3433008..c2defb514b9f 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c -@@ -52,6 +52,7 @@ struct omap_crtc { +@@ -51,6 +51,7 @@ struct omap_crtc { bool pending; wait_queue_head_t pending_wait; struct drm_pending_vblank_event *event; @@ -35,7 +30,7 @@ index dee9b6e..8255241 100644 void (*framedone_handler)(void *); void *framedone_handler_data; -@@ -143,6 +144,28 @@ static void omap_crtc_dss_disconnect(enum omap_channel channel, +@@ -142,6 +143,28 @@ static void omap_crtc_dss_disconnect(enum omap_channel channel, static void omap_crtc_dss_start_update(enum omap_channel channel) { @@ -64,7 +59,7 @@ index dee9b6e..8255241 100644 } /* Called only from the encoder enable/disable and suspend/resume handlers. */ -@@ -154,12 +177,17 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) +@@ -153,12 +176,17 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) enum omap_channel channel = omap_crtc->channel; struct omap_irq_wait *wait; u32 framedone_irq, vsync_irq; @@ -83,7 +78,7 @@ index dee9b6e..8255241 100644 priv->dispc_ops->mgr_enable(channel, enable); omap_crtc->enabled = enable; return; -@@ -210,7 +238,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) +@@ -209,7 +237,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) } } @@ -91,7 +86,7 @@ index dee9b6e..8255241 100644 static int omap_crtc_dss_enable(enum omap_channel channel) { struct omap_crtc *omap_crtc = omap_crtcs[channel]; -@@ -370,6 +397,53 @@ void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus) +@@ -369,6 +396,53 @@ void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus) wake_up(&omap_crtc->pending_wait); } @@ -145,7 +140,7 @@ index dee9b6e..8255241 100644 static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc) { struct omap_drm_private *priv = crtc->dev->dev_private; -@@ -422,6 +496,10 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc, +@@ -421,6 +495,10 @@ static void omap_crtc_atomic_enable(struct drm_crtc *crtc, DBG("%s", omap_crtc->name); @@ -156,7 +151,7 @@ index dee9b6e..8255241 100644 spin_lock_irq(&crtc->dev->event_lock); drm_crtc_vblank_on(crtc); ret = drm_crtc_vblank_get(crtc); -@@ -435,6 +513,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc, +@@ -434,6 +512,7 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { struct omap_crtc *omap_crtc = to_omap_crtc(crtc); @@ -164,7 +159,7 @@ index dee9b6e..8255241 100644 DBG("%s", omap_crtc->name); -@@ -445,6 +524,11 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc, +@@ -444,6 +523,11 @@ static void omap_crtc_atomic_disable(struct drm_crtc *crtc, } spin_unlock_irq(&crtc->dev->event_lock); @@ -176,7 +171,7 @@ index dee9b6e..8255241 100644 drm_crtc_vblank_off(crtc); } -@@ -559,13 +643,20 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, +@@ -593,13 +677,20 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc, DBG("%s: GO", omap_crtc->name); @@ -203,7 +198,7 @@ index dee9b6e..8255241 100644 } static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, -@@ -726,6 +817,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, +@@ -761,6 +852,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, omap_crtc->channel = channel; omap_crtc->name = channel_names[channel]; @@ -213,23 +208,22 @@ index dee9b6e..8255241 100644 ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, &omap_crtc_funcs, NULL); if (ret < 0) { -diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h -index f6c48f2..3cb9f9a 100644 ---- a/drivers/gpu/drm/omapdrm/omap_drv.h -+++ b/drivers/gpu/drm/omapdrm/omap_drv.h -@@ -126,6 +126,7 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc); +diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h +index bd316bc0b6f4..b61c94b34f04 100644 +--- a/drivers/gpu/drm/omapdrm/omap_crtc.h ++++ b/drivers/gpu/drm/omapdrm/omap_crtc.h +@@ -40,5 +40,6 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc); void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus); void omap_crtc_vblank_irq(struct drm_crtc *crtc); void omap_crtc_framedone_irq(struct drm_crtc *crtc, uint32_t irqstatus); +void omap_crtc_flush(struct drm_crtc *crtc); - struct drm_plane *omap_plane_init(struct drm_device *dev, - int idx, enum drm_plane_type type, + #endif /* __OMAPDRM_CRTC_H__ */ diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c -index b1a762b..9492be6 100644 +index b2539a90e1a4..57b1767bef09 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c -@@ -97,8 +97,28 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb) +@@ -95,8 +95,28 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb) kfree(omap_fb); } @@ -259,5 +253,4 @@ index b1a762b..9492be6 100644 }; -- -2.1.4 - +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0004_dt-bindings-panel-common-document-orientation-property.patch b/extra/patches/linux-droid4-patches/0004_dt-bindings-panel-common-document-orientation-property.patch new file mode 100644 index 0000000..432abbd --- /dev/null +++ b/extra/patches/linux-droid4-patches/0004_dt-bindings-panel-common-document-orientation-property.patch @@ -0,0 +1,57 @@ +Introduce new "orientation" property for describing in which +orientation a panel has been mounted to the device. This can +be used by the operating system to automatically rotate the +display correctly. + +Signed-off-by: Sebastian Reichel +--- + .../devicetree/bindings/display/panel/panel-common.txt | 12 ++++++++++++ + include/dt-bindings/display/common.h | 14 ++++++++++++++ + 2 files changed, 26 insertions(+) + create mode 100644 include/dt-bindings/display/common.h + +diff --git a/Documentation/devicetree/bindings/display/panel/panel-common.txt b/Documentation/devicetree/bindings/display/panel/panel-common.txt +index 557fa765adcb..c646b8908458 100644 +--- a/Documentation/devicetree/bindings/display/panel/panel-common.txt ++++ b/Documentation/devicetree/bindings/display/panel/panel-common.txt +@@ -18,6 +18,18 @@ Descriptive Properties + physical area where images are displayed. These properties are expressed in + millimeters and rounded to the closest unit. + ++- orientation: The orientation property specifies the panel orientation ++ in relation to the device's casing. The following values are possible: ++ ++ * 0 = The top side of the panel matches the top side of the device's ++ casing. ++ * 1 = The top side of the panel matches the bottom side of the device's ++ casing. In other words the panel is mounted upside-down. ++ * 2 = The left side of the panel matches the top side of the device's ++ casing. ++ * 3 = The right side of the panel matches the top side of the device's ++ casing. ++ + - label: The label property specifies a symbolic name for the panel as a + string suitable for use by humans. It typically contains a name inscribed on + the system (e.g. as an affixed label) or specified in the system's +diff --git a/include/dt-bindings/display/common.h b/include/dt-bindings/display/common.h +new file mode 100644 +index 000000000000..a864775445a0 +--- /dev/null ++++ b/include/dt-bindings/display/common.h +@@ -0,0 +1,14 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * This header provides common constants for displays ++ */ ++ ++#ifndef _DT_BINDINGS_DISPLAY_COMMON_H ++#define _DT_BINDINGS_DISPLAY_COMMON_H ++ ++#define PANEL_ORIENTATION_NORMAL 0 ++#define PANEL_ORIENTATION_BOTTOM_UP 1 ++#define PANEL_ORIENTATION_LEFT_UP 2 ++#define PANEL_ORIENTATION_RIGHT_UP 3 ++ ++#endif +-- +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0005_drm-omap-add-support-for-orientation-hints-from-display-drivers.patch b/extra/patches/linux-droid4-patches/0005_drm-omap-add-support-for-orientation-hints-from-display-drivers.patch new file mode 100644 index 0000000..a55fae3 --- /dev/null +++ b/extra/patches/linux-droid4-patches/0005_drm-omap-add-support-for-orientation-hints-from-display-drivers.patch @@ -0,0 +1,59 @@ +This adds support for setting DRM panel orientation property +based on information from the display driver. + +Signed-off-by: Sebastian Reichel +--- + drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 ++ + drivers/gpu/drm/omapdrm/omap_connector.c | 10 +++++++++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h +index f8f83e826a56..72ebd82409d3 100644 +--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h ++++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h +@@ -565,6 +565,8 @@ struct omap_dss_driver { + struct videomode *vm); + void (*get_size)(struct omap_dss_device *dssdev, + unsigned int *width, unsigned int *height); ++ void (*get_orientation)(struct omap_dss_device *dssdev, ++ int *orientation); + + int (*set_wss)(struct omap_dss_device *dssdev, u32 wss); + u32 (*get_wss)(struct omap_dss_device *dssdev); +diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c +index a33b51484b2d..2f296d29b74b 100644 +--- a/drivers/gpu/drm/omapdrm/omap_connector.c ++++ b/drivers/gpu/drm/omapdrm/omap_connector.c +@@ -249,6 +249,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, + struct drm_connector *connector = NULL; + struct omap_connector *omap_connector; + bool hpd_supported = false; ++ int ret; + + DBG("%s", dssdev->name); + +@@ -267,7 +268,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, + drm_connector_helper_add(connector, &omap_connector_helper_funcs); + + if (dssdev->driver->register_hpd_cb) { +- int ret = dssdev->driver->register_hpd_cb(dssdev, ++ ret = dssdev->driver->register_hpd_cb(dssdev, + omap_connector_hpd_cb, + omap_connector); + if (!ret) +@@ -288,6 +289,13 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, + connector->interlace_allowed = 1; + connector->doublescan_allowed = 0; + ++ if (dssdev->driver->get_orientation) ++ dssdev->driver->get_orientation(dssdev, &connector->display_info.panel_orientation); ++ ++ ret = drm_connector_init_panel_orientation_property(connector, 0, 0); ++ if (ret) ++ DBG("%s: Failed to init orientation property (%d)", dssdev->name, ret); ++ + return connector; + + fail: +-- +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0006_drm-omap-panel-dsi-cm-add-orientation-support.patch b/extra/patches/linux-droid4-patches/0006_drm-omap-panel-dsi-cm-add-orientation-support.patch new file mode 100644 index 0000000..67ea57b --- /dev/null +++ b/extra/patches/linux-droid4-patches/0006_drm-omap-panel-dsi-cm-add-orientation-support.patch @@ -0,0 +1,55 @@ +Add support to inform the DRM subsystem about the orientation +the display has been mounted to the casing. + +Signed-off-by: Sebastian Reichel +--- + drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +index 15399a1a666b..7a63d6775a27 100644 +--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c ++++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +@@ -68,6 +68,7 @@ struct panel_drv_data { + + int width_mm; + int height_mm; ++ int orientation; + + struct omap_dsi_pin_config pin_config; + +@@ -1198,6 +1199,14 @@ static void dsicm_get_size(struct omap_dss_device *dssdev, + *height = ddata->height_mm; + } + ++static void dsicm_get_orientation(struct omap_dss_device *dssdev, ++ int *orientation) ++{ ++ struct panel_drv_data *ddata = to_panel_data(dssdev); ++ ++ *orientation = ddata->orientation; ++} ++ + static struct omap_dss_driver dsicm_ops = { + .connect = dsicm_connect, + .disconnect = dsicm_disconnect, +@@ -1211,6 +1220,7 @@ static struct omap_dss_driver dsicm_ops = { + .get_timings = dsicm_get_timings, + .check_timings = dsicm_check_timings, + .get_size = dsicm_get_size, ++ .get_orientation = dsicm_get_orientation, + + .enable_te = dsicm_enable_te, + .get_te = dsicm_get_te, +@@ -1259,6 +1269,9 @@ static int dsicm_probe_of(struct platform_device *pdev) + ddata->height_mm = 0; + of_property_read_u32(node, "height-mm", &ddata->height_mm); + ++ ddata->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; ++ of_property_read_u32(node, "orientation", &ddata->orientation); ++ + in = omapdss_of_find_source_for_first_ep(node); + if (IS_ERR(in)) { + dev_err(&pdev->dev, "failed to find video source\n"); +-- +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0007-drm-omap-add-support-for-physical-size-hints-from-di.patch b/extra/patches/linux-droid4-patches/0007-drm-omap-add-support-for-physical-size-hints-from-di.patch deleted file mode 100644 index 20f4a51..0000000 --- a/extra/patches/linux-droid4-patches/0007-drm-omap-add-support-for-physical-size-hints-from-di.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 1e66c0a2f776d6054c2324daf55fc3e3df126c33 Mon Sep 17 00:00:00 2001 -From: Sebastian Reichel -Date: Mon, 24 Jul 2017 19:33:04 +0200 -Subject: [PATCH 07/17] drm/omap: add support for physical size hints from - display drivers - -While physical size information is automatically parsed for EDID -based displays, we need to provide it manually for displays providing -one fixed mode. - -Signed-off-by: Sebastian Reichel -Acked-by: Pavel Machek ---- - drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 ++ - drivers/gpu/drm/omapdrm/omap_connector.c | 6 ++++++ - 2 files changed, 8 insertions(+) - -diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h -index 3d25359..5be6ff8 100644 ---- a/drivers/gpu/drm/omapdrm/dss/omapdss.h -+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h -@@ -562,6 +562,8 @@ struct omap_dss_driver { - struct videomode *vm); - void (*get_timings)(struct omap_dss_device *dssdev, - struct videomode *vm); -+ void (*get_size)(struct omap_dss_device *dssdev, -+ unsigned int *width, unsigned int *height); - - int (*set_wss)(struct omap_dss_device *dssdev, u32 wss); - u32 (*get_wss)(struct omap_dss_device *dssdev); -diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c -index 4f4c7ef..8874f55 100644 ---- a/drivers/gpu/drm/omapdrm/omap_connector.c -+++ b/drivers/gpu/drm/omapdrm/omap_connector.c -@@ -157,6 +157,12 @@ static int omap_connector_get_modes(struct drm_connector *connector) - drm_mode_set_name(mode); - drm_mode_probed_add(connector, mode); - -+ if (dssdrv->get_size) { -+ dssdrv->get_size(dssdev, -+ &connector->display_info.width_mm, -+ &connector->display_info.height_mm); -+ } -+ - n = 1; - } - --- -2.1.4 - diff --git a/extra/patches/linux-droid4-patches/0007_arm-dts-omap4-droid4-add-lcd-panel-orientation-property.patch b/extra/patches/linux-droid4-patches/0007_arm-dts-omap4-droid4-add-lcd-panel-orientation-property.patch new file mode 100644 index 0000000..c022006 --- /dev/null +++ b/extra/patches/linux-droid4-patches/0007_arm-dts-omap4-droid4-add-lcd-panel-orientation-property.patch @@ -0,0 +1,31 @@ +This adds a LCD panel orientation hint to the Droid 4. If the +display is rotated this way the keyboard can be used properly. + +Signed-off-by: Sebastian Reichel +--- + arch/arm/boot/dts/omap4-droid4-xt894.dts | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts +index b21084da490b..e11a24397163 100644 +--- a/arch/arm/boot/dts/omap4-droid4-xt894.dts ++++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts +@@ -6,6 +6,7 @@ + /dts-v1/; + + #include ++#include + #include "omap443x.dtsi" + #include "motorola-cpcap-mapphone.dtsi" + +@@ -181,6 +182,8 @@ + height-mm = <89>; + backlight = <&lcd_backlight>; + ++ orientation = ; ++ + panel-timing { + clock-frequency = <0>; /* Calculated by dsi */ + +-- +2.15.1 diff --git a/extra/patches/linux-droid4-patches/0008-drm-omap-panel-dsi-cm-fix-driver.patch b/extra/patches/linux-droid4-patches/0008-drm-omap-panel-dsi-cm-fix-driver.patch deleted file mode 100644 index 3db803e..0000000 --- a/extra/patches/linux-droid4-patches/0008-drm-omap-panel-dsi-cm-fix-driver.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 328a31aeb9e4cb56f312be7722010ede59ef96be Mon Sep 17 00:00:00 2001 -From: Tony Lindgren -Date: Mon, 24 Jul 2017 19:33:05 +0200 -Subject: [PATCH 08/17] drm/omap: panel-dsi-cm: fix driver - -This adds support for get_timings() and check_timings() -to get the driver working and properly initializes the -timing information from DT. - -Signed-off-by: Tony Lindgren -Signed-off-by: Sebastian Reichel ---- - drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 56 ++++++++++++++++++++++--- - 1 file changed, 51 insertions(+), 5 deletions(-) - -diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c -index 92c556a..905b717 100644 ---- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c -+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c -@@ -25,6 +25,7 @@ - #include - - #include