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: 10515369 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 240A76032A for ; Mon, 9 Jul 2018 17:34:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C7B328DCC for ; Mon, 9 Jul 2018 17:34:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F36F428DD3; Mon, 9 Jul 2018 17:34:42 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B085B28DCC for ; Mon, 9 Jul 2018 17:34:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA1278826D; Mon, 9 Jul 2018 17:34:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb0-x244.google.com (mail-yb0-x244.google.com [IPv6:2607:f8b0:4002:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 890106E59E for ; Mon, 9 Jul 2018 17:34:40 +0000 (UTC) Received: by mail-yb0-x244.google.com with SMTP id x15-v6so7505977ybm.2 for ; Mon, 09 Jul 2018 10:34:40 -0700 (PDT) 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=Q0ngWdLfr3un0UQ1jXZVgGveNCNwuTeJC7cfPyg8rqQ5Yt+uIccHOlqNHhL20ULKTw vD2adyD8O3D+JYjgjVYIungQ8p5Ge6IkGzcuJMgFCD2zcYRhAyuSHsNkPgAfVyn2Yhlz UxTH6xgMWeOiBztPk3c3VNmJl5nOX8Vt59kKtrxIvK1ZvRucfaGhjsfrUVMMDM7aWaoy zBXzRpWx+fKxt9W95ucwn1fQTBhAEtLXrw1FGkxIbupl93q0b1E+74JWYcwLuYJOhyoS Wz6udKrLJHStPTn4DVI3eErhJUEkI7ks+rFjeVui4nP64VwdwVqiek/8svMiyy4yaItU hNBA== X-Gm-Message-State: APt69E06r4CIAzCIIzK0leklNxlzNryW8WdJodSlclZsSTUGzM5Il/C6 FSMvRGvHQYWqJ7PXbZfRr4CUoQ== 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 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> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Mack MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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);