All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-18 12:10 ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-18 12:10 UTC (permalink / raw)
  To: linux, heiko, rjw, viresh.kumar
  Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm, wxt,
	zyw, jay.xu, tim.chen, xxx, huangtao, Feng Xiao

This driver will directly use cpufreq-dt driver as backend.

As there is not a generic devicetree board file(rockchip.c)
on ARM64 architecture, so remove platform_device_register_simple
in rockchip.c and add a new cpufreq driver to support for all
Rockchip SoCs.

Signed-off-by: Feng Xiao <xf@rock-chips.com>
---
 arch/arm/mach-rockchip/rockchip.c  |  1 -
 drivers/cpufreq/Kconfig.arm        | 10 ++++++++++
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/rockchip-cpufreq.c | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpufreq/rockchip-cpufreq.c

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3f07cc5..beb71da 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void)
 {
 	rockchip_suspend_init();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
 }
 
 static const char * const rockchip_board_dt_compat[] = {
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 14b1f93..1786315 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_ROCKCHIP_CPUFREQ
+	tristate "Rockchip CPUfreq driver"
+	depends on ARCH_ROCKCHIP && CPUFREQ_DT
+	select PM_OPP
+	help
+	  This adds the CPUFreq driver support for Rockchip SoCs.
+	  The driver will directly use cpufreq-dt driver as backend.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 9e63fb1..91d8bb7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ)	+= rockchip-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)	+= s3c24xx-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)	+= s3c2410-cpufreq.o
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
new file mode 100644
index 0000000..ecbadcd
--- /dev/null
+++ b/drivers/cpufreq/rockchip-cpufreq.c
@@ -0,0 +1,36 @@
+/*
+ * Rockchip Platforms CPUFreq Support
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Feng Xiao <xf@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static int __init rockchip_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+
+	pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
+	return PTR_ERR_OR_ZERO(pdev);
+}
+module_init(rockchip_cpufreq_driver_init);
+
+MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-18 12:10 ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-18 12:10 UTC (permalink / raw)
  To: linux-arm-kernel

This driver will directly use cpufreq-dt driver as backend.

As there is not a generic devicetree board file(rockchip.c)
on ARM64 architecture, so remove platform_device_register_simple
in rockchip.c and add a new cpufreq driver to support for all
Rockchip SoCs.

Signed-off-by: Feng Xiao <xf@rock-chips.com>
---
 arch/arm/mach-rockchip/rockchip.c  |  1 -
 drivers/cpufreq/Kconfig.arm        | 10 ++++++++++
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/rockchip-cpufreq.c | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpufreq/rockchip-cpufreq.c

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3f07cc5..beb71da 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void)
 {
 	rockchip_suspend_init();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
 }
 
 static const char * const rockchip_board_dt_compat[] = {
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 14b1f93..1786315 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_ROCKCHIP_CPUFREQ
+	tristate "Rockchip CPUfreq driver"
+	depends on ARCH_ROCKCHIP && CPUFREQ_DT
+	select PM_OPP
+	help
+	  This adds the CPUFreq driver support for Rockchip SoCs.
+	  The driver will directly use cpufreq-dt driver as backend.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 9e63fb1..91d8bb7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ)	+= rockchip-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)	+= s3c24xx-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)	+= s3c2410-cpufreq.o
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
new file mode 100644
index 0000000..ecbadcd
--- /dev/null
+++ b/drivers/cpufreq/rockchip-cpufreq.c
@@ -0,0 +1,36 @@
+/*
+ * Rockchip Platforms CPUFreq Support
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Feng Xiao <xf@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static int __init rockchip_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+
+	pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
+	return PTR_ERR_OR_ZERO(pdev);
+}
+module_init(rockchip_cpufreq_driver_init);
+
+MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-18 12:10 ` Feng Xiao
@ 2016-03-18 12:56   ` Heiko Stübner
  -1 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-18 12:56 UTC (permalink / raw)
  To: Feng Xiao
  Cc: linux, rjw, viresh.kumar, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

Hi Feng,

Am Freitag, 18. März 2016, 20:10:04 schrieb Feng Xiao:
> This driver will directly use cpufreq-dt driver as backend.
> 
> As there is not a generic devicetree board file(rockchip.c)
> on ARM64 architecture, so remove platform_device_register_simple
> in rockchip.c and add a new cpufreq driver to support for all
> Rockchip SoCs.
> 
> Signed-off-by: Feng Xiao <xf@rock-chips.com>

[...]

> diff --git a/drivers/cpufreq/rockchip-cpufreq.c
> b/drivers/cpufreq/rockchip-cpufreq.c new file mode 100644
> index 0000000..ecbadcd
> --- /dev/null
> +++ b/drivers/cpufreq/rockchip-cpufreq.c
> @@ -0,0 +1,36 @@
> +/*
> + * Rockchip Platforms CPUFreq Support
> + *
> + * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
> + *
> + * Feng Xiao <xf@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static int __init rockchip_cpufreq_driver_init(void)
> +{
> +	struct platform_device *pdev;
> +
> +	pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
> +	return PTR_ERR_OR_ZERO(pdev);

This would create that cpufreq-dt device on all non-Rockchip platforms 
compiled into the same kernel image as well - we definitly don't want that.

Also, on both the rk3368 as well as the rk3399, you probably want the cluster-
handling of arm-bL-cpufreq-dt.
Contrary to its name it is _not_ limited to switching between clusters, but 
can also control frequencies of multiple cpu-clusters running at the same 
time.


Implementation-wise, I guess doing it similar to the scpi-implementation might 
make more sense. Please take a look at drivers/clk/clk-scpi.c that registers 
the virtual cpufreq device there.

So we could do something similar, move the cpufreq from mach-rockchip to the 
clock drivers and register the appropriate cpufreq-driver for each soc.
cpufreq-dt for socs with a single cluster, the bL-thing for socs with multiple 
clusters.


Heiko

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-18 12:56   ` Heiko Stübner
  0 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-18 12:56 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Feng,

Am Freitag, 18. M?rz 2016, 20:10:04 schrieb Feng Xiao:
> This driver will directly use cpufreq-dt driver as backend.
> 
> As there is not a generic devicetree board file(rockchip.c)
> on ARM64 architecture, so remove platform_device_register_simple
> in rockchip.c and add a new cpufreq driver to support for all
> Rockchip SoCs.
> 
> Signed-off-by: Feng Xiao <xf@rock-chips.com>

[...]

> diff --git a/drivers/cpufreq/rockchip-cpufreq.c
> b/drivers/cpufreq/rockchip-cpufreq.c new file mode 100644
> index 0000000..ecbadcd
> --- /dev/null
> +++ b/drivers/cpufreq/rockchip-cpufreq.c
> @@ -0,0 +1,36 @@
> +/*
> + * Rockchip Platforms CPUFreq Support
> + *
> + * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
> + *
> + * Feng Xiao <xf@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static int __init rockchip_cpufreq_driver_init(void)
> +{
> +	struct platform_device *pdev;
> +
> +	pdev = platform_device_register_simple("cpufreq-dt", -1, NULL, 0);
> +	return PTR_ERR_OR_ZERO(pdev);

This would create that cpufreq-dt device on all non-Rockchip platforms 
compiled into the same kernel image as well - we definitly don't want that.

Also, on both the rk3368 as well as the rk3399, you probably want the cluster-
handling of arm-bL-cpufreq-dt.
Contrary to its name it is _not_ limited to switching between clusters, but 
can also control frequencies of multiple cpu-clusters running at the same 
time.


Implementation-wise, I guess doing it similar to the scpi-implementation might 
make more sense. Please take a look at drivers/clk/clk-scpi.c that registers 
the virtual cpufreq device there.

So we could do something similar, move the cpufreq from mach-rockchip to the 
clock drivers and register the appropriate cpufreq-driver for each soc.
cpufreq-dt for socs with a single cluster, the bL-thing for socs with multiple 
clusters.


Heiko

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-18 12:56   ` Heiko Stübner
@ 2016-03-21  9:50     ` Viresh Kumar
  -1 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-21  9:50 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Feng Xiao, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

On 18-03-16, 13:56, Heiko Stübner wrote:
> Also, on both the rk3368 as well as the rk3399, you probably want the cluster-
> handling of arm-bL-cpufreq-dt.
> Contrary to its name it is _not_ limited to switching between clusters, but 
> can also control frequencies of multiple cpu-clusters running at the same 
> time.

We aren't adding any new users to bL driver, please use cpufreq-dt as that also
supports multiple clusters now.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21  9:50     ` Viresh Kumar
  0 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-21  9:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 18-03-16, 13:56, Heiko St?bner wrote:
> Also, on both the rk3368 as well as the rk3399, you probably want the cluster-
> handling of arm-bL-cpufreq-dt.
> Contrary to its name it is _not_ limited to switching between clusters, but 
> can also control frequencies of multiple cpu-clusters running at the same 
> time.

We aren't adding any new users to bL driver, please use cpufreq-dt as that also
supports multiple clusters now.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21  9:50     ` Viresh Kumar
@ 2016-03-21  9:54       ` Heiko Stübner
  -1 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-21  9:54 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Feng Xiao, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

Am Montag, 21. März 2016, 15:20:49 schrieb Viresh Kumar:
> On 18-03-16, 13:56, Heiko Stübner wrote:
> > Also, on both the rk3368 as well as the rk3399, you probably want the
> > cluster- handling of arm-bL-cpufreq-dt.
> > Contrary to its name it is _not_ limited to switching between clusters,
> > but
> > can also control frequencies of multiple cpu-clusters running at the same
> > time.
> 
> We aren't adding any new users to bL driver, please use cpufreq-dt as that
> also supports multiple clusters now.

I hadn't seen that yet ... nice that cpufreq-dt now also supports clusters :-)

The other part still stands though, as we probably should register the 
platform-device somewhere else and not in some new special module.

When everything is using cpufreq-dt now, I guess we could just add it to the 
core rockchip clk-code. Or was there some agreement where this should be done 
(obviously not the devicetree itself)?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21  9:54       ` Heiko Stübner
  0 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-21  9:54 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, 21. M?rz 2016, 15:20:49 schrieb Viresh Kumar:
> On 18-03-16, 13:56, Heiko St?bner wrote:
> > Also, on both the rk3368 as well as the rk3399, you probably want the
> > cluster- handling of arm-bL-cpufreq-dt.
> > Contrary to its name it is _not_ limited to switching between clusters,
> > but
> > can also control frequencies of multiple cpu-clusters running at the same
> > time.
> 
> We aren't adding any new users to bL driver, please use cpufreq-dt as that
> also supports multiple clusters now.

I hadn't seen that yet ... nice that cpufreq-dt now also supports clusters :-)

The other part still stands though, as we probably should register the 
platform-device somewhere else and not in some new special module.

When everything is using cpufreq-dt now, I guess we could just add it to the 
core rockchip clk-code. Or was there some agreement where this should be done 
(obviously not the devicetree itself)?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21  9:54       ` Heiko Stübner
@ 2016-03-21  9:58         ` Viresh Kumar
  -1 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-21  9:58 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Feng Xiao, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

On 21-03-16, 10:54, Heiko Stübner wrote:
> I hadn't seen that yet ... nice that cpufreq-dt now also supports clusters :-)
> 
> The other part still stands though, as we probably should register the 
> platform-device somewhere else and not in some new special module.
> 
> When everything is using cpufreq-dt now, I guess we could just add it to the 
> core rockchip clk-code. Or was there some agreement where this should be done 
> (obviously not the devicetree itself)?

Yeah, there was a discussion around creating a white or black list of platforms
that want to create a platform device for cpufreq-dt. That can be done in
cpufreq-dt.c or a new file, but I haven't worked out on that yet.

You can do it from clk-code or from the driver that was added in this thread.
Just that you need to match your platform's compatible string before doing that.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21  9:58         ` Viresh Kumar
  0 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-21  9:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 21-03-16, 10:54, Heiko St?bner wrote:
> I hadn't seen that yet ... nice that cpufreq-dt now also supports clusters :-)
> 
> The other part still stands though, as we probably should register the 
> platform-device somewhere else and not in some new special module.
> 
> When everything is using cpufreq-dt now, I guess we could just add it to the 
> core rockchip clk-code. Or was there some agreement where this should be done 
> (obviously not the devicetree itself)?

Yeah, there was a discussion around creating a white or black list of platforms
that want to create a platform device for cpufreq-dt. That can be done in
cpufreq-dt.c or a new file, but I haven't worked out on that yet.

You can do it from clk-code or from the driver that was added in this thread.
Just that you need to match your platform's compatible string before doing that.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21  9:58         ` Viresh Kumar
@ 2016-03-21 13:24           ` Feng Xiao
  -1 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-21 13:24 UTC (permalink / raw)
  To: Viresh Kumar, Heiko Stübner
  Cc: linux, rjw, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-pm, wxt, zyw, jay.xu, tim.chen, xxx, huangtao,
	Stephen Boyd, Michael Turquette



在 2016/3/21 17:58, Viresh Kumar 写道:
> On 21-03-16, 10:54, Heiko Stübner wrote:
>> I hadn't seen that yet ... nice that cpufreq-dt now also supports clusters :-)
>>
>> The other part still stands though, as we probably should register the
>> platform-device somewhere else and not in some new special module.
>>
>> When everything is using cpufreq-dt now, I guess we could just add it to the
>> core rockchip clk-code. Or was there some agreement where this should be done
>> (obviously not the devicetree itself)?
Of_clk_init is called early, and platform_device_register_simple should 
be called after devices_init, it will be failed to do it from clk-code.
So we need add a new file or add module_init to each clock controller 
driver(like clk-rk3368.c, clk-rk3399.c) ?
> Yeah, there was a discussion around creating a white or black list of platforms
> that want to create a platform device for cpufreq-dt. That can be done in
> cpufreq-dt.c or a new file, but I haven't worked out on that yet.
>
> You can do it from clk-code or from the driver that was added in this thread.
> Just that you need to match your platform's compatible string before doing that.
Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be 
compiled on non-Rockchip platforms.
The driver can support all Rockchip SoCs up to now, add 
of_machine_is_compatible may be redundant ?
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21 13:24           ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-21 13:24 UTC (permalink / raw)
  To: linux-arm-kernel



? 2016/3/21 17:58, Viresh Kumar ??:
> On 21-03-16, 10:54, Heiko St?bner wrote:
>> I hadn't seen that yet ... nice that cpufreq-dt now also supports clusters :-)
>>
>> The other part still stands though, as we probably should register the
>> platform-device somewhere else and not in some new special module.
>>
>> When everything is using cpufreq-dt now, I guess we could just add it to the
>> core rockchip clk-code. Or was there some agreement where this should be done
>> (obviously not the devicetree itself)?
Of_clk_init is called early, and platform_device_register_simple should 
be called after devices_init, it will be failed to do it from clk-code.
So we need add a new file or add module_init to each clock controller 
driver(like clk-rk3368.c, clk-rk3399.c) ?
> Yeah, there was a discussion around creating a white or black list of platforms
> that want to create a platform device for cpufreq-dt. That can be done in
> cpufreq-dt.c or a new file, but I haven't worked out on that yet.
>
> You can do it from clk-code or from the driver that was added in this thread.
> Just that you need to match your platform's compatible string before doing that.
Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be 
compiled on non-Rockchip platforms.
The driver can support all Rockchip SoCs up to now, add 
of_machine_is_compatible may be redundant ?
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21 13:24           ` Feng Xiao
@ 2016-03-21 15:13             ` Viresh Kumar
  -1 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-21 15:13 UTC (permalink / raw)
  To: Feng Xiao
  Cc: Heiko Stübner, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

On 21-03-16, 21:24, Feng Xiao wrote:
> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be compiled
> on non-Rockchip platforms.
> The driver can support all Rockchip SoCs up to now, add
> of_machine_is_compatible may be redundant ?

Heard of Multi-platform kernels ?

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21 15:13             ` Viresh Kumar
  0 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-21 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 21-03-16, 21:24, Feng Xiao wrote:
> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be compiled
> on non-Rockchip platforms.
> The driver can support all Rockchip SoCs up to now, add
> of_machine_is_compatible may be redundant ?

Heard of Multi-platform kernels ?

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21 13:24           ` Feng Xiao
@ 2016-03-21 15:13             ` Heiko Stübner
  -1 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-21 15:13 UTC (permalink / raw)
  To: Feng Xiao
  Cc: Viresh Kumar, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

Hi,

Am Montag, 21. März 2016, 21:24:32 schrieb Feng Xiao:
> 在 2016/3/21 17:58, Viresh Kumar 写道:
> > On 21-03-16, 10:54, Heiko Stübner wrote:
> >> I hadn't seen that yet ... nice that cpufreq-dt now also supports
> >> clusters :-)
> >> 
> >> The other part still stands though, as we probably should register the
> >> platform-device somewhere else and not in some new special module.
> >> 
> >> When everything is using cpufreq-dt now, I guess we could just add it to
> >> the core rockchip clk-code. Or was there some agreement where this
> >> should be done (obviously not the devicetree itself)?
> 
> Of_clk_init is called early, and platform_device_register_simple should
> be called after devices_init, it will be failed to do it from clk-code.
> So we need add a new file or add module_init to each clock controller
> driver(like clk-rk3368.c, clk-rk3399.c) ?

as Viresh said, it should be ok to do it like your approach creating a module 
in drivers/cpufreq. But the compatible check is necessary.

Doing it this way also makes it easier to have

> > Yeah, there was a discussion around creating a white or black list of
> > platforms that want to create a platform device for cpufreq-dt. That can
> > be done in cpufreq-dt.c or a new file, but I haven't worked out on that
> > yet.
> > 
> > You can do it from clk-code or from the driver that was added in this
> > thread. Just that you need to match your platform's compatible string
> > before doing that.
> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
> compiled on non-Rockchip platforms.
> The driver can support all Rockchip SoCs up to now, add
> of_machine_is_compatible may be redundant ?

Please always keep multiplatform in mind. These days the kernel can be 
compiled for multiple architectures at the same time, so you can have support 
for Rockchip, Exynos, Qualcom and whatever in the same kernel image.

Therefore a compile-time check is not enough and you need to check the 
actually running machine as well.


Heiko

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21 15:13             ` Heiko Stübner
  0 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-21 15:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Am Montag, 21. M?rz 2016, 21:24:32 schrieb Feng Xiao:
> ? 2016/3/21 17:58, Viresh Kumar ??:
> > On 21-03-16, 10:54, Heiko St?bner wrote:
> >> I hadn't seen that yet ... nice that cpufreq-dt now also supports
> >> clusters :-)
> >> 
> >> The other part still stands though, as we probably should register the
> >> platform-device somewhere else and not in some new special module.
> >> 
> >> When everything is using cpufreq-dt now, I guess we could just add it to
> >> the core rockchip clk-code. Or was there some agreement where this
> >> should be done (obviously not the devicetree itself)?
> 
> Of_clk_init is called early, and platform_device_register_simple should
> be called after devices_init, it will be failed to do it from clk-code.
> So we need add a new file or add module_init to each clock controller
> driver(like clk-rk3368.c, clk-rk3399.c) ?

as Viresh said, it should be ok to do it like your approach creating a module 
in drivers/cpufreq. But the compatible check is necessary.

Doing it this way also makes it easier to have

> > Yeah, there was a discussion around creating a white or black list of
> > platforms that want to create a platform device for cpufreq-dt. That can
> > be done in cpufreq-dt.c or a new file, but I haven't worked out on that
> > yet.
> > 
> > You can do it from clk-code or from the driver that was added in this
> > thread. Just that you need to match your platform's compatible string
> > before doing that.
> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
> compiled on non-Rockchip platforms.
> The driver can support all Rockchip SoCs up to now, add
> of_machine_is_compatible may be redundant ?

Please always keep multiplatform in mind. These days the kernel can be 
compiled for multiple architectures at the same time, so you can have support 
for Rockchip, Exynos, Qualcom and whatever in the same kernel image.

Therefore a compile-time check is not enough and you need to check the 
actually running machine as well.


Heiko

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21 15:13             ` Heiko Stübner
@ 2016-03-21 15:52               ` Heiko Stübner
  -1 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-21 15:52 UTC (permalink / raw)
  To: Feng Xiao
  Cc: Viresh Kumar, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

Am Montag, 21. März 2016, 16:13:40 schrieb Heiko Stübner:
> Hi,
> 
> Am Montag, 21. März 2016, 21:24:32 schrieb Feng Xiao:
> > 在 2016/3/21 17:58, Viresh Kumar 写道:
> > > On 21-03-16, 10:54, Heiko Stübner wrote:
> > >> I hadn't seen that yet ... nice that cpufreq-dt now also supports
> > >> clusters :-)
> > >> 
> > >> The other part still stands though, as we probably should register the
> > >> platform-device somewhere else and not in some new special module.
> > >> 
> > >> When everything is using cpufreq-dt now, I guess we could just add it
> > >> to
> > >> the core rockchip clk-code. Or was there some agreement where this
> > >> should be done (obviously not the devicetree itself)?
> > 
> > Of_clk_init is called early, and platform_device_register_simple should
> > be called after devices_init, it will be failed to do it from clk-code.
> > So we need add a new file or add module_init to each clock controller
> > driver(like clk-rk3368.c, clk-rk3399.c) ?
> 
> as Viresh said, it should be ok to do it like your approach creating a
> module in drivers/cpufreq. But the compatible check is necessary.
> 
> Doing it this way also makes it easier to have

Seem like I forgot the complete my sentence here. This should've been

Doing it this way also makes it easier to have everything go into cpufreq-dt 
once that whitelist appears that Viresh wrote about. So this might be better 
than to distribute this stuff around other subsystems, as I originally 
suggested.

> 
> > > Yeah, there was a discussion around creating a white or black list of
> > > platforms that want to create a platform device for cpufreq-dt. That can
> > > be done in cpufreq-dt.c or a new file, but I haven't worked out on that
> > > yet.
> > > 
> > > You can do it from clk-code or from the driver that was added in this
> > > thread. Just that you need to match your platform's compatible string
> > > before doing that.
> > 
> > Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
> > compiled on non-Rockchip platforms.
> > The driver can support all Rockchip SoCs up to now, add
> > of_machine_is_compatible may be redundant ?
> 
> Please always keep multiplatform in mind. These days the kernel can be
> compiled for multiple architectures at the same time, so you can have
> support for Rockchip, Exynos, Qualcom and whatever in the same kernel
> image.
> 
> Therefore a compile-time check is not enough and you need to check the
> actually running machine as well.
> 
> 
> Heiko

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-21 15:52               ` Heiko Stübner
  0 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-21 15:52 UTC (permalink / raw)
  To: linux-arm-kernel

Am Montag, 21. M?rz 2016, 16:13:40 schrieb Heiko St?bner:
> Hi,
> 
> Am Montag, 21. M?rz 2016, 21:24:32 schrieb Feng Xiao:
> > ? 2016/3/21 17:58, Viresh Kumar ??:
> > > On 21-03-16, 10:54, Heiko St?bner wrote:
> > >> I hadn't seen that yet ... nice that cpufreq-dt now also supports
> > >> clusters :-)
> > >> 
> > >> The other part still stands though, as we probably should register the
> > >> platform-device somewhere else and not in some new special module.
> > >> 
> > >> When everything is using cpufreq-dt now, I guess we could just add it
> > >> to
> > >> the core rockchip clk-code. Or was there some agreement where this
> > >> should be done (obviously not the devicetree itself)?
> > 
> > Of_clk_init is called early, and platform_device_register_simple should
> > be called after devices_init, it will be failed to do it from clk-code.
> > So we need add a new file or add module_init to each clock controller
> > driver(like clk-rk3368.c, clk-rk3399.c) ?
> 
> as Viresh said, it should be ok to do it like your approach creating a
> module in drivers/cpufreq. But the compatible check is necessary.
> 
> Doing it this way also makes it easier to have

Seem like I forgot the complete my sentence here. This should've been

Doing it this way also makes it easier to have everything go into cpufreq-dt 
once that whitelist appears that Viresh wrote about. So this might be better 
than to distribute this stuff around other subsystems, as I originally 
suggested.

> 
> > > Yeah, there was a discussion around creating a white or black list of
> > > platforms that want to create a platform device for cpufreq-dt. That can
> > > be done in cpufreq-dt.c or a new file, but I haven't worked out on that
> > > yet.
> > > 
> > > You can do it from clk-code or from the driver that was added in this
> > > thread. Just that you need to match your platform's compatible string
> > > before doing that.
> > 
> > Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
> > compiled on non-Rockchip platforms.
> > The driver can support all Rockchip SoCs up to now, add
> > of_machine_is_compatible may be redundant ?
> 
> Please always keep multiplatform in mind. These days the kernel can be
> compiled for multiple architectures at the same time, so you can have
> support for Rockchip, Exynos, Qualcom and whatever in the same kernel
> image.
> 
> Therefore a compile-time check is not enough and you need to check the
> actually running machine as well.
> 
> 
> Heiko

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
  2016-03-21 15:52               ` Heiko Stübner
  (?)
@ 2016-03-22  1:28                 ` Feng Xiao
  -1 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-22  1:28 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: Viresh Kumar, linux, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, Stephen Boyd, Michael Turquette

I get it, thanks.

在 2016/3/21 23:52, Heiko Stübner 写道:
> Am Montag, 21. März 2016, 16:13:40 schrieb Heiko Stübner:
>> Hi,
>>
>> Am Montag, 21. März 2016, 21:24:32 schrieb Feng Xiao:
>>> 在 2016/3/21 17:58, Viresh Kumar 写道:
>>>> On 21-03-16, 10:54, Heiko Stübner wrote:
>>>>> I hadn't seen that yet ... nice that cpufreq-dt now also supports
>>>>> clusters :-)
>>>>>
>>>>> The other part still stands though, as we probably should register the
>>>>> platform-device somewhere else and not in some new special module.
>>>>>
>>>>> When everything is using cpufreq-dt now, I guess we could just add it
>>>>> to
>>>>> the core rockchip clk-code. Or was there some agreement where this
>>>>> should be done (obviously not the devicetree itself)?
>>> Of_clk_init is called early, and platform_device_register_simple should
>>> be called after devices_init, it will be failed to do it from clk-code.
>>> So we need add a new file or add module_init to each clock controller
>>> driver(like clk-rk3368.c, clk-rk3399.c) ?
>> as Viresh said, it should be ok to do it like your approach creating a
>> module in drivers/cpufreq. But the compatible check is necessary.
>>
>> Doing it this way also makes it easier to have
> Seem like I forgot the complete my sentence here. This should've been
>
> Doing it this way also makes it easier to have everything go into cpufreq-dt
> once that whitelist appears that Viresh wrote about. So this might be better
> than to distribute this stuff around other subsystems, as I originally
> suggested.
>
>>>> Yeah, there was a discussion around creating a white or black list of
>>>> platforms that want to create a platform device for cpufreq-dt. That can
>>>> be done in cpufreq-dt.c or a new file, but I haven't worked out on that
>>>> yet.
>>>>
>>>> You can do it from clk-code or from the driver that was added in this
>>>> thread. Just that you need to match your platform's compatible string
>>>> before doing that.
>>> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
>>> compiled on non-Rockchip platforms.
>>> The driver can support all Rockchip SoCs up to now, add
>>> of_machine_is_compatible may be redundant ?
>> Please always keep multiplatform in mind. These days the kernel can be
>> compiled for multiple architectures at the same time, so you can have
>> support for Rockchip, Exynos, Qualcom and whatever in the same kernel
>> image.
>>
>> Therefore a compile-time check is not enough and you need to check the
>> actually running machine as well.
>>
>>
>> Heiko
>
>
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH] cpufreq: rockchip: add driver
@ 2016-03-22  1:28                 ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-22  1:28 UTC (permalink / raw)
  To: Heiko Stübner
  Cc: huangtao-TNX95d0MmH7DzftRWevZcw, tim.chen-TNX95d0MmH7DzftRWevZcw,
	linux-lFZ/pmaqli7XmaaqVzeoHQ, linux-pm-u79uwXL29TY76Z2rM5mHXA,
	Viresh Kumar, xxx-TNX95d0MmH7DzftRWevZcw,
	rjw-LthD3rsA81gm4RdzfppkhA, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Michael Turquette, zyw-TNX95d0MmH7DzftRWevZcw,
	jay.xu-TNX95d0MmH7DzftRWevZcw, Stephen Boyd,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	wxt-TNX95d0MmH7DzftRWevZcw

I get it, thanks.

在 2016/3/21 23:52, Heiko Stübner 写道:
> Am Montag, 21. März 2016, 16:13:40 schrieb Heiko Stübner:
>> Hi,
>>
>> Am Montag, 21. März 2016, 21:24:32 schrieb Feng Xiao:
>>> 在 2016/3/21 17:58, Viresh Kumar 写道:
>>>> On 21-03-16, 10:54, Heiko Stübner wrote:
>>>>> I hadn't seen that yet ... nice that cpufreq-dt now also supports
>>>>> clusters :-)
>>>>>
>>>>> The other part still stands though, as we probably should register the
>>>>> platform-device somewhere else and not in some new special module.
>>>>>
>>>>> When everything is using cpufreq-dt now, I guess we could just add it
>>>>> to
>>>>> the core rockchip clk-code. Or was there some agreement where this
>>>>> should be done (obviously not the devicetree itself)?
>>> Of_clk_init is called early, and platform_device_register_simple should
>>> be called after devices_init, it will be failed to do it from clk-code.
>>> So we need add a new file or add module_init to each clock controller
>>> driver(like clk-rk3368.c, clk-rk3399.c) ?
>> as Viresh said, it should be ok to do it like your approach creating a
>> module in drivers/cpufreq. But the compatible check is necessary.
>>
>> Doing it this way also makes it easier to have
> Seem like I forgot the complete my sentence here. This should've been
>
> Doing it this way also makes it easier to have everything go into cpufreq-dt
> once that whitelist appears that Viresh wrote about. So this might be better
> than to distribute this stuff around other subsystems, as I originally
> suggested.
>
>>>> Yeah, there was a discussion around creating a white or black list of
>>>> platforms that want to create a platform device for cpufreq-dt. That can
>>>> be done in cpufreq-dt.c or a new file, but I haven't worked out on that
>>>> yet.
>>>>
>>>> You can do it from clk-code or from the driver that was added in this
>>>> thread. Just that you need to match your platform's compatible string
>>>> before doing that.
>>> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
>>> compiled on non-Rockchip platforms.
>>> The driver can support all Rockchip SoCs up to now, add
>>> of_machine_is_compatible may be redundant ?
>> Please always keep multiplatform in mind. These days the kernel can be
>> compiled for multiple architectures at the same time, so you can have
>> support for Rockchip, Exynos, Qualcom and whatever in the same kernel
>> image.
>>
>> Therefore a compile-time check is not enough and you need to check the
>> actually running machine as well.
>>
>>
>> Heiko
>
>
>



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH] cpufreq: rockchip: add driver
@ 2016-03-22  1:28                 ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-22  1:28 UTC (permalink / raw)
  To: linux-arm-kernel

I get it, thanks.

? 2016/3/21 23:52, Heiko St?bner ??:
> Am Montag, 21. M?rz 2016, 16:13:40 schrieb Heiko St?bner:
>> Hi,
>>
>> Am Montag, 21. M?rz 2016, 21:24:32 schrieb Feng Xiao:
>>> ? 2016/3/21 17:58, Viresh Kumar ??:
>>>> On 21-03-16, 10:54, Heiko St?bner wrote:
>>>>> I hadn't seen that yet ... nice that cpufreq-dt now also supports
>>>>> clusters :-)
>>>>>
>>>>> The other part still stands though, as we probably should register the
>>>>> platform-device somewhere else and not in some new special module.
>>>>>
>>>>> When everything is using cpufreq-dt now, I guess we could just add it
>>>>> to
>>>>> the core rockchip clk-code. Or was there some agreement where this
>>>>> should be done (obviously not the devicetree itself)?
>>> Of_clk_init is called early, and platform_device_register_simple should
>>> be called after devices_init, it will be failed to do it from clk-code.
>>> So we need add a new file or add module_init to each clock controller
>>> driver(like clk-rk3368.c, clk-rk3399.c) ?
>> as Viresh said, it should be ok to do it like your approach creating a
>> module in drivers/cpufreq. But the compatible check is necessary.
>>
>> Doing it this way also makes it easier to have
> Seem like I forgot the complete my sentence here. This should've been
>
> Doing it this way also makes it easier to have everything go into cpufreq-dt
> once that whitelist appears that Viresh wrote about. So this might be better
> than to distribute this stuff around other subsystems, as I originally
> suggested.
>
>>>> Yeah, there was a discussion around creating a white or black list of
>>>> platforms that want to create a platform device for cpufreq-dt. That can
>>>> be done in cpufreq-dt.c or a new file, but I haven't worked out on that
>>>> yet.
>>>>
>>>> You can do it from clk-code or from the driver that was added in this
>>>> thread. Just that you need to match your platform's compatible string
>>>> before doing that.
>>> Rockchip-cpufreq.c depends on ARM_ROCKCHIP_CPUFREQ, it will not be
>>> compiled on non-Rockchip platforms.
>>> The driver can support all Rockchip SoCs up to now, add
>>> of_machine_is_compatible may be redundant ?
>> Please always keep multiplatform in mind. These days the kernel can be
>> compiled for multiple architectures at the same time, so you can have
>> support for Rockchip, Exynos, Qualcom and whatever in the same kernel
>> image.
>>
>> Therefore a compile-time check is not enough and you need to check the
>> actually running machine as well.
>>
>>
>> Heiko
>
>
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v1] cpufreq: rockchip: add driver
  2016-03-18 12:10 ` Feng Xiao
@ 2016-03-22 11:57   ` Feng Xiao
  -1 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-22 11:57 UTC (permalink / raw)
  To: linux, heiko, rjw, viresh.kumar
  Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm, wxt,
	zyw, jay.xu, tim.chen, xxx, huangtao, Feng Xiao

This driver will directly use cpufreq-dt driver as backend.

As there is not a generic devicetree board file(rockchip.c)
on ARM64 architecture, so remove platform_device_register_simple
in rockchip.c and add a new cpufreq driver to support Rockchip
SoCs.

Signed-off-by: Feng Xiao <xf@rock-chips.com>
---
change in v1:
- add compatible check

 arch/arm/mach-rockchip/rockchip.c  |  1 -
 drivers/cpufreq/Kconfig.arm        | 10 +++++++
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/rockchip-cpufreq.c | 55 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpufreq/rockchip-cpufreq.c

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3f07cc5..beb71da 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void)
 {
 	rockchip_suspend_init();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
 }
 
 static const char * const rockchip_board_dt_compat[] = {
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 14b1f93..1786315 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_ROCKCHIP_CPUFREQ
+	tristate "Rockchip CPUfreq driver"
+	depends on ARCH_ROCKCHIP && CPUFREQ_DT
+	select PM_OPP
+	help
+	  This adds the CPUFreq driver support for Rockchip SoCs.
+	  The driver will directly use cpufreq-dt driver as backend.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 9e63fb1..91d8bb7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ)	+= rockchip-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)	+= s3c24xx-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)	+= s3c2410-cpufreq.o
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
new file mode 100644
index 0000000..65c1de9
--- /dev/null
+++ b/drivers/cpufreq/rockchip-cpufreq.c
@@ -0,0 +1,55 @@
+/*
+ * Rockchip Platforms CPUFreq Support
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Feng Xiao <xf@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static const char * const rockchip_compat[] = {
+	"rockchip,rk2928",
+	"rockchip,rk3066a",
+	"rockchip,rk3066b",
+	"rockchip,rk3188",
+	"rockchip,rk3288",
+	"rockchip,rk3366",
+	"rockchip,rk3368",
+	"rockchip,rk3399",
+};
+
+static int __init rockchip_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
+		if (of_machine_is_compatible(rockchip_compat[i])) {
+			pdev = platform_device_register_simple("cpufreq-dt",
+							       -1, NULL, 0);
+			return PTR_ERR_OR_ZERO(pdev);
+		}
+	}
+
+	return -ENODEV;
+}
+module_init(rockchip_cpufreq_driver_init);
+
+MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v1] cpufreq: rockchip: add driver
@ 2016-03-22 11:57   ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-22 11:57 UTC (permalink / raw)
  To: linux-arm-kernel

This driver will directly use cpufreq-dt driver as backend.

As there is not a generic devicetree board file(rockchip.c)
on ARM64 architecture, so remove platform_device_register_simple
in rockchip.c and add a new cpufreq driver to support Rockchip
SoCs.

Signed-off-by: Feng Xiao <xf@rock-chips.com>
---
change in v1:
- add compatible check

 arch/arm/mach-rockchip/rockchip.c  |  1 -
 drivers/cpufreq/Kconfig.arm        | 10 +++++++
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/rockchip-cpufreq.c | 55 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpufreq/rockchip-cpufreq.c

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3f07cc5..beb71da 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void)
 {
 	rockchip_suspend_init();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
 }
 
 static const char * const rockchip_board_dt_compat[] = {
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 14b1f93..1786315 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_ROCKCHIP_CPUFREQ
+	tristate "Rockchip CPUfreq driver"
+	depends on ARCH_ROCKCHIP && CPUFREQ_DT
+	select PM_OPP
+	help
+	  This adds the CPUFreq driver support for Rockchip SoCs.
+	  The driver will directly use cpufreq-dt driver as backend.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 9e63fb1..91d8bb7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ)	+= rockchip-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)	+= s3c24xx-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)	+= s3c2410-cpufreq.o
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
new file mode 100644
index 0000000..65c1de9
--- /dev/null
+++ b/drivers/cpufreq/rockchip-cpufreq.c
@@ -0,0 +1,55 @@
+/*
+ * Rockchip Platforms CPUFreq Support
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Feng Xiao <xf@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static const char * const rockchip_compat[] = {
+	"rockchip,rk2928",
+	"rockchip,rk3066a",
+	"rockchip,rk3066b",
+	"rockchip,rk3188",
+	"rockchip,rk3288",
+	"rockchip,rk3366",
+	"rockchip,rk3368",
+	"rockchip,rk3399",
+};
+
+static int __init rockchip_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
+		if (of_machine_is_compatible(rockchip_compat[i])) {
+			pdev = platform_device_register_simple("cpufreq-dt",
+							       -1, NULL, 0);
+			return PTR_ERR_OR_ZERO(pdev);
+		}
+	}
+
+	return -ENODEV;
+}
+module_init(rockchip_cpufreq_driver_init);
+
+MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH v1] cpufreq: rockchip: add driver
  2016-03-22 11:57   ` Feng Xiao
@ 2016-03-22 16:07     ` Heiko Stübner
  -1 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-22 16:07 UTC (permalink / raw)
  To: Feng Xiao
  Cc: linux, rjw, viresh.kumar, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao

Hi,

Am Dienstag, 22. März 2016, 19:57:28 schrieb Feng Xiao:
> This driver will directly use cpufreq-dt driver as backend.
> 
> As there is not a generic devicetree board file(rockchip.c)
> on ARM64 architecture, so remove platform_device_register_simple
> in rockchip.c and add a new cpufreq driver to support Rockchip
> SoCs.
> 
> Signed-off-by: Feng Xiao <xf@rock-chips.com>

some hints regarding the soc-selection below, otherwise this looks nice.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

[includes an Ack for the mach-rockchip change ;-) ]

[...]

> diff --git a/drivers/cpufreq/rockchip-cpufreq.c
> b/drivers/cpufreq/rockchip-cpufreq.c new file mode 100644
> index 0000000..65c1de9
> --- /dev/null
> +++ b/drivers/cpufreq/rockchip-cpufreq.c
> @@ -0,0 +1,55 @@
> +/*
> + * Rockchip Platforms CPUFreq Support
> + *
> + * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
> + *
> + * Feng Xiao <xf@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static const char * const rockchip_compat[] = {
> +	"rockchip,rk2928",

+	"rockchip,rk3036",

> +	"rockchip,rk3066a",
> +	"rockchip,rk3066b",
> +	"rockchip,rk3188",

+	"rockchip,rk3228",

> +	"rockchip,rk3288",
> +	"rockchip,rk3366",
> +	"rockchip,rk3368",
> +	"rockchip,rk3399",
> +};
> +
> +static int __init rockchip_cpufreq_driver_init(void)
> +{
> +	struct platform_device *pdev;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
> +		if (of_machine_is_compatible(rockchip_compat[i])) {
> +			pdev = platform_device_register_simple("cpufreq-dt",
> +							       -1, NULL, 0);
> +			return PTR_ERR_OR_ZERO(pdev);
> +		}
> +	}
> +
> +	return -ENODEV;
> +}
> +module_init(rockchip_cpufreq_driver_init);
> +
> +MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
> +MODULE_DESCRIPTION("Rockchip cpufreq driver");
> +MODULE_LICENSE("GPL v2");

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v1] cpufreq: rockchip: add driver
@ 2016-03-22 16:07     ` Heiko Stübner
  0 siblings, 0 replies; 38+ messages in thread
From: Heiko Stübner @ 2016-03-22 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Am Dienstag, 22. M?rz 2016, 19:57:28 schrieb Feng Xiao:
> This driver will directly use cpufreq-dt driver as backend.
> 
> As there is not a generic devicetree board file(rockchip.c)
> on ARM64 architecture, so remove platform_device_register_simple
> in rockchip.c and add a new cpufreq driver to support Rockchip
> SoCs.
> 
> Signed-off-by: Feng Xiao <xf@rock-chips.com>

some hints regarding the soc-selection below, otherwise this looks nice.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

[includes an Ack for the mach-rockchip change ;-) ]

[...]

> diff --git a/drivers/cpufreq/rockchip-cpufreq.c
> b/drivers/cpufreq/rockchip-cpufreq.c new file mode 100644
> index 0000000..65c1de9
> --- /dev/null
> +++ b/drivers/cpufreq/rockchip-cpufreq.c
> @@ -0,0 +1,55 @@
> +/*
> + * Rockchip Platforms CPUFreq Support
> + *
> + * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
> + *
> + * Feng Xiao <xf@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed "as is" WITHOUT ANY WARRANTY of any
> + * kind, whether express or implied; without even the implied warranty
> + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/err.h>
> +#include <linux/init.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +static const char * const rockchip_compat[] = {
> +	"rockchip,rk2928",

+	"rockchip,rk3036",

> +	"rockchip,rk3066a",
> +	"rockchip,rk3066b",
> +	"rockchip,rk3188",

+	"rockchip,rk3228",

> +	"rockchip,rk3288",
> +	"rockchip,rk3366",
> +	"rockchip,rk3368",
> +	"rockchip,rk3399",
> +};
> +
> +static int __init rockchip_cpufreq_driver_init(void)
> +{
> +	struct platform_device *pdev;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
> +		if (of_machine_is_compatible(rockchip_compat[i])) {
> +			pdev = platform_device_register_simple("cpufreq-dt",
> +							       -1, NULL, 0);
> +			return PTR_ERR_OR_ZERO(pdev);
> +		}
> +	}
> +
> +	return -ENODEV;
> +}
> +module_init(rockchip_cpufreq_driver_init);
> +
> +MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
> +MODULE_DESCRIPTION("Rockchip cpufreq driver");
> +MODULE_LICENSE("GPL v2");

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
  2016-03-22 11:57   ` Feng Xiao
@ 2016-03-23  2:18     ` Feng Xiao
  -1 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-23  2:18 UTC (permalink / raw)
  To: linux, heiko, rjw, viresh.kumar
  Cc: linux-arm-kernel, linux-rockchip, linux-kernel, linux-pm, wxt,
	zyw, jay.xu, tim.chen, xxx, huangtao, Feng Xiao

This driver will directly use cpufreq-dt driver as backend.

As there is not a generic devicetree board file(rockchip.c)
on ARM64 architecture, so remove platform_device_register_simple
in rockchip.c and add a new cpufreq driver to support Rockchip
SoCs.

Signed-off-by: Feng Xiao <xf@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
---
change in v2:
- add rockchip,rk3036 and rockchip,rk3228 to compatibility list

change in v1:
- add compatible check

 arch/arm/mach-rockchip/rockchip.c  |  1 -
 drivers/cpufreq/Kconfig.arm        | 10 +++++++
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/rockchip-cpufreq.c | 57 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpufreq/rockchip-cpufreq.c

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3f07cc5..beb71da 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void)
 {
 	rockchip_suspend_init();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
 }
 
 static const char * const rockchip_board_dt_compat[] = {
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 14b1f93..1786315 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_ROCKCHIP_CPUFREQ
+	tristate "Rockchip CPUfreq driver"
+	depends on ARCH_ROCKCHIP && CPUFREQ_DT
+	select PM_OPP
+	help
+	  This adds the CPUFreq driver support for Rockchip SoCs.
+	  The driver will directly use cpufreq-dt driver as backend.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 9e63fb1..91d8bb7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ)	+= rockchip-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)	+= s3c24xx-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)	+= s3c2410-cpufreq.o
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
new file mode 100644
index 0000000..9266614
--- /dev/null
+++ b/drivers/cpufreq/rockchip-cpufreq.c
@@ -0,0 +1,57 @@
+/*
+ * Rockchip Platforms CPUFreq Support
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Feng Xiao <xf@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static const char * const rockchip_compat[] = {
+	"rockchip,rk2928",
+	"rockchip,rk3036",
+	"rockchip,rk3066a",
+	"rockchip,rk3066b",
+	"rockchip,rk3188",
+	"rockchip,rk3228",
+	"rockchip,rk3288",
+	"rockchip,rk3366",
+	"rockchip,rk3368",
+	"rockchip,rk3399",
+};
+
+static int __init rockchip_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
+		if (of_machine_is_compatible(rockchip_compat[i])) {
+			pdev = platform_device_register_simple("cpufreq-dt",
+							       -1, NULL, 0);
+			return PTR_ERR_OR_ZERO(pdev);
+		}
+	}
+
+	return -ENODEV;
+}
+module_init(rockchip_cpufreq_driver_init);
+
+MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-23  2:18     ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-23  2:18 UTC (permalink / raw)
  To: linux-arm-kernel

This driver will directly use cpufreq-dt driver as backend.

As there is not a generic devicetree board file(rockchip.c)
on ARM64 architecture, so remove platform_device_register_simple
in rockchip.c and add a new cpufreq driver to support Rockchip
SoCs.

Signed-off-by: Feng Xiao <xf@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
---
change in v2:
- add rockchip,rk3036 and rockchip,rk3228 to compatibility list

change in v1:
- add compatible check

 arch/arm/mach-rockchip/rockchip.c  |  1 -
 drivers/cpufreq/Kconfig.arm        | 10 +++++++
 drivers/cpufreq/Makefile           |  1 +
 drivers/cpufreq/rockchip-cpufreq.c | 57 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 drivers/cpufreq/rockchip-cpufreq.c

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index 3f07cc5..beb71da 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -74,7 +74,6 @@ static void __init rockchip_dt_init(void)
 {
 	rockchip_suspend_init();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-	platform_device_register_simple("cpufreq-dt", 0, NULL, 0);
 }
 
 static const char * const rockchip_board_dt_compat[] = {
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 14b1f93..1786315 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
 	depends on ARCH_OMAP2PLUS
 	default ARCH_OMAP2PLUS
 
+config ARM_ROCKCHIP_CPUFREQ
+	tristate "Rockchip CPUfreq driver"
+	depends on ARCH_ROCKCHIP && CPUFREQ_DT
+	select PM_OPP
+	help
+	  This adds the CPUFreq driver support for Rockchip SoCs.
+	  The driver will directly use cpufreq-dt driver as backend.
+
+	  If in doubt, say N.
+
 config ARM_S3C_CPUFREQ
 	bool
 	help
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 9e63fb1..91d8bb7 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -61,6 +61,7 @@ obj-$(CONFIG_ARM_MT8173_CPUFREQ)	+= mt8173-cpufreq.o
 obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ)	+= omap-cpufreq.o
 obj-$(CONFIG_ARM_PXA2xx_CPUFREQ)	+= pxa2xx-cpufreq.o
 obj-$(CONFIG_PXA3xx)			+= pxa3xx-cpufreq.o
+obj-$(CONFIG_ARM_ROCKCHIP_CPUFREQ)	+= rockchip-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ)	+= s3c24xx-cpufreq.o
 obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o
 obj-$(CONFIG_ARM_S3C2410_CPUFREQ)	+= s3c2410-cpufreq.o
diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c
new file mode 100644
index 0000000..9266614
--- /dev/null
+++ b/drivers/cpufreq/rockchip-cpufreq.c
@@ -0,0 +1,57 @@
+/*
+ * Rockchip Platforms CPUFreq Support
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Feng Xiao <xf@rock-chips.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+static const char * const rockchip_compat[] = {
+	"rockchip,rk2928",
+	"rockchip,rk3036",
+	"rockchip,rk3066a",
+	"rockchip,rk3066b",
+	"rockchip,rk3188",
+	"rockchip,rk3228",
+	"rockchip,rk3288",
+	"rockchip,rk3366",
+	"rockchip,rk3368",
+	"rockchip,rk3399",
+};
+
+static int __init rockchip_cpufreq_driver_init(void)
+{
+	struct platform_device *pdev;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
+		if (of_machine_is_compatible(rockchip_compat[i])) {
+			pdev = platform_device_register_simple("cpufreq-dt",
+							       -1, NULL, 0);
+			return PTR_ERR_OR_ZERO(pdev);
+		}
+	}
+
+	return -ENODEV;
+}
+module_init(rockchip_cpufreq_driver_init);
+
+MODULE_AUTHOR("Feng Xiao <xf@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH v2] cpufreq: rockchip: add driver
  2016-03-23  2:18     ` Feng Xiao
@ 2016-03-23  4:40       ` Viresh Kumar
  -1 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-23  4:40 UTC (permalink / raw)
  To: Feng Xiao
  Cc: linux, heiko, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao

On 23-03-16, 10:18, Feng Xiao wrote:
> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
> index 14b1f93..1786315 100644
> --- a/drivers/cpufreq/Kconfig.arm
> +++ b/drivers/cpufreq/Kconfig.arm
> @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
>  	depends on ARCH_OMAP2PLUS
>  	default ARCH_OMAP2PLUS
>  
> +config ARM_ROCKCHIP_CPUFREQ
> +	tristate "Rockchip CPUfreq driver"

Since you are allowing it to be built as a module ...

> +	depends on ARCH_ROCKCHIP && CPUFREQ_DT
> +	select PM_OPP
> +	help
> +	  This adds the CPUFreq driver support for Rockchip SoCs.
> +	  The driver will directly use cpufreq-dt driver as backend.
> +
> +	  If in doubt, say N.

> +++ b/drivers/cpufreq/rockchip-cpufreq.c
> +static int __init rockchip_cpufreq_driver_init(void)
> +{
> +	struct platform_device *pdev;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
> +		if (of_machine_is_compatible(rockchip_compat[i])) {
> +			pdev = platform_device_register_simple("cpufreq-dt",
> +							       -1, NULL, 0);
> +			return PTR_ERR_OR_ZERO(pdev);
> +		}
> +	}
> +
> +	return -ENODEV;
> +}
> +module_init(rockchip_cpufreq_driver_init);

You need a module exit as well to remove the device. Otherwise following
sequence will give you errors:

insmod rockchip-cpufreq.ko
rmmod rockchip-cpufreq.ko
insmod rockchip-cpufreq.ko //Errors on this..

So, either don't allow it to be built as a module or fix the module-exit path.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-23  4:40       ` Viresh Kumar
  0 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-23  4:40 UTC (permalink / raw)
  To: linux-arm-kernel

On 23-03-16, 10:18, Feng Xiao wrote:
> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
> index 14b1f93..1786315 100644
> --- a/drivers/cpufreq/Kconfig.arm
> +++ b/drivers/cpufreq/Kconfig.arm
> @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
>  	depends on ARCH_OMAP2PLUS
>  	default ARCH_OMAP2PLUS
>  
> +config ARM_ROCKCHIP_CPUFREQ
> +	tristate "Rockchip CPUfreq driver"

Since you are allowing it to be built as a module ...

> +	depends on ARCH_ROCKCHIP && CPUFREQ_DT
> +	select PM_OPP
> +	help
> +	  This adds the CPUFreq driver support for Rockchip SoCs.
> +	  The driver will directly use cpufreq-dt driver as backend.
> +
> +	  If in doubt, say N.

> +++ b/drivers/cpufreq/rockchip-cpufreq.c
> +static int __init rockchip_cpufreq_driver_init(void)
> +{
> +	struct platform_device *pdev;
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
> +		if (of_machine_is_compatible(rockchip_compat[i])) {
> +			pdev = platform_device_register_simple("cpufreq-dt",
> +							       -1, NULL, 0);
> +			return PTR_ERR_OR_ZERO(pdev);
> +		}
> +	}
> +
> +	return -ENODEV;
> +}
> +module_init(rockchip_cpufreq_driver_init);

You need a module exit as well to remove the device. Otherwise following
sequence will give you errors:

insmod rockchip-cpufreq.ko
rmmod rockchip-cpufreq.ko
insmod rockchip-cpufreq.ko //Errors on this..

So, either don't allow it to be built as a module or fix the module-exit path.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2] cpufreq: rockchip: add driver
  2016-03-23  4:40       ` Viresh Kumar
  (?)
@ 2016-03-24  3:01         ` Feng Xiao
  -1 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-24  3:01 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linux, heiko, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao, rjw

hi all,
      I found that it could match the cpufreq-dt driver succesfully only 
with the following changes.
--- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
@@ -139,6 +139,10 @@
                 };
         };

+       cpufreq-dt {   //the node name must be cpufreq-dt
+               compatible = "rockchip,cpufreq";  //  the compatible 
name is insignificant
+       };
+

This was supported by the commit 07e461cd7e73a84f0e3757932b93cc80976fd749

commit 07e461cd7e73a84f0e3757932b93cc80976fd749
Author: Grant Likely <grant.likely@linaro.org>
Date:   Wed May 21 15:40:31 2014 +0900

     of: Ensure unique names without sacrificing determinism

     The way the driver core is implemented, every device using the same bus
     type is required to have a unique name because a symlink to each device
     is created in the appropriate /sys/bus/*/devices directory, and two
     identical names causes a collision.

     The current code handles the requirement by using an globally
     incremented counter that is appended to the device name. It works, but
     it means any change to device registration will change the assigned
     numbers. Instead, if we build up the name by using information from the
     parent nodes, then it can be guaranteed to be unique without adding a
     random number to the end of it.

     Signed-off-by: Grant Likely <grant.likely@linaro.org>
     Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
     Cc: Rob Herring <robh@kernel.org>

If so, do I need to continue to add the new cpufreq driver ?

在 2016/3/23 12:40, Viresh Kumar 写道:
> On 23-03-16, 10:18, Feng Xiao wrote:
>> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
>> index 14b1f93..1786315 100644
>> --- a/drivers/cpufreq/Kconfig.arm
>> +++ b/drivers/cpufreq/Kconfig.arm
>> @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
>>   	depends on ARCH_OMAP2PLUS
>>   	default ARCH_OMAP2PLUS
>>   
>> +config ARM_ROCKCHIP_CPUFREQ
>> +	tristate "Rockchip CPUfreq driver"
> Since you are allowing it to be built as a module ...
>
>> +	depends on ARCH_ROCKCHIP && CPUFREQ_DT
>> +	select PM_OPP
>> +	help
>> +	  This adds the CPUFreq driver support for Rockchip SoCs.
>> +	  The driver will directly use cpufreq-dt driver as backend.
>> +
>> +	  If in doubt, say N.
>> +++ b/drivers/cpufreq/rockchip-cpufreq.c
>> +static int __init rockchip_cpufreq_driver_init(void)
>> +{
>> +	struct platform_device *pdev;
>> +	int i;
>> +
>> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
>> +		if (of_machine_is_compatible(rockchip_compat[i])) {
>> +			pdev = platform_device_register_simple("cpufreq-dt",
>> +							       -1, NULL, 0);
>> +			return PTR_ERR_OR_ZERO(pdev);
>> +		}
>> +	}
>> +
>> +	return -ENODEV;
>> +}
>> +module_init(rockchip_cpufreq_driver_init);
> You need a module exit as well to remove the device. Otherwise following
> sequence will give you errors:
>
> insmod rockchip-cpufreq.ko
> rmmod rockchip-cpufreq.ko
> insmod rockchip-cpufreq.ko //Errors on this..
>
> So, either don't allow it to be built as a module or fix the module-exit path.
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-24  3:01         ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-24  3:01 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: linux, heiko, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao

hi all,
      I found that it could match the cpufreq-dt driver succesfully only 
with the following changes.
--- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
@@ -139,6 +139,10 @@
                 };
         };

+       cpufreq-dt {   //the node name must be cpufreq-dt
+               compatible = "rockchip,cpufreq";  //  the compatible 
name is insignificant
+       };
+

This was supported by the commit 07e461cd7e73a84f0e3757932b93cc80976fd749

commit 07e461cd7e73a84f0e3757932b93cc80976fd749
Author: Grant Likely <grant.likely@linaro.org>
Date:   Wed May 21 15:40:31 2014 +0900

     of: Ensure unique names without sacrificing determinism

     The way the driver core is implemented, every device using the same bus
     type is required to have a unique name because a symlink to each device
     is created in the appropriate /sys/bus/*/devices directory, and two
     identical names causes a collision.

     The current code handles the requirement by using an globally
     incremented counter that is appended to the device name. It works, but
     it means any change to device registration will change the assigned
     numbers. Instead, if we build up the name by using information from the
     parent nodes, then it can be guaranteed to be unique without adding a
     random number to the end of it.

     Signed-off-by: Grant Likely <grant.likely@linaro.org>
     Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
     Cc: Rob Herring <robh@kernel.org>

If so, do I need to continue to add the new cpufreq driver ?

在 2016/3/23 12:40, Viresh Kumar 写道:
> On 23-03-16, 10:18, Feng Xiao wrote:
>> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
>> index 14b1f93..1786315 100644
>> --- a/drivers/cpufreq/Kconfig.arm
>> +++ b/drivers/cpufreq/Kconfig.arm
>> @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
>>   	depends on ARCH_OMAP2PLUS
>>   	default ARCH_OMAP2PLUS
>>   
>> +config ARM_ROCKCHIP_CPUFREQ
>> +	tristate "Rockchip CPUfreq driver"
> Since you are allowing it to be built as a module ...
>
>> +	depends on ARCH_ROCKCHIP && CPUFREQ_DT
>> +	select PM_OPP
>> +	help
>> +	  This adds the CPUFreq driver support for Rockchip SoCs.
>> +	  The driver will directly use cpufreq-dt driver as backend.
>> +
>> +	  If in doubt, say N.
>> +++ b/drivers/cpufreq/rockchip-cpufreq.c
>> +static int __init rockchip_cpufreq_driver_init(void)
>> +{
>> +	struct platform_device *pdev;
>> +	int i;
>> +
>> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
>> +		if (of_machine_is_compatible(rockchip_compat[i])) {
>> +			pdev = platform_device_register_simple("cpufreq-dt",
>> +							       -1, NULL, 0);
>> +			return PTR_ERR_OR_ZERO(pdev);
>> +		}
>> +	}
>> +
>> +	return -ENODEV;
>> +}
>> +module_init(rockchip_cpufreq_driver_init);
> You need a module exit as well to remove the device. Otherwise following
> sequence will give you errors:
>
> insmod rockchip-cpufreq.ko
> rmmod rockchip-cpufreq.ko
> insmod rockchip-cpufreq.ko //Errors on this..
>
> So, either don't allow it to be built as a module or fix the module-exit path.
>



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-24  3:01         ` Feng Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Feng Xiao @ 2016-03-24  3:01 UTC (permalink / raw)
  To: linux-arm-kernel

hi all,
      I found that it could match the cpufreq-dt driver succesfully only 
with the following changes.
--- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
@@ -139,6 +139,10 @@
                 };
         };

+       cpufreq-dt {   //the node name must be cpufreq-dt
+               compatible = "rockchip,cpufreq";  //  the compatible 
name is insignificant
+       };
+

This was supported by the commit 07e461cd7e73a84f0e3757932b93cc80976fd749

commit 07e461cd7e73a84f0e3757932b93cc80976fd749
Author: Grant Likely <grant.likely@linaro.org>
Date:   Wed May 21 15:40:31 2014 +0900

     of: Ensure unique names without sacrificing determinism

     The way the driver core is implemented, every device using the same bus
     type is required to have a unique name because a symlink to each device
     is created in the appropriate /sys/bus/*/devices directory, and two
     identical names causes a collision.

     The current code handles the requirement by using an globally
     incremented counter that is appended to the device name. It works, but
     it means any change to device registration will change the assigned
     numbers. Instead, if we build up the name by using information from the
     parent nodes, then it can be guaranteed to be unique without adding a
     random number to the end of it.

     Signed-off-by: Grant Likely <grant.likely@linaro.org>
     Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
     Cc: Rob Herring <robh@kernel.org>

If so, do I need to continue to add the new cpufreq driver ?

? 2016/3/23 12:40, Viresh Kumar ??:
> On 23-03-16, 10:18, Feng Xiao wrote:
>> diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
>> index 14b1f93..1786315 100644
>> --- a/drivers/cpufreq/Kconfig.arm
>> +++ b/drivers/cpufreq/Kconfig.arm
>> @@ -97,6 +97,16 @@ config ARM_OMAP2PLUS_CPUFREQ
>>   	depends on ARCH_OMAP2PLUS
>>   	default ARCH_OMAP2PLUS
>>   
>> +config ARM_ROCKCHIP_CPUFREQ
>> +	tristate "Rockchip CPUfreq driver"
> Since you are allowing it to be built as a module ...
>
>> +	depends on ARCH_ROCKCHIP && CPUFREQ_DT
>> +	select PM_OPP
>> +	help
>> +	  This adds the CPUFreq driver support for Rockchip SoCs.
>> +	  The driver will directly use cpufreq-dt driver as backend.
>> +
>> +	  If in doubt, say N.
>> +++ b/drivers/cpufreq/rockchip-cpufreq.c
>> +static int __init rockchip_cpufreq_driver_init(void)
>> +{
>> +	struct platform_device *pdev;
>> +	int i;
>> +
>> +	for (i = 0; i < ARRAY_SIZE(rockchip_compat); i++) {
>> +		if (of_machine_is_compatible(rockchip_compat[i])) {
>> +			pdev = platform_device_register_simple("cpufreq-dt",
>> +							       -1, NULL, 0);
>> +			return PTR_ERR_OR_ZERO(pdev);
>> +		}
>> +	}
>> +
>> +	return -ENODEV;
>> +}
>> +module_init(rockchip_cpufreq_driver_init);
> You need a module exit as well to remove the device. Otherwise following
> sequence will give you errors:
>
> insmod rockchip-cpufreq.ko
> rmmod rockchip-cpufreq.ko
> insmod rockchip-cpufreq.ko //Errors on this..
>
> So, either don't allow it to be built as a module or fix the module-exit path.
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2] cpufreq: rockchip: add driver
  2016-03-24  3:01         ` Feng Xiao
@ 2016-03-24  6:43           ` Viresh Kumar
  -1 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-24  6:43 UTC (permalink / raw)
  To: Feng Xiao
  Cc: linux, heiko, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao

On 24-03-16, 11:01, Feng Xiao wrote:
> hi all,
>      I found that it could match the cpufreq-dt driver succesfully only with
> the following changes.
> --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> @@ -139,6 +139,10 @@
>                 };
>         };
> 
> +       cpufreq-dt {   //the node name must be cpufreq-dt
> +               compatible = "rockchip,cpufreq";  //  the compatible name is
> insignificant
> +       };
> +

Its not allowed to create a DT node for a dummy device and so we never
followed this way.

I have just sent a patchset and cc'd you:
"[PATCH 0/3] cpufreq: dt: Create platform device from generic code"

and so this patch shall get replaced now.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-24  6:43           ` Viresh Kumar
  0 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-24  6:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 24-03-16, 11:01, Feng Xiao wrote:
> hi all,
>      I found that it could match the cpufreq-dt driver succesfully only with
> the following changes.
> --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> @@ -139,6 +139,10 @@
>                 };
>         };
> 
> +       cpufreq-dt {   //the node name must be cpufreq-dt
> +               compatible = "rockchip,cpufreq";  //  the compatible name is
> insignificant
> +       };
> +

Its not allowed to create a DT node for a dummy device and so we never
followed this way.

I have just sent a patchset and cc'd you:
"[PATCH 0/3] cpufreq: dt: Create platform device from generic code"

and so this patch shall get replaced now.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2] cpufreq: rockchip: add driver
  2016-03-24  6:43           ` Viresh Kumar
@ 2016-03-24 15:09             ` Finley Xiao
  -1 siblings, 0 replies; 38+ messages in thread
From: Finley Xiao @ 2016-03-24 15:09 UTC (permalink / raw)
  To: Viresh Kumar, Feng Xiao
  Cc: linux, heiko, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao

Hi Viresh,

can we add a of_match_table with a common compatible name as follows ?

--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -470,10 +470,16 @@ static int dt_cpufreq_remove(struct 
platform_device *pdev)
         cpufreq_unregister_driver(&dt_cpufreq_driver);
         return 0;
  }
+static const struct of_device_id dt_cpufreq_of_match[] = {
+       { .compatible = "***,***", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, dt_cpufreq_of_match);
  static struct platform_driver dt_cpufreq_platdrv = {
         .driver = {
                 .name   = "cpufreq-dt",
+               .of_match_table = dt_cpufreq_of_match,
         },

--- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+       cpufreq {
+               compatible = "***,***";
+       }

Does it create a DT node for a dummy device too ?


在 2016/3/24 14:43, Viresh Kumar 写道:
> On 24-03-16, 11:01, Feng Xiao wrote:
>> hi all,
>>       I found that it could match the cpufreq-dt driver succesfully only with
>> the following changes.
>> --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
>> @@ -139,6 +139,10 @@
>>                  };
>>          };
>>
>> +       cpufreq-dt {   //the node name must be cpufreq-dt
>> +               compatible = "rockchip,cpufreq";  //  the compatible name is
>> insignificant
>> +       };
>> +
> Its not allowed to create a DT node for a dummy device and so we never
> followed this way.
>
> I have just sent a patchset and cc'd you:
> "[PATCH 0/3] cpufreq: dt: Create platform device from generic code"
>
> and so this patch shall get replaced now.
>

-- 
Finley

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-24 15:09             ` Finley Xiao
  0 siblings, 0 replies; 38+ messages in thread
From: Finley Xiao @ 2016-03-24 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Viresh,

can we add a of_match_table with a common compatible name as follows ?

--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -470,10 +470,16 @@ static int dt_cpufreq_remove(struct 
platform_device *pdev)
         cpufreq_unregister_driver(&dt_cpufreq_driver);
         return 0;
  }
+static const struct of_device_id dt_cpufreq_of_match[] = {
+       { .compatible = "***,***", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, dt_cpufreq_of_match);
  static struct platform_driver dt_cpufreq_platdrv = {
         .driver = {
                 .name   = "cpufreq-dt",
+               .of_match_table = dt_cpufreq_of_match,
         },

--- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
+       cpufreq {
+               compatible = "***,***";
+       }

Does it create a DT node for a dummy device too ?


? 2016/3/24 14:43, Viresh Kumar ??:
> On 24-03-16, 11:01, Feng Xiao wrote:
>> hi all,
>>       I found that it could match the cpufreq-dt driver succesfully only with
>> the following changes.
>> --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
>> @@ -139,6 +139,10 @@
>>                  };
>>          };
>>
>> +       cpufreq-dt {   //the node name must be cpufreq-dt
>> +               compatible = "rockchip,cpufreq";  //  the compatible name is
>> insignificant
>> +       };
>> +
> Its not allowed to create a DT node for a dummy device and so we never
> followed this way.
>
> I have just sent a patchset and cc'd you:
> "[PATCH 0/3] cpufreq: dt: Create platform device from generic code"
>
> and so this patch shall get replaced now.
>

-- 
Finley

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH v2] cpufreq: rockchip: add driver
  2016-03-24 15:09             ` Finley Xiao
@ 2016-03-25  4:42               ` Viresh Kumar
  -1 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-25  4:42 UTC (permalink / raw)
  To: Finley Xiao
  Cc: Feng Xiao, linux, heiko, rjw, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-pm, wxt, zyw, jay.xu, tim.chen, xxx,
	huangtao

On 24-03-16, 23:09, Finley Xiao wrote:
> --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> +       cpufreq {
> +               compatible = "***,***";
> +       }
> 
> Does it create a DT node for a dummy device too ?

Yes, its not allowed.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH v2] cpufreq: rockchip: add driver
@ 2016-03-25  4:42               ` Viresh Kumar
  0 siblings, 0 replies; 38+ messages in thread
From: Viresh Kumar @ 2016-03-25  4:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 24-03-16, 23:09, Finley Xiao wrote:
> --- a/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3366.dtsi
> +       cpufreq {
> +               compatible = "***,***";
> +       }
> 
> Does it create a DT node for a dummy device too ?

Yes, its not allowed.

-- 
viresh

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2016-03-25  4:42 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 12:10 [PATCH] cpufreq: rockchip: add driver Feng Xiao
2016-03-18 12:10 ` Feng Xiao
2016-03-18 12:56 ` Heiko Stübner
2016-03-18 12:56   ` Heiko Stübner
2016-03-21  9:50   ` Viresh Kumar
2016-03-21  9:50     ` Viresh Kumar
2016-03-21  9:54     ` Heiko Stübner
2016-03-21  9:54       ` Heiko Stübner
2016-03-21  9:58       ` Viresh Kumar
2016-03-21  9:58         ` Viresh Kumar
2016-03-21 13:24         ` Feng Xiao
2016-03-21 13:24           ` Feng Xiao
2016-03-21 15:13           ` Viresh Kumar
2016-03-21 15:13             ` Viresh Kumar
2016-03-21 15:13           ` Heiko Stübner
2016-03-21 15:13             ` Heiko Stübner
2016-03-21 15:52             ` Heiko Stübner
2016-03-21 15:52               ` Heiko Stübner
2016-03-22  1:28               ` Feng Xiao
2016-03-22  1:28                 ` Feng Xiao
2016-03-22  1:28                 ` Feng Xiao
2016-03-22 11:57 ` [PATCH v1] " Feng Xiao
2016-03-22 11:57   ` Feng Xiao
2016-03-22 16:07   ` Heiko Stübner
2016-03-22 16:07     ` Heiko Stübner
2016-03-23  2:18   ` [PATCH v2] " Feng Xiao
2016-03-23  2:18     ` Feng Xiao
2016-03-23  4:40     ` Viresh Kumar
2016-03-23  4:40       ` Viresh Kumar
2016-03-24  3:01       ` Feng Xiao
2016-03-24  3:01         ` Feng Xiao
2016-03-24  3:01         ` Feng Xiao
2016-03-24  6:43         ` Viresh Kumar
2016-03-24  6:43           ` Viresh Kumar
2016-03-24 15:09           ` Finley Xiao
2016-03-24 15:09             ` Finley Xiao
2016-03-25  4:42             ` Viresh Kumar
2016-03-25  4:42               ` Viresh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.