[RX51] workaround lines issue (#309)

This works around the lines issue using a patch from Ti: https://lkml.org/lkml/2017/6/30/163
This commit is contained in:
clayton craft 2017-07-31 12:25:45 -07:00 committed by Martijn Braam
parent 0f00759fde
commit d6bf0009e7
2 changed files with 120 additions and 2 deletions

View File

@ -0,0 +1,116 @@
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -36,12 +36,15 @@ struct omap_crtc {
struct videomode vm;
- bool ignore_digit_sync_lost;
+ bool ignore_sync_lost;
bool enabled;
bool pending;
wait_queue_head_t pending_wait;
struct drm_pending_vblank_event *event;
+
+ struct work_struct error_work;
+ u32 error_channels;
};
/* -----------------------------------------------------------------------------
@@ -157,7 +160,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
* Digit output produces some sync lost interrupts during the
* first frame when enabling, so we need to ignore those.
*/
- omap_crtc->ignore_digit_sync_lost = true;
+ omap_crtc->ignore_sync_lost = true;
}
framedone_irq = priv->dispc_ops->mgr_get_framedone_irq(channel);
@@ -191,7 +194,7 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
}
if (omap_crtc->channel == OMAP_DSS_CHANNEL_DIGIT) {
- omap_crtc->ignore_digit_sync_lost = false;
+ omap_crtc->ignore_sync_lost = false;
/* make sure the irq handler sees the value above */
mb();
}
@@ -263,17 +266,65 @@ static const struct dss_mgr_ops mgr_ops = {
* Setup, Flush and Page Flip
*/
+static void omap_crtc_error_worker(struct work_struct *work)
+{
+ struct omap_crtc *omap_crtc = container_of(work, struct omap_crtc, error_work);
+ struct drm_crtc *crtc = &omap_crtc->base;
+ struct drm_device *dev = omap_crtc->base.dev;
+ struct omap_drm_private *priv = dev->dev_private;
+
+ drm_modeset_lock(&crtc->mutex, NULL);
+
+ dev_warn(dev->dev, "sync lost on %s, enabling & disabling...\n",
+ omap_crtc->name);
+
+ priv->dispc_ops->mgr_enable(omap_crtc->channel, false);
+
+ msleep(50);
+ dev_warn(dev->dev, "sync lost enabling %s\n",
+ omap_crtc->name);
+
+ priv->dispc_ops->mgr_enable(omap_crtc->channel, true);
+
+ msleep(50);
+
+ dev_warn(dev->dev, "sync lost recovery done on on %s\n",
+ omap_crtc->name);
+
+ omap_crtc->ignore_sync_lost = false;
+ /* make sure the irq handler sees the value above */
+ mb();
+
+ drm_modeset_unlock(&crtc->mutex);
+}
+
void omap_crtc_error_irq(struct drm_crtc *crtc, uint32_t irqstatus)
{
struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+ struct drm_device *dev = omap_crtc->base.dev;
+ struct omap_drm_private *priv = dev->dev_private;
+ enum omap_channel channel = omap_crtc_channel(crtc);
+ u32 sync_lost_irq;
+ bool sync_lost;
+
+ sync_lost_irq = priv->dispc_ops->mgr_get_sync_lost_irq(channel);
- if (omap_crtc->ignore_digit_sync_lost) {
- irqstatus &= ~DISPC_IRQ_SYNC_LOST_DIGIT;
- if (!irqstatus)
- return;
+ sync_lost = irqstatus & sync_lost_irq;
+
+ if (sync_lost) {
+ if (omap_crtc->ignore_sync_lost) {
+ irqstatus &= ~sync_lost_irq;
+ } else {
+ /* error worker will set this to false */
+ omap_crtc->ignore_sync_lost = true;
+ schedule_work(&omap_crtc->error_work);
+ }
}
- DRM_ERROR_RATELIMITED("%s: errors: %08x\n", omap_crtc->name, irqstatus);
+ if (!irqstatus)
+ return;
+
+ printk("%s: errors: %08x\n", omap_crtc->name, irqstatus);
}
void omap_crtc_vblank_irq(struct drm_crtc *crtc)
@@ -612,6 +663,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
init_waitqueue_head(&omap_crtc->pending_wait);
+ INIT_WORK(&omap_crtc->error_work, omap_crtc_error_worker);
+
omap_crtc->channel = channel;
omap_crtc->name = channel_names[channel];

View File

@ -15,7 +15,7 @@ pkgname=linux-${_flavor}
pkgver=4.12.4
_kernver=${pkgver}
pkgrel=2
pkgrel=3
arch="all"
pkgdesc="Mainline Linux for pmOS supported chipsets (OMAP)"
@ -28,6 +28,7 @@ source="
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
config-${_flavor}.armhf
config-${_flavor}.x86_64
0001-rx51-drm-regression-workaround.patch
"
subpackages="$pkgname-dev::$CBUILD_ARCH"
license="GPL2"
@ -172,4 +173,5 @@ dev() {
sha512sums="beb3c7644f12925301aedcc0cfc347cd086ce0486d3a4fe5a59fd4e00452c5495cec1eb7a294b83bd0d4a55238077d0b3766824b70e92e9b211b3f3146b6cc68 linux-4.12.4.tar.xz
3f4435ce0cf227e4ba64aa7153c913370c53069e34a376e453786d601b5a73706a3f44b002fab1b10a72dc94e896c1d8fb462c2b78e62ed69c468d98aa7220da config-postmarketos.armhf
c2bdaf8885dab4c3d3f96d856179138fed2d33cadcb9b33997238c8395a13eb8cb2b35f5f887339c5b47b34c8aa1bcd121059987601c1908103b66c23da478f0 config-postmarketos.x86_64"
c2bdaf8885dab4c3d3f96d856179138fed2d33cadcb9b33997238c8395a13eb8cb2b35f5f887339c5b47b34c8aa1bcd121059987601c1908103b66c23da478f0 config-postmarketos.x86_64
17c48bb7b4218297bd2be6faa5b6570ce1560a33385237a9962c0884d782c9a722a25a30077b6721d2943a9b98c29dcad6adfef718b0163c559c19a79519319b 0001-rx51-drm-regression-workaround.patch"