From patchwork Thu Jun 3 09:34:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 453237 Delivered-To: patches@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp114800jao; Thu, 3 Jun 2021 02:34:45 -0700 (PDT) X-Received: by 2002:a2e:bf2a:: with SMTP id c42mr29060268ljr.1.1622712885656; Thu, 03 Jun 2021 02:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622712885; cv=none; d=google.com; s=arc-20160816; b=he0TPCpIxOMUI0H0vPnUQ+uDTf0TnWsI1tGBcm8AGNBQaFuvVoIx7MBO7AM7AtEcyH UmI5A8iH3zJgW4eT+ZKO7ftYlW4gcHEevGS6tSE+N7Aa/exFYcQAy1kkKyhFkFdxHwol rnqsw2ROr8l9vwtIP2xw4CHLNxY2vXsxwq78Erh21SAx82QB/nOCL64VHF+Tz2GUF90N ne0i/pPbihXYvLazDt636Gti1AQBnOzl7m7/T+x0BJOwZBUUFSdvd+X6p5ABI10Ko3T6 onvRaeiWxUgkxDmsGT1YCf6KGFPSts8F/l+gmywg5oK2mypfjjVK9jFBPVdYnaPa3rTx unww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=W2qohUx5zvhRLc6tyEmW8SgJ1vqoJNLaHxoGTkcoMlw=; b=Cxi+TKj1uwXvSq4SIcU4K1vc/ez1iPxIGPa/2iEZ8IRduwA51rxycMeEBB4i83a39S yPLix0f/sGf5mpvgZopE5qwIBP7/x3zWUC8ddfbmCj3eZSmQuk76Z1z+aFnqx3rNh4HT hIGRe8JC8+28W63/lCMDrlGFyrvalh1x2qg77OIMKT0YQTW8f0uw2sxyY/kx3ktDubSu TjZvvN0Sb5f9FDDWTBQFpRB8f06F97LgMF7qDJdk5MEcT+e9yMy8NbW6qbZiAH2vDZmB qYBIN1G64IUogLbb1Y3WMxnXOs04bFveEfZTBUpIvkqaLSlvdC+RBu7KgihS9zbRt1bC 9hXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nk8B/VdW"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q14sor564875lfc.111.2021.06.03.02.34.45 for (Google Transport Security); Thu, 03 Jun 2021 02:34:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nk8B/VdW"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=W2qohUx5zvhRLc6tyEmW8SgJ1vqoJNLaHxoGTkcoMlw=; b=nk8B/VdWmx3KAqA42yHHA3SMsqWeaAApkaBxCr8d7U/DoYUBhJk2eMiGbLG2xY3KSn 8yfkDnfYsyyB+JRo+vWsEoV3urS7U355PL27lVoLO4lo0N6ulYRZOeJOB/K4C1L3IJcJ qHgHTUEVUWH4EqPFK4iYVeDx0T5WA6VNFSGqTBilmHVAGUwShzf7rzqoewS5bm5T+YZD OTB4FxcnNFGJvSA3FIZxZEYEYJWGv6xZGTPrTcfr5amf61fOLQ7jp+1FYDAZR2lh8ETA y6/3fGJPh+DpX579pnaw9pO77k42Fyz6/xFcBupTzmOrccUjwFa49RazJ+ayor3O4Kbs 02Sg== 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:mime-version :content-transfer-encoding; bh=W2qohUx5zvhRLc6tyEmW8SgJ1vqoJNLaHxoGTkcoMlw=; b=o0MXqCQX3c8NYIa4sLq2egxha9N5ZYhHuPwoick7+/CXhErpsh4xln1oVqXq2/Jr66 ZUXXm6jK7PyVQDp+mbsSpm4Oi7EItDv+kpnyKOU8qAeyobsX5fF3LHpMfkPQZOqViWA1 taRoEWXbpcV2RU82ycRfgpp7Tg70EFamHfvZnGchjKQCZTd2RWI0Gsj8S+NCE8NBKgQK CJhIZwpNC1G+jxvuMzq61CExiLopbjyF2M+qPzaYrLFZvJL07qq3IVBB9prEdf80vmCK zXd9F7vH4yIXDVOI+RVa45Fj30xwECpssjksJEcfSO4KaNKnIRi2Z3H3izNFg5lVeC39 N/+Q== X-Gm-Message-State: AOAM531NLfAbQtHCJ8rt9mR36HeYuRoMMxkGCHYfGh4aAVLcrYxur0Jb nFgxZTRmsMAG+GWcq2KHW4grEsVh X-Google-Smtp-Source: ABdhPJxKARwFPjRnFkZHuPnu3FusqFdLnePffuVIc/oEngA5mhIyEyAAbQBPSM/kS6I3xgVoFP6VWQ== X-Received: by 2002:ac2:443b:: with SMTP id w27mr6921374lfl.295.1622712885178; Thu, 03 Jun 2021 02:34:45 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id q4sm263373lfc.172.2021.06.03.02.34.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:34:44 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org Cc: Ulf Hansson , Dmitry Osipenko , Jonathan Hunter , Thierry Reding , Rajendra Nayak , Stephan Gerhold , Roja Rani Yarubandi , Bjorn Andersson , Vincent Guittot , Stephen Boyd , linux-kernel@vger.kernel.org Subject: [PATCH v2 0/4] PM: domains: Avoid boilerplate code for DVFS in subsystem/drivers Date: Thu, 3 Jun 2021 11:34:34 +0200 Message-Id: <20210603093438.138705-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Various discussions on LKML have pointed out that many subsystem/drivers for devices that may be attached to a genpd and which manages DVFS/OPP though the genpd performance states, would need very similar updates. More precisely, they would likely have to call dev_pm_opp_set_rate|opp() to drop and restore OPPs (which propagates upwards into performance states votes in genpd), every time their devices should enter/exit a low power state, via their device PM callbacks. Rather than having to add the boilerplate code for these things into the subsystems/drivers, this series implements the logic internally into genpd. Concerns have been raised about this approach, mostly by myself, around that it limits flexibility. On the other hand, it starts to look like more and more people are requesting this to be manged internally in genpd, for good reasons. So, I think it's worth to give this a try. In the long run, if it turns out that the flexibility was indeed needed, we can always deal with that as special cases on top. Test and reviews are of course greatly appreciated! Kind regards Ulf Hansson Ulf Hansson (4): PM: domains: Split code in dev_pm_genpd_set_performance_state() PM: domains: Return early if perf state is already set for the device PM: domains: Drop/restore performance state votes for devices at runtime PM PM: domains: Drop/restore performance state votes for devices at system PM drivers/base/power/domain.c | 70 +++++++++++++++++++++++++++++-------- include/linux/pm_domain.h | 2 ++ 2 files changed, 58 insertions(+), 14 deletions(-) -- 2.25.1