From patchwork Mon Jul 9 17:31:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10515367 X-Patchwork-Delegate: agross@codeaurora.org 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 09EF1600CA for ; Mon, 9 Jul 2018 17:34:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5C2B28DCC for ; Mon, 9 Jul 2018 17:34:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8E6C28DD3; Mon, 9 Jul 2018 17:34:41 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 7E67D28DCC for ; Mon, 9 Jul 2018 17:34:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933757AbeGIRek (ORCPT ); Mon, 9 Jul 2018 13:34:40 -0400 Received: from mail-yb0-f194.google.com ([209.85.213.194]:41443 "EHLO mail-yb0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933537AbeGIRek (ORCPT ); Mon, 9 Jul 2018 13:34:40 -0400 Received: by mail-yb0-f194.google.com with SMTP id s8-v6so7500968ybe.8 for ; Mon, 09 Jul 2018 10:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Oq+KaLjTDMfKp8TFvOARlREZHoPWI07kflIcc+/KcU0=; b=YwR/XTmZ2QD+r1WKe9oLzXXUWaLTlUIK4H7OFhqQqr+kRw338hi5n8dME7jMBuA5Ln DJMe5SEbY2Ut+7rCpDP0ZKYl6BlHgrWCy6BeX9/VuKvXdSbnbJ26fSyRs6ZkicqYj7GS aHx5e1R1x7F+3UhSN6StfmZTAi2CN7JGvxPLg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Oq+KaLjTDMfKp8TFvOARlREZHoPWI07kflIcc+/KcU0=; b=bZzeO1uak1dAKM7EGfC4I14CCj7MRFYzH/yZtBExWBnGZnFd6j9LUeTFYeIHrFrc0M sZlTVnpiSeUlx1Ux/QYqQU+3QrPGTwgvL7Xlv36PZTTktN/0MsQAcyQNTBxzmZ1q8HSh IP2+oW3RY6CzSCahxPuHUdY7nn8S38xVUOqABBvPS/5SRsuRxRqaqMLRHT4NVgw0u7/N ouYzgkcRhygVGe9EZUwaBnNDJMYQ/heZVq1rRHQma1aThFPyrhbQCkfQakzYv0+12fv5 j3GnBoKkKL97TX1CKa4/JKYCX1Kgpu92myn8cXG0K1KpeN190QGuPQIFCVfW/uGQ+/j8 4Amg== X-Gm-Message-State: APt69E2JaXCAGyIkz60sc9BcMOU6MpTpwqPf+WPdQDtudMVaN9ey3A8M dumkTobUSyMvKqSjSoB5CuTH8w== X-Google-Smtp-Source: AAOMgpdeFziMcLAG7ajKj5ElmcGMMgo9lkAxFgMMeTFn+v81/R7kxX6O8PJE4en/Yvr/lijxU34UUA== X-Received: by 2002:a25:7e06:: with SMTP id z6-v6mr6759876ybc.504.1531157679795; Mon, 09 Jul 2018 10:34:39 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id s206-v6sm5885495ywc.55.2018.07.09.10.34.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 10:34:39 -0700 (PDT) From: Sean Paul To: abhinavk@codeaurora.org, architt@codeaurora.org, chandanu@codeaurora.org, jsanka@codeaurora.org, jcrouse@codeaurora.org, ryadav@codeaurora.org, seanpaul@chromium.org, skolluku@codeaurora.org, dri-devel@lists.freedesktop.org, robdclark@gmail.com, airlied@linux.ie, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, nganji@codeaurora.org, hoegsberg@chromium.org, dovizu@chromium.org, robh+dt@kernel.org Cc: Stefan Agner , Daniel Mack Subject: [PATCH 11/21] drm/msm: higher values of pclk can exceed 32 bits when multiplied by a factor Date: Mon, 9 Jul 2018 13:31:47 -0400 Message-Id: <20180709173200.238457-12-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog In-Reply-To: <20180709173200.238457-1-seanpaul@chromium.org> References: <20180709173200.238457-1-seanpaul@chromium.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Abhinav Kumar Make the pclk_rate u64 to accommodate higher pixel clock rates. Changes in v4: - fixed commit message Signed-off-by: Abhinav Kumar Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi_host.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 671039b7b75b..73587e731a23 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -669,7 +669,8 @@ static int dsi_calc_clk_rate(struct msm_dsi_host *msm_host, bool is_dual_dsi) const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd; u8 lanes = msm_host->lanes; u32 bpp = dsi_get_bpp(msm_host->format); - u32 pclk_rate; + u64 pclk_rate; + u64 pclk_bpp; if (!mode) { pr_err("%s: mode not set\n", __func__); @@ -689,13 +690,15 @@ static int dsi_calc_clk_rate(struct msm_dsi_host *msm_host, bool is_dual_dsi) if (is_dual_dsi) pclk_rate /= 2; + pclk_bpp = pclk_rate * bpp; if (lanes > 0) { - msm_host->byte_clk_rate = (pclk_rate * bpp) / (8 * lanes); + do_div(pclk_bpp, (8 * lanes)); } else { pr_err("%s: forcing mdss_dsi lanes to 1\n", __func__); - msm_host->byte_clk_rate = (pclk_rate * bpp) / 8; + do_div(pclk_bpp, 8); } msm_host->pixel_clk_rate = pclk_rate; + msm_host->byte_clk_rate = pclk_bpp; DBG("pclk=%d, bclk=%d", msm_host->pixel_clk_rate, msm_host->byte_clk_rate);