Received: by 10.192.165.148 with SMTP id m20csp4020302imm; Mon, 23 Apr 2018 17:21:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Xha7JxPqH3QqWXzDbVM3SLn6HXdObFNuZ6wFeYxZoCjYmGsd9cahPUZrNvCmDpeaEGb6U X-Received: by 10.99.49.205 with SMTP id x196mr16530298pgx.397.1524529315401; Mon, 23 Apr 2018 17:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524529315; cv=none; d=google.com; s=arc-20160816; b=ksSSI6uot3qIZgDmOQXWb4m3phLyXsakL+wLaii3nuE2MSEHL2Gaa4i7ysG8oxEOg5 pbx2S2muv5AbJwG9Qzi50+ZCVFklj7Sts6bvc0PFG83ZhLAN3LPV7aCy8/7BNTnPG5iY 9lVfQo3qZTp5lcrDGUCs9bJ5QQH5enQ3FYu9b9xRXIH+X+CcPWQMe8ne6uJ7Pt8fnQF5 mN4Ldl+B5Q8f4WC6E8AQQ7UsOaqX8oKO379jMmnEw4VSPUCtBpAeTLRAYISidxPEI2Qt cRF9qXcda0JMAebgfnRLPzr3wWDI2EBjsQ0ZBIqFj/P8Jbr6CyTn9hl3VBCLAisUkPZ9 +3ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=oq/MiC8agxBZwYUIV0NGKzNJZJQo/yYIKvJRf6+gseI=; b=haTLN8E2uVGk8IZQBMsp8CRrwSEtGdr2Qa9H+DiYAIZAQeZRMHEFePWnB9q62WKURZ WFKj980i4hPZjHDK/Fnyiwnn0hZ0t4Poif0adAlIbCNxH+30tf9MBAe6YFESgF1PDT3i D0cZmWgaB2koWvngqUsMo7SbX+kgCJ+v1+E1N+3pJvv7uhngqP/Eb8xnZDe/7vXNtGp4 fW3zpJojbD8bG54q5ZxjQe2yzmrqt2ejRxhTHYsseO9kuYHCyT3rl8y1cz6+8bAYsO2U iQ8Zb/2rz/BU+gmFkAQZ7iZ8SfWhsah0TLnzoUv78Z03doPDwuroQ498bvBsuEIhbo4F mIRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CzwC5R4Q; 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 s5si8287953pgv.522.2018.04.23.17.21.39; Mon, 23 Apr 2018 17:21:55 -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=CzwC5R4Q; 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 S932708AbeDXAU0 (ORCPT + 99 others); Mon, 23 Apr 2018 20:20:26 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:41969 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932661AbeDXAUV (ORCPT ); Mon, 23 Apr 2018 20:20:21 -0400 Received: by mail-pf0-f193.google.com with SMTP id v63so1104897pfk.8 for ; Mon, 23 Apr 2018 17:20:21 -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; bh=oq/MiC8agxBZwYUIV0NGKzNJZJQo/yYIKvJRf6+gseI=; b=CzwC5R4QKaMWmSZX+q1tv5MRTSmSySzeaRDACVS+SJGXRA97V589CwlXb/93McvfK0 GtwXT3wZSkLd6pS6ozytjICxe4hBDTRzHWwANEIyz5pLIE93DKDtdErUxP2nDF/P79fq HL4NWW33y9C51d/wMxu0ANidzbk0vhF5XArqk= 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; bh=oq/MiC8agxBZwYUIV0NGKzNJZJQo/yYIKvJRf6+gseI=; b=PZIaGorEDHWKU3+l6SsQWlcQKYlFkaHf6VsKQ7rXkVFJ3bzbT/vBdFf7DxUCSi45qp k8IXv52Qb9zTU1qTwxPoPc0PI7+sdtUscN52QX72la9lFY1B+QHw4xxQLTvUuMQ5fmWT Bb7AZEjJLxKmU/H07aTh8C8iM628Z+bW4SNrp01vr+6IoM2Ya1cr50tibJQfr+tn/gob gSu33L4Yy7zIUMVZ0xp8/dKn81nxjKNaipiGLLma3KpMblGzTimSRkX7RLYsJKCKeskc skR0bpd032JC8m+f+iFeBRX8ONtfWssDGSVy2Zq5Hhv9l5hE5iymq51t1S7+OeDWCijW lhEg== X-Gm-Message-State: ALQs6tB3HnKxTDc2X29uqXffm9zisOHEXM3nTMV3PSq3G6pRee6O3Y5+ Qazp21Bmclc3+4SuaUD2eENELQ== X-Received: by 10.98.238.3 with SMTP id e3mr21753324pfi.232.1524529220991; Mon, 23 Apr 2018 17:20:20 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id p6sm26669845pfk.104.2018.04.23.17.20.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 17:20:20 -0700 (PDT) From: Bjorn Andersson To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: Vinayak Holikatti , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vivek Gautam Subject: [PATCH 1/3] PM / devfreq: Actually support providing freq_table Date: Mon, 23 Apr 2018 17:20:14 -0700 Message-Id: <20180424002016.9205-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180424002016.9205-1-bjorn.andersson@linaro.org> References: <20180424002016.9205-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The code in devfreq_add_device() handles the case where a freq_table is passed by the client, but then requests min and max frequences from the, in this case absent, opp tables. Read the min and max frequencies from the frequency table, which has been built from the opp table if one exists, instead of querying the opp table. Signed-off-by: Bjorn Andersson --- An alternative approach is to clarify in the devfreq code that it's not possible to pass a freq_table and then in patch 3 create an opp table for the device in runtime; although the error handling of this becomes non-trivial. Transitioning the UFSHCD to use opp tables directly is hindered by the fact that the Qualcomm UFS hardware has two different clocks that needs to be running at different rates, so we would need a way to describe the two rates in the opp table. (And would force us to change the DT binding) drivers/devfreq/devfreq.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index fe2af6aa88fc..086ced50a13d 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -74,30 +74,16 @@ static struct devfreq *find_device_devfreq(struct device *dev) static unsigned long find_available_min_freq(struct devfreq *devfreq) { - struct dev_pm_opp *opp; - unsigned long min_freq = 0; - - opp = dev_pm_opp_find_freq_ceil(devfreq->dev.parent, &min_freq); - if (IS_ERR(opp)) - min_freq = 0; - else - dev_pm_opp_put(opp); + struct devfreq_dev_profile *profile = devfreq->profile; - return min_freq; + return profile->freq_table[0]; } static unsigned long find_available_max_freq(struct devfreq *devfreq) { - struct dev_pm_opp *opp; - unsigned long max_freq = ULONG_MAX; - - opp = dev_pm_opp_find_freq_floor(devfreq->dev.parent, &max_freq); - if (IS_ERR(opp)) - max_freq = 0; - else - dev_pm_opp_put(opp); + struct devfreq_dev_profile *profile = devfreq->profile; - return max_freq; + return profile->freq_table[profile->max_state - 1]; } /** -- 2.16.2