From patchwork Fri Apr 13 20:33:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Green X-Patchwork-Id: 10340749 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 C713A60153 for ; Fri, 13 Apr 2018 20:34:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99B48289FB for ; Fri, 13 Apr 2018 20:34:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E05228A03; Fri, 13 Apr 2018 20:34:01 +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 7D2EB289FB for ; Fri, 13 Apr 2018 20:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751421AbeDMUd7 (ORCPT ); Fri, 13 Apr 2018 16:33:59 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36562 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751036AbeDMUd5 (ORCPT ); Fri, 13 Apr 2018 16:33:57 -0400 Received: by mail-pl0-f65.google.com with SMTP id 91-v6so6692450pld.3 for ; Fri, 13 Apr 2018 13:33:57 -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; bh=9pwxlG9eVhiY+wSJTMv7HPXXnuu3VME2A32eA7qgA3I=; b=G5WIXGPnOLWh7Zoc6g6He5moN2gqrP3u4vMmHu/ln4swmSWL2QLkEMGFAze0cJEXxt sHrEIZvXhHmQ4HLdou0UpoS44bKvYmOugDDkGlZxDlh7kWQ3WgajTJRAeezSgOWbzago kzcEfmCwdp9a+vNJzc2NVKnZ3e8dp7xtPa4/E= 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; bh=9pwxlG9eVhiY+wSJTMv7HPXXnuu3VME2A32eA7qgA3I=; b=cjSKbQLdOH8eTWAAJhXrRGUSjQdc0gtFt5s8jagUGW9XenZuB70ip95GrarqEEiLRe ejPuE67RWH4tIU8E5Wd6VSubLPgHpCN1OCoJGW09MkxpLotwV61FM8Hj412/hHf0Mqwd iDn39vUTsPYPdo8j6k+IBwSTTMEAJi0Zf3AZC8rQwHEqeJpPu7HA/Qg7IY/b1mphv7EL RBVIzRsrnjrvJpOxZ2woz5AdyJokj0U/IkfSIRS5gec3JyvdfH1Rk2uAaG47rbSrfV0/ xTbEPLcv/1pWYtveq9VoFm62g7/s8CjJohpWuBHU03aOZqcwVAkdT2fcr5t0dCBetkRO Q0dQ== X-Gm-Message-State: ALQs6tCqrF00JCOQJ7hvLp36KT2Gse/OJ7PvBfs2lW8UCbUTzOyfHRLk J5gx2+2iivTkze5AaUBV1J2/MA== X-Google-Smtp-Source: AIpwx48aRVasjkeKG/OO24YUo4mFssj7xFPl80CzhjLZn/qNzDptBNyoVrCT8+HIzwIA/rqEXx4AJw== X-Received: by 2002:a17:902:8543:: with SMTP id d3-v6mr6498457plo.20.1523651637396; Fri, 13 Apr 2018 13:33:57 -0700 (PDT) Received: from evgreen2.mtv.corp.google.com ([2620:0:1000:1511:116f:8bf3:133b:f7fd]) by smtp.gmail.com with ESMTPSA id i186sm13194195pfg.53.2018.04.13.13.33.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Apr 2018 13:33:56 -0700 (PDT) From: Evan Green To: Andy Gross , David Brown , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Evan Green Subject: [PATCH] clk: qcom: Base rcg parent rate off plan frequency Date: Fri, 13 Apr 2018 13:33:36 -0700 Message-Id: <20180413203336.134364-1-evgreen@chromium.org> X-Mailer: git-send-email 2.13.5 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 _freq_tbl_determine_rate uses the pre_div found in the clock plan multiplied by the requested rate from the caller to determine the best parent rate to set. If the requested rate is not exactly equal to the rate that was found in the clock plan, then using the requested rate in parent rate calculations is incorrect. For instance, if 150MHz was requested, but 200MHz was the match found, and that plan had a pre_div of 3, then the parent should be set to 600MHz, not 450MHz. Signed-off-by: Evan Green --- drivers/clk/qcom/clk-rcg2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index bbeaf9c09dbb..ec6cee8ff1bc 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -211,6 +211,7 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, clk_flags = clk_hw_get_flags(hw); p = clk_hw_get_parent_by_index(hw, index); if (clk_flags & CLK_SET_RATE_PARENT) { + rate = f->freq; if (f->pre_div) { rate /= 2; rate *= f->pre_div + 1;