2 * CLPS711X CPU idle driver
4 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #include <linux/cpuidle.h>
13 #include <linux/err.h>
15 #include <linux/module.h>
16 #include <linux/platform_device.h>
18 #define CLPS711X_CPUIDLE_NAME "clps711x-cpuidle"
20 static void __iomem
*clps711x_halt
;
22 static int clps711x_cpuidle_halt(struct cpuidle_device
*dev
,
23 struct cpuidle_driver
*drv
, int index
)
25 writel(0xaa, clps711x_halt
);
30 static struct cpuidle_driver clps711x_idle_driver
= {
31 .name
= CLPS711X_CPUIDLE_NAME
,
35 .desc
= "CLPS711X HALT",
36 .enter
= clps711x_cpuidle_halt
,
42 static int __init
clps711x_cpuidle_probe(struct platform_device
*pdev
)
46 res
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
47 clps711x_halt
= devm_ioremap_resource(&pdev
->dev
, res
);
48 if (IS_ERR(clps711x_halt
))
49 return PTR_ERR(clps711x_halt
);
51 return cpuidle_register(&clps711x_idle_driver
, NULL
);
54 static struct platform_driver clps711x_cpuidle_driver
= {
56 .name
= CLPS711X_CPUIDLE_NAME
,
60 module_platform_driver_probe(clps711x_cpuidle_driver
, clps711x_cpuidle_probe
);
62 MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
63 MODULE_DESCRIPTION("CLPS711X CPU idle driver");
64 MODULE_LICENSE("GPL");