Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1248701ybl; Fri, 16 Aug 2019 11:23:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzCVLafdICE6r9GWFJYQ+l9vFmZnhhWZKFNDmY6Yvk/FdTMzj6OLsXvZ0f5N5JYrtYIPyrf X-Received: by 2002:a63:c70d:: with SMTP id n13mr8856499pgg.171.1565979825074; Fri, 16 Aug 2019 11:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565979825; cv=none; d=google.com; s=arc-20160816; b=YCgySfynGajEmZY0DSOHNdHFAD2qsY+o12t/veraLrAyQhusct33898bXO0tMiWeCL vF8KYzug+bMnrxa1FglcFBIBxu5fo5aBHK+XgN55EpAkISt+G2BQaxXpBvCdJqPpHaBq L2gYfoxCLQUqOET3lCnQGj4U5d7dcrm9yRHxB49LDy0flnKWnC5LhWJoxkgYdZkss6mz /xEmGMxmUjXAg+ConQb9QC6bUU4lHqvkmJR+2KBW6xsX1ohEJ+BCUZM8tTtXzSfjk0v1 XN9uGfUDfDMn/8hhDYwByU5ZvUCKGCtsjfFp6VBlYPmz9ReCR4vn2fd8mHPUDEHYrxr7 UERA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=m5Dss8Io9g2Vy6xnyAHajbf9wQCIaG3hTrlZSYxPt5I=; b=LC9fndZeEmgIyaF/RFlnxg8G8PDDB7RyNhjXs06urpxZKKu4GiaSvQuM7dsgTU6N9f kbN5sbcC6EkMNyUJMxwOg3tDrFkWZGfrzr/Wt9YuXUIsOK5nk1dy/dhW1RxrY8y3Huf2 GRhO0ftYDB9v29A9kDFmtyzfqQFGY1LCcfMO6yMFjDuBUcXIZoiGj5V1IRyI8q+Pwjol OUoUQh98ZncRELQSP5p95lZMtjtUa1PrUSluF+f1L/PjpejbpnWtIihZH0GrNuLDtJmB qngXQGbvzCU+gPEP17fqdJz9QwgZ2jVykEzoQ3OG6Y4nQ6B7Fruxfx4Z6OLe/yQ3b6fg qlcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="e53ZOCk/"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v185si4289781pgd.340.2019.08.16.11.23.28; Fri, 16 Aug 2019 11:23:45 -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=@kernel.org header.s=default header.b="e53ZOCk/"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727598AbfHPSVd (ORCPT + 99 others); Fri, 16 Aug 2019 14:21:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:45602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727568AbfHPSVc (ORCPT ); Fri, 16 Aug 2019 14:21:32 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A692E206C1; Fri, 16 Aug 2019 18:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565979691; bh=SdLfbqllEBIl5x50TrX3UxG8XOSW2YtXDHKp5IStfXM=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=e53ZOCk/X9G2cDNOl0Z73k7huakI07VBl7FdYFhOLpShZfOzZ+5coj70+uwihDuvk z9s6x8bIEepalcIsgxfqA417KLs5rwMzixF/i/iCjCs5hEETPYowz8ThkXLhea1b2B 9fE9gRvCpr7m3PE9EV05zdCL1YPGNixTRhMdfNS4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190807223111.230846-3-saravanak@google.com> References: <20190807223111.230846-1-saravanak@google.com> <20190807223111.230846-3-saravanak@google.com> Subject: Re: [PATCH v5 2/3] OPP: Add support for bandwidth OPP tables From: Stephen Boyd Cc: Saravana Kannan , Georgi Djakov , 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 To: "Rafael J. Wysocki" , Mark Rutland , Nishanth Menon , Rob Herring , Saravana Kannan , Viresh Kumar User-Agent: alot/0.8.1 Date: Fri, 16 Aug 2019 11:21:30 -0700 Message-Id: <20190816182131.A692E206C1@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Saravana Kannan (2019-08-07 15:31:10) > diff --git a/drivers/opp/of.c b/drivers/opp/of.c > index 1813f5ad5fa2..e1750033fef9 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); > =20 > +static int _read_opp_key(struct dev_pm_opp *new_opp, struct device_node = *np) > +{ > + int ret; > + u64 rate; > + u32 bw; > + > + ret =3D 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 rat= e is 64 > + * bit guaranteed in clk API. > + */ > + new_opp->rate =3D (unsigned long)rate; > + return 0; > + } > + > + ret =3D of_property_read_u32(np, "opp-peak-kBps", &bw); > + if (ret) > + return ret; > + new_opp->rate =3D (unsigned long) bw; > + > + ret =3D of_property_read_u32(np, "opp-avg-kBps", &bw); > + if (!ret) I would write this as=20 if (!of_property_read_u32(np, "opp-avg-kBps", &bw)) new_opp->avg_bw =3D (unsigned long) bw; because you don't care about the return value. > + new_opp->avg_bw =3D (unsigned long) bw; > + > + return 0; > +} > + > /** > * _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings) > * @opp_table: OPP table > diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h > index 01a500e2c40a..6bb238af9cac 100644 > --- a/drivers/opp/opp.h > +++ b/drivers/opp/opp.h > @@ -56,7 +56,8 @@ extern struct list_head opp_tables; > * @turbo: true if turbo (boost) OPP > * @suspend: true if suspend OPP > * @pstate: Device's power domain's performance state. > - * @rate: Frequency in hertz > + * @rate: Frequency in hertz OR Peak bandwidth in kilobytes per sec= ond Why is Peak capitalized? > + * @avg_bw: Average bandwidth in kilobytes per second > * @level: Performance level > * @supplies: Power supplies voltage/current values > * @clock_latency_ns: Latency (in nanoseconds) of switching to this OPP's > @@ -78,6 +79,7 @@ struct dev_pm_opp { > bool suspend; > unsigned int pstate; > unsigned long rate; If you're trying to save space why not make an anonymous union here of 'rate' and 'bandwidth'? Then the code doesn't read all weird. > + unsigned long avg_bw; > unsigned int level; > =20 > struct dev_pm_opp_supply *supplies;