From nobody Mon Sep 16 18:58:33 2024 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00A7615697A for ; Tue, 23 Jul 2024 14:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721745999; cv=none; b=cIItwnfIVLCF4wNRLYRgjsiJAp2qmadDPXL3Hr/yiizNk0/Zff2P88NPPPbOn8zHP+UuT410jswy1CcBS72/hLbITp0ePzCEdyaihuCE7kLB/L39dmKiPyDNzjsAYjc/VNCHLwwz3+mtqNXGfjcLRD3Rxm45vTQSciolVVgXkxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721745999; c=relaxed/simple; bh=G1bdc1Bbc1w5rYBE7Tc2f+lHBc5gkXwukaXyrq0t8+c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=B0BBCALCCYzNOEjkwu8gNJnufYXtsT9uXpqj7DEW7tJuf1zVMGJ7cLaEl+tRslhiImLBNyEwsIv5XHVuymQqWDdxaZRloZN+CpAf3ztSlGSShmkElz1JLFs+tQmtcfbWuBv99JmVYxYhPXiK+q29S2DbCQP7cSXPHMyEHoPemsM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=v16j/tJY; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="v16j/tJY" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-52f04c1e58eso2954230e87.3 for ; Tue, 23 Jul 2024 07:46:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721745994; x=1722350794; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SMvMejcYTJIM4KIVqv1c9N6HVUpji/79NTaho6YiZqU=; b=v16j/tJYy846EjQGBTisf6koyNavGBk0U9LTqoxVFznPcGNliMDzFfVA2pNvP7xxHJ 7ruRYZRnqhueSuzXNCEw0fPMcm96WdCeslCb8MQT6mztmT0gqoqie5UtGqDC1/yG/KPK qsigbKXMleH2k7gUKeut/JATSW7Rq3USugbcWBbvwuEmLHqhVYwTGzLMfOS/Ckpq/hdL iem5Cz5HqLJgT2N5b4UEXu732uxhfXi7acK+0IHMPTx+Fub0u6XIeYvHQgYEpniwfNMu fGxkpMbSYhUtbyg7nMt8wdgXxndYYZ5Ik3ZJhTIxBa5JXXkA2VOvwz7T3rfd1vD0ao/B 2MbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721745994; x=1722350794; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SMvMejcYTJIM4KIVqv1c9N6HVUpji/79NTaho6YiZqU=; b=ZQDNSGJJN+n88doCA75FzIkv0kaU+GlEDVR/Fu1VbpTvn1L+fZpKTyCX3MWEyt0Ee/ AK/xQ84gSJwBwVIqbLILNDtxMbIfsXWJeMhmPcXLfj9HPWneijW8vlmkMvHiRHM3fm/r Z4WQTi66pc8DdHV9JpdkyDXy+s28YP1qUVGnHRhJqqGry6lllfZc+Qb6TtJzmQdRcagf j8w+MQ2S+DtAb8XDS/lE8LAQuf4Ur43y3qiHFgVHsJM7b+HATsFwC35R61Ss+Sc/Uwc0 cZ1Z/f/Gg9ri2qfBg4lMVCS5jJcXTt2UyOxmM4t5DA7RjjeTuM0Dn7yCGx7uulb3q07y jutQ== X-Forwarded-Encrypted: i=1; AJvYcCV0BmAJyQ0XURPh/dPaDHWy69cEVEMlpTi1TPam2dmALpxd/7V5DroMUgAwUBWFlOEFr3YDiu70moaxcfmfohfPeMFMw4cvqoS6HfPO X-Gm-Message-State: AOJu0YzsuqSHyA0e7SGzjiFBURgiggz7Jo0GSbI2lxsSMs9ZtLyjgIXJ H+Bjvk71NtDOq1UnWWZkIcVpsb5KiPp8e4eK+0ECG9uFSyUw2XlyxLw1OcO0nyk= X-Google-Smtp-Source: AGHT+IEZ1h6MbPLjULEjFJKo9gP06D2/tDoy9HevGDIpR9mHTnvQPTceARptLwA/k582cDSpVdzfpQ== X-Received: by 2002:a05:6512:4008:b0:52e:fada:f002 with SMTP id 2adb3069b0e04-52efb5223cemr8834295e87.10.1721745994036; Tue, 23 Jul 2024 07:46:34 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52f0415eb08sm774540e87.9.2024.07.23.07.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 07:46:33 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH 1/4] drm/tegra: gr3d: Convert into dev_pm_domain_attach|detach_list() Date: Tue, 23 Jul 2024 16:46:07 +0200 Message-Id: <20240723144610.564273-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723144610.564273-1-ulf.hansson@linaro.org> References: <20240723144610.564273-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rather than hooking up the PM domains through devm_pm_opp_attach_genpd() and manage the device-link, let's avoid the boilerplate-code by converting into dev_pm_domain_attach|detach_list. Signed-off-by: Ulf Hansson --- drivers/gpu/drm/tegra/gr3d.c | 46 ++++++++++-------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 00c8564520e7..4de1ea0fc7c0 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -46,6 +46,7 @@ struct gr3d { unsigned int nclocks; struct reset_control_bulk_data resets[RST_GR3D_MAX]; unsigned int nresets; + struct dev_pm_domain_list *pd_list; =20 DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); }; @@ -369,18 +370,12 @@ static int gr3d_power_up_legacy_domain(struct device = *dev, const char *name, return 0; } =20 -static void gr3d_del_link(void *link) -{ - device_link_del(link); -} - static int gr3d_init_power(struct device *dev, struct gr3d *gr3d) { - static const char * const opp_genpd_names[] =3D { "3d0", "3d1", NULL }; - const u32 link_flags =3D DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME; - struct device **opp_virt_devs, *pd_dev; - struct device_link *link; - unsigned int i; + struct dev_pm_domain_attach_data pd_data =3D { + .pd_names =3D (const char *[]) { "3d0", "3d1" }, + .num_pd_names =3D 2, + }; int err; =20 err =3D of_count_phandle_with_args(dev->of_node, "power-domains", @@ -414,29 +409,10 @@ static int gr3d_init_power(struct device *dev, struct= gr3d *gr3d) if (dev->pm_domain) return 0; =20 - err =3D devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); - if (err) + err =3D dev_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list); + if (err < 0) return err; =20 - for (i =3D 0; opp_genpd_names[i]; i++) { - pd_dev =3D opp_virt_devs[i]; - if (!pd_dev) { - dev_err(dev, "failed to get %s power domain\n", - opp_genpd_names[i]); - return -EINVAL; - } - - link =3D device_link_add(dev, pd_dev, link_flags); - if (!link) { - dev_err(dev, "failed to link to %s\n", dev_name(pd_dev)); - return -EINVAL; - } - - err =3D devm_add_action_or_reset(dev, gr3d_del_link, link); - if (err) - return err; - } - return 0; } =20 @@ -527,13 +503,13 @@ static int gr3d_probe(struct platform_device *pdev) =20 err =3D devm_tegra_core_dev_init_opp_table_common(&pdev->dev); if (err) - return err; + goto err; =20 err =3D host1x_client_register(&gr3d->client.base); if (err < 0) { dev_err(&pdev->dev, "failed to register host1x client: %d\n", err); - return err; + goto err; } =20 /* initialize address register map */ @@ -541,6 +517,9 @@ static int gr3d_probe(struct platform_device *pdev) set_bit(gr3d_addr_regs[i], gr3d->addr_regs); =20 return 0; +err: + dev_pm_domain_detach_list(gr3d->pd_list); + return err; } =20 static void gr3d_remove(struct platform_device *pdev) @@ -549,6 +528,7 @@ static void gr3d_remove(struct platform_device *pdev) =20 pm_runtime_disable(&pdev->dev); host1x_client_unregister(&gr3d->client.base); + dev_pm_domain_detach_list(gr3d->pd_list); } =20 static int __maybe_unused gr3d_runtime_suspend(struct device *dev) --=20 2.34.1 From nobody Mon Sep 16 18:58:33 2024 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2030E156C63 for ; Tue, 23 Jul 2024 14:46:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721745999; cv=none; b=P5fqlzrIQvw3WtvwD7O4OO2qcUodrPvcCRM0dnoHu2xj109yxSUdtutRjCXvgo/c3828GZfgfZgxMMS84uMejhdJlsAGDEv8/ZSvm3vpdBAyhliQ1jiKRSLc4E2LSae2mzKxmb0wZExKu3qnMYDu5dBjX3c5uMoGWpGLN+hzZZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721745999; c=relaxed/simple; bh=WX8LSh0rDhHf39Hv/bNh9FIYIrWp/QkmbC/T7oE22gQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Cp+0eXe3nbCSlHFDyzcYjMTGPXgq+Ld3ZEHPuYl6sfonnaKRf+rEmfgDvo92IbyPCiRMDKAfsv6RJL+LH7lzw8IkRM3f657jzp9VxnMr65JiUOT1cm34m5cJiuyA6pRmYkXnppKrxEMli3GGmOCQY804LqEc5IG8El6etWASoR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=O6T9+TQI; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O6T9+TQI" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-52f04150796so3129392e87.3 for ; Tue, 23 Jul 2024 07:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721745995; x=1722350795; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XBP7dKcnoInh8D+ltmvy6AsIFtXdPmqqH+0/BiruIy4=; b=O6T9+TQIqTsJoMcf34HEDRSTyxQFYXXO43oDOHHj0ElP1oNrL2DfHi6TaHTmtlX/nm yhnYdklrNNlkPPAYGAIuLsUwgmWJ7UXmjHezFyItqTJB/j3bxN83xOwkCQePy3IgbWzw X/ySlHG93DX3qIMHB9NWvp1zcc5tK7a9LmKNxNJdEFxp6brc87iqhCAyC0CmQPptReic +Pgz6SnJJvC1hZ5YGRlUCa1ma/HiFDF/Xtk3KYBwPW3skEi1Bz0y0w14z1GottaQzrcA 2vSRM46+qZbNUnb0z5fGfGGxZzFwWTeZnUnOnyf6b9L2XgLDcgOnm3jWkRcc5TMGfmlW K0hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721745995; x=1722350795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XBP7dKcnoInh8D+ltmvy6AsIFtXdPmqqH+0/BiruIy4=; b=wRueJegpgzcdO+r4nF7T7Ibkwhmcu1uY4dLEvS3A4X214yemin5yvErI9sDWiyzz/5 WfnjouBzPZLPd64w73u6opgFHz19S673XnlCa9ibPmUg0LuTG2sZxwVFJBXL42BaRkX+ hm1Zr1s/IVgbbSlxhOiwXYE1TwOK3xvymjemKERunSS+yUbkPqgnLRjpm+bRFS1bAgZh OQLLWxoBCt81u3HEN1F++rZ2DxtqIujkSJLWFGMC4GfiaRfveeKaD9Z8+P1bb5Iqe8JU y36Sp3i9WwiTyk7hix3dtr/6XJsWIT/ug33SV05qHPkrlja43ZDCLQccmlzwJI2bH98S m/rQ== X-Forwarded-Encrypted: i=1; AJvYcCWQxPiZgbF/ulBNmWx/dPEUuJYtoMADKlj19YgPzrgrSkT5qiDwu39JHBP6tQvWBsAIHWFlV9NUIjXJsNKqOa77H7OuI9AGSpvNPv/e X-Gm-Message-State: AOJu0YzF6Z0AwPdX7e3XEPZx463xpvqHqTjHJrbBjCb4QOpnFYoicZcx XSHSF7BAcLnUAGwqvAa1YtDsIv+379x7YL0etpTycr7lk86kjn11LsCxHeP2Lms= X-Google-Smtp-Source: AGHT+IFGj2dGhWRS15wyntOxuIbZDSW3f20N1Gxb1NU6kUm4Z5FMUXshX3IqJbFS6MM2MvmCAr6WLA== X-Received: by 2002:a05:6512:2204:b0:52c:cc38:592c with SMTP id 2adb3069b0e04-52fc3fef109mr2116350e87.0.1721745995211; Tue, 23 Jul 2024 07:46:35 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52f0415eb08sm774540e87.9.2024.07.23.07.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 07:46:34 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stanimir Varbanov , Vikash Garodia , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain Date: Tue, 23 Jul 2024 16:46:08 +0200 Message-Id: <20240723144610.564273-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723144610.564273-1-ulf.hansson@linaro.org> References: <20240723144610.564273-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rather than hooking up the PM domains through devm_pm_opp_attach_genpd() and manage the device-link, let's avoid the boilerplate-code by converting into dev_pm_domain_attach|detach_list. Signed-off-by: Ulf Hansson Acked-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 8 ++--- drivers/media/platform/qcom/venus/core.h | 6 +--- .../media/platform/qcom/venus/pm_helpers.c | 31 ++++++------------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index ce206b709754..a422bbb3b610 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -709,7 +709,7 @@ static const struct venus_resources sdm845_res_v2 =3D { .vcodec_clks_num =3D 2, .vcodec_pmdomains =3D (const char *[]) { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num =3D 3, - .opp_pmdomain =3D (const char *[]) { "cx", NULL }, + .opp_pmdomain =3D (const char *[]) { "cx" }, .vcodec_num =3D 2, .max_load =3D 3110400, /* 4096x2160@90 */ .hfi_version =3D HFI_VERSION_4XX, @@ -758,7 +758,7 @@ static const struct venus_resources sc7180_res =3D { .vcodec_clks_num =3D 2, .vcodec_pmdomains =3D (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num =3D 2, - .opp_pmdomain =3D (const char *[]) { "cx", NULL }, + .opp_pmdomain =3D (const char *[]) { "cx" }, .vcodec_num =3D 1, .hfi_version =3D HFI_VERSION_4XX, .vpu_version =3D VPU_VERSION_AR50, @@ -815,7 +815,7 @@ static const struct venus_resources sm8250_res =3D { .vcodec_clks_num =3D 1, .vcodec_pmdomains =3D (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num =3D 2, - .opp_pmdomain =3D (const char *[]) { "mx", NULL }, + .opp_pmdomain =3D (const char *[]) { "mx" }, .vcodec_num =3D 1, .max_load =3D 7833600, .hfi_version =3D HFI_VERSION_6XX, @@ -874,7 +874,7 @@ static const struct venus_resources sc7280_res =3D { .vcodec_clks_num =3D 2, .vcodec_pmdomains =3D (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num =3D 2, - .opp_pmdomain =3D (const char *[]) { "cx", NULL }, + .opp_pmdomain =3D (const char *[]) { "cx" }, .vcodec_num =3D 1, .hfi_version =3D HFI_VERSION_6XX, .vpu_version =3D VPU_VERSION_IRIS2_1, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platf= orm/qcom/venus/core.h index 6a77de374454..aec587e6294f 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -132,9 +132,7 @@ struct venus_format { * @vcodec1_clks: an array of vcodec1 struct clk pointers * @video_path: an interconnect handle to video to/from memory path * @cpucfg_path: an interconnect handle to cpu configuration path - * @has_opp_table: does OPP table exist * @pmdomains: a pointer to a list of pmdomains - * @opp_dl_venus: an device-link for device OPP * @opp_pmdomain: an OPP power-domain * @resets: an array of reset signals * @vdev_dec: a reference to video device structure for decoder instances @@ -185,10 +183,8 @@ struct venus_core { struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; struct icc_path *video_path; struct icc_path *cpucfg_path; - bool has_opp_table; struct dev_pm_domain_list *pmdomains; - struct device_link *opp_dl_venus; - struct device *opp_pmdomain; + struct dev_pm_domain_list *opp_pmdomain; struct reset_control *resets[VIDC_RESETS_NUM_MAX]; struct video_device *vdev_dec; struct video_device *vdev_enc; diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index 502822059498..e133683871aa 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -857,7 +857,6 @@ static int venc_power_v4(struct device *dev, int on) static int vcodec_domains_get(struct venus_core *core) { int ret; - struct device **opp_virt_dev; struct device *dev =3D core->dev; const struct venus_resources *res =3D core->res; struct dev_pm_domain_attach_data vcodec_data =3D { @@ -865,6 +864,11 @@ static int vcodec_domains_get(struct venus_core *core) .num_pd_names =3D res->vcodec_pmdomains_num, .pd_flags =3D PD_FLAG_NO_DEV_LINK, }; + struct dev_pm_domain_attach_data opp_pd_data =3D { + .pd_names =3D res->opp_pmdomain, + .num_pd_names =3D 1, + .pd_flags =3D PD_FLAG_DEV_LINK_ON, + }; =20 if (!res->vcodec_pmdomains_num) goto skip_pmdomains; @@ -874,24 +878,14 @@ static int vcodec_domains_get(struct venus_core *core) return ret; =20 skip_pmdomains: - if (!core->res->opp_pmdomain) + if (!res->opp_pmdomain) return 0; =20 /* Attach the power domain for setting performance state */ - ret =3D devm_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); + ret =3D dev_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain); if (ret) goto opp_attach_err; =20 - core->opp_pmdomain =3D *opp_virt_dev; - core->opp_dl_venus =3D device_link_add(dev, core->opp_pmdomain, - DL_FLAG_RPM_ACTIVE | - DL_FLAG_PM_RUNTIME | - DL_FLAG_STATELESS); - if (!core->opp_dl_venus) { - ret =3D -ENODEV; - goto opp_attach_err; - } - return 0; =20 opp_attach_err: @@ -902,12 +896,7 @@ static int vcodec_domains_get(struct venus_core *core) static void vcodec_domains_put(struct venus_core *core) { dev_pm_domain_detach_list(core->pmdomains); - - if (!core->has_opp_table) - return; - - if (core->opp_dl_venus) - device_link_del(core->opp_dl_venus); + dev_pm_domain_detach_list(core->opp_pmdomain); } =20 static int core_resets_reset(struct venus_core *core) @@ -996,9 +985,7 @@ static int core_get_v4(struct venus_core *core) =20 if (core->res->opp_pmdomain) { ret =3D devm_pm_opp_of_add_table(dev); - if (!ret) { - core->has_opp_table =3D true; - } else if (ret !=3D -ENODEV) { + if (ret && ret !=3D -ENODEV) { dev_err(dev, "invalid OPP table in device tree\n"); return ret; } --=20 2.34.1 From nobody Mon Sep 16 18:58:33 2024 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41076156C78 for ; Tue, 23 Jul 2024 14:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721746000; cv=none; b=p3cx7azp6Pvx/0sxDEjeCj/g0w5U+dvZaVZGDcwgfGSnsvUzoZnRsMSv1rqNZzSO1ylYqCeYmL/R+pMT3FI9soU/O37xOh9noeL7zlXzlRZEmMx999raa4j4vK0biogDk0RG4quV/+ikacDqK5vTIZl7f8t4+KNr0yiJEsA/9Qw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721746000; c=relaxed/simple; bh=/Cz64eiORglL+JzsTj4J/qRQ+zkIqCGxhfUI/VtVVk8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nxB8XxoHBpwMi8dpNKjo5m7XCUQslxYBIEP1rpZK+zCJ/wvNEO0awPXQFqeb29RsQpAwgdLxJbSQXH/AH+7dIPtWUWK1Q97PALILC37LX5wLVGg8uSeaiIztAF2MGuQ5xxBWqQPK6N+VVnEtl8T0vOirRbjAx/HfWrvXHwcV3JE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Fs5k9JJw; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Fs5k9JJw" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-52efd08e6d9so4178464e87.1 for ; Tue, 23 Jul 2024 07:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721745996; x=1722350796; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FrrcMYfLG/IRNiRlIGOfcILMNeNyK16y6kYofjra+ME=; b=Fs5k9JJwNkn38jF5j/3cTOW6MPopJSbKnXcOYPNzoZ50zhX4iUrWqyu240TFa2g3IA zVT2RL9IhoYDT7vFkliRGTzQr5b3zEQsTcPY/sS6C7TDsDaFmMCkPGiYVf9hUQOJkioL DTpccfRNR1ptBiu/0vHr3nmJB7QP+3HDqMMnJ+zrJgLUEX0Jqjz4jNLTk38pPoiZ+CTF 8mCT8+hzsynEXpfKscPA31g1PFhIgk7bR3LXGbJw7AilQtbBPXkUkgJjaNoDMU6Hfzu1 KG8y2Eq2R5eqGiuVdghPK15FCT6ZNazqsb5FS82Sb7BTbt/VTM2U6UOIHQPYRtLf9K/i gumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721745996; x=1722350796; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FrrcMYfLG/IRNiRlIGOfcILMNeNyK16y6kYofjra+ME=; b=kZnbq1omsgsJn2WLwPkp6XEU676jfHlW+Aid8a0SisR3iNJ4ial3ZwSPfjbEoFs5oC 2rPWr66DFREW43X+ivguBSMazg8phGivCaooqm1DTfDLpIkicBVIvf9TpMe31LhTslDn gAaw2aticRATqMiO2PD9FLYX2SQ5ESU7kv+YNN1aZkYInvps9VGbAvXqmwJo1ssFloeM jqYc5OWR/DbsJsqPee2rso8knudBBg7KSB13v4yLhQaBuvY3tLa3RUCD68K7ngkZPRx2 z+zms4/U385XXMeNOLe7nTsVg1V/56su2NT/t2rbMGqhoqpVMvSLGkBcU1glthU4tXWg lRbA== X-Forwarded-Encrypted: i=1; AJvYcCUnHOi2e7J7ZsRldNv56/SYKpcPDC+9VZCvz9t8VvjS4tiXrb2Ao6arwWQxVCWulVZ/xHXZAUEqWsW7Gox9s5PEj5Ba7HPOeZrbdVIj X-Gm-Message-State: AOJu0Yz18i8+3oRcBnCSdf9ZSinxmnRfz/fqANwRGY80CitDm6KpsZu7 dSRVEtFTDOoKicSjZfQ9xbuxhSxynB9aumzeT+bpBLiC0XKerP50GPWsMAnEv6I= X-Google-Smtp-Source: AGHT+IHI7MKcmaUYwLbT8KpWV+gZCkHNesswZsoZOrPGXmC51ZgZNSlNboV0W17HiSXE+kZ3RDydkQ== X-Received: by 2002:a05:6512:31c7:b0:52e:be1f:bf8b with SMTP id 2adb3069b0e04-52fc406f0famr2550946e87.47.1721745996507; Tue, 23 Jul 2024 07:46:36 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52f0415eb08sm774540e87.9.2024.07.23.07.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 07:46:36 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ilia Lin , Stephan Gerhold , linux-arm-msm@vger.kernel.org Subject: [PATCH 3/4] cpufreq: qcom-nvmem: Convert to dev_pm_domain_attach|detach_list() Date: Tue, 23 Jul 2024 16:46:09 +0200 Message-Id: <20240723144610.564273-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723144610.564273-1-ulf.hansson@linaro.org> References: <20240723144610.564273-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rather than hooking up the PM domains through _opp_attach_genpd() and manually manage runtime PM for the corresponding virtual devices created by genpd during attach, let's avoid the boilerplate-code by converting into dev_pm_domain_attach|detach_list. Signed-off-by: Ulf Hansson --- drivers/cpufreq/qcom-cpufreq-nvmem.c | 79 +++++++++------------------- 1 file changed, 26 insertions(+), 53 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cp= ufreq-nvmem.c index ea05d9d67490..65739ce98658 100644 --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c @@ -52,12 +52,13 @@ struct qcom_cpufreq_match_data { struct nvmem_cell *speedbin_nvmem, char **pvs_name, struct qcom_cpufreq_drv *drv); - const char **genpd_names; + const char **pd_names; + unsigned int num_pd_names; }; =20 struct qcom_cpufreq_drv_cpu { int opp_token; - struct device **virt_devs; + struct dev_pm_domain_list *pd_list; }; =20 struct qcom_cpufreq_drv { @@ -394,8 +395,6 @@ static int qcom_cpufreq_ipq8074_name_version(struct dev= ice *cpu_dev, return 0; } =20 -static const char *generic_genpd_names[] =3D { "perf", NULL }; - static const struct qcom_cpufreq_match_data match_data_kryo =3D { .get_version =3D qcom_cpufreq_kryo_name_version, }; @@ -406,13 +405,13 @@ static const struct qcom_cpufreq_match_data match_dat= a_krait =3D { =20 static const struct qcom_cpufreq_match_data match_data_msm8909 =3D { .get_version =3D qcom_cpufreq_simple_get_version, - .genpd_names =3D generic_genpd_names, + .pd_names =3D (const char *[]) { "perf" }, + .num_pd_names =3D 1, }; =20 -static const char *qcs404_genpd_names[] =3D { "cpr", NULL }; - static const struct qcom_cpufreq_match_data match_data_qcs404 =3D { - .genpd_names =3D qcs404_genpd_names, + .pd_names =3D (const char *[]) { "cpr" }, + .num_pd_names =3D 1, }; =20 static const struct qcom_cpufreq_match_data match_data_ipq6018 =3D { @@ -427,28 +426,16 @@ static const struct qcom_cpufreq_match_data match_dat= a_ipq8074 =3D { .get_version =3D qcom_cpufreq_ipq8074_name_version, }; =20 -static void qcom_cpufreq_suspend_virt_devs(struct qcom_cpufreq_drv *drv, u= nsigned int cpu) +static void qcom_cpufreq_suspend_pd_devs(struct qcom_cpufreq_drv *drv, uns= igned int cpu) { - const char * const *name =3D drv->data->genpd_names; + struct dev_pm_domain_list *pd_list =3D drv->cpus[cpu].pd_list; int i; =20 - if (!drv->cpus[cpu].virt_devs) + if (!pd_list) return; =20 - for (i =3D 0; *name; i++, name++) - device_set_awake_path(drv->cpus[cpu].virt_devs[i]); -} - -static void qcom_cpufreq_put_virt_devs(struct qcom_cpufreq_drv *drv, unsig= ned int cpu) -{ - const char * const *name =3D drv->data->genpd_names; - int i; - - if (!drv->cpus[cpu].virt_devs) - return; - - for (i =3D 0; *name; i++, name++) - pm_runtime_put(drv->cpus[cpu].virt_devs[i]); + for (i =3D 0; i < pd_list->num_pds; i++) + device_set_awake_path(pd_list->pd_devs[i]); } =20 static int qcom_cpufreq_probe(struct platform_device *pdev) @@ -505,7 +492,6 @@ static int qcom_cpufreq_probe(struct platform_device *p= dev) of_node_put(np); =20 for_each_possible_cpu(cpu) { - struct device **virt_devs =3D NULL; struct dev_pm_opp_config config =3D { .supported_hw =3D NULL, }; @@ -524,12 +510,7 @@ static int qcom_cpufreq_probe(struct platform_device *= pdev) config.prop_name =3D pvs_name; } =20 - if (drv->data->genpd_names) { - config.genpd_names =3D drv->data->genpd_names; - config.virt_devs =3D &virt_devs; - } - - if (config.supported_hw || config.genpd_names) { + if (config.supported_hw) { drv->cpus[cpu].opp_token =3D dev_pm_opp_set_config(cpu_dev, &config); if (drv->cpus[cpu].opp_token < 0) { ret =3D drv->cpus[cpu].opp_token; @@ -538,25 +519,17 @@ static int qcom_cpufreq_probe(struct platform_device = *pdev) } } =20 - if (virt_devs) { - const char * const *name =3D config.genpd_names; - int i, j; - - for (i =3D 0; *name; i++, name++) { - ret =3D pm_runtime_resume_and_get(virt_devs[i]); - if (ret) { - dev_err(cpu_dev, "failed to resume %s: %d\n", - *name, ret); + if (drv->data->pd_names) { + struct dev_pm_domain_attach_data attach_data =3D { + .pd_names =3D drv->data->pd_names, + .num_pd_names =3D drv->data->num_pd_names, + .pd_flags =3D PD_FLAG_DEV_LINK_ON, + }; =20 - /* Rollback previous PM runtime calls */ - name =3D config.genpd_names; - for (j =3D 0; *name && j < i; j++, name++) - pm_runtime_put(virt_devs[j]); - - goto free_opp; - } - } - drv->cpus[cpu].virt_devs =3D virt_devs; + ret =3D dev_pm_domain_attach_list(cpu_dev, &attach_data, + &drv->cpus[cpu].pd_list); + if (ret < 0) + goto free_opp; } } =20 @@ -572,7 +545,7 @@ static int qcom_cpufreq_probe(struct platform_device *p= dev) =20 free_opp: for_each_possible_cpu(cpu) { - qcom_cpufreq_put_virt_devs(drv, cpu); + dev_pm_domain_detach_list(drv->cpus[cpu].pd_list); dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); } return ret; @@ -586,7 +559,7 @@ static void qcom_cpufreq_remove(struct platform_device = *pdev) platform_device_unregister(cpufreq_dt_pdev); =20 for_each_possible_cpu(cpu) { - qcom_cpufreq_put_virt_devs(drv, cpu); + dev_pm_domain_detach_list(drv->cpus[cpu].pd_list); dev_pm_opp_clear_config(drv->cpus[cpu].opp_token); } } @@ -597,7 +570,7 @@ static int qcom_cpufreq_suspend(struct device *dev) unsigned int cpu; =20 for_each_possible_cpu(cpu) - qcom_cpufreq_suspend_virt_devs(drv, cpu); + qcom_cpufreq_suspend_pd_devs(drv, cpu); =20 return 0; } --=20 2.34.1 From nobody Mon Sep 16 18:58:33 2024 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F3BD156F4B for ; Tue, 23 Jul 2024 14:46:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721746001; cv=none; b=LIn4vX7vd9HpJrAL4b2Py8JlknR+Esvyw8ySuz8tkD/pBE6rRC2JTIKo+HCosKki95MMb+ti7gw6uQuhgMSoV5WjMWP0m7/FbVW64SEGOq+bFiwDsUMen7OdQJ5JErlrCUzdBoKSWx52pwHGMCMsfmDHR6phDhpHnVBKyAo0jV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721746001; c=relaxed/simple; bh=amoWYev3rPnJKUB49T3A+2z9/9V8qrykIM/9P/sEwf8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j8OZtokllyyob6hXbOVDwtMY3gVdQ0TZdtwktoeC2ktTVgCELUNB8+DEedTrYDZxEarECptpPNZqZkIqf1p8Iycb2ivK7ScdkP7MfTTsKmrreFhJ2PGLCraiv/ufbT08Vvh0yE18JzUn2O4zdlRvkg1tBKm4IC4ZJnsSOoZ4rWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hBS8UFdO; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hBS8UFdO" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-52fc4388a64so1863945e87.1 for ; Tue, 23 Jul 2024 07:46:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721745998; x=1722350798; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1r6mQjxdA5Ycu1o4JlXvEuFhP6RdDyjqQdXSFbqbnuk=; b=hBS8UFdORXpGI3k46tFgQrT3aM1Fk1lpwdkD379kK96tJ7pmpIEIzdjUqRO9VB8L0s 7wpd2ta0ru9PjSSU0f8PpGvyf2eZKCa2Xp6D8XWPfi8lFgj/oVSpr8nFYO9QQBTVBYuI dUbLirW/cbRL/Fr1+TbkaP8aDX2kky0mE06WesQK8lHzVRdP8Qp0RQ9ECjW3rDzHKAxp TmVwh5cTfwdocDOyANbBNQCEg+Gkx6pHBJv1x6HPYY5lH6Px1tJQm1fMQUEf6GMzwpCb k/NwaZ9H4goXkJsxpdR22zvK0VzS/zdmplTgGyGM5zd0+0mnIbFC8K72oVKmNjqeG17m PIBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721745998; x=1722350798; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1r6mQjxdA5Ycu1o4JlXvEuFhP6RdDyjqQdXSFbqbnuk=; b=Gh3trftOktuomKiUhfCnxFLJuMA4EfYPzLNpza+uRwZOXM2J6R4NIyvd9emqPgl9x/ WAvBQeSJr0OT6Mh4l+W66VmXhAoV+5yQ3W0guz/eCzrH6MOBPdaCbzzRvWAxlcx+TGB9 SJI//6dkVeX8ttLAD8qT2XWXoAe9rKJfM4w5s4XITXUgi+rYnjZtzNYMfGmh8W2lOFri 7ffl/LZi7b6xJPOrYIVyIFprQ3CmM7C0rfvJfb1/zz0DttZBqWfvdVKI1Y8veRV3/nrm +xQ+BoOz07g4Yx/SeIdjLYupkedgkr6my33JmX7gzWcvXb3VP07iWbBmNSGBuiKIjlck 1PAg== X-Forwarded-Encrypted: i=1; AJvYcCWEZ1UAlXT8zxc7DGYVC9DD7l5Uzxb2sPrpnEBhouF3z5LBvG4bOXf4RId3OHKK300dEdzEEBZRysUieK7pfKFoeOFBS4x6uiIC05DK X-Gm-Message-State: AOJu0Yy7xHx3mNIdRVEMlNGVp0qfUYKrlw+C22IrYYazX8VT27bn2uyV 6Ma4lDUqNPlMA4T1qYV5GKCSXKV9zf7snFhYfkNZMQQxJxtEKg+2yRnDfQBvgAo= X-Google-Smtp-Source: AGHT+IF4JXt63g3aJOtD34L0D3D22CnPoBsXJUr8hYUB/3dr0SeT1SQm94wxj0Gjpxn1WXB5Y5YwJw== X-Received: by 2002:a05:6512:1048:b0:52f:c3c9:1691 with SMTP id 2adb3069b0e04-52fc404d27bmr2282609e87.32.1721745997599; Tue, 23 Jul 2024 07:46:37 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52f0415eb08sm774540e87.9.2024.07.23.07.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 07:46:37 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] OPP: Drop redundant _opp_attach|detach_genpd() Date: Tue, 23 Jul 2024 16:46:10 +0200 Message-Id: <20240723144610.564273-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240723144610.564273-1-ulf.hansson@linaro.org> References: <20240723144610.564273-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There no longer any users of _opp_attach|detach_genpd(), hence let's drop it along with the corresponding exported functions. Signed-off-by: Ulf Hansson --- drivers/opp/core.c | 96 +----------------------------------------- drivers/opp/opp.h | 3 +- include/linux/pm_opp.h | 38 +---------------- 3 files changed, 3 insertions(+), 134 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index cad7e84c9ad3..66cac7a1d9db 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2360,86 +2360,6 @@ static void _opp_put_config_regulators_helper(struct= opp_table *opp_table) opp_table->config_regulators =3D NULL; } =20 -static void _opp_detach_genpd(struct opp_table *opp_table) -{ - int index; - - for (index =3D 0; index < opp_table->required_opp_count; index++) { - if (!opp_table->required_devs[index]) - continue; - - dev_pm_domain_detach(opp_table->required_devs[index], false); - } -} - -/* - * Multiple generic power domains for a device are supported with the help= of - * virtual genpd devices, which are created for each consumer device - gen= pd - * pair. These are the device structures which are attached to the power d= omain - * and are required by the OPP core to set the performance state of the ge= npd. - * The same API also works for the case where single genpd is available an= d so - * we don't need to support that separately. - * - * This helper will normally be called by the consumer driver of the device - * "dev", as only that has details of the genpd names. - * - * This helper needs to be called once with a list of all genpd to attach. - * Otherwise the original device structure will be used instead by the OPP= core. - * - * The order of entries in the names array must match the order in which - * "required-opps" are added in DT. - */ -static int _opp_attach_genpd(struct opp_table *opp_table, struct device *d= ev, - const char * const *names, struct device ***virt_devs) -{ - struct device *virt_dev; - int index =3D 0, ret =3D -EINVAL; - const char * const *name =3D names; - - if (!opp_table->required_devs) { - dev_err(dev, "Required OPPs not available, can't attach genpd\n"); - return -EINVAL; - } - - /* Genpd core takes care of propagation to parent genpd */ - if (opp_table->is_genpd) { - dev_err(dev, "%s: Operation not supported for genpds\n", __func__); - return -EOPNOTSUPP; - } - - /* Checking only the first one is enough ? */ - if (opp_table->required_devs[0]) - return 0; - - while (*name) { - if (index >=3D opp_table->required_opp_count) { - dev_err(dev, "Index can't be greater than required-opp-count - 1, %s (%= d : %d)\n", - *name, opp_table->required_opp_count, index); - goto err; - } - - virt_dev =3D dev_pm_domain_attach_by_name(dev, *name); - if (IS_ERR_OR_NULL(virt_dev)) { - ret =3D virt_dev ? PTR_ERR(virt_dev) : -ENODEV; - dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); - goto err; - } - - index++; - name++; - } - - if (virt_devs) - *virt_devs =3D opp_table->required_devs; - - return 0; - -err: - _opp_detach_genpd(opp_table); - return ret; - -} - static int _opp_set_required_dev(struct opp_table *opp_table, struct device *dev, struct device *required_dev, @@ -2516,9 +2436,6 @@ static void _opp_clear_config(struct opp_config_data = *data) { if (data->flags & OPP_CONFIG_REQUIRED_DEV) _opp_put_required_dev(data->opp_table, data->index); - else if (data->flags & OPP_CONFIG_GENPD) - _opp_detach_genpd(data->opp_table); - if (data->flags & OPP_CONFIG_REGULATOR) _opp_put_regulators(data->opp_table); if (data->flags & OPP_CONFIG_SUPPORTED_HW) @@ -2630,18 +2547,7 @@ int dev_pm_opp_set_config(struct device *dev, struct= dev_pm_opp_config *config) data->flags |=3D OPP_CONFIG_REGULATOR; } =20 - /* Attach genpds */ - if (config->genpd_names) { - if (config->required_dev) - goto err; - - ret =3D _opp_attach_genpd(opp_table, dev, config->genpd_names, - config->virt_devs); - if (ret) - goto err; - - data->flags |=3D OPP_CONFIG_GENPD; - } else if (config->required_dev && config->required_opp_table) { + if (config->required_dev && config->required_opp_table) { ret =3D _opp_set_required_dev(opp_table, dev, config->required_dev, config->required_opp_table); diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index 5b5a4bd89c9e..318a4ecbabf1 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -34,8 +34,7 @@ extern struct list_head opp_tables; #define OPP_CONFIG_REGULATOR_HELPER BIT(2) #define OPP_CONFIG_PROP_NAME BIT(3) #define OPP_CONFIG_SUPPORTED_HW BIT(4) -#define OPP_CONFIG_GENPD BIT(5) -#define OPP_CONFIG_REQUIRED_DEV BIT(6) +#define OPP_CONFIG_REQUIRED_DEV BIT(5) =20 /** * struct opp_config_data - data for set config operations diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 5fade5c4de40..451a7465a605 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -62,11 +62,7 @@ typedef int (*config_clks_t)(struct device *dev, struct = opp_table *opp_table, * @supported_hw: Array of hierarchy of versions to match. * @supported_hw_count: Number of elements in the array. * @regulator_names: Array of pointers to the names of the regulator, NULL= terminated. - * @genpd_names: Null terminated array of pointers containing names of gen= pd to - * attach. Mutually exclusive with required_dev. - * @virt_devs: Pointer to return the array of genpd virtual devices. Mutua= lly - * exclusive with required_dev. - * @required_dev: Required OPP device. Mutually exclusive with genpd_names= /virt_devs. + * @required_dev: Required OPP device. * @required_opp_table: The corresponding required OPP table for @required= _dev. * * This structure contains platform specific OPP configurations for the de= vice. @@ -80,8 +76,6 @@ struct dev_pm_opp_config { const unsigned int *supported_hw; unsigned int supported_hw_count; const char * const *regulator_names; - const char * const *genpd_names; - struct device ***virt_devs; struct device *required_dev; struct opp_table *required_opp_table; }; @@ -677,36 +671,6 @@ static inline void dev_pm_opp_put_config_regulators(in= t token) dev_pm_opp_clear_config(token); } =20 -/* genpd helpers */ -static inline int dev_pm_opp_attach_genpd(struct device *dev, - const char * const *names, - struct device ***virt_devs) -{ - struct dev_pm_opp_config config =3D { - .genpd_names =3D names, - .virt_devs =3D virt_devs, - }; - - return dev_pm_opp_set_config(dev, &config); -} - -static inline void dev_pm_opp_detach_genpd(int token) -{ - dev_pm_opp_clear_config(token); -} - -static inline int devm_pm_opp_attach_genpd(struct device *dev, - const char * const *names, - struct device ***virt_devs) -{ - struct dev_pm_opp_config config =3D { - .genpd_names =3D names, - .virt_devs =3D virt_devs, - }; - - return devm_pm_opp_set_config(dev, &config); -} - /* prop-name helpers */ static inline int dev_pm_opp_set_prop_name(struct device *dev, const char = *name) { --=20 2.34.1