Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *  CLPS711X CPU idle driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *  Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/cpuidle.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define CLPS711X_CPUIDLE_NAME	"clps711x-cpuidle"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static void __iomem *clps711x_halt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static int clps711x_cpuidle_halt(struct cpuidle_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 				 struct cpuidle_driver *drv, int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	writel(0xaa, clps711x_halt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	return index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static struct cpuidle_driver clps711x_idle_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	.name		= CLPS711X_CPUIDLE_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	.owner		= THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	.states[0]	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		.name		= "HALT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		.desc		= "CLPS711X HALT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		.enter		= clps711x_cpuidle_halt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		.exit_latency	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	.state_count	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static int __init clps711x_cpuidle_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	clps711x_halt = devm_platform_ioremap_resource(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	if (IS_ERR(clps711x_halt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		return PTR_ERR(clps711x_halt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	return cpuidle_register(&clps711x_idle_driver, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static struct platform_driver clps711x_cpuidle_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	.driver	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		.name	= CLPS711X_CPUIDLE_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) builtin_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe);