]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/cpuidle/cpuidle-clps711x.c
UBUNTU: Ubuntu-4.15.0-96.97
[mirror_ubuntu-bionic-kernel.git] / drivers / cpuidle / cpuidle-clps711x.c
CommitLineData
7c7f8f7f
AS
1/*
2 * CLPS711X CPU idle driver
3 *
4 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru>
5 *
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.
10 */
11
12#include <linux/cpuidle.h>
13#include <linux/err.h>
14#include <linux/io.h>
94e8057b 15#include <linux/init.h>
7c7f8f7f
AS
16#include <linux/platform_device.h>
17
18#define CLPS711X_CPUIDLE_NAME "clps711x-cpuidle"
19
20static void __iomem *clps711x_halt;
21
22static int clps711x_cpuidle_halt(struct cpuidle_device *dev,
23 struct cpuidle_driver *drv, int index)
24{
25 writel(0xaa, clps711x_halt);
26
27 return index;
28}
29
30static struct cpuidle_driver clps711x_idle_driver = {
31 .name = CLPS711X_CPUIDLE_NAME,
32 .owner = THIS_MODULE,
33 .states[0] = {
34 .name = "HALT",
35 .desc = "CLPS711X HALT",
36 .enter = clps711x_cpuidle_halt,
37 .exit_latency = 1,
38 },
39 .state_count = 1,
40};
41
42static int __init clps711x_cpuidle_probe(struct platform_device *pdev)
43{
44 struct resource *res;
45
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);
50
51 return cpuidle_register(&clps711x_idle_driver, NULL);
52}
53
54static struct platform_driver clps711x_cpuidle_driver = {
55 .driver = {
56 .name = CLPS711X_CPUIDLE_NAME,
7c7f8f7f
AS
57 },
58};
94e8057b 59builtin_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe);