cpuidle-kirkwood.c (554c06ba3ee29cf453fca17e9e61120b75aa476d) cpuidle-kirkwood.c (30dc72c6fa91c640e98ce5ef5ec33fb2beb41ad2)
1/*
2 * arch/arm/mach-kirkwood/cpuidle.c
3 *
4 * CPU idle Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.

--- 38 unchanged lines hidden (view full) ---

47 .exit_latency = 10,
48 .target_residency = 100000,
49 .flags = CPUIDLE_FLAG_TIME_VALID,
50 .name = "DDR SR",
51 .desc = "WFI and DDR Self Refresh",
52 },
53 .state_count = KIRKWOOD_MAX_STATES,
54};
1/*
2 * arch/arm/mach-kirkwood/cpuidle.c
3 *
4 * CPU idle Marvell Kirkwood SoCs
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.

--- 38 unchanged lines hidden (view full) ---

47 .exit_latency = 10,
48 .target_residency = 100000,
49 .flags = CPUIDLE_FLAG_TIME_VALID,
50 .name = "DDR SR",
51 .desc = "WFI and DDR Self Refresh",
52 },
53 .state_count = KIRKWOOD_MAX_STATES,
54};
55static struct cpuidle_device *device;
56
55
57static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
58
59/* Initialize CPU idle by registering the idle states */
60static int kirkwood_cpuidle_probe(struct platform_device *pdev)
61{
62 struct resource *res;
63
64 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
65 if (res == NULL)
66 return -EINVAL;
67
68 ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
69 if (IS_ERR(ddr_operation_base))
70 return PTR_ERR(ddr_operation_base);
71
56/* Initialize CPU idle by registering the idle states */
57static int kirkwood_cpuidle_probe(struct platform_device *pdev)
58{
59 struct resource *res;
60
61 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
62 if (res == NULL)
63 return -EINVAL;
64
65 ddr_operation_base = devm_ioremap_resource(&pdev->dev, res);
66 if (IS_ERR(ddr_operation_base))
67 return PTR_ERR(ddr_operation_base);
68
72 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
73 device->state_count = KIRKWOOD_MAX_STATES;
74
75 cpuidle_register_driver(&kirkwood_idle_driver);
76 if (cpuidle_register_device(device)) {
77 pr_err("kirkwood_init_cpuidle: Failed registering\n");
78 return -EIO;
79 }
80 return 0;
69 return cpuidle_register(&kirkwood_idle_driver, NULL);
81}
82
83int kirkwood_cpuidle_remove(struct platform_device *pdev)
84{
70}
71
72int kirkwood_cpuidle_remove(struct platform_device *pdev)
73{
85 cpuidle_unregister_device(device);
86 cpuidle_unregister_driver(&kirkwood_idle_driver);
87
74 cpuidle_unregister(&kirkwood_idle_driver);
88 return 0;
89}
90
91static struct platform_driver kirkwood_cpuidle_driver = {
92 .probe = kirkwood_cpuidle_probe,
93 .remove = kirkwood_cpuidle_remove,
94 .driver = {
95 .name = "kirkwood_cpuidle",
96 .owner = THIS_MODULE,
97 },
98};
99
100module_platform_driver(kirkwood_cpuidle_driver);
101
102MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
103MODULE_DESCRIPTION("Kirkwood cpu idle driver");
104MODULE_LICENSE("GPL v2");
105MODULE_ALIAS("platform:kirkwood-cpuidle");
75 return 0;
76}
77
78static struct platform_driver kirkwood_cpuidle_driver = {
79 .probe = kirkwood_cpuidle_probe,
80 .remove = kirkwood_cpuidle_remove,
81 .driver = {
82 .name = "kirkwood_cpuidle",
83 .owner = THIS_MODULE,
84 },
85};
86
87module_platform_driver(kirkwood_cpuidle_driver);
88
89MODULE_AUTHOR("Andrew Lunn <andrew@lunn.ch>");
90MODULE_DESCRIPTION("Kirkwood cpu idle driver");
91MODULE_LICENSE("GPL v2");
92MODULE_ALIAS("platform:kirkwood-cpuidle");