1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * CLPS711X CPU idle driver
5 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
8 #include <linux/cpuidle.h>
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
14 #define CLPS711X_CPUIDLE_NAME "clps711x-cpuidle"
16 static void __iomem *clps711x_halt;
18 static int clps711x_cpuidle_halt(struct cpuidle_device *dev,
19 struct cpuidle_driver *drv, int index)
21 writel(0xaa, clps711x_halt);
26 static struct cpuidle_driver clps711x_idle_driver = {
27 .name = CLPS711X_CPUIDLE_NAME,
31 .desc = "CLPS711X HALT",
32 .enter = clps711x_cpuidle_halt,
38 static int __init clps711x_cpuidle_probe(struct platform_device *pdev)
42 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
43 clps711x_halt = devm_ioremap_resource(&pdev->dev, res);
44 if (IS_ERR(clps711x_halt))
45 return PTR_ERR(clps711x_halt);
47 return cpuidle_register(&clps711x_idle_driver, NULL);
50 static struct platform_driver clps711x_cpuidle_driver = {
52 .name = CLPS711X_CPUIDLE_NAME,
55 builtin_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe);