From patchwork Mon Aug 26 16:45:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 172177 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4597283ily; Mon, 26 Aug 2019 09:45:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNAVzViJINqi/MzTCAXEnXbYrRgUNLEp4c/Hme495C1U4gw+VK0NZ4S6GD1CFX+IAQ1tag X-Received: by 2002:a65:6817:: with SMTP id l23mr17345622pgt.46.1566837934452; Mon, 26 Aug 2019 09:45:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566837934; cv=none; d=google.com; s=arc-20160816; b=Stbydr9UVZJRO4EwN++5LofWfgOomV3h2jJTfH7R2g2Kxoz/U0Urg3NINjqNAHdv0/ 3U1SV8eKiE6T3pXxGP+KauSy6c4xLKX/4jPVqX39eU6QMHY4ZJTDDQHDoeyIUwful58T asQN4MZv48WKp4YLsRFQz5jR8UaKr8K9r/dq+FYjFbDxqM9MGpV5XoN3seiRmgEYQMTO E07sLVWIK9b/S7mOeNbF1xZLQAKn+x5y6kXx1ubPXRm1Yc93BI0rKQAGmj7PHmvzSiON pdbZuk6EBqhe9+yCMwztSvOSRD80av6BUi1OLCmMOjzUtvjrhNnPFakBQPbLZeyMmH+p MA/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AduWeROQMDkKls+kl/fLswGL+rHZfEiqcyM0mR/LCMQ=; b=VIzbgqfWDKY+lhIGszmK0WTdhH7yIKEXh95z45vWiIXzmdtdNj2XLB0ndCPNknWCP9 wQMjTa2u80P6bMwtpU6r2ElHY7SRDr/XoB9flIZTH7ezEPJc4De2x6hJ73bp+7Sl6QJc OKlQQ5+V17V7tPI3LqNYYAhivgVjCKmhi4y2g3J79Zxn8dO+t7VnUWIJnNtoJk5y6dxS Qd+Cl08nLxyvVzWexxgb50FZa6TTAgrAODbDx5lNDuwj1eLwokZTOMYT73rd27lXa3HF +NR+EZU8TlSybcEi54/KgKRwEH+y7vRXN1EP8nFyAyZPXDZyOiqJ/4AvujGO4wyVfYx9 xSAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZIQIzeKY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si9371958pgr.243.2019.08.26.09.45.34; Mon, 26 Aug 2019 09:45:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZIQIzeKY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733010AbfHZQpX (ORCPT + 28 others); Mon, 26 Aug 2019 12:45:23 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43814 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732974AbfHZQpU (ORCPT ); Mon, 26 Aug 2019 12:45:20 -0400 Received: by mail-wr1-f68.google.com with SMTP id y8so15966263wrn.10 for ; Mon, 26 Aug 2019 09:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AduWeROQMDkKls+kl/fLswGL+rHZfEiqcyM0mR/LCMQ=; b=ZIQIzeKYCgaQGA3mvoHdMljzb0wEi7oer9LTbZr5HMpxDFPOgxtKb6VqdW862YV8km 04stCMBB1CU0drEjv/HuwbCLA/Jd1m4jBj2IX5eP5GcLNb5H0y96of/8RLrgkCVmJDiA t6avVK9FSWPEWWBcj4zHGwA+FTc9+7NYbGw2PSPIWtdzIIsiVV33OHd06oRpaEnDWfjN kAPZ/UIGq3FLf5aMXUUhbColc9tbabiobhcFIRuv2HQxs7FFIh+m2bjFJ1v2eRfkr8lt L8NkMZsn9ZC+KG+n8ZrT/975M13k6QJZKo3CsK2SJT13L/Z7K/MRW8HEtqxwztb/2Xk0 6QVg== 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:mime-version:content-transfer-encoding; bh=AduWeROQMDkKls+kl/fLswGL+rHZfEiqcyM0mR/LCMQ=; b=bh2OGzq3p8lBZ4lbcwktfzyehElWeZOWrUh4RTUlXytGGlXhUbzKG5PtEN1puBbnZP G6wR4ACsXzmkBAy+ubM/D6whvumOkdidunCXae4SYwhF6AFSzhTwhumQo93r7WOvwVwi rzxDNyCjWVBOfadU+e3qgOTEWcR6cYF6D4jbwh1GUjFUYDCZ8OyLDE+zItsdOhkCgi6x vfx28NyeRdtDFxPLKLou3RKDN9/h7gxQ0aeL0Lf/HjxVCd9x6E1RFQJLzkXiLCodtBzJ 1PNYsHmU+lR3jbYNKeXhVFnkcC7iBBZsrC5y/C5WFx+eki51SAoi/x26lXF/7SgOyMNo OKvQ== X-Gm-Message-State: APjAAAUbUx41GfUhflKG3+n39mMIpQiNfcxPBKScGyS34I/ipJlTb6GS kzMD2lNr7M3QVBxgYwE92pSw7A== X-Received: by 2002:a5d:610d:: with SMTP id v13mr24331376wrt.249.1566837918384; Mon, 26 Aug 2019 09:45:18 -0700 (PDT) Received: from localhost.localdomain (124.red-83-36-179.dynamicip.rima-tde.net. [83.36.179.124]) by smtp.gmail.com with ESMTPSA id l62sm77872wml.13.2019.08.26.09.45.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Aug 2019 09:45:17 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com Cc: bjorn.andersson@linaro.org, niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] clk: qcom: hfpll: CLK_IGNORE_UNUSED Date: Mon, 26 Aug 2019 18:45:10 +0200 Message-Id: <20190826164510.6425-5-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190826164510.6425-1-jorge.ramirez-ortiz@linaro.org> References: <20190826164510.6425-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and to keep the software model of the clock in line with reality, the framework transverses the clock tree and disables those clocks that were enabled by the firmware but have not been enabled by any device driver. If CPUFREQ is enabled, early during the system boot, it might attempt to change the CPU frequency ("set_rate"). If the HFPLL is selected as a provider, it will then change the rate for this clock. As boot continues, clk_disable_unused_subtree will run. Since it wont find a valid counter (enable_count) for a clock that is actually enabled it will attempt to disable it which will cause the CPU to stop. Notice that in this driver, calls to check whether the clock is enabled are routed via the is_enabled callback which queries the hardware. The following commit, rather than marking the clock critical and forcing the clock to be always enabled, addresses the above scenario making sure the clock is not disabled but it continues to rely on the firmware to enable the clock. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/hfpll.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.22.0 diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index 0ffed0d41c50..d5fd27938e7b 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -58,6 +58,13 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, + /* + * rather than marking the clock critical and forcing the clock + * to be always enabled, we make sure that the clock is not + * disabled: the firmware remains responsible of enabling this + * clock (for more info check the commit log) + */ + .flags = CLK_IGNORE_UNUSED, }; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL);