From patchwork Tue Jun 9 04:09:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11594363 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A09EA17C7 for ; Tue, 9 Jun 2020 04:10:07 +0000 (UTC) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 77FA8207F9 for ; Tue, 9 Jun 2020 04:10:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lists.cip-project.org header.i=@lists.cip-project.org header.b="TVjk2K+n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77FA8207F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csie.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=bounce+64572+4783+4520428+8129116@lists.cip-project.org X-Received: by 127.0.0.2 with SMTP id 69GoYY4521763xg9AOECpOsN; Mon, 08 Jun 2020 21:10:07 -0700 X-Received: from wens.tw (wens.tw [140.112.30.76]) by mx.groups.io with SMTP id smtpd.web12.104.1591675802788434046 for ; Mon, 08 Jun 2020 21:10:03 -0700 X-Received: by wens.tw (Postfix, from userid 1000) id 5FDF2600DD; Tue, 9 Jun 2020 12:09:59 +0800 (CST) From: "Chen-Yu Tsai (Moxa)" To: nobuhiro1.iwamatsu@toshiba.co.jp, pavel@denx.de Cc: cip-dev@lists.cip-project.org, JohnsonCH.Chen@moxa.com Subject: [cip-dev] [PATCH 4.4.y-cip v3 12/14] cpufreq-dt: Supply power coefficient when registering cooling devices Date: Tue, 9 Jun 2020 12:09:24 +0800 Message-Id: <20200609040926.8910-13-wens@csie.org> In-Reply-To: <20200609040926.8910-1-wens@csie.org> References: <20200609040926.8910-1-wens@csie.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: cip-dev@lists.cip-project.org List-Id: Mailing-List: list cip-dev@lists.cip-project.org; contact cip-dev+owner@lists.cip-project.org Delivered-To: mailing list cip-dev@lists.cip-project.org Reply-To: cip-dev@lists.cip-project.org X-Gm-Message-State: g2aCcNnc5rJegXhSjk6Dw6qOx4520428AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.cip-project.org; q=dns/txt; s=20140610; t=1591675807; bh=GwGzpniWOOHnc0AT2AZQk2WJtGS2gHdVLbl9F95z6rs=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=TVjk2K+n6oEZiIO1KkUppJg3sy3L04hFUOiyj1G4pNOm3mx9C7VSq/iejf8uur1OgIR 5DAeRh83VpeKHz8pE2+GaX0t9arI8BVfUgen98bYYBjh3SFpd7ErtM64moXKDJ7JkVo3z j8baP0qjebdrgw7SXh5Xyc5dCMqwKGIohjM= From: Punit Agrawal commit f8fa8ae06b8c2c25d81c99766f9226adc5c3e073 upstream. Support registering cooling devices with dynamic power coefficient where provided by the device tree. This allows OF registered cooling devices driver to be used with the power_allocator thermal governor. Signed-off-by: Punit Agrawal Acked-by: Viresh Kumar Reviewed-by: Javi Merino Signed-off-by: Rafael J. Wysocki Signed-off-by: Chen-Yu Tsai (Moxa) --- drivers/cpufreq/cpufreq-dt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 90d64081ddb34..1ceece9d67112 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -407,8 +407,13 @@ static void cpufreq_ready(struct cpufreq_policy *policy) * thermal DT code takes care of matching them. */ if (of_find_property(np, "#cooling-cells", NULL)) { - priv->cdev = of_cpufreq_cooling_register(np, - policy->related_cpus); + u32 power_coefficient = 0; + + of_property_read_u32(np, "dynamic-power-coefficient", + &power_coefficient); + + priv->cdev = of_cpufreq_power_cooling_register(np, + policy->related_cpus, power_coefficient, NULL); if (IS_ERR(priv->cdev)) { dev_err(priv->cpu_dev, "running cpufreq without cooling device: %ld\n",