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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 DBF37C19F33 for ; Wed, 18 Aug 2021 08:30:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B1C266102A for ; Wed, 18 Aug 2021 08:30:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238260AbhHRIaz (ORCPT ); Wed, 18 Aug 2021 04:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238671AbhHRIay (ORCPT ); Wed, 18 Aug 2021 04:30:54 -0400 Received: from mail-vs1-xe34.google.com (mail-vs1-xe34.google.com [IPv6:2607:f8b0:4864:20::e34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59406C0617AD for ; Wed, 18 Aug 2021 01:30:18 -0700 (PDT) Received: by mail-vs1-xe34.google.com with SMTP id e9so1269463vst.6 for ; Wed, 18 Aug 2021 01:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=IKqcflYMaSUyzwd/eHbHpOkvH7hAYsOOplnEzRxLbhU=; b=R/YglmSTFalwgblF0J7z+xo4QD/viWueOMjtEA3qajPeKluQA8KyZlPIazxZCmQcOV ypXroUN/dz8G8KIy2PndGeFR9trr2TXk1MLEpZYZHSdEPDIvmCIDK5BOf+7ryOnDMlAz KKZOIcOvNnsfQADPruS78lcAX/NT/qxMC6OewVDoFYGt5hY5K9huXDQ6tsxV07Sxs/Du uf/zCLpMusk1iMjpoom1MA3j5kIRz40ZYONDbw9Bk+/YXVmdr5o2bmiJpfJC1CERXXmo E0BgAf1avWcJ6cYGmW6zCxZHRihbaxeLgDmifTSo359uCk7uScIh0CC8oShYygGDo0u/ CxTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=IKqcflYMaSUyzwd/eHbHpOkvH7hAYsOOplnEzRxLbhU=; b=o3s4WdZOboe4BtVlV01gq9Go4UOkTQyydXKZCTJ5f6bkiVtVe+kTZWf1ZJzip7sGe6 qp9ZNkfMLMn5plYxtatsV9EoPfguGlQO1kSrgox2uJv/TwULj2TMLFNT2Zut8N+JlqmB CJyGsQfaWhIGgl0kUyynHVb/FZBw5lKJ7J2qr9w8v9rHn3xCajey2BuQiy/kCQpH4iqd ePH2cO3AGeTioO+CqbtkatFBkXIakv0vTl6jRN+n6ohSktKLDcGmj0hAA8Dnt/VtPFkS thVXUIFHRMrpWkZN94l6q3FKWsIMC7XrW0t1KnTf1sJ+g2EiCz6QzOZDI8i07dzglp7J f5bQ== X-Gm-Message-State: AOAM532TQvtn7x9dh3eGsrQKaexQ/ToOK2mkmpTvoXb+Ae52vqkxIKPd 4vdWoobAn3RSHpIP/MRVfI3AcFy0O+L10fcSnZJekQ== X-Google-Smtp-Source: ABdhPJwKrtdwLrtqnGeoY6XyZUUGVixFdE7Mg0poY1hljrcpole6+hd3NjZWSpGJ4mjLJUHBolVYDumnC7t4U+ynnmc= X-Received: by 2002:a67:3212:: with SMTP id y18mr6323760vsy.19.1629275417181; Wed, 18 Aug 2021 01:30:17 -0700 (PDT) MIME-Version: 1.0 References: <20210817075515.vyyv7z37e6jcrhsl@vireshk-i7> <710261d9-7ae3-5155-c0a2-f8aed2408d0b@gmail.com> <20210818035533.ieqkexltfvvf2p4n@vireshk-i7> <5b2a80c1-9743-e633-6257-ede94c8a274c@gmail.com> <20210818043131.7klajx6drvvkftoc@vireshk-i7> <20210818045307.4brb6cafkh3adjth@vireshk-i7> <080469b3-612b-3a34-86e5-7037a64de2fe@gmail.com> <20210818055849.ybfajzu75ecpdrbn@vireshk-i7> <20210818062723.dqamssfkf7lf7cf7@vireshk-i7> In-Reply-To: <20210818062723.dqamssfkf7lf7cf7@vireshk-i7> From: Ulf Hansson Date: Wed, 18 Aug 2021 10:29:40 +0200 Message-ID: Subject: Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper To: Viresh Kumar , Dmitry Osipenko Cc: Thierry Reding , Jonathan Hunter , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Mark Brown , Lee Jones , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Nishanth Menon , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Adrian Hunter , Mauro Carvalho Chehab , Rob Herring , Michael Turquette , Linux Kernel Mailing List , linux-tegra , Linux PM , Linux USB List , linux-staging@lists.linux.dev, linux-spi@vger.kernel.org, linux-pwm@vger.kernel.org, linux-mtd@lists.infradead.org, linux-mmc , Linux Media Mailing List , dri-devel , DTML , linux-clk Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Wed, 18 Aug 2021 at 08:27, Viresh Kumar wrote: > > On 18-08-21, 09:22, Dmitry Osipenko wrote: > > 18.08.2021 08:58, Viresh Kumar =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > > What about calling dev_pm_opp_set_rate(dev, clk_get_rate(dev)) here > > > instead ? That will work, right ? The advantage is it works without > > > any special routine to do so. > > > > It will work, but a dedicated helper is nicer. > > > > > I also wonder looking at your gr3d.c changes, you set a set-opp > > > helper, but the driver doesn't call set_opp_rate at all. Who calls it > > > ? > > > > dev_pm_opp_sync() calls it from _set_opp(). > > Okay, please use dev_pm_opp_set_rate() instead then. New helper just > adds to the confusion and isn't doing anything special apart from > doing clk_get_rate() for you. > > > > And if it is all about just syncing the genpd core, then can the genp= d > > > core do something like what clk framework does? i.e. allow a new > > > optional genpd callback, get_performance_state() (just like > > > set_performance_state()), which can be called initially by the core t= o > > > get the performance to something other than zero. opp-set-rate is > > > there to set the performance state and enable the stuff as well. > > > That's why it looks incorrect in your case, where the function was > > > only required to be called once, and you are ending up calling it on > > > each resume. Limiting that with another local variable is bad as well= . > > > > We discussed variant with get_performance_state() previously and Ulf > > didn't like it either since it still requires to touch 'internals' of G= ENPD. > > Hmm, I wonder if that would be a problem since only genpd core is > going to call that routine anyway. Me and Dmitry discussed adding a new genpd callback for this. I agreed that it seems like a reasonable thing to add, if he insists. The intent was to invoke the new callback from __genpd_dev_pm_attach() when the device has been attached to its genpd. This allows the callback, to invoke clk_get_rate() and then dev_pm_opp_set_rate(), to update the vote according to the current state of the HW. I am not sure if/why that approach seemed insufficient? Another option to solve the problem, I think, is simply to patch drivers to let them call dev_pm_opp_set_rate() during ->probe(), this should synchronize the HW state too. Dmitry, can you please elaborate on this? Kind regards Uffe