From patchwork Mon Jan 18 00:55:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365833 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 ADBBCC433E0 for ; Mon, 18 Jan 2021 00:56:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E97F2250F for ; Mon, 18 Jan 2021 00:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730132AbhARA40 (ORCPT ); Sun, 17 Jan 2021 19:56:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730234AbhARA4R (ORCPT ); Sun, 17 Jan 2021 19:56:17 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53774C061574; Sun, 17 Jan 2021 16:55:37 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id x20so21600566lfe.12; Sun, 17 Jan 2021 16:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+a0TnX2ybR+9zT3v5f4ICq5eAhyFrIALU+uTlPBGTCA=; b=CtxxSCvcUvDVc5k8siym1L1Xn7APGDTcrMhrLOFN2UQetgZ7xyxXaxg6eSSHZsKb8A 6Ccdfc6/+YOSmbJZnNxiLBfBZP4ZEOjIUtrPVZKe9qcKvL1dbJf/hX9DZjhqbr/7c+TD ePsSN9B7c6DQmA2m25xvJCJEFYn//ffKWLDM6dW/fhyWTkSdV3PhVEvXy+7YJRjvdrck KLpCWaSmYbL1SbHtXrUGpm5k2KriF8Gj62xST9Q69wUDWxrKAHSoqRLZCUP6sUAjTz56 dpTIFnodEmHhGVF57TBBGf2ZGt2lC+ZW3PO+pdbe5UURg/2IuG16m28h+oOVAT/sou5i YcbA== 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:mime-version:content-transfer-encoding; bh=+a0TnX2ybR+9zT3v5f4ICq5eAhyFrIALU+uTlPBGTCA=; b=Ux+4C/Jc4/LHXrIs5DEKkKauUG1SgQsmK6rH/Ljrh5a0NbKO0sS4aqJpEobaJF0met nj8L3DhfOHOAIazkRka3CNabUKKk0JnkuYZ1r9CjvbpXGfxi5taZuyykvfy/Ijb8sy6B G5oc8Dqa7F8PgXtxHWoZAgUcTT0Y1GDqS/20LKZf/lJliyDIBUoFoiVmalfAT/2JWN0H mQzrDpHxU+Imsq8DV8r4xqahPCOjhmWBtwKHHv1N5JGSUVZAc2mqBTGwGc8LHsiNXHKE bplmIw2vvoi3NIOE+X9PtOnoWIuxTxL0yRVisB0AAviG9eM8fX6LuhyhgSOHqzVu/sdv rVnA== X-Gm-Message-State: AOAM530TouF9+g7Skrswpby8TKVX556Qk1NzubSRgwxVH/poZXIVpKlY DaoXPXP+ketIcmXeYegCgPUfD+dbHf8= X-Google-Smtp-Source: ABdhPJx5WCEh/lj3K7rWyUD+Rzb3nCDmTazV0J0o5LiH8805KR36AAf7zFIST3A2ciVyrfS08FtVPg== X-Received: by 2002:a19:7507:: with SMTP id y7mr8737220lfe.554.1610931335896; Sun, 17 Jan 2021 16:55:35 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id m24sm1484553ljj.62.2021.01.17.16.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 16:55:35 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Nishanth Menon , Yangtao Li , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 01/12] opp: Fix adding OPP entries in a wrong order if rate is unavailable Date: Mon, 18 Jan 2021 03:55:13 +0300 Message-Id: <20210118005524.27787-2-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118005524.27787-1-digetx@gmail.com> References: <20210118005524.27787-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Fix adding OPP entries in a wrong (opposite) order if OPP rate is unavailable. The OPP comparison was erroneously skipped, thus OPPs were left unsorted. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index dfc4208d3f87..48618ff3e99e 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1527,12 +1527,10 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, mutex_lock(&opp_table->lock); head = &opp_table->opp_list; - if (likely(!rate_not_available)) { - ret = _opp_is_duplicate(dev, new_opp, opp_table, &head); - if (ret) { - mutex_unlock(&opp_table->lock); - return ret; - } + ret = _opp_is_duplicate(dev, new_opp, opp_table, &head); + if (ret) { + mutex_unlock(&opp_table->lock); + return ret; } list_add(&new_opp->node, head); From patchwork Mon Jan 18 00:55:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365832 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=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 CC1A6C433E0 for ; Mon, 18 Jan 2021 00:56:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A24BC20758 for ; Mon, 18 Jan 2021 00:56:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730355AbhARA4f (ORCPT ); Sun, 17 Jan 2021 19:56:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730258AbhARA4U (ORCPT ); Sun, 17 Jan 2021 19:56:20 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20D98C0613C1; Sun, 17 Jan 2021 16:55:40 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id o13so21663708lfr.3; Sun, 17 Jan 2021 16:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ORGCA2NNYd6672ynomRyYjTRM+EXXCwELHNI7EanuCU=; b=pN9Mjcz0nokQWkTvVfz5+Lt8ICl1kGOENr5AdsNb5nYEy+cYI29WvO/meLDMeXjM/F Z/IvMq03D3bXqal8c246kwJ/I+Ut6Y4FNjBZ0Fq/4z+xOIhM/72sPt+kTtYmPR9+mP1v J/59PY0byw7OoPppfK35xDgCm/r6KOZ4QLAlrefk4dl8/Y3dJaAOT4z2A72zJsE63czq t4NzHv6tJlZaBr7m2HoGlLRwr4FLslBNvyBAmV6OHl8sooCnlMxd9KfOjkfoO+GpsOWY al79hbQGZD8QxjDPUB8y9ZTDT8H4+drv/yFf2RWnb/+UleSq4FIhZvuDRR1Hjoq+9i7G FiyA== 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:mime-version:content-transfer-encoding; bh=ORGCA2NNYd6672ynomRyYjTRM+EXXCwELHNI7EanuCU=; b=pS1B58/gHEZSt9e6oAJutX+nUDp0RT2QNkHSmQvW9WtB+tBkXwSAg5RyOSx429m5Pg LeVWdbdZBm/CjByOY5i7iKBz2cm8dHKs1WRuX8Hl39T6Vz6weYrgeEw49n4mSW+PLIbK Zea04ulfs+oZJ/9+FC1luDvcPEGidD+7WfeCumhGhgJndPHYXDBI7ZRwe0lk6FqmB99v 2cIWSo8r9F+BOMMO2+7zr8L82WMh0C4uR47V2FHJAt8Bdejd12edwtBpR5BdED6KZQds dyha/WrAVx1Z/YAZNCjo6TU7wYvPgoMaAceYn8iSM643nxwkfCc/Armoe/avSv29AEOI yg3g== X-Gm-Message-State: AOAM530iR18J2+KgJYNTg+lnaQgYFRS9WBOIx3vSLq/CmE793oxtjCfb OVp5IQPMfLjirVdXy8L/oYQ= X-Google-Smtp-Source: ABdhPJxMSTh9dMUpjPVmeMl/WvlsAqwhhMIuN747VN0oDre3vhFgUw/zEZw8Jd31NCMx+KK/qnnQQQ== X-Received: by 2002:ac2:5ec1:: with SMTP id d1mr9620671lfq.589.1610931338709; Sun, 17 Jan 2021 16:55:38 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id m24sm1484553ljj.62.2021.01.17.16.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 16:55:38 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Nishanth Menon , Yangtao Li , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 04/12] opp: Add dev_pm_opp_sync_regulators() Date: Mon, 18 Jan 2021 03:55:16 +0300 Message-Id: <20210118005524.27787-5-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118005524.27787-1-digetx@gmail.com> References: <20210118005524.27787-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Extend OPP API with dev_pm_opp_sync_regulators() function, which syncs voltage state of regulators. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 45 ++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 51 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 7b4d07279638..99d18befc209 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2686,3 +2686,48 @@ void dev_pm_opp_remove_table(struct device *dev) dev_pm_opp_put_opp_table(opp_table); } EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table); + +/** + * dev_pm_opp_sync_regulators() - Sync state of voltage regulators + * @dev: device for which we do this operation + * + * Sync voltage state of the OPP table regulators. + * + * Return: 0 on success or a negative error value. + */ +int dev_pm_opp_sync_regulators(struct device *dev) +{ + struct opp_table *opp_table; + struct regulator *reg; + int i, ret = 0; + + /* Device may not have OPP table */ + opp_table = _find_opp_table(dev); + if (IS_ERR(opp_table)) + return 0; + + /* Regulator may not be required for the device */ + if (!opp_table->regulators) + goto put_table; + + mutex_lock(&opp_table->lock); + + /* Nothing to sync if voltage wasn't changed */ + if (!opp_table->enabled) + goto unlock; + + for (i = 0; i < opp_table->regulator_count; i++) { + reg = opp_table->regulators[i]; + ret = regulator_sync_voltage(reg); + if (ret) + break; + } +unlock: + mutex_unlock(&opp_table->lock); +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_regulators); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index c24bd34339d7..1c3a09cc8dcd 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -162,6 +162,7 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cp int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask); void dev_pm_opp_remove_table(struct device *dev); void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask); +int dev_pm_opp_sync_regulators(struct device *dev); #else static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev) { @@ -398,6 +399,11 @@ static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask { } +static inline int dev_pm_opp_sync_regulators(struct device *dev) +{ + return -ENOTSUPP; +} + #endif /* CONFIG_PM_OPP */ #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) From patchwork Mon Jan 18 00:55:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365830 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 42461C433DB for ; Mon, 18 Jan 2021 01:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00F9820758 for ; Mon, 18 Jan 2021 01:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730466AbhARA5J (ORCPT ); Sun, 17 Jan 2021 19:57:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbhARA5C (ORCPT ); Sun, 17 Jan 2021 19:57:02 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1006DC0613CF; Sun, 17 Jan 2021 16:55:41 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id o19so21662780lfo.1; Sun, 17 Jan 2021 16:55:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sBN+qDoZ+2xkp7oR26gY6Zqd1Sn2t+N/0CHYfu4wuTs=; b=N0kolekTv77LULSo5h6UrdruKTf1gLmyDoikAjHTHvjvlGzKnBG70ARv3fuLhBY164 2VEgD1/OEx/MBrvW9vhJ46zvVywamJBUQrGKbCXVa1obaxq8HsxMjLZri8mGU0EF/542 VUwmJ0Vr9Ji1kpXYQhkZs8WzOM8aCsLB78OrlJxx7P8KxF5R4z+y/oBsn1fhDuX7qvhr 1Ks13u1w3TzEZhUsnbXL6/YGAD7l4+okG5WAaHDSWkjHF+0cI8H8Z+Powu+5yv61WvJZ /F9bxBRuvFCrHRd3v3YorqJSZa6INnexi2Mu1WOPn4Rw9ppIrxJAdlhYxU6UuE3JJXNZ JFxA== 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:mime-version:content-transfer-encoding; bh=sBN+qDoZ+2xkp7oR26gY6Zqd1Sn2t+N/0CHYfu4wuTs=; b=HOU7/f1oNe8jXS4MlWdkrJYpdalyWN6BCw9hcUqE55f8pVtL3ZZjVTFMn6qrr5oipg 7RKwUoW/TEIF2cXx2S6+uxGPMIHt9pTKcBXPZRayLBVSnEC+QlueCCd3dN47bSzJwDbe kpDAoclol2tsaSdMpZ2Buqs8spfTRFe6bgMndING2l8EytTLHpqZsw6RE4X05Su8JV9F DeX0iranEzAjmgdjajfylSzJ3K2TUW2jLSWM4zHh6/lFcBZbcqwjKrscF30plovRv7I4 BJAqbTjj+0gxYtKOlHm3l/4u5D77TLxrI/rn3LUaySD8PeQqhjpksAVI8okJfEI9kEy/ L+Dg== X-Gm-Message-State: AOAM532M5n3Y+p5ir1ReXZ0XzTkhGD6bl9I1wRL7xvv+Y9KgIiSazRnu UkeDJcwH7FdGw/FFIbLCYH6XloWLyXE= X-Google-Smtp-Source: ABdhPJwxl910tMjxSVp26/+RBgN0gD4sr24MoLEbRgE8/1QfcPtpCWGwLKnAJsKiMRA4dczyQbE+mw== X-Received: by 2002:ac2:5201:: with SMTP id a1mr8388633lfl.515.1610931339627; Sun, 17 Jan 2021 16:55:39 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id m24sm1484553ljj.62.2021.01.17.16.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 16:55:39 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Nishanth Menon , Yangtao Li , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 05/12] opp: Add dev_pm_opp_set_voltage() Date: Mon, 18 Jan 2021 03:55:17 +0300 Message-Id: <20210118005524.27787-6-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118005524.27787-1-digetx@gmail.com> References: <20210118005524.27787-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add dev_pm_opp_set_voltage() which allows OPP table users to set voltage in accordance to a given OPP. In particular this is needed for driving voltage of a generic power domain which uses OPPs and doesn't have a clock. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 55 ++++++++++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 +++++ 2 files changed, 61 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 99d18befc209..341484d58e6c 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2731,3 +2731,58 @@ int dev_pm_opp_sync_regulators(struct device *dev) return ret; } EXPORT_SYMBOL_GPL(dev_pm_opp_sync_regulators); + +/** + * dev_pm_opp_set_voltage() - Change voltage of regulators + * @dev: device for which we do this operation + * @opp: opp based on which the voltages are to be configured + * + * Change voltage of the OPP table regulators. + * + * Return: 0 on success or a negative error value. + */ +int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp) +{ + struct opp_table *opp_table; + struct regulator *reg; + int ret = 0; + + /* Device may not have OPP table */ + opp_table = _find_opp_table(dev); + if (IS_ERR(opp_table)) + return 0; + + /* Regulator may not be required for the device */ + if (!opp_table->regulators) + goto put_table; + + /* This function only supports single regulator per device */ + if (WARN_ON(opp_table->regulator_count > 1)) { + dev_err(dev, "multiple regulators are not supported\n"); + ret = -EINVAL; + goto put_table; + } + + mutex_lock(&opp_table->lock); + + reg = opp_table->regulators[0]; + ret = _set_opp_voltage(dev, reg, opp->supplies); + + if (!opp_table->enabled) { + ret = regulator_enable(reg); + if (ret < 0) { + dev_warn(dev, "Failed to enable regulator: %d", ret); + goto unlock; + } + + opp_table->enabled = true; + } +unlock: + mutex_unlock(&opp_table->lock); +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_set_voltage); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 1c3a09cc8dcd..f344be844bde 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -163,6 +163,7 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) void dev_pm_opp_remove_table(struct device *dev); void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_sync_regulators(struct device *dev); +int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp); #else static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev) { @@ -404,6 +405,11 @@ static inline int dev_pm_opp_sync_regulators(struct device *dev) return -ENOTSUPP; } +static inline int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp) +{ + return -ENOTSUPP; +} + #endif /* CONFIG_PM_OPP */ #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) From patchwork Mon Jan 18 00:55:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365827 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 C408AC433E9 for ; Mon, 18 Jan 2021 01:05:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E33E207AE for ; Mon, 18 Jan 2021 01:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730539AbhARBF0 (ORCPT ); Sun, 17 Jan 2021 20:05:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730433AbhARA5E (ORCPT ); Sun, 17 Jan 2021 19:57:04 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE51CC0613ED; Sun, 17 Jan 2021 16:55:43 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id o13so21663816lfr.3; Sun, 17 Jan 2021 16:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vgDoSUPRoPUFpDdr936+57Rv3VyE6xZwg/R405Zj7FM=; b=Q9Xr1KYDDf/wQO0QAAoJdCsR2X3CU7X12Zn+9x7ok8bjlryXvSfBcnYhXSGFpEjT/B nDqZ6GJkMxI8xISHL/hgL9NIDd+mI7Lv+cPCvTPFQwPfOcZsmDKiPAk0njQJyGJTqSA8 MlsZtl7ST3Wj/kG9MNcptgsppWrwLTRsEEZsmApI0JimIQoGoOrI/KL3spNwUAdVyMTn 1OqS/98Hg8uVZIKW0nuwpSQh7rly8krNrgY4RjNORxzmsQFgEfMZGMlESAUqBRB0XpW7 UshUuvEtwfV7valYKFBhg18jtXBcOkMIu99RrZWqHhCxlpXHGv+d/h3LYmYgt6RUndGj U5VQ== 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:mime-version:content-transfer-encoding; bh=vgDoSUPRoPUFpDdr936+57Rv3VyE6xZwg/R405Zj7FM=; b=HUBqg7V+b8IqLvuwJC633ZsV/ID6nRUwxevu/CDaymfM2O94+sKNdwMclIljClnoHY hR6g+qQCdBQ56AuftQAhn+yRtvy9EU4Nuu7aMpqKYYa5oeZ3EvLuY3eA6K0UDbzp6cvI G/Qunpfm8tpDNaXXb1OYzJt9iWEewgLw2aiAkAdxpbIj3vz8XeD0nK54b+zUwhmnnWMq ueKXvXH0ZoCe5xojpXgbbDPVzq6Hh2zbJDCtYB9FyK7hjUXRKl8bKnZz3qMpDVOuIMJC I8jB3RUzIGZZfjK83NG7pDwnHaQLeN7qUn286W4jvEWy5NSo9UrAsp6Yq9ANcKRiBUHH cywg== X-Gm-Message-State: AOAM531iBOTfLZdWYzFBuNKbR3+6+8F7bcBRzbJwyC00k3ByUxPLEIF9 KeV/KM9alwNh9A9zs3Rub3s= X-Google-Smtp-Source: ABdhPJyVyFQhDEzOgofsjcTMdMzB3JK/5khRhA4EtPdSZyVBvc2EQbXNf/IfFQoYpIg2bvHagCpgag== X-Received: by 2002:a19:6459:: with SMTP id b25mr9607365lfj.635.1610931342481; Sun, 17 Jan 2021 16:55:42 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id m24sm1484553ljj.62.2021.01.17.16.55.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 16:55:42 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Nishanth Menon , Yangtao Li , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 08/12] opp: Add devm_pm_opp_register_set_opp_helper Date: Mon, 18 Jan 2021 03:55:20 +0300 Message-Id: <20210118005524.27787-9-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118005524.27787-1-digetx@gmail.com> References: <20210118005524.27787-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add resource-managed version of dev_pm_opp_register_set_opp_helper(). Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 8 ++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index fde2ec00ab0e..8e0d2193fd5f 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2857,3 +2857,37 @@ int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp) return ret; } EXPORT_SYMBOL_GPL(dev_pm_opp_set_voltage); + +static void devm_pm_opp_unregister_set_opp_helper(void *data) +{ + dev_pm_opp_unregister_set_opp_helper(data); +} + +/** + * devm_pm_opp_register_set_opp_helper() - Register custom set OPP helper + * @dev: Device for which the helper is getting registered. + * @set_opp: Custom set OPP helper. + * + * This is a resource-managed version of dev_pm_opp_register_set_opp_helper(). + * + * Return: pointer to 'struct opp_table' on success and errorno otherwise. + */ +struct opp_table * +devm_pm_opp_register_set_opp_helper(struct device *dev, + int (*set_opp)(struct dev_pm_set_opp_data *data)) +{ + struct opp_table *opp_table; + int err; + + opp_table = dev_pm_opp_register_set_opp_helper(dev, set_opp); + if (IS_ERR(opp_table)) + return opp_table; + + err = devm_add_action_or_reset(dev, devm_pm_opp_unregister_set_opp_helper, + opp_table); + if (err) + return ERR_PTR(err); + + return opp_table; +} +EXPORT_SYMBOL_GPL(devm_pm_opp_register_set_opp_helper); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index e072148ae0e1..6de5853aaada 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -169,6 +169,7 @@ void dev_pm_opp_remove_table(struct device *dev); void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_sync_regulators(struct device *dev); int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp); +struct opp_table *devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); #else static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev) { @@ -428,6 +429,13 @@ static inline int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp * return -ENOTSUPP; } +static inline struct opp_table * +devm_pm_opp_register_set_opp_helper(struct device *dev, + int (*set_opp)(struct dev_pm_set_opp_data *data)) +{ + return ERR_PTR(-ENOTSUPP); +} + #endif /* CONFIG_PM_OPP */ #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) From patchwork Mon Jan 18 00:55:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365829 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 BD45CC4332D for ; Mon, 18 Jan 2021 01:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8430B2250F for ; Mon, 18 Jan 2021 01:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730620AbhARBDt (ORCPT ); Sun, 17 Jan 2021 20:03:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730436AbhARA5E (ORCPT ); Sun, 17 Jan 2021 19:57:04 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C93B3C061786; Sun, 17 Jan 2021 16:55:44 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id m25so21599203lfc.11; Sun, 17 Jan 2021 16:55:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QLPIfKPwYX5SNI2taLqEpDVVxuBGhm+P/85rwSfPkA8=; b=NLXB4ayekAjXRjsu8jPpTl41qXyhkUxkvb9o9/yqhHOEvKgQLslVlGJTIkcv43BLPo ckHAExViue2jU8DBzie491RWKnMhqsXdxS/tDTZFx7xVk/k19DCpdQlaHfuJxmXLOpSc YBwjBXA+lsfIwLDjyPvGlefi1VSwyManWxk8a8Zmr1luEFR4xjvf7lus6NkMwC2U9CPX f6XJ380gSwfeXvIGk0xlB90wG82wDFtwr9ep+4SNtUrodQrRXq4l0ZmTw8dAW0IHokTh 7LfFYxibouKAHxYMZu8BQqEJ+x7Oi5ytajf/nTVjyafFf8YYMZP98bM1Z9v9fPEKaBvx mJkg== 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:mime-version:content-transfer-encoding; bh=QLPIfKPwYX5SNI2taLqEpDVVxuBGhm+P/85rwSfPkA8=; b=lge/uy+7m9Rey0rinBnAnqCt8/4ZPq+wHkoasRBr7+eEzOOFeYurnzN3Qt1PV1xTiw g7Enj4Z4M2cYtpY3xm8cPO/o4yVeLLOFLTMg+7xFWZhrMaX2GoO5VQiLJ4BLFXFKXN5y 8sigVrRHaP0DsrmAucKob1N0XAG9BmVPdLPVqIb+6YyPyRxcn9LDz9RX393evsOHuUgS 7t4G33z0tZGlZ+jBp4cM0JBBR+2iCXQCQmgblT9xR8p4b/VOpzfY7LYYa8zfD5106QoW JTUfQKG4obLsaaAteC8bz3Yq4yYbOKuSJaEVjw9n8RfB7xC/km+AEQdRmo0xIrI27KIz cFyg== X-Gm-Message-State: AOAM530UBmROfCX2ARtpVVgHHxUCpJTuq4RC581Ci8v404TWzxmxsJZ1 Vm67R/fsktwwt7P8h+ZjQ8I= X-Google-Smtp-Source: ABdhPJycsd/DptfAMvflHjHcqyL5YTSyHEYOaBxhLvtXy18zfMIe8CFN1aBbB4IBWFgNf3huq4l9+A== X-Received: by 2002:a19:651a:: with SMTP id z26mr9970794lfb.306.1610931343400; Sun, 17 Jan 2021 16:55:43 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id m24sm1484553ljj.62.2021.01.17.16.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 16:55:43 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Nishanth Menon , Yangtao Li , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 09/12] opp: Add devm_pm_opp_attach_genpd Date: Mon, 18 Jan 2021 03:55:21 +0300 Message-Id: <20210118005524.27787-10-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118005524.27787-1-digetx@gmail.com> References: <20210118005524.27787-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add resource-managed version of dev_pm_opp_attach_genpd(). Signed-off-by: Dmitry Osipenko --- drivers/opp/core.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 8 ++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 8e0d2193fd5f..49419ab9fbb4 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2891,3 +2891,38 @@ devm_pm_opp_register_set_opp_helper(struct device *dev, return opp_table; } EXPORT_SYMBOL_GPL(devm_pm_opp_register_set_opp_helper); + +static void devm_pm_opp_detach_genpd(void *data) +{ + dev_pm_opp_detach_genpd(data); +} + +/** + * devm_pm_opp_attach_genpd - Attach genpd(s) for the device and save virtual device pointer + * @dev: Consumer device for which the genpd is getting attached. + * @names: Null terminated array of pointers containing names of genpd to attach. + * @virt_devs: Pointer to return the array of virtual devices. + * + * This is a resource-managed version of dev_pm_opp_attach_genpd(). + * + * Return: pointer to 'struct opp_table' on success and errorno otherwise. + */ +struct opp_table * +devm_pm_opp_attach_genpd(struct device *dev, const char **names, + struct device ***virt_devs) +{ + struct opp_table *opp_table; + int err; + + opp_table = dev_pm_opp_attach_genpd(dev, names, virt_devs); + if (IS_ERR(opp_table)) + return opp_table; + + err = devm_add_action_or_reset(dev, devm_pm_opp_detach_genpd, + opp_table); + if (err) + return ERR_PTR(err); + + return opp_table; +} +EXPORT_SYMBOL_GPL(devm_pm_opp_attach_genpd); diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 6de5853aaada..eefd0b15890c 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -170,6 +170,7 @@ void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask); int dev_pm_opp_sync_regulators(struct device *dev); int dev_pm_opp_set_voltage(struct device *dev, struct dev_pm_opp *opp); struct opp_table *devm_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data)); +struct opp_table *devm_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs); #else static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev) { @@ -436,6 +437,13 @@ devm_pm_opp_register_set_opp_helper(struct device *dev, return ERR_PTR(-ENOTSUPP); } +static inline struct opp_table * +devm_pm_opp_attach_genpd(struct device *dev, const char **names, + struct device ***virt_devs) +{ + return ERR_PTR(-ENOTSUPP); +} + #endif /* CONFIG_PM_OPP */ #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF) From patchwork Mon Jan 18 00:55:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 365828 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 E92FDC433E0 for ; Mon, 18 Jan 2021 01:04:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C26922137B for ; Mon, 18 Jan 2021 01:04:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729919AbhARBDq (ORCPT ); Sun, 17 Jan 2021 20:03:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730472AbhARA5L (ORCPT ); Sun, 17 Jan 2021 19:57:11 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B18D1C061795; Sun, 17 Jan 2021 16:55:47 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id w26so16519202ljo.4; Sun, 17 Jan 2021 16:55:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DilXPRI3TRJmzULgddpAwxGtKs9uc5bXa700Snpt8eg=; b=jkazrJTlp36hPiUFrC7+kV3l/6K9OcH+n0l0ToQZJatwEfH45vuOuQHKdbSx5Agt/m Zkx4gfKuxm8joxqX1fCVKjv7tfssLoyYjVBzVbctl4sHyY31hy2etFKh5TVmGHunzGVI wPoW89LcSShSPDDGOzHRofjldjka5fVLPMgggkwnu1crxdMRmSPz8+dz2F4YrHWV2RrJ jCeJtjFJV+hsdcu0GYJJYVIBKfiiKP4ggQ0wjotl4yJ1RhXZEuWz7fmiQlkPh4hkgIwV /gD6sxhVwLpG9Sq+P0k6ktUIuGfpb1HLxo129X+uf5ZDsRhPvKjZQKfkTICNf9HtvS0R hK8w== 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:mime-version:content-transfer-encoding; bh=DilXPRI3TRJmzULgddpAwxGtKs9uc5bXa700Snpt8eg=; b=YejkF1/uF7f5rPtNmCHgCRruilv7dIfoQP0fODcbnbKZJKfccrV9dvxoCuK2pgx7hD /o4AqqTefUQIg27O19FYvBU9jVGO2ku5D6aOmQ4OGgSJatFdkUggOI7Ep+wtq7Z1tXRk lVMwTQPQPuFaKOfSsTS6HtCfpo3kotzadMW4KrxN6553/SC83WWqEF+VMTLcAJ+oAfNB MeyLg8aE5W4Nfs8T2IecvGIzRD1sP4k1FwUq7nzdKZhRUg86XyUFPdJLByHwH9neewpG Jh9mXSoN9T/1FP4pGAyUHD8bsDbjv4TMm4jXbLjFd5qHf0RzyfQ8lhtBuo5y3DKoja2r uSDw== X-Gm-Message-State: AOAM531yrYcu1sFMV1B44rv5e3BMCdEPq9TQywIgIHh+gokh92aci7QK qyvHQ4w6YAZ9HVCbsFFzL5Fv2+Wcjps= X-Google-Smtp-Source: ABdhPJwJPyNTEMevAfSEECE2toaXbJUsIn96iIntXcmUHGkNfR12JhXMpsdGv6/2GG1f0eSXZU1wzA== X-Received: by 2002:a2e:9497:: with SMTP id c23mr9805613ljh.362.1610931346276; Sun, 17 Jan 2021 16:55:46 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id m24sm1484553ljj.62.2021.01.17.16.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 16:55:45 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Peter Geis , Nicolas Chauvet , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Nishanth Menon , Yangtao Li , Matt Merhar Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH v3 12/12] opp: Print OPP level in debug message of _opp_add_static_v2() Date: Mon, 18 Jan 2021 03:55:24 +0300 Message-Id: <20210118005524.27787-13-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118005524.27787-1-digetx@gmail.com> References: <20210118005524.27787-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Print OPP level in debug message of _opp_add_static_v2(). This helps to chase GENPD bugs. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Tested-by: Matt Merhar Signed-off-by: Dmitry Osipenko --- drivers/opp/of.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 63b16cdba5ea..758730d070da 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -822,10 +822,11 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, if (new_opp->clock_latency_ns > opp_table->clock_latency_ns_max) opp_table->clock_latency_ns_max = new_opp->clock_latency_ns; - pr_debug("%s: turbo:%d rate:%lu uv:%lu uvmin:%lu uvmax:%lu latency:%lu\n", + pr_debug("%s: turbo:%d rate:%lu uv:%lu uvmin:%lu uvmax:%lu latency:%lu level:%u\n", __func__, new_opp->turbo, new_opp->rate, new_opp->supplies[0].u_volt, new_opp->supplies[0].u_volt_min, - new_opp->supplies[0].u_volt_max, new_opp->clock_latency_ns); + new_opp->supplies[0].u_volt_max, new_opp->clock_latency_ns, + new_opp->level); /* * Notify the changes in the availability of the operable