From patchwork Fri Apr 3 14:00:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 46769 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34D46216D1 for ; Fri, 3 Apr 2015 14:00:29 +0000 (UTC) Received: by wgua4 with SMTP id a4sf23042234wgu.2 for ; Fri, 03 Apr 2015 07:00:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=dyf2lul0jHJALnw8GJgFjYiaq6QmCTl8eQdUmF1LxS0=; b=auYrr7KDYMFyzwF1H+bguJjYbmYCp788sVUhJa3/6qoQpFZ85zzAj6ksxONiX0Q9jW t5vYf+VIj7MFU0UNYHPcaVFNYpnTkOTaqvHaXyYj13wtOKw8JQCjhec3+q/MN5lnbG79 cEGOeWN4F+Ln2XkzKM4CkIAi3tO571nLSpKONdVq35PQ2YCOcp939FjESQb5Onu1WSCw 24mJFnXenPEAAE2+O1PSmOUb/5OgyXaORfB6a3sxaKzk7KjqzttyWe7kGsGwRtw3PKXP qIWkx1bR0JwCz9m2Ca3+K/+eHJI1kEwKmXPThdGML5dRtB68KSa/1z1UR3/br/eYqmQj JpIw== X-Gm-Message-State: ALoCoQnOBP6OaKmYcCi+jAZsiGBo5ABuANRV7LRjliqcubnRqSSTnTpeQWBH5pnwPIKAWEFQGxKk X-Received: by 10.112.137.202 with SMTP id qk10mr610365lbb.21.1428069628466; Fri, 03 Apr 2015 07:00:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.199 with SMTP id x7ls342118lae.0.gmail; Fri, 03 Apr 2015 07:00:28 -0700 (PDT) X-Received: by 10.112.157.100 with SMTP id wl4mr2316382lbb.108.1428069628234; Fri, 03 Apr 2015 07:00:28 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id un5si1925921lbc.53.2015.04.03.07.00.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 07:00:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by lajy8 with SMTP id y8so80222818laj.0 for ; Fri, 03 Apr 2015 07:00:27 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr2381747lac.56.1428069627825; Fri, 03 Apr 2015 07:00:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1965409lbq; Fri, 3 Apr 2015 07:00:26 -0700 (PDT) X-Received: by 10.66.141.109 with SMTP id rn13mr4446056pab.113.1428069625968; Fri, 03 Apr 2015 07:00:25 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pc10si12128530pac.187.2015.04.03.07.00.24; Fri, 03 Apr 2015 07:00:25 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbbDCOAX (ORCPT + 5 others); Fri, 3 Apr 2015 10:00:23 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:36126 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036AbbDCOAW (ORCPT ); Fri, 3 Apr 2015 10:00:22 -0400 Received: by wgra20 with SMTP id a20so111696423wgr.3 for ; Fri, 03 Apr 2015 07:00:21 -0700 (PDT) X-Received: by 10.181.12.14 with SMTP id em14mr20086159wid.55.1428069621535; Fri, 03 Apr 2015 07:00:21 -0700 (PDT) Received: from mms.wifi.mm-sol.com ([37.157.136.206]) by mx.google.com with ESMTPSA id k1sm11655013wjn.9.2015.04.03.07.00.20 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 03 Apr 2015 07:00:20 -0700 (PDT) From: Georgi Djakov To: sboyd@codeaurora.org Cc: mturquette@linaro.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH] clk: qcom: Fix parent_map translations Date: Fri, 3 Apr 2015 17:00:03 +0300 Message-Id: <1428069603-2641-1-git-send-email-georgi.djakov@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: georgi.djakov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When we introduced the parent_map tables, we missed to update some of the functions where mapping is translated. Fix this. Signed-off-by: Georgi Djakov Tested-by: Nicolas Dechesne --- drivers/clk/qcom/clk-rcg.c | 13 ++++++++++--- drivers/clk/qcom/clk-rcg2.c | 20 +++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/clk/qcom/clk-rcg.c b/drivers/clk/qcom/clk-rcg.c index 8f2f48071a7a..e30821a3ba68 100644 --- a/drivers/clk/qcom/clk-rcg.c +++ b/drivers/clk/qcom/clk-rcg.c @@ -319,7 +319,7 @@ static int clk_dyn_rcg_set_parent(struct clk_hw *hw, u8 index) if (banked_p) f.pre_div = ns_to_pre_div(&rcg->p[bank], ns) + 1; - f.src = index; + f.src = qcom_find_src_index(hw, rcg->s[bank].parent_map, index); return configure_bank(rcg, &f); } @@ -411,13 +411,19 @@ static long _freq_tbl_determine_rate(struct clk_hw *hw, { unsigned long clk_flags; struct clk *p; + struct clk_rcg *rcg = to_clk_rcg(hw); + int index; f = qcom_find_freq(f, rate); if (!f) return -EINVAL; + index = qcom_find_src_index(hw, rcg->s.parent_map, f->src); + if (index < 0) + return index; + clk_flags = __clk_get_flags(hw->clk); - p = clk_get_parent_by_index(hw->clk, f->src); + p = clk_get_parent_by_index(hw->clk, index); if (clk_flags & CLK_SET_RATE_PARENT) { rate = rate * f->pre_div; if (f->n) { @@ -462,8 +468,9 @@ static long clk_rcg_bypass_determine_rate(struct clk_hw *hw, unsigned long rate, struct clk_rcg *rcg = to_clk_rcg(hw); const struct freq_tbl *f = rcg->freq_tbl; struct clk *p; + int index = qcom_find_src_index(hw, rcg->s.parent_map, f->src); - p = clk_get_parent_by_index(hw->clk, f->src); + p = clk_get_parent_by_index(hw->clk, index); *p_hw = __clk_get_hw(p); *p_rate = __clk_round_rate(p, rate); diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index 416becce4170..b95d17fbb8d7 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -182,13 +182,19 @@ static long _freq_tbl_determine_rate(struct clk_hw *hw, { unsigned long clk_flags; struct clk *p; + struct clk_rcg2 *rcg = to_clk_rcg2(hw); + int index; f = qcom_find_freq(f, rate); if (!f) return -EINVAL; + index = qcom_find_src_index(hw, rcg->parent_map, f->src); + if (index < 0) + return index; + clk_flags = __clk_get_flags(hw->clk); - p = clk_get_parent_by_index(hw->clk, f->src); + p = clk_get_parent_by_index(hw->clk, index); if (clk_flags & CLK_SET_RATE_PARENT) { if (f->pre_div) { rate /= 2; @@ -381,9 +387,10 @@ static long clk_edp_pixel_determine_rate(struct clk_hw *hw, unsigned long rate, s64 request; u32 mask = BIT(rcg->hid_width) - 1; u32 hid_div; + int index = qcom_find_src_index(hw, rcg->parent_map, f->src); /* Force the correct parent */ - *p = __clk_get_hw(clk_get_parent_by_index(hw->clk, f->src)); + *p = __clk_get_hw(clk_get_parent_by_index(hw->clk, index)); if (src_rate == 810000000) frac = frac_table_810m; @@ -427,6 +434,7 @@ static long clk_byte_determine_rate(struct clk_hw *hw, unsigned long rate, { struct clk_rcg2 *rcg = to_clk_rcg2(hw); const struct freq_tbl *f = rcg->freq_tbl; + int index = qcom_find_src_index(hw, rcg->parent_map, f->src); unsigned long parent_rate, div; u32 mask = BIT(rcg->hid_width) - 1; struct clk *p; @@ -434,7 +442,7 @@ static long clk_byte_determine_rate(struct clk_hw *hw, unsigned long rate, if (rate == 0) return -EINVAL; - p = clk_get_parent_by_index(hw->clk, f->src); + p = clk_get_parent_by_index(hw->clk, index); *p_hw = __clk_get_hw(p); *p_rate = parent_rate = __clk_round_rate(p, rate); @@ -496,7 +504,8 @@ static long clk_pixel_determine_rate(struct clk_hw *hw, unsigned long rate, int delta = 100000; const struct freq_tbl *f = rcg->freq_tbl; const struct frac_entry *frac = frac_table_pixel; - struct clk *parent = clk_get_parent_by_index(hw->clk, f->src); + int index = qcom_find_src_index(hw, rcg->parent_map, f->src); + struct clk *parent = clk_get_parent_by_index(hw->clk, index); *p = __clk_get_hw(parent); @@ -525,7 +534,8 @@ static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate, int delta = 100000; u32 mask = BIT(rcg->hid_width) - 1; u32 hid_div; - struct clk *parent = clk_get_parent_by_index(hw->clk, f.src); + int index = qcom_find_src_index(hw, rcg->parent_map, f.src); + struct clk *parent = clk_get_parent_by_index(hw->clk, index); for (; frac->num; frac++) { request = (rate * frac->den) / frac->num;