Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1758098imu; Thu, 17 Jan 2019 02:48:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN6wEmytFPjXxNTSSTQN6dUW5u0bQNV/g64TGf6zoVM+xj0UHu6jnwnepEFT2e4YHz735AHA X-Received: by 2002:a63:e247:: with SMTP id y7mr12426122pgj.84.1547722103370; Thu, 17 Jan 2019 02:48:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547722103; cv=none; d=google.com; s=arc-20160816; b=LghcfvYq+v9EO3WlvEk1E2k/auJlyB1MMhC69ZvmQblnbAIFJJjjrB0RPZg0YXGhXt 3BieQDiyyvb7VxM0npRALK7xSIQGI0Q/1i6PD8Wps0oO1IfRESzimAnJh55EaG4DirD5 qzs45nAr+VNrVVZXoCp4V8Y2XUmbq7dMRh0zesWDAuN5C7CI3hpdLw6qoGxYUTN+VPZp g6Gl3k4yfvT1Zl4P7aQlq9dxHVAo34dCvBGX15z8whcXBb6FjY9qjIDmV0PY7wHC7Uxv D7x95OwaJwX7ij98QY1fSeSnmNuTXxbvjTvsHga5YNUxYKvlKH79jEasL2FFvwGw6L33 zuNg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4wjGNMQ1Xyj/2nk4iZvOiwJXuhvRb1mvppAMZfhe2UI=; b=XUneXfc1qnZjhEbBH7h0C02bsz7GdYpMlABVqgETkd5D/fJTJZNuQoiz2qQPvDQGX0 TTo3cNnzdQhtg8ZH6zpiZNCwIBtfCy686QmlYq8asjGDbxBYkDaaXFV6R3cRU0iOEuQU OcHgyzz6nIjMitVmn3qw/gAznH4rEDG3s5gekoeL9y/2nVSOnUDXtFxoQcUQEy/JE7EM lcUqqopEdOhY/5QrpnfjMYE/PJh3AZF7Y+r+iTzJUUc4k6yOgBPxuS/LwF+RMFgruDNQ uPISgk7YJX6c9xhTyyNM0CQN9I+PNNDW9SD+bhMSFJXZYyDenVkKq57jazyGNpRU9Q3J CXdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nh97rH3g; 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 64si1437834pfe.74.2019.01.17.02.48.06; Thu, 17 Jan 2019 02:48:23 -0800 (PST) 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=Nh97rH3g; 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 S1728305AbfAQKq0 (ORCPT + 99 others); Thu, 17 Jan 2019 05:46:26 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46184 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbfAQKqZ (ORCPT ); Thu, 17 Jan 2019 05:46:25 -0500 Received: by mail-wr1-f68.google.com with SMTP id l9so10374712wrt.13 for ; Thu, 17 Jan 2019 02:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4wjGNMQ1Xyj/2nk4iZvOiwJXuhvRb1mvppAMZfhe2UI=; b=Nh97rH3g4xO4yRnaRfwnZCtw8lMhWS5ifN3UoStuXWV8XreZpBgNFP6v513+F830R7 1A8fkYGpSLFmKF9JquRLeWu5RmELG9dEJ1uV4op58lJzDxaQpVOpCbmoNPe4RJPQq4et daBtCall7K34uaGZbsbxhJ6Jx0tpmnDM2vNXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4wjGNMQ1Xyj/2nk4iZvOiwJXuhvRb1mvppAMZfhe2UI=; b=YJHJh6rt/qz8iB3TG/FTVuWzBM5qbxE9UE1uFdciFubUlpfjkppzaR+XTGy/QTW+Nq RtkMgc7iVHf1pU7hacWgM9Id3DBPPiD8teXeWjGusPd7KTj16tfcWft7ABymFkA6H9x2 /tcN554oF2Dt0iPmMw+T3hyMqJXpvzcs7EiPlZ5x6HAACJHerL8hsY0WK0aNgxtPJO/Q 4x77BJC+EqogiFUuiibeQgAdGBp6k2d2svac17KhmLmC76cLTKlxMgSj5h66uPma5/8q eQ6tqdHMU8AKXrmICDFOrY0M7qQlQWkGclrVrjUTcHeJJLwABgZUiJNsr4sVF+r8TwkF cXZg== X-Gm-Message-State: AJcUukfRBaTOEHBtKAydPujhr68Of+I1gS4pqDkAg5PvB+TK+hTaz+YX KitdxIaZ3R5AqJWM5d4Bh8ZuXrNpxBg= X-Received: by 2002:a5d:6684:: with SMTP id l4mr12345067wru.154.1547721984108; Thu, 17 Jan 2019 02:46:24 -0800 (PST) Received: from [192.168.1.2] (92.red-83-34-185.dynamicip.rima-tde.net. [83.34.185.92]) by smtp.gmail.com with ESMTPSA id s16sm63932643wrt.77.2019.01.17.02.46.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 02:46:23 -0800 (PST) Subject: Re: [PATCH 08/13] clk: qcom: hfpll: CLK_IGNORE_UNUSED To: Viresh Kumar Cc: Bjorn Andersson , robh+dt@kernel.org, mark.rutland@arm.com, andy.gross@linaro.org, david.brown@linaro.org, sboyd@kernel.org, will.deacon@arm.com, mturquette@baylibre.com, jassisinghbrar@gmail.com, vkoul@kernel.org, niklas.cassel@linaro.org, sibis@codeaurora.org, georgi.djakov@linaro.org, arnd@arndb.de, horms+renesas@verge.net.au, heiko@sntech.de, enric.balletbo@collabora.com, jagan@amarulasolutions.com, olof@lixom.net, amit.kucheria@linaro.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org References: <1545039990-19984-1-git-send-email-jorge.ramirez-ortiz@linaro.org> <1545039990-19984-9-git-send-email-jorge.ramirez-ortiz@linaro.org> <20190117063312.GE25498@builder> <9abbe59b-433c-4e30-1e4d-b5eed3afc695@linaro.org> <20190117100807.pmew5iqisdcc63eq@vireshk-i7> From: Jorge Ramirez Message-ID: Date: Thu, 17 Jan 2019 11:46:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190117100807.pmew5iqisdcc63eq@vireshk-i7> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/17/19 11:08, Viresh Kumar wrote: > On 17-01-19, 09:38, Jorge Ramirez wrote: >> COMMON_CLK_DISABLED_UNUSED relies on the enable_count reference counter >> to disable the clocks that were enabled by the firwmare and not by the >> drivers. >> >> the cpufreq driver does not enable the cpu clock. >> >> so when clk_change_rate is called, the enable_count counter is not >> incremented and therefore it just remains null since this was enabled by >> the firmware. >> >> I tried doing: >> >> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c >> index e58bfcb..5a9f83e 100644 >> --- a/drivers/cpufreq/cpufreq-dt.c >> +++ b/drivers/cpufreq/cpufreq-dt.c >> @@ -124,6 +124,10 @@ static int resources_available(void) >> return ret; >> } >> >> + ret = clk_prepare_enable(cpu_clk); >> + if (ret) >> + return ret; >> + >> clk_put(cpu_clk); >> >> name = find_supply_name(cpu_dev); >> >> >> and that removed the need for CLK_IGNORE_UNUSED. But I am not sure of >> the system wide consequences of that change to cpufreq. > > If the cpufreq driver enables it then it should disable it on exit as > well, right ? And in that case if you unload your driver's module, you > will hang the system as the clock will get disabled :) ah, of course, sorry was over-thinking this thing :) > > Every other platform must either be marking it with CLK_IGNORE_UNUSED > or they must be doing clk_enable from somewhere, maybe the CPU online > path, not sure though. > since this clock is enabled by the firmware, it seems to me that using CLK_IGNORE_UNUSED remains the best option.