From patchwork Fri Jan 5 16:00:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13512351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B22E2C47258 for ; Fri, 5 Jan 2024 16:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hlEV59PgiARg8GOkqNKFh2oyKV6eXiJnpPt6FVaV90g=; b=d8kLIU0uRZEzLd 2opUH0oaDykOrhT7Hmg6UfFE6+P2u92Wnt5bzoHDvIfJZvcQtM/VO4F6BaHVCz0tWxOGlbOpXhwIN 4m8uwgsHbJewPrrHSyF89xNPHiaQuTFGxOlvjdQaC7kxaNRbb7dY71XHwMONF3jlPWsBZu4Hm8wb5 azC4Ki/Ug4oSm2DJWN2sZiWfvUNyBm8BVUzYyucdSyxT9LskqdUvqCfFe0ECi76pXRLR9jLo5qSuM ZZEqHX1zNbMeH+1fY8pHZE5F78S+5roNmfFYRtDa/8AXvqFyUtYOegYMA3esxQRGj6svuKx1f/c/P NkamnQIsQ3LTMWd7nzOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLmdH-00HF7Z-2U; Fri, 05 Jan 2024 16:01:15 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLmdE-00HF5j-0e for linux-arm-kernel@lists.infradead.org; Fri, 05 Jan 2024 16:01:13 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50e7f58c5fbso2201667e87.1 for ; Fri, 05 Jan 2024 08:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704470469; x=1705075269; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=38V7OcbMS6BvfR/Kfa+Il7csYOikckmVIMPsPO2mrzc=; b=SYT34ONISgYLyLa3YejLtQ4ChgzlOS5jJP3ghCYNLGEXOVn4o2b5JhESXaUUFkvwaB eyMwkeBYk6SgHtPWM7eNQCuJV556LhJMIcuLXTv1brDESXBkrE8xLkxmY5lImzPLBqSp +dtNuaRrD8Wp5D4FubwA6zFAJnOGd39z8cQHsdvwRPlSMXgf44O7DhMoUKn1JQYMuE5/ gefoZOi3PBWHt6i4ulneFHDiFx0KG69mGv0yBs8wR0vNKyIgWdjC8+cDdXTLXV/hM/wB zKd3FPvqaIBv1qF5d3rXeMrBO3/9tVROIpBPujpRFVm4galVfm8zVWbrEcTnPvdjyn03 PwPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704470469; x=1705075269; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=38V7OcbMS6BvfR/Kfa+Il7csYOikckmVIMPsPO2mrzc=; b=Gicj9EiAYAdMnGMucCe0A0Vc3zI27Hp18WPjLEJyCpkEzRsoqyBmWhQaySsy1EoN7N GhCyOG4AltX7k2mqa63qQHbIQTQl7VTk5arKtg+fgn0Dpr0a5Go9LvRX5FQM+lgJ/YpS WpjubilSSz5VioifoLqb+NwJBLEFLau6KwmPVB0VLzXshoV1Uz6AVvE8XzuUfWDsgK2v a2TAx6aLRVZwOcEyTCp1qaTbM1Otbg28ik1mvIW/+dmt96Lm7mBHIgkQkKv2joYhMkmc I6+mULV/50i1uSmlRUOA4ZfL9j7JuqBGWZCjY7cSVMa6AESM5gSqXQYKGb+xFR8jIAb3 J20g== X-Gm-Message-State: AOJu0YwKOY56BlBsa575MLrg6hwvLWBqFvKhIHctv5CIOqrNNUSgSP9i /Dw60YMGHgVfFF/tzAngkqzOEMiM6HNyLQ== X-Google-Smtp-Source: AGHT+IFh9YVPZuE9tKS0AFwt3Ec/+vDaZEOHyXj2dDkN6g3GOJ4V2yIMVU7V8xUNC8GjeZWedVH3Zw== X-Received: by 2002:a05:6512:2315:b0:50e:6ec3:6a42 with SMTP id o21-20020a056512231500b0050e6ec36a42mr1573154lfu.126.1704470469081; Fri, 05 Jan 2024 08:01:09 -0800 (PST) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id n5-20020a056512310500b0050e76978861sm262094lfb.277.2024.01.05.08.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 08:01:08 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Greg Kroah-Hartman , Viresh Kumar , linux-pm@vger.kernel.org Cc: Ulf Hansson , Sudeep Holla , Kevin Hilman , Konrad Dybcio , Bjorn Andersson , Nikunj Kela , Prasad Sodagudi , Stephan Gerhold , Ben Horgan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 0/5] PM: domains: Add helpers for multi PM domains to avoid open-coding Date: Fri, 5 Jan 2024 17:00:58 +0100 Message-Id: <20240105160103.183092-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240105_080112_236960_E8A81F2C X-CRM114-Status: GOOD ( 15.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Updates in v2: - Ccing Daniel Baluta and Iuliana Prodan the NXP remoteproc patches to requests help with testing. - Fixed NULL pointer bug in patch1, pointed out by Nikunj. - Added some tested/reviewed-by tags. Attaching/detaching of a device to multiple PM domains has started to become a common operation for many drivers, typically during ->probe() and ->remove(). In most cases, this has lead to lots of boilerplate code in the drivers. This series adds a pair of helper functions to manage the attach/detach of a device to its multiple PM domains. Moreover, a couple of drivers have been converted to use the new helpers as a proof of concept. Note 1) The changes in the drivers have only been compile tested, while the helpers have been tested along with a couple of local dummy drivers that I have hacked up to model both genpd providers and genpd consumers. Note 2) I was struggling to make up mind if we should have a separate helper to attach all available power-domains described in DT, rather than providing "NULL" to the dev_pm_domain_attach_list(). I decided not to, but please let me know if you prefer the other option. Note 3) For OPP integration, as a follow up I am striving to make the dev_pm_opp_attach_genpd() redundant. Instead I think we should move towards using dev_pm_opp_set_config()->_opp_set_required_devs(), which would allow us to use the helpers that $subject series is adding. Kind regards Ulf Hansson Ulf Hansson (5): PM: domains: Add helper functions to attach/detach multiple PM domains remoteproc: imx_dsp_rproc: Convert to dev_pm_domain_attach|detach_list() remoteproc: imx_rproc: Convert to dev_pm_domain_attach|detach_list() remoteproc: qcom_q6v5_adsp: Convert to dev_pm_domain_attach|detach_list() media: venus: Convert to dev_pm_domain_attach|detach_list() for vcodec drivers/base/power/common.c | 134 +++++++++++++++ drivers/media/platform/qcom/venus/core.c | 12 +- drivers/media/platform/qcom/venus/core.h | 7 +- .../media/platform/qcom/venus/pm_helpers.c | 48 ++---- drivers/remoteproc/imx_dsp_rproc.c | 82 +-------- drivers/remoteproc/imx_rproc.c | 73 +------- drivers/remoteproc/qcom_q6v5_adsp.c | 160 ++++++++---------- include/linux/pm_domain.h | 38 +++++ 8 files changed, 289 insertions(+), 265 deletions(-)