From patchwork Thu Feb 8 18:30:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 10207743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE4D860327 for ; Thu, 8 Feb 2018 18:32:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB4DD2950A for ; Thu, 8 Feb 2018 18:32:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C72C02950D; Thu, 8 Feb 2018 18:32:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F112229947 for ; Thu, 8 Feb 2018 18:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752448AbeBHSbJ (ORCPT ); Thu, 8 Feb 2018 13:31:09 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48692 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752439AbeBHSbH (ORCPT ); Thu, 8 Feb 2018 13:31:07 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id F1FDE272779 From: Sebastian Reichel To: Sebastian Reichel , Tomi Valkeinen , Tony Lindgren Cc: Laurent Pinchart , Hans de Goede , Rob Herring , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Sebastian Reichel Subject: [PATCHv2 8/8] drm/omap: plane: update fifo size on ovl setup Date: Thu, 8 Feb 2018 19:30:35 +0100 Message-Id: <20180208183035.8461-9-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180208183035.8461-1-sebastian.reichel@collabora.co.uk> References: <20180208183035.8461-1-sebastian.reichel@collabora.co.uk> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. This is not the case for the OMAP4 based Droid 4, which works perfectly fine with default settings. Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/dispc.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 4e8f68efd169..0904c3201914 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -157,6 +157,8 @@ struct dispc_features { bool has_gamma_table:1; bool has_gamma_i734_bug:1; + + bool has_fifo_stallmode_bug:1; }; #define DISPC_MAX_NR_FIFOS 5 @@ -1489,6 +1491,18 @@ void dispc_ovl_compute_fifo_thresholds(enum omap_plane_id plane, } } +static 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; @@ -2651,8 +2665,21 @@ static int dispc_ovl_setup(enum omap_plane_id plane, oi->out_width, oi->out_height, oi->fourcc, oi->rotation, oi->zorder, oi->pre_mult_alpha, oi->global_alpha, oi->rotation_type, replication, vm, mem_to_mem); + if (r) + return r; - return r; + /* + * OMAP3 chips have non-working FIFO thresholds for manually updated + * displays. The issue is not fully understood, but this workaround + * fixes the issue. OMAP4 is known to work with default thresholds. + */ + if (mgr_fld_read(channel, DISPC_MGR_FLD_STALLMODE) && + dispc.feat->has_fifo_stallmode_bug) { + DSSDBG("Enable OMAP3 FIFO stallmode bug workaround!\n"); + dispc_ovl_set_manual_fifo_threshold(plane); + } + + return 0; } int dispc_wb_setup(const struct omap_dss_writeback_info *wi, @@ -4067,6 +4094,7 @@ static const struct dispc_features omap24xx_dispc_feats = { .no_framedone_tv = true, .set_max_preload = false, .last_pixel_inc_missing = true, + .has_fifo_stallmode_bug = true, }; static const struct dispc_features omap34xx_rev1_0_dispc_feats = { @@ -4101,6 +4129,7 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats = { .no_framedone_tv = true, .set_max_preload = false, .last_pixel_inc_missing = true, + .has_fifo_stallmode_bug = true, }; static const struct dispc_features omap34xx_rev3_0_dispc_feats = { @@ -4135,6 +4164,7 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats = { .no_framedone_tv = true, .set_max_preload = false, .last_pixel_inc_missing = true, + .has_fifo_stallmode_bug = true, }; static const struct dispc_features omap36xx_dispc_feats = { @@ -4169,6 +4199,7 @@ static const struct dispc_features omap36xx_dispc_feats = { .no_framedone_tv = true, .set_max_preload = false, .last_pixel_inc_missing = true, + .has_fifo_stallmode_bug = true, }; static const struct dispc_features am43xx_dispc_feats = { @@ -4203,6 +4234,7 @@ static const struct dispc_features am43xx_dispc_feats = { .no_framedone_tv = true, .set_max_preload = false, .last_pixel_inc_missing = true, + .has_fifo_stallmode_bug = false, }; static const struct dispc_features omap44xx_dispc_feats = { @@ -4242,6 +4274,7 @@ static const struct dispc_features omap44xx_dispc_feats = { .reverse_ilace_field_order = true, .has_gamma_table = true, .has_gamma_i734_bug = true, + .has_fifo_stallmode_bug = false, }; static const struct dispc_features omap54xx_dispc_feats = { @@ -4282,6 +4315,7 @@ static const struct dispc_features omap54xx_dispc_feats = { .reverse_ilace_field_order = true, .has_gamma_table = true, .has_gamma_i734_bug = true, + .has_fifo_stallmode_bug = false, }; static irqreturn_t dispc_irq_handler(int irq, void *arg)