Thread (18 messages) 18 messages, 4 authors, 2016-03-25

[PATCH v1] cpufreq: rockchip: add driver

From: heiko@sntech.de (Heiko Stübner)
Date: 2016-03-22 16:07:57
Also in: linux-pm, linux-rockchip, lkml

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 <redacted>
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 ;-) ]

[...]
quoted hunk ↗ jump to hunk
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 [off-list ref]");
+MODULE_DESCRIPTION("Rockchip cpufreq driver");
+MODULE_LICENSE("GPL v2");
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help