[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMzjBvkbITbSIzwf@builder.lan>
Date: Fri, 18 Jun 2021 13:16:38 -0500
From: Bjorn Andersson <bjorn.andersson@...aro.org>
To: Thara Gopinath <thara.gopinath@...aro.org>
Cc: agross@...nel.org, rui.zhang@...el.com, daniel.lezcano@...aro.org,
viresh.kumar@...aro.org, rjw@...ysocki.net, robh+dt@...nel.org,
linux-arm-msm@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 3/5] cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support
On Tue 08 Jun 17:29 CDT 2021, Thara Gopinath wrote:
> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
[..]
> @@ -305,6 +383,8 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
>
> index = args.args[0];
>
> + lmh_mitigation_enabled = of_property_read_bool(pdev->dev.of_node, "qcom,support-lmh");
Rather than adding a new interrupt _and_ a flag to tell the driver that
this new interrupt should be used, wouldn't it be sufficient to just see
if the interrupt is specified?
> +
> res = platform_get_resource(pdev, IORESOURCE_MEM, index);
> if (!res) {
> dev_err(dev, "failed to get mem resource %d\n", index);
> @@ -329,6 +409,11 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
> goto unmap_base;
> }
>
> + if (!alloc_cpumask_var(&data->cpus, GFP_KERNEL)) {
> + ret = -ENOMEM;
> + goto unmap_base;
> + }
> +
> data->soc_data = of_device_get_match_data(&pdev->dev);
> data->base = base;
> data->res = res;
> @@ -347,6 +432,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
> goto error;
> }
>
> + cpumask_copy(data->cpus, policy->cpus);
> policy->driver_data = data;
>
> ret = qcom_cpufreq_hw_read_lut(cpu_dev, policy);
> @@ -370,6 +456,20 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
> dev_warn(cpu_dev, "failed to enable boost: %d\n", ret);
> }
>
> + if (lmh_mitigation_enabled) {
> + data->lmh_dcvs_irq = platform_get_irq(pdev, index);
> + if (data->lmh_dcvs_irq < 0) {
This will be -ENXIO if the interrupt isn't specified and <0 for other
errors, so you should be able to distinguish the two failure cases.
Regards,
Bjorn
> + ret = data->lmh_dcvs_irq;
> + goto error;
> + }
> + ret = devm_request_irq(dev, data->lmh_dcvs_irq, qcom_lmh_dcvs_handle_irq,
> + 0, "dcvsh-irq", data);
> + if (ret) {
> + dev_err(dev, "Error %d registering irq %x\n", ret, data->lmh_dcvs_irq);
> + goto error;
> + }
> + INIT_DEFERRABLE_WORK(&data->lmh_dcvs_poll_work, qcom_lmh_dcvs_poll);
> + }
> return 0;
> error:
> kfree(data);
> --
> 2.25.1
>
Powered by blists - more mailing lists