From patchwork Thu Dec 28 11:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13505952 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 3209BC3DA6E for ; Thu, 28 Dec 2023 11:42:43 +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=1G96UqIJMRTylioqhxApzaA65bIzvG6n+3YKBRXS8K8=; b=oXHQjprtUWH5G7 MAtA1s4zJGbiTQWV4AWyxKQw441fLvonEfqn351Tm5f8pn9kUgGictVOzqZzvFA32ssXioYB2EO5k 8di43onwo/Q9PBuEk/bFdrhOKbjAFh4VNYWhJSxza1B/J4jFNNTNgSkyU/pgy3hFX4PMjRc9ma0bu qliyY5R3KJUQkjOkufiafRVFANR/TkIKfaxLHSEwX0/gcOoeSJ2L2NbU/x+KLSicdmI5cTYsFP78U niyu6ayv223uJvqzni+IROA7GFr2M8SyAusf/O86IrZFzr7AazCpMvlxSPBPDCpfqJuijFZXK2kUa 5sKPQvpJteWq+O3/Vavg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rIomD-00Gl1i-35; Thu, 28 Dec 2023 11:42:13 +0000 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rIomB-00GkzD-1y for linux-arm-kernel@lists.infradead.org; Thu, 28 Dec 2023 11:42:13 +0000 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2cb21afa6c1so73495801fa.0 for ; Thu, 28 Dec 2023 03:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703763729; x=1704368529; 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=jbh0l/OCUlD5uVSuXEGMcXjE9wl3eO27IjVISScAPlo=; b=ivulVbfNC+Zdvbu7UkYEy1g0VC1iyVXvPWblxUKE9N+ldzM+h3MU7S9TMCl1pSKRuU puXCAMYtx3xmVeuW5ySPH/aLqi3ctAXZDzMwyIh1IMoVXkAk9JRimp+tQ2I6S/xQt4nG eNSJbnYywigNC676y6xJ751XebqEwr0Ty6L2/hWUN8upyfvL8f4pFXXO5nPqfd1glnEN 1ZGXZ6Pe63IrQFKthHA2cK+TVhx63rk7hLFZkVW+petADQG38ZY9/yO4TQd2yn3qdTQu 7ehCW7BLDgY03T3t37bZnOssSvxN/VmdOp182byDGJsgNu1RsMxJ6KBsTKEOj0GLE1QR NDSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703763729; x=1704368529; 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=jbh0l/OCUlD5uVSuXEGMcXjE9wl3eO27IjVISScAPlo=; b=dHemWz7uHv9qrtn4ur0M0bfaI3gAKnsbFoY+UP4r/75RP9LUaeIsf5NOrMwtJW6JpE qsevZBm1/svXEHhTrvKZlJi6+KQyTz9iYgXeNW3lePcJPpxG/2l3KS12iatgWk3d22rT fUJUcdo/MiAeO3KLi3e92N6RMhPwtKkwNkKo7RCeAGkAoUeOKtQ6RKGAS990if+LdznT f5Lu7MJDlRIp+9WUEHoqcMmjlQbnF5C2eiMdcmm6OvzYXHtn6WxrOVpjsJnxLQkz7NaJ fwuUe2BuWUw98HcqtgN9sCW8LlMDYPHgfV/Rl5aC1Oif4TlfTx/I1mCW9tyhGmVoquFU rF0g== X-Gm-Message-State: AOJu0YzdogCNvM/wR4QqGwBiKsZkqvsvMlgRn2h5MCHYFjGOz4O+HaV1 YbR8AW2gFgGZ+7SfFfLMS157r5t6NFBLrw== X-Google-Smtp-Source: AGHT+IHSnOW4rpsICrtsFJGdeaeqXLcYGA//H43gyGrL38Vu+aM+ohhsDrXuAXLflLZoBD6Jm7JHIA== X-Received: by 2002:a2e:3c02:0:b0:2cc:69f5:de84 with SMTP id j2-20020a2e3c02000000b002cc69f5de84mr4762669lja.100.1703763729234; Thu, 28 Dec 2023 03:42: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 a4-20020a05651c210400b002cc32fbe2e5sm2792867ljq.51.2023.12.28.03.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Dec 2023 03:42: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 0/5] PM: domains: Add helpers for multi PM domains to avoid open-coding Date: Thu, 28 Dec 2023 12:41:52 +0100 Message-Id: <20231228114157.104822-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-20231228_034211_691628_20E81DF0 X-CRM114-Status: GOOD ( 14.02 ) 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 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 | 133 +++++++++++++++ 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, 288 insertions(+), 265 deletions(-)