* [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain [not found] <20240723144610.564273-1-ulf.hansson@linaro.org> @ 2024-07-23 14:46 ` Ulf Hansson 2024-08-20 20:48 ` Stanimir Varbanov 2024-07-23 14:46 ` [PATCH 3/4] cpufreq: qcom-nvmem: Convert to dev_pm_domain_attach|detach_list() Ulf Hansson 1 sibling, 1 reply; 8+ messages in thread From: Ulf Hansson @ 2024-07-23 14:46 UTC (permalink / raw) 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, linux-arm-kernel, linux-kernel, Stanimir Varbanov, Vikash Garodia, linux-media, linux-arm-msm 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 <ulf.hansson@linaro.org> --- 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/platform/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 = { .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0", "vcodec1" }, .vcodec_pmdomains_num = 3, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = (const char *[]) { "cx" }, .vcodec_num = 2, .max_load = 3110400, /* 4096x2160@90 */ .hfi_version = HFI_VERSION_4XX, @@ -758,7 +758,7 @@ static const struct venus_resources sc7180_res = { .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = (const char *[]) { "cx" }, .vcodec_num = 1, .hfi_version = HFI_VERSION_4XX, .vpu_version = VPU_VERSION_AR50, @@ -815,7 +815,7 @@ static const struct venus_resources sm8250_res = { .vcodec_clks_num = 1, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "mx", NULL }, + .opp_pmdomain = (const char *[]) { "mx" }, .vcodec_num = 1, .max_load = 7833600, .hfi_version = HFI_VERSION_6XX, @@ -874,7 +874,7 @@ static const struct venus_resources sc7280_res = { .vcodec_clks_num = 2, .vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" }, .vcodec_pmdomains_num = 2, - .opp_pmdomain = (const char *[]) { "cx", NULL }, + .opp_pmdomain = (const char *[]) { "cx" }, .vcodec_num = 1, .hfi_version = HFI_VERSION_6XX, .vpu_version = VPU_VERSION_IRIS2_1, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/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 = core->dev; const struct venus_resources *res = core->res; struct dev_pm_domain_attach_data vcodec_data = { @@ -865,6 +864,11 @@ static int vcodec_domains_get(struct venus_core *core) .num_pd_names = res->vcodec_pmdomains_num, .pd_flags = PD_FLAG_NO_DEV_LINK, }; + struct dev_pm_domain_attach_data opp_pd_data = { + .pd_names = res->opp_pmdomain, + .num_pd_names = 1, + .pd_flags = PD_FLAG_DEV_LINK_ON, + }; if (!res->vcodec_pmdomains_num) goto skip_pmdomains; @@ -874,24 +878,14 @@ static int vcodec_domains_get(struct venus_core *core) return ret; skip_pmdomains: - if (!core->res->opp_pmdomain) + if (!res->opp_pmdomain) return 0; /* Attach the power domain for setting performance state */ - ret = devm_pm_opp_attach_genpd(dev, res->opp_pmdomain, &opp_virt_dev); + ret = dev_pm_domain_attach_list(dev, &opp_pd_data, &core->opp_pmdomain); if (ret) goto opp_attach_err; - core->opp_pmdomain = *opp_virt_dev; - core->opp_dl_venus = device_link_add(dev, core->opp_pmdomain, - DL_FLAG_RPM_ACTIVE | - DL_FLAG_PM_RUNTIME | - DL_FLAG_STATELESS); - if (!core->opp_dl_venus) { - ret = -ENODEV; - goto opp_attach_err; - } - return 0; 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); } static int core_resets_reset(struct venus_core *core) @@ -996,9 +985,7 @@ static int core_get_v4(struct venus_core *core) if (core->res->opp_pmdomain) { ret = devm_pm_opp_of_add_table(dev); - if (!ret) { - core->has_opp_table = true; - } else if (ret != -ENODEV) { + if (ret && ret != -ENODEV) { dev_err(dev, "invalid OPP table in device tree\n"); return ret; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain 2024-07-23 14:46 ` [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain Ulf Hansson @ 2024-08-20 20:48 ` Stanimir Varbanov 2024-08-21 8:56 ` Ulf Hansson 0 siblings, 1 reply; 8+ messages in thread From: Stanimir Varbanov @ 2024-08-20 20:48 UTC (permalink / raw) To: Ulf Hansson, Viresh Kumar, Nishanth Menon, Stephen Boyd Cc: Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue, Thierry Reding, Mikko Perttunen, Jonathan Hunter, linux-pm, linux-arm-kernel, linux-kernel, Vikash Garodia, linux-media, linux-arm-msm Hi Ulf, Thank you for the patch! On 23.07.24 г. 17:46 ч., Ulf Hansson wrote: > 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 <ulf.hansson@linaro.org> > --- > 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(-) > Acked-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> I'll pick it through linux-media. -- regards, Stan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain 2024-08-20 20:48 ` Stanimir Varbanov @ 2024-08-21 8:56 ` Ulf Hansson 2024-08-21 8:58 ` Ulf Hansson 2024-08-22 18:05 ` Stanimir Varbanov 0 siblings, 2 replies; 8+ messages in thread From: Ulf Hansson @ 2024-08-21 8:56 UTC (permalink / raw) To: Stanimir Varbanov Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue, Thierry Reding, Mikko Perttunen, Jonathan Hunter, linux-pm, linux-arm-kernel, linux-kernel, Vikash Garodia, linux-media, linux-arm-msm On Tue, 20 Aug 2024 at 22:48, Stanimir Varbanov <stanimir.k.varbanov@gmail.com> wrote: > > Hi Ulf, > > Thank you for the patch! > > On 23.07.24 г. 17:46 ч., Ulf Hansson wrote: > > 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 <ulf.hansson@linaro.org> > > --- > > 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(-) > > > > Acked-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> Thanks! > > I'll pick it through linux-media. Please don't. I should have stated that this depends on another series [1] - and they need either to go together or we need to defer $subject patch until the next release cycle. Kind regards Uffe ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain 2024-08-21 8:56 ` Ulf Hansson @ 2024-08-21 8:58 ` Ulf Hansson 2024-08-22 18:05 ` Stanimir Varbanov 1 sibling, 0 replies; 8+ messages in thread From: Ulf Hansson @ 2024-08-21 8:58 UTC (permalink / raw) To: Stanimir Varbanov Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue, Thierry Reding, Mikko Perttunen, Jonathan Hunter, linux-pm, linux-arm-kernel, linux-kernel, Vikash Garodia, linux-media, linux-arm-msm On Wed, 21 Aug 2024 at 10:56, Ulf Hansson <ulf.hansson@linaro.org> wrote: > > On Tue, 20 Aug 2024 at 22:48, Stanimir Varbanov > <stanimir.k.varbanov@gmail.com> wrote: > > > > Hi Ulf, > > > > Thank you for the patch! > > > > On 23.07.24 г. 17:46 ч., Ulf Hansson wrote: > > > 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 <ulf.hansson@linaro.org> > > > --- > > > 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(-) > > > > > > > Acked-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> > > Thanks! > > > > > I'll pick it through linux-media. > > Please don't. > > I should have stated that this depends on another series [1] - and > they need either to go together or we need to defer $subject patch > until the next release cycle. > > Kind regards > Uffe Forgot the link, here it is: [1] https://lore.kernel.org/all/20240718234319.356451-1-ulf.hansson@linaro.org/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain 2024-08-21 8:56 ` Ulf Hansson 2024-08-21 8:58 ` Ulf Hansson @ 2024-08-22 18:05 ` Stanimir Varbanov 2024-08-22 21:40 ` Ulf Hansson 1 sibling, 1 reply; 8+ messages in thread From: Stanimir Varbanov @ 2024-08-22 18:05 UTC (permalink / raw) To: Ulf Hansson Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue, Thierry Reding, Mikko Perttunen, Jonathan Hunter, linux-pm, linux-arm-kernel, linux-kernel, Vikash Garodia, linux-media, linux-arm-msm Hi Ulf, On 21.08.24 г. 11:56 ч., Ulf Hansson wrote: > On Tue, 20 Aug 2024 at 22:48, Stanimir Varbanov > <stanimir.k.varbanov@gmail.com> wrote: >> >> Hi Ulf, >> >> Thank you for the patch! >> >> On 23.07.24 г. 17:46 ч., Ulf Hansson wrote: >>> 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 <ulf.hansson@linaro.org> >>> --- >>> 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(-) >>> >> >> Acked-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> > > Thanks! > >> >> I'll pick it through linux-media. > > Please don't. > > I should have stated that this depends on another series [1] - and > they need either to go together or we need to defer $subject patch > until the next release cycle. Sure, then I guess we will deffer venus patch until the preparation series is merged to avoid conflicts. Thank you! > > Kind regards > Uffe -- regards, Stan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain 2024-08-22 18:05 ` Stanimir Varbanov @ 2024-08-22 21:40 ` Ulf Hansson 2024-08-23 7:42 ` Stanimir Varbanov 0 siblings, 1 reply; 8+ messages in thread From: Ulf Hansson @ 2024-08-22 21:40 UTC (permalink / raw) To: Stanimir Varbanov Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue, Thierry Reding, Mikko Perttunen, Jonathan Hunter, linux-pm, linux-arm-kernel, linux-kernel, Vikash Garodia, linux-media, linux-arm-msm On Thu, 22 Aug 2024 at 20:05, Stanimir Varbanov <stanimir.k.varbanov@gmail.com> wrote: > > Hi Ulf, > > On 21.08.24 г. 11:56 ч., Ulf Hansson wrote: > > On Tue, 20 Aug 2024 at 22:48, Stanimir Varbanov > > <stanimir.k.varbanov@gmail.com> wrote: > >> > >> Hi Ulf, > >> > >> Thank you for the patch! > >> > >> On 23.07.24 г. 17:46 ч., Ulf Hansson wrote: > >>> 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 <ulf.hansson@linaro.org> > >>> --- > >>> 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(-) > >>> > >> > >> Acked-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> > > > > Thanks! > > > >> > >> I'll pick it through linux-media. > > > > Please don't. > > > > I should have stated that this depends on another series [1] - and > > they need either to go together or we need to defer $subject patch > > until the next release cycle. > > Sure, then I guess we will deffer venus patch until the preparation > series is merged to avoid conflicts. Thank you! Assuming the preparation series gets accepted, maybe we can give it a try via my pmdomain tree? Or do expect to land a lot of code that could conflict? I also realized that I already have a different series [1] queued in my pmdomain tree from Dikshita Agarwal (reviewed by Bryan), that moves an existing call for dev_pm_domain_attach() to the new devm_pm_domain_attach() helper. So far I haven't received any reports about conflicts from linux-next, so it looks good I think. Kind regards Uffe [1] https://lore.kernel.org/all/CAPDyKFqsHL3uatmLZaRzZ_GfkZw-+fURQNSEgvmrf-ini+WHng@mail.gmail.com/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain 2024-08-22 21:40 ` Ulf Hansson @ 2024-08-23 7:42 ` Stanimir Varbanov 0 siblings, 0 replies; 8+ messages in thread From: Stanimir Varbanov @ 2024-08-23 7:42 UTC (permalink / raw) To: Ulf Hansson Cc: Viresh Kumar, Nishanth Menon, Stephen Boyd, Bjorn Andersson, Konrad Dybcio, Bryan O'Donoghue, Thierry Reding, Mikko Perttunen, Jonathan Hunter, linux-pm, linux-arm-kernel, linux-kernel, Vikash Garodia, linux-media, linux-arm-msm Hi Ulf, On 23.08.24 г. 0:40 ч., Ulf Hansson wrote: > On Thu, 22 Aug 2024 at 20:05, Stanimir Varbanov > <stanimir.k.varbanov@gmail.com> wrote: >> >> Hi Ulf, >> >> On 21.08.24 г. 11:56 ч., Ulf Hansson wrote: >>> On Tue, 20 Aug 2024 at 22:48, Stanimir Varbanov >>> <stanimir.k.varbanov@gmail.com> wrote: >>>> >>>> Hi Ulf, >>>> >>>> Thank you for the patch! >>>> >>>> On 23.07.24 г. 17:46 ч., Ulf Hansson wrote: >>>>> 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 <ulf.hansson@linaro.org> >>>>> --- >>>>> 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(-) >>>>> >>>> >>>> Acked-by: Stanimir Varbanov <stanimir.k.varbanov@gmail.com> >>> >>> Thanks! >>> >>>> >>>> I'll pick it through linux-media. >>> >>> Please don't. >>> >>> I should have stated that this depends on another series [1] - and >>> they need either to go together or we need to defer $subject patch >>> until the next release cycle. >> >> Sure, then I guess we will deffer venus patch until the preparation >> series is merged to avoid conflicts. Thank you! > > Assuming the preparation series gets accepted, maybe we can give it a > try via my pmdomain tree? Or do expect to land a lot of code that > could conflict? Please take it via pmdomain tree. Thank you! > > I also realized that I already have a different series [1] queued in > my pmdomain tree from Dikshita Agarwal (reviewed by Bryan), that moves > an existing call for dev_pm_domain_attach() to the new > devm_pm_domain_attach() helper. So far I haven't received any reports > about conflicts from linux-next, so it looks good I think. > > Kind regards > Uffe > > [1] > https://lore.kernel.org/all/CAPDyKFqsHL3uatmLZaRzZ_GfkZw-+fURQNSEgvmrf-ini+WHng@mail.gmail.com/ -- regards, Stan ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] cpufreq: qcom-nvmem: Convert to dev_pm_domain_attach|detach_list() [not found] <20240723144610.564273-1-ulf.hansson@linaro.org> 2024-07-23 14:46 ` [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain Ulf Hansson @ 2024-07-23 14:46 ` Ulf Hansson 1 sibling, 0 replies; 8+ messages in thread From: Ulf Hansson @ 2024-07-23 14:46 UTC (permalink / raw) 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, linux-arm-kernel, linux-kernel, Ilia Lin, Stephan Gerhold, linux-arm-msm 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 <ulf.hansson@linaro.org> --- 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-cpufreq-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; }; struct qcom_cpufreq_drv_cpu { int opp_token; - struct device **virt_devs; + struct dev_pm_domain_list *pd_list; }; struct qcom_cpufreq_drv { @@ -394,8 +395,6 @@ static int qcom_cpufreq_ipq8074_name_version(struct device *cpu_dev, return 0; } -static const char *generic_genpd_names[] = { "perf", NULL }; - static const struct qcom_cpufreq_match_data match_data_kryo = { .get_version = qcom_cpufreq_kryo_name_version, }; @@ -406,13 +405,13 @@ static const struct qcom_cpufreq_match_data match_data_krait = { static const struct qcom_cpufreq_match_data match_data_msm8909 = { .get_version = qcom_cpufreq_simple_get_version, - .genpd_names = generic_genpd_names, + .pd_names = (const char *[]) { "perf" }, + .num_pd_names = 1, }; -static const char *qcs404_genpd_names[] = { "cpr", NULL }; - static const struct qcom_cpufreq_match_data match_data_qcs404 = { - .genpd_names = qcs404_genpd_names, + .pd_names = (const char *[]) { "cpr" }, + .num_pd_names = 1, }; static const struct qcom_cpufreq_match_data match_data_ipq6018 = { @@ -427,28 +426,16 @@ static const struct qcom_cpufreq_match_data match_data_ipq8074 = { .get_version = qcom_cpufreq_ipq8074_name_version, }; -static void qcom_cpufreq_suspend_virt_devs(struct qcom_cpufreq_drv *drv, unsigned int cpu) +static void qcom_cpufreq_suspend_pd_devs(struct qcom_cpufreq_drv *drv, unsigned int cpu) { - const char * const *name = drv->data->genpd_names; + struct dev_pm_domain_list *pd_list = drv->cpus[cpu].pd_list; int i; - if (!drv->cpus[cpu].virt_devs) + if (!pd_list) return; - for (i = 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, unsigned int cpu) -{ - const char * const *name = drv->data->genpd_names; - int i; - - if (!drv->cpus[cpu].virt_devs) - return; - - for (i = 0; *name; i++, name++) - pm_runtime_put(drv->cpus[cpu].virt_devs[i]); + for (i = 0; i < pd_list->num_pds; i++) + device_set_awake_path(pd_list->pd_devs[i]); } static int qcom_cpufreq_probe(struct platform_device *pdev) @@ -505,7 +492,6 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) of_node_put(np); for_each_possible_cpu(cpu) { - struct device **virt_devs = NULL; struct dev_pm_opp_config config = { .supported_hw = NULL, }; @@ -524,12 +510,7 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) config.prop_name = pvs_name; } - if (drv->data->genpd_names) { - config.genpd_names = drv->data->genpd_names; - config.virt_devs = &virt_devs; - } - - if (config.supported_hw || config.genpd_names) { + if (config.supported_hw) { drv->cpus[cpu].opp_token = dev_pm_opp_set_config(cpu_dev, &config); if (drv->cpus[cpu].opp_token < 0) { ret = drv->cpus[cpu].opp_token; @@ -538,25 +519,17 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) } } - if (virt_devs) { - const char * const *name = config.genpd_names; - int i, j; - - for (i = 0; *name; i++, name++) { - ret = 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 = { + .pd_names = drv->data->pd_names, + .num_pd_names = drv->data->num_pd_names, + .pd_flags = PD_FLAG_DEV_LINK_ON, + }; - /* Rollback previous PM runtime calls */ - name = config.genpd_names; - for (j = 0; *name && j < i; j++, name++) - pm_runtime_put(virt_devs[j]); - - goto free_opp; - } - } - drv->cpus[cpu].virt_devs = virt_devs; + ret = dev_pm_domain_attach_list(cpu_dev, &attach_data, + &drv->cpus[cpu].pd_list); + if (ret < 0) + goto free_opp; } } @@ -572,7 +545,7 @@ static int qcom_cpufreq_probe(struct platform_device *pdev) 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); 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; for_each_possible_cpu(cpu) - qcom_cpufreq_suspend_virt_devs(drv, cpu); + qcom_cpufreq_suspend_pd_devs(drv, cpu); return 0; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-08-23 7:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240723144610.564273-1-ulf.hansson@linaro.org>
2024-07-23 14:46 ` [PATCH 2/4] media: venus: Use dev_pm_domain_attach|detach_list() for OPP PM domain Ulf Hansson
2024-08-20 20:48 ` Stanimir Varbanov
2024-08-21 8:56 ` Ulf Hansson
2024-08-21 8:58 ` Ulf Hansson
2024-08-22 18:05 ` Stanimir Varbanov
2024-08-22 21:40 ` Ulf Hansson
2024-08-23 7:42 ` Stanimir Varbanov
2024-07-23 14:46 ` [PATCH 3/4] cpufreq: qcom-nvmem: Convert to dev_pm_domain_attach|detach_list() Ulf Hansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox