From patchwork Wed Sep 5 09:16:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10588587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18E8D13BB for ; Wed, 5 Sep 2018 09:21:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1883E29BDD for ; Wed, 5 Sep 2018 09:21:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 165B429C18; Wed, 5 Sep 2018 09:21:10 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7783E29BF5 for ; Wed, 5 Sep 2018 09:21:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=rapTHs7rfP6IVZAnwzJTiBjF2o/hky97wZ+m2BccbWA=; b=oMn9a9QBKJTJhuU7NfHhgp8Cze M9VmxBUjIsksNeX8STL5JOu6de00oI6PPOzvjTqpVlVn0BErUFABeAxpLNT5NiVa86f+aNtGWafH2 UCqOxKGE6NoPVoeec97cno4fOkIU1CweGDOaPNRKi+Xpxoy68nMGY063qOjxcF/rpdbOH1fwNBFoH hnj9tEH7KQ6ZUlOr1h+UMFux81tSaxGzUQAp9R/g7cBUuhtHZZpT+4kLXwSgDEDNA/EDNQr4LbvqP yv07acvmjy22vf+ofexCTh5NaLoUcRt1AA/IuLzE+gfiuxSQBW/RRNntCI1ONpCf9u0QnYs5dTInH BuH+qwYA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxTzg-0001JO-Io; Wed, 05 Sep 2018 09:21:00 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxTw5-0006wH-8b for linux-arm-kernel@lists.infradead.org; Wed, 05 Sep 2018 09:17:19 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 485A120789; Wed, 5 Sep 2018 11:16:56 +0200 (CEST) Received: from localhost (AAubervilliers-681-1-92-107.w90-88.abo.wanadoo.fr [90.88.33.107]) by mail.bootlin.com (Postfix) with ESMTPSA id 1759D20795; Wed, 5 Sep 2018 11:16:46 +0200 (CEST) From: Maxime Ripard To: Kishon Vijay Abraham I , Boris Brezillon Subject: [PATCH 07/10] drm/bridge: cdns: Remove mode_check test Date: Wed, 5 Sep 2018 11:16:38 +0200 Message-Id: <62fe67f20c91471d370913910fcd66f6054aec21.1536138624.git-series.maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180905_021717_675830_9879FD39 X-CRM114-Status: GOOD ( 14.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Archit Taneja , Rafal Ciepiela , Krzysztof Witos , Maxime Ripard , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Andrzej Hajda , Chen-Yu Tsai , Laurent Pinchart , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The crtc_* variants of the timings are initialised at the same value than their !crtc counterparts, and can later on be tweaked. This means that we can always use the crtc variants, instead of trying to figure out which of these two we should use. Move to always use the crtc_* variants, and remove the extra parameter to the mode2cfg function that allows to tell which variant we should use. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/bridge/cdns-dsi.c | 51 ++++++++------------------------ 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/bridge/cdns-dsi.c b/drivers/gpu/drm/bridge/cdns-dsi.c index ce9496d13986..6474e6d999b7 100644 --- a/drivers/gpu/drm/bridge/cdns-dsi.c +++ b/drivers/gpu/drm/bridge/cdns-dsi.c @@ -731,8 +731,7 @@ static unsigned int dpi_to_dsi_timing(unsigned int dpi_timing, static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, const struct drm_display_mode *mode, struct cdns_dsi_cfg *dsi_cfg, - struct cdns_dphy_cfg *dphy_cfg, - bool mode_valid_check) + struct cdns_dphy_cfg *dphy_cfg) { unsigned long dsi_htotal = 0, dsi_hss_hsa_hse_hbp = 0; struct cdns_dsi_output *output = &dsi->output; @@ -748,23 +747,15 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format); nlanes = output->dev->lanes; - if (mode_valid_check) - tmp = mode->htotal - - (sync_pulse ? mode->hsync_end : mode->hsync_start); - else - tmp = mode->crtc_htotal - - (sync_pulse ? - mode->crtc_hsync_end : mode->crtc_hsync_start); + tmp = mode->crtc_htotal - + (sync_pulse ? mode->crtc_hsync_end : mode->crtc_hsync_start); dsi_cfg->hbp = dpi_to_dsi_timing(tmp, bpp, DSI_HBP_FRAME_OVERHEAD); dsi_htotal += dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD; dsi_hss_hsa_hse_hbp += dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD; if (sync_pulse) { - if (mode_valid_check) - tmp = mode->hsync_end - mode->hsync_start; - else - tmp = mode->crtc_hsync_end - mode->crtc_hsync_start; + tmp = mode->crtc_hsync_end - mode->crtc_hsync_start; dsi_cfg->hsa = dpi_to_dsi_timing(tmp, bpp, DSI_HSA_FRAME_OVERHEAD); @@ -772,32 +763,19 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, dsi_hss_hsa_hse_hbp += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD; } - dsi_cfg->hact = dpi_to_dsi_timing(mode_valid_check ? - mode->hdisplay : mode->crtc_hdisplay, + dsi_cfg->hact = dpi_to_dsi_timing(mode->crtc_hdisplay, bpp, 0); dsi_htotal += dsi_cfg->hact; - if (mode_valid_check) - dpi_hfp = mode->hsync_start - mode->hdisplay; - else - dpi_hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; - + dpi_hfp = mode->crtc_hsync_start - mode->crtc_hdisplay; dsi_cfg->hfp = dpi_to_dsi_timing(dpi_hfp, bpp, DSI_HFP_FRAME_OVERHEAD); dsi_htotal += dsi_cfg->hfp + DSI_HFP_FRAME_OVERHEAD; - if (mode_valid_check) - ret = cdns_dsi_get_dphy_pll_cfg(dsi->dphy, dphy_cfg, - mode->htotal, bpp, - mode->clock * 1000, - dsi_htotal, nlanes, - &dsi_hfp_ext); - else - ret = cdns_dsi_get_dphy_pll_cfg(dsi->dphy, dphy_cfg, - mode->crtc_htotal, bpp, - mode->crtc_clock * 1000, - dsi_htotal, nlanes, - &dsi_hfp_ext); - + ret = cdns_dsi_get_dphy_pll_cfg(dsi->dphy, dphy_cfg, + mode->crtc_htotal, bpp, + mode->crtc_clock * 1000, + dsi_htotal, nlanes, + &dsi_hfp_ext); if (ret) return ret; @@ -811,8 +789,7 @@ static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi, * interface. */ if ((u64)dphy_cfg->lane_bps * dpi_hfp * nlanes < - (u64)dsi_hss_hsa_hse_hbp * - (mode_valid_check ? mode->clock : mode->crtc_clock) * 1000) + (u64)dsi_hss_hsa_hse_hbp * mode->crtc_clock * 1000) return -EINVAL; return 0; @@ -862,7 +839,7 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, nlanes = output->dev->lanes; - ret = cdns_dsi_mode2cfg(dsi, mode, &dsi_cfg, &dphy_cfg, true); + ret = cdns_dsi_mode2cfg(dsi, mode, &dsi_cfg, &dphy_cfg); if (ret) return MODE_CLOCK_RANGE; @@ -990,7 +967,7 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format); nlanes = output->dev->lanes; - WARN_ON_ONCE(cdns_dsi_mode2cfg(dsi, mode, &dsi_cfg, &dphy_cfg, false)); + WARN_ON_ONCE(cdns_dsi_mode2cfg(dsi, mode, &dsi_cfg, &dphy_cfg)); cdns_dsi_hs_init(dsi, &dphy_cfg); cdns_dsi_init_link(dsi);