Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5490209ybh; Wed, 7 Aug 2019 06:53:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCxNfwBzAtQdBXgMORtlkMZr2rdnQjwR0ccSizLqjmzzco18shJwayLVS0rgyeXNgjfl7m X-Received: by 2002:a17:90a:9905:: with SMTP id b5mr106265pjp.70.1565186010468; Wed, 07 Aug 2019 06:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565186010; cv=none; d=google.com; s=arc-20160816; b=tJK4jF5f/e5TECCNN5VJqVTijE58DirMbI1nKek1aR5KKx/nlS7xdwx/w8gyLmDAg+ 8GqJDe4TZ10Dz4QBqgaYANvhjidAkp7Z4tABmsBJxkiLpN4fmRkK/6m4nFK3LozWiNx4 sMSQ9pgnAYhwGNP1aoLPnYcS1yQWN2To8GHD+4Y+QIdN7XSvsrTTqORF8Hq//cMZlTr4 qJAnuu2iuSV3Q7sI3dz01KwuvuMhhIMh1zokIqj7mfdg5nzSxoXSnPajKY6I/0bJ2dk+ WNOOkLMP9mVszEr+F4SMnXeY34wa+5GZcOFnLC66CjvB9+1QzNXGs4+vPBjljoBS1hZO AEcA== 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:date:message-id:autocrypt :openpgp:from:references:cc:to:subject:dkim-signature; bh=c/zLwd8HNpguG/AbdpxIDoWAPn4KcVkLv5Fqa19DHlk=; b=begBIikgHqrlbR9pwSUqj1ET4nPodo+WmUqrAptVry4p4ABXZwf+tjCMrGepkpHDxH hYmm/odNMqQ/CJP2GP/j51mRNvvvYrHLUI4saJRPRfS86/hQDVQH7WU6AEwDW4ppt+hQ Y9x+CdZHAZ8UqrTKJoPJUmaSzK8QdDX4uaEQq3fA9YY241NmmgpQF73m5COFrSEeAKXk LYMvcEWp3MonqS9/OQ8timE0UdWpG/4IxdqmQ/eeZZebfcE7dHYBuGmHfTEhKGQ9vVJs nysSG7XGJNnER+8PjaFngHS/w8Viw2wrexlJH1TGPx2cU2hw7bpaSWG9P2cIgiNryrpO qUrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kq8FX4m+; 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 s70si16311863pgc.53.2019.08.07.06.53.14; Wed, 07 Aug 2019 06:53:30 -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=Kq8FX4m+; 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 S2387802AbfHGMx7 (ORCPT + 99 others); Wed, 7 Aug 2019 08:53:59 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45089 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729808AbfHGMx7 (ORCPT ); Wed, 7 Aug 2019 08:53:59 -0400 Received: by mail-lj1-f194.google.com with SMTP id m23so85290966lje.12 for ; Wed, 07 Aug 2019 05:53:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=c/zLwd8HNpguG/AbdpxIDoWAPn4KcVkLv5Fqa19DHlk=; b=Kq8FX4m+/2evCTbQm5MWBFIJRWSsGvSbCWAsr/KoKleFQzEM8+t7RdxtDegWrZXfLP yw4wwCJS43vwOznVEts+MsZWNwsGv46NOPf8zNhj07O88M69UBaIcNl/zmHo6i773x8Z 5RJ8O8m1MhaarDlLymClWOS+kieGpDSK7gnbBuz61wwqNIb/pvF5rLbGSNjEy6UFnjji oBgxcNSK/sgTY0YvddITbGNajgCl9AihWKnYwur/K/nN7Fp6pnyW+biQIqYkfUVLMJAz o1ZLoOQcVSZ7sJl82QNd0U4J9HLaqAC7PAT561CEooxDw5JaZcGMDr4sHCDTXMHntIL7 TFFA== 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:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=c/zLwd8HNpguG/AbdpxIDoWAPn4KcVkLv5Fqa19DHlk=; b=l1MCu6DUj6ZVxv1+g3YDq7DhDT9J/7+HVNiu3BNbKCutcOgOZdgzKWulT99nNSuke3 KsMLvfdy/PZjdENsd9k7REyaRlYnW9Z/UhNl0OkmSoa0SEDLjOOYz+RZpQ5mjq/ZpaSg mTqiBieM2NDuiJAWM0STRzhsSFNNlL0GNWaFEVeAeIxDkJPrCr5NfY3KPQpgD3Sxm2nB cGPF07nw69+CB5y6dvth69LDSsskvTcOnYW0/hfRAn5nWMmiIZ8+LvsYU3Va36XkW43e 6PhW0qI7v2FK9Rtz7zB6CFoEOjfdZs1MukJrMrAmi9XmnX+OTBRK4NfAapHsHxmpo5lM WNcg== X-Gm-Message-State: APjAAAU04xOX6RdcrK2fKi3NW4p8d6bXvrBKf32+7DISxo/04oz0qvuL +b1AhJSzjCwRzziVOZnEfrogfWfyOXA= X-Received: by 2002:a2e:9b03:: with SMTP id u3mr4784867lji.15.1565182436201; Wed, 07 Aug 2019 05:53:56 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id v25sm449086lfg.77.2019.08.07.05.53.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 05:53:55 -0700 (PDT) Subject: Re: [PATCH v4 2/3] OPP: Add support for bandwidth OPP tables To: Saravana Kannan , Rob Herring , Mark Rutland , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: vincent.guittot@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, adharmap@codeaurora.org, Rajendra Nayak , sibis@codeaurora.org, bjorn.andersson@linaro.org, evgreen@chromium.org, kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190726231558.175130-1-saravanak@google.com> <20190726231558.175130-3-saravanak@google.com> From: Georgi Djakov Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= mQINBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamS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BE0uA3zFVRfLiT6NUjDQ0vdphTnsdA7h01MliZLQ2lLL2Mt5lsqU+6sup Tfql1omgEpjnFsPsyFebzcKGbdEr6vySGa3Cof+miX06hQXKe99a5+eHNhtZJcMAIO89wZmj 7ayYJIXFqjl/X0KBcCbiAl4vbdBw1bqFnO4zd1lMXKVoa29UHqby4MPbQhjWNVv9kqp8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: Date: Wed, 7 Aug 2019 15:53:53 +0300 MIME-Version: 1.0 In-Reply-To: <20190726231558.175130-3-saravanak@google.com> 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 Hi Saravana, On 7/27/19 02:15, Saravana Kannan wrote: > Not all devices quantify their performance points in terms of frequency. > Devices like interconnects quantify their performance points in terms of > bandwidth. We need a way to represent these bandwidth levels in OPP. So, > add support for parsing bandwidth OPPs from DT. > > Signed-off-by: Saravana Kannan > --- > drivers/opp/of.c | 41 ++++++++++++++++++++++++++++++++--------- > drivers/opp/opp.h | 4 +++- > 2 files changed, 35 insertions(+), 10 deletions(-) > > diff --git a/drivers/opp/of.c b/drivers/opp/of.c > index b313aca9894f..ac73512f4416 100644 > --- a/drivers/opp/of.c > +++ b/drivers/opp/of.c > @@ -523,6 +523,35 @@ void dev_pm_opp_of_remove_table(struct device *dev) > } > EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table); > > +static int _read_opp_key(struct dev_pm_opp *new_opp, struct device_node *np) > +{ > + int ret; > + u64 rate; > + u32 bw; > + > + ret = of_property_read_u64(np, "opp-hz", &rate); > + if (!ret) { > + /* > + * Rate is defined as an unsigned long in clk API, and so > + * casting explicitly to its type. Must be fixed once rate is 64 > + * bit guaranteed in clk API. > + */ > + new_opp->rate = (unsigned long)rate; > + return 0; So we can't have a single OPP table with both frequency and bandwidth? > + } > + > + ret = of_property_read_u32(np, "opp-peak-KBps", &bw); > + if (ret) > + return ret; > + new_opp->rate = (unsigned long) bw; > + > + ret = of_property_read_u32(np, "opp-avg-KBps", &bw); > + if (!ret) > + new_opp->avg_bw = (unsigned long) bw; > + > + return 0; > +} > + > /** > * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) > * @opp_table: OPP table > @@ -560,22 +589,16 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, > if (!new_opp) > return ERR_PTR(-ENOMEM); > > - ret = of_property_read_u64(np, "opp-hz", &rate); > + ret = _read_opp_key(new_opp, np); > if (ret < 0) { > /* "opp-hz" is optional for devices like power domains. */ > if (!opp_table->is_genpd) { > - dev_err(dev, "%s: opp-hz not found\n", __func__); > + dev_err(dev, "%s: opp-hz or opp-peak-bw not found\n", s/opp-peak-bw/opp-peak-kBps/ Thanks, Georgi