Re: [RFC PATCH 4/9] cpufreq: qcom: support qcs404 on nvmem driver

2019-04-08 Thread Viresh Kumar
On 04-04-19, 07:09, Niklas Cassel wrote:
> From: Jorge Ramirez-Ortiz 
> 

Always have something here, even for the simplest of the patches.

> Signed-off-by: Jorge Ramirez-Ortiz 
> Co-developed-by: Niklas Cassel 
> Signed-off-by: Niklas Cassel 
> ---
>  drivers/cpufreq/qcom-cpufreq-nvmem.c | 18 ++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c 
> b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index 366c65a7132a..7fdc38218390 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -24,6 +24,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -79,6 +80,13 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
>   return version;
>  }
>  
> +static int qcom_cpufreq_qcs404_name_version(struct device *cpu_dev,
> + struct nvmem_cell *speedbin_nvmem,
> + struct qcom_cpufreq_drv *drv)
> +{
> + return 0;
> +}
> +

Why provide empty stubs? Rather check for get_version() in probe and call only
if it is supported.

>  static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
> struct nvmem_cell *speedbin_nvmem,
> struct qcom_cpufreq_drv *drv)
> @@ -191,6 +199,14 @@ static int qcom_cpufreq_probe(struct platform_device 
> *pdev)
>   dev_err(cpu_dev, "Failed to set supported hardware\n");
>   goto free_opp;
>   }
> +
> + ret = dev_pm_domain_attach(cpu_dev, false);

Why is it required specially for this platform and not earlier ?

And I was hoping for the attach-by-name thing to be present here instead because
of multiple domain thing.

> + if (ret) {
> + if (ret == -EPROBE_DEFER)
> + goto free_opp;
> + dev_err(cpu_dev, "Could not attach to pm_domain: %d\n",
> + ret);

And it is okay if we couldn't attach the domain ?

> + }
>   }
>  
>   cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1,
> @@ -247,6 +263,8 @@ static const struct of_device_id 
> qcom_cpufreq_match_list[] __initconst = {
> .data = qcom_cpufreq_kryo_name_version },
>   { .compatible = "qcom,msm8996",
> .data = qcom_cpufreq_kryo_name_version },
> + { .compatible = "qcom,qcs404",
> +   .data = qcom_cpufreq_qcs404_name_version },
>   {},
>  };
>  
> -- 
> 2.20.1

-- 
viresh


[RFC PATCH 4/9] cpufreq: qcom: support qcs404 on nvmem driver

2019-04-03 Thread Niklas Cassel
From: Jorge Ramirez-Ortiz 

Signed-off-by: Jorge Ramirez-Ortiz 
Co-developed-by: Niklas Cassel 
Signed-off-by: Niklas Cassel 
---
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c 
b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 366c65a7132a..7fdc38218390 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,6 +80,13 @@ static enum _msm8996_version qcom_cpufreq_get_msm_id(void)
return version;
 }
 
+static int qcom_cpufreq_qcs404_name_version(struct device *cpu_dev,
+   struct nvmem_cell *speedbin_nvmem,
+   struct qcom_cpufreq_drv *drv)
+{
+   return 0;
+}
+
 static int qcom_cpufreq_kryo_name_version(struct device *cpu_dev,
  struct nvmem_cell *speedbin_nvmem,
  struct qcom_cpufreq_drv *drv)
@@ -191,6 +199,14 @@ static int qcom_cpufreq_probe(struct platform_device *pdev)
dev_err(cpu_dev, "Failed to set supported hardware\n");
goto free_opp;
}
+
+   ret = dev_pm_domain_attach(cpu_dev, false);
+   if (ret) {
+   if (ret == -EPROBE_DEFER)
+   goto free_opp;
+   dev_err(cpu_dev, "Could not attach to pm_domain: %d\n",
+   ret);
+   }
}
 
cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1,
@@ -247,6 +263,8 @@ static const struct of_device_id qcom_cpufreq_match_list[] 
__initconst = {
  .data = qcom_cpufreq_kryo_name_version },
{ .compatible = "qcom,msm8996",
  .data = qcom_cpufreq_kryo_name_version },
+   { .compatible = "qcom,qcs404",
+ .data = qcom_cpufreq_qcs404_name_version },
{},
 };
 
-- 
2.20.1