0001-PATCHv2-8-8-drm-omap-plane-update-fifo-size-on-ovl-setup.patch (5029B)
1 From patchwork Thu Feb 8 18:30:35 2018 2 Content-Type: text/plain; charset="utf-8" 3 MIME-Version: 1.0 4 Content-Transfer-Encoding: 7bit 5 Subject: [PATCHv2,8/8] drm/omap: plane: update fifo size on ovl setup 6 From: Sebastian Reichel <sebastian.reichel@collabora.co.uk> 7 X-Patchwork-Id: 10207743 8 Message-Id: <20180208183035.8461-9-sebastian.reichel@collabora.co.uk> 9 To: Sebastian Reichel <sre@kernel.org>, 10 Tomi Valkeinen <tomi.valkeinen@ti.com>, Tony Lindgren <tony@atomide.com> 11 Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>, 12 Hans de Goede <hdegoede@redhat.com>, Rob Herring <robh+dt@kernel.org>, 13 Mark Rutland <mark.rutland@arm.com>, 14 dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, 15 linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, 16 kernel@collabora.com, Sebastian Reichel <sebastian.reichel@collabora.co.uk> 17 Date: Thu, 8 Feb 2018 19:30:35 +0100 18 19 This is a workaround for a hardware bug occuring on OMAP3 20 with manually updated panels. Details about the HW bug are 21 unknown to me, but without this fix the panel refresh does 22 not work at all on Nokia N950. This is not the case for the 23 OMAP4 based Droid 4, which works perfectly fine with default 24 settings. 25 26 Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> 27 --- 28 drivers/gpu/drm/omapdrm/dss/dispc.c | 36 +++++++++++++++++++++++++++++++++++- 29 1 file changed, 35 insertions(+), 1 deletion(-) 30 31 diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c 32 index 4e8f68efd169..0904c3201914 100644 33 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c 34 +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c 35 @@ -157,6 +157,8 @@ struct dispc_features { 36 bool has_gamma_table:1; 37 38 bool has_gamma_i734_bug:1; 39 + 40 + bool has_fifo_stallmode_bug:1; 41 }; 42 43 #define DISPC_MAX_NR_FIFOS 5 44 @@ -1489,6 +1491,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane, 45 } 46 } 47 48 +static void dispc_ovl_set_manual_fifo_threshold(enum omap_plane_id plane) 49 +{ 50 + u32 fifo_low, fifo_high; 51 + bool use_fifo_merge = false; 52 + bool use_manual_update = true; 53 + 54 + dispc_ovl_compute_fifo_thresholds(plane, &fifo_low, &fifo_high, 55 + use_fifo_merge, use_manual_update); 56 + 57 + dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high); 58 +} 59 + 60 static void dispc_ovl_set_mflag(enum omap_plane_id plane, bool enable) 61 { 62 int bit; 63 @@ -2651,8 +2665,21 @@ static int dispc_ovl_setup(enum omap_plane_id plane, 64 oi->out_width, oi->out_height, oi->fourcc, oi->rotation, 65 oi->zorder, oi->pre_mult_alpha, oi->global_alpha, 66 oi->rotation_type, replication, vm, mem_to_mem); 67 + if (r) 68 + return r; 69 70 - return r; 71 + /* 72 + * OMAP3 chips have non-working FIFO thresholds for manually updated 73 + * displays. The issue is not fully understood, but this workaround 74 + * fixes the issue. OMAP4 is known to work with default thresholds. 75 + */ 76 + if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE) && 77 + dispc.feat->has_fifo_stallmode_bug) { 78 + DSSDBG("Enable OMAP3 FIFO stallmode bug workaround!\n"); 79 + dispc_ovl_set_manual_fifo_threshold(plane); 80 + } 81 + 82 + return 0; 83 } 84 85 int dispc_wb_setup(const struct omap_dss_writeback_info *wi, 86 @@ -4067,6 +4094,7 @@ static const struct dispc_features omap24xx_dispc_feats = { 87 .no_framedone_tv = true, 88 .set_max_preload = false, 89 .last_pixel_inc_missing = true, 90 + .has_fifo_stallmode_bug = true, 91 }; 92 93 static const struct dispc_features omap34xx_rev1_0_dispc_feats = { 94 @@ -4101,6 +4129,7 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats = { 95 .no_framedone_tv = true, 96 .set_max_preload = false, 97 .last_pixel_inc_missing = true, 98 + .has_fifo_stallmode_bug = true, 99 }; 100 101 static const struct dispc_features omap34xx_rev3_0_dispc_feats = { 102 @@ -4135,6 +4164,7 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats = { 103 .no_framedone_tv = true, 104 .set_max_preload = false, 105 .last_pixel_inc_missing = true, 106 + .has_fifo_stallmode_bug = true, 107 }; 108 109 static const struct dispc_features omap36xx_dispc_feats = { 110 @@ -4169,6 +4199,7 @@ static const struct dispc_features omap36xx_dispc_feats = { 111 .no_framedone_tv = true, 112 .set_max_preload = false, 113 .last_pixel_inc_missing = true, 114 + .has_fifo_stallmode_bug = true, 115 }; 116 117 static const struct dispc_features am43xx_dispc_feats = { 118 @@ -4203,6 +4234,7 @@ static const struct dispc_features am43xx_dispc_feats = { 119 .no_framedone_tv = true, 120 .set_max_preload = false, 121 .last_pixel_inc_missing = true, 122 + .has_fifo_stallmode_bug = false, 123 }; 124 125 static const struct dispc_features omap44xx_dispc_feats = { 126 @@ -4242,6 +4274,7 @@ static const struct dispc_features omap44xx_dispc_feats = { 127 .reverse_ilace_field_order = true, 128 .has_gamma_table = true, 129 .has_gamma_i734_bug = true, 130 + .has_fifo_stallmode_bug = false, 131 }; 132 133 static const struct dispc_features omap54xx_dispc_feats = { 134 @@ -4282,6 +4315,7 @@ static const struct dispc_features omap54xx_dispc_feats = { 135 .reverse_ilace_field_order = true, 136 .has_gamma_table = true, 137 .has_gamma_i734_bug = true, 138 + .has_fifo_stallmode_bug = false, 139 }; 140 141 static irqreturn_t dispc_irq_handler(int irq, void *arg)