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=-7.2 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,USER_AGENT_SANE_1 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 C3220C4338F for ; Tue, 24 Aug 2021 03:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A41CB60240 for ; Tue, 24 Aug 2021 03:09:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235256AbhHXDJj (ORCPT ); Mon, 23 Aug 2021 23:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235107AbhHXDFo (ORCPT ); Mon, 23 Aug 2021 23:05:44 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A985FC06129E for ; Mon, 23 Aug 2021 20:04:24 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id j2so6959042pll.1 for ; Mon, 23 Aug 2021 20:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ftVLBcz2CA6HVw5Sak06NSKiX7H+vKeynT4dia9GcmU=; b=k+9ugNQMNP1T757zCmBjD0HZ4Cm6T3BE+v/X7Wxf65qXhZ4Y1Om/ZwreVVsFldU5ED 26Au5VziBd3fTRw9qajnc5Q1bzTZtCXlNbNzYEhhdrLy0j6q3RP41Bfsx2Vet4JiZwHE HpssKarI+iW9nKfS+aZW4kug15wwleM1PIEsfGzs+E/ENGb7NoFhvlaUVQuCR3IWspbE 1jdc92yTGvHUY8w5qgAHpd6F4jZjsLSyz7OphX6zYHG1h8uepViMakkTUt9Apji0AqlD h496UE7ulnKIyaYIIz+9WlMWKL7f+UCly0DgUoeMlhVK/OeculmtFoztQ69V1z3oNjW5 BaQw== 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=ftVLBcz2CA6HVw5Sak06NSKiX7H+vKeynT4dia9GcmU=; b=SPmRK7cV3Yb4T5O9ydrc66g5XETIglP94ZKtwJcxj4tvQBsLYpIlG2szE+z16tzQHh dHoadcSdufbs4npsjMxCYNXAJLLBBNgy6AjTDbdeEQtIwTrT1SPdkJAyHX1ceF/WiW2s YJQ/yJ5kSSJ17btQsy+9JsjDZMfBDr05ihnND/UNJFLF+ByllfM+uMKwZVceoiI0WvEr pzUaRIcHtFXJMJzh0QvBgARL8+cc8qkXydxW+xqL31N5YOhcs/OPFMleInec5TJmPra6 9nY/6J6jHmM06ByoPna95miXvZenA3CqwDpaNrgj8LH7UqgmbJeQZXYmJmtIm5azggUP dWXg== X-Gm-Message-State: AOAM531NEzR9dd+5Or6Q4gMzSamyBuBBcS4P0gnOXtdKu7m0YQy2rQeI c2OJoliWq8DaZKH0xk6aTzuUMA== X-Google-Smtp-Source: ABdhPJxgNZPrPk9tzmxpkCehrPdfFes88M8DqFhHlA/X7V8qZTGRmqZiqGy9NJMzzCPLtwobPdjSGw== X-Received: by 2002:a17:902:e547:b029:12c:563c:4a03 with SMTP id n7-20020a170902e547b029012c563c4a03mr30922945plf.46.1629774264209; Mon, 23 Aug 2021 20:04:24 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id c12sm16184839pfl.56.2021.08.23.20.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Aug 2021 20:04:23 -0700 (PDT) Date: Tue, 24 Aug 2021 08:34:21 +0530 From: Viresh Kumar To: Dmitry Osipenko Cc: Ulf Hansson , Thierry Reding , Jonathan Hunter , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Mark Brown , Lee Jones , Uwe =?utf-8?Q?Kleine-K=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 Subject: Re: [PATCH v8 01/34] opp: Add dev_pm_opp_sync() helper Message-ID: <20210824030421.3tjfjkx3c2silbnz@vireshk-i7> References: <20210818062723.dqamssfkf7lf7cf7@vireshk-i7> <20210818091417.dvlnsxlgybdsn76x@vireshk-i7> <20210819061617.r4kuqxafjstrv3kt@vireshk-i7> <20210820051843.5mueqpnjbqt3zdzc@vireshk-i7> <085d1a2e-57b0-222e-c569-12f3c6bc8161@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <085d1a2e-57b0-222e-c569-12f3c6bc8161@gmail.com> User-Agent: NeoMutt/20180716-391-311a52 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23-08-21, 23:24, Dmitry Osipenko wrote: > It's not clear to me whether it will be okay to add a generic OPP syncing by clock rate or should it be a Tegra-specific helper. Viresh, what do you think about this generic OPP helper: > > /** > * dev_pm_opp_sync_with_clk_rate() - Sync OPP state with clock rate > * @dev: device for which we do this operation > * > * Sync OPP table state with the current clock rate of device. > * > * Return: 0 on success or a negative error value. > */ > int dev_pm_opp_sync_with_clk_rate(struct device *dev) > { > struct opp_table *opp_table; > int ret = 0; > > /* Device may not have OPP table */ > opp_table = _find_opp_table(dev); > if (IS_ERR(opp_table)) > return 0; > > /* Device may not use clock */ > if (IS_ERR(opp_table->clk)) > goto put_table; > > /* Device may have empty OPP table */ > if (!_get_opp_count(opp_table)) > goto put_table; > > ret = dev_pm_opp_set_rate(dev, clk_get_rate(opp_table->clk)); > put_table: > /* Drop reference taken by _find_opp_table() */ > dev_pm_opp_put_opp_table(opp_table); > > return ret; > } > EXPORT_SYMBOL_GPL(dev_pm_opp_sync_with_clk_rate); I am not sure why you still need this, hope we were going another way ? Anyway I will have a look at what you have posted now. -- viresh