From patchwork Tue Nov 10 11:10:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 321013 Delivered-To: patch@linaro.org Received: by 2002:a17:906:d156:0:0:0:0 with SMTP id br22csp3448508ejb; Tue, 10 Nov 2020 03:10:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoqKIO7o9KfJF+bke2ha7TmqETC7IicvZTZ5BmYXWYbBq0ZcHl/t9Dj3IxibChB8/ihc1h X-Received: by 2002:a17:906:22c7:: with SMTP id q7mr20340319eja.291.1605006654928; Tue, 10 Nov 2020 03:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605006654; cv=none; d=google.com; s=arc-20160816; b=XCvhTZ+PfmUAMSV1bN5AF0uQEmcFASAxazOfQ8GZRamrQ0n+VMMZm+vOnsXcWfWUpG XVtofLtx5LwrKCtZT7L7GYpuoM93ZNbEV/4RuX024VZCkVyq4DLaVv6HEdGVIus/QVxI 40lIXApHrTaFgtCW5oHZ01JdcCYPhBhuQ31S1cqOEJLWAShduuqjxyCUo0BSsmAorTRn fIsO0KWWd1lvSuK3FM+xqRRNez0iBuh92R6t1k5YOk6lAVjCL/KpkkBm1vYYHXoiP0MN HtkiKBZsK/oRSYW+A00Fe1rinIH5p15w1a/ndMNUqACGJOiLoFuvjvApLijSeyvSOaAz gV8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ANU/V6a7aKbtZ8QWTY/dBHm2TF7ZEkcc6B4K68+MYQ8=; b=verCj9Q3aN9d4l76cQ5amEFnC5qoY0E1Xms6nZXImcty/dZVCE9sng+gljxNS4g9q+ r4rAlET0zDD9feKOXMYalcSboxGjPchLrFUdp2dzH+0d5bVgGzpoTn1V7Pv2M8WRCFr3 /+T5ZqZ8ypT9sH5dmxU+n054hu/A0fC73OdyOz6LRRwupmLwxPluBDpy6yXeqlZkNokZ mO/im7j3s8CM3B/Tgrw/yRTZgAA3Kuyg68YkohstjrZTCTx7shd/0N63FSKlr45grBu5 pSXE5yyogqxJiidBeL2lAP62g1WR1Ak8xg9SRMSirQhWsB4yZL1NYi2FGYhYHEyYMXv6 kmUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si8796229ejf.165.2020.11.10.03.10.49; Tue, 10 Nov 2020 03:10:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726428AbgKJLKt (ORCPT + 9 others); Tue, 10 Nov 2020 06:10:49 -0500 Received: from foss.arm.com ([217.140.110.172]:54036 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726152AbgKJLKt (ORCPT ); Tue, 10 Nov 2020 06:10:49 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3CE3D12FC; Tue, 10 Nov 2020 03:10:48 -0800 (PST) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 56A0C3F6CF; Tue, 10 Nov 2020 03:10:47 -0800 (PST) From: Sudeep Holla To: linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Cristian Marussi , "Rafael J . Wysocki" , Viresh Kumar Subject: [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider Date: Tue, 10 Nov 2020 11:10:40 +0000 Message-Id: <20201110111040.280231-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within _allocate_opp_table() which is called from dev_pm_opp_add and it now propagates the error back to the caller. SCMI performance domain re-used clock bindings to keep it simple. However with the above mentioned change, if clock property is present in a device node, opps fails to get added with below errors until clk_get succeeds. cpu0: failed to add opp 450000000Hz cpu0: failed to add opps to the device ....(errors on cpu1-cpu4) cpu5: failed to add opp 450000000Hz cpu5: failed to add opps to the device So, in order to fix the issue, we need to register dummy clock provider. With the dummy clock provider, clk_get returns NULL(no errors!), then opp core proceeds to add OPPs for the CPUs. Cc: Rafael J. Wysocki Cc: Viresh Kumar Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER") Signed-off-by: Sudeep Holla --- drivers/cpufreq/scmi-cpufreq.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.25.1 Acked-by: Viresh Kumar diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index e855e8612a67..78318508a6d6 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -228,12 +229,17 @@ static struct cpufreq_driver scmi_cpufreq_driver = { static int scmi_cpufreq_probe(struct scmi_device *sdev) { int ret; + struct device *dev = &sdev->dev; handle = sdev->handle; if (!handle || !handle->perf_ops) return -ENODEV; + /* dummy clock provider as needed by OPP if clocks property is used */ + if (of_find_property(dev->of_node, "#clock-cells", NULL)) + devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL); + ret = cpufreq_register_driver(&scmi_cpufreq_driver); if (ret) { dev_err(&sdev->dev, "%s: registering cpufreq failed, err: %d\n",