From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01F71C43603 for ; Thu, 5 Dec 2019 17:48:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC57421835 for ; Thu, 5 Dec 2019 17:48:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LTDu7jl3"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="X38JZEgX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC57421835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1lR2Cj/90G21fnTaPFojJpD6bKzpa3WU9SMkamMKb1o=; b=LTDu7jl3AnVDAu zvkkDX65c8WQSrS2PFeQNoQpEmCCObhxB1vdS6+Ibz5CAOoaVTIUb15QydzU+cGLImMmTioeuOLgz aKleghPw9UaD3VpIk0eJNb/rvlmvxe7z8UBI98Z0Ez24Yjjtr7pKBgJ90ATiwePMYwt5kxguN3pPP bGoBcOo8t6UYQUrn3C0Fhz1ClSUVHYeU0k+rAQ7XKvt4Nkqxj0WOPO3MUhuaaI4GT4IkJXolspFXj H5LZ1ruD5NTyBKirCk4L3BVH/KiaV3rEgMa2r+My4/B/sqqkPnygPLTTxI5Bf6UZbQTHXccY1jqyW Rq6Shjagce/gPQ2BQezw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1icvFJ-0003Iq-Sx; Thu, 05 Dec 2019 17:48:57 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1icvFD-0003Fu-F6 for linux-arm-kernel@lists.infradead.org; Thu, 05 Dec 2019 17:48:52 +0000 Received: by mail-pj1-x1043.google.com with SMTP id w23so1587141pjd.2 for ; Thu, 05 Dec 2019 09:48:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=I5d912MYAJV7WOySMZ2inDSLRZhcHr5jXA7MY3FsoXI=; b=X38JZEgX7yfJlOpqTqHrPssrpwQQEh60or9o8EzRxMIWmQHCiLCJ/zhQC/8L0EpNTV ICORf+RLfQiZPwWN/rPPp5/hRe8w4ASX5HAk1fiDUHIjKSwXkRvgOPD6N9EllVXDRXnX w7MRzx/XyYwKIDE5gzOLSHapHXI8zW4PP0btM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=I5d912MYAJV7WOySMZ2inDSLRZhcHr5jXA7MY3FsoXI=; b=S2TmN09kGv997ZuqO+Rvpyvt4oVmHT2SwaeLm7XmQP/R3l+ADfASAv+SxDWMYV5G7/ Ir1IZIvkQJKG3O/J4cda2PjoJeA7wdAKBqYc8gv4LtRU+0pALkWhnpzVtfNa6YgrHf48 L5WEfQtEIhki3fcZhJ+AgbT3/1Mjbh92kjKcuTgOHjnfxPzYnuslum+6ULx+/56EAr2v CmypcsanqxA5eKVKJAV58XTYmY3tW1h+ilehXr0LBEUQPEqgnQ2kokdRo2hEv+wDuyZY zVCPvzl2lmg1zhTvUrUmEbdJDmvM4pvYL62n9vQ0RVq+I2jvxNgUiGqxi5GgkgJMfLFE z8uA== X-Gm-Message-State: APjAAAXGmrSriapMVLTcSUTz1PlmY/4WtkJ56DxGB6UpZcB9GtCns4oT aiUnJPqNXBsX0GZfZjbsAbfq9Q== X-Google-Smtp-Source: APXvYqxfMUKZGT6P0TUfMuyW8oAlxX+Wy1kXyKhkiDjIudTd/T2t0aiQ+3RAHYm9wAj/+7FicLF9Iw== X-Received: by 2002:a17:902:8201:: with SMTP id x1mr10263704pln.193.1575568127950; Thu, 05 Dec 2019 09:48:47 -0800 (PST) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id a13sm2259865pfc.40.2019.12.05.09.48.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Dec 2019 09:48:47 -0800 (PST) Date: Thu, 5 Dec 2019 09:48:46 -0800 From: Matthias Kaehlcke To: Leonard Crestez Subject: Re: [PATCH v2 1/2] PM / devfreq: Add PM QoS support Message-ID: <20191205174846.GM228856@google.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191205_094851_529468_9B504BA3 X-CRM114-Status: GOOD ( 17.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Artur =?utf-8?B?xZp3aWdvxYQ=?= , Jacky Bai , linux-pm@vger.kernel.org, Viresh Kumar , "Rafael J. Wysocki" , Chanwoo Choi , Kyungmin Park , MyungJoo Ham , NXP Linux Team , Georgi Djakov , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Dec 05, 2019 at 12:05:06PM +0200, Leonard Crestez wrote: > Register notifiers with the PM QoS framework in order to respond to > requests for DEV_PM_QOS_MIN_FREQUENCY and DEV_PM_QOS_MAX_FREQUENCY. > > No notifiers are added by this patch but PM QoS constraints can be > imposed externally (for example from other devices). > > Signed-off-by: Leonard Crestez > Acked-by: Chanwoo Choi > --- > drivers/devfreq/devfreq.c | 77 +++++++++++++++++++++++++++++++++++++++ > include/linux/devfreq.h | 5 +++ > 2 files changed, 82 insertions(+) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index bdeb4189c978..e8b943fc4259 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -22,15 +22,18 @@ > #include > #include > #include > #include > #include > +#include > #include "governor.h" > > #define CREATE_TRACE_POINTS > #include > > +#define HZ_PER_KHZ 1000 > + > static struct class *devfreq_class; > > /* > * devfreq core provides delayed work based load monitoring helper > * functions. Governors can use these or can implement their own > @@ -109,10 +112,11 @@ static unsigned long find_available_max_freq(struct devfreq *devfreq) > static void get_freq_range(struct devfreq *devfreq, > unsigned long *min_freq, > unsigned long *max_freq) > { > unsigned long *freq_table = devfreq->profile->freq_table; > + s32 qos_min_freq, qos_max_freq; > > lockdep_assert_held(&devfreq->lock); > > /* > * Initialize minimum/maximum frequency from freq table. > @@ -125,10 +129,20 @@ static void get_freq_range(struct devfreq *devfreq, > } else { > *min_freq = freq_table[devfreq->profile->max_state - 1]; > *max_freq = freq_table[0]; > } > > + /* Apply constraints from PM QoS */ > + qos_min_freq = dev_pm_qos_read_value(devfreq->dev.parent, > + DEV_PM_QOS_MIN_FREQUENCY); > + qos_max_freq = dev_pm_qos_read_value(devfreq->dev.parent, > + DEV_PM_QOS_MAX_FREQUENCY); > + *min_freq = max(*min_freq, (unsigned long)HZ_PER_KHZ * qos_min_freq); > + if (qos_max_freq != PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE) The condition shouldn't be needed anymore now that PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE is S32_MAX and not -1. > + *max_freq = min(*max_freq, > + (unsigned long)HZ_PER_KHZ * qos_max_freq); > + Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel