diff options
Diffstat (limited to 'arch/x86/platform/olpc')
-rw-r--r-- | arch/x86/platform/olpc/olpc-xo1.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/arch/x86/platform/olpc/olpc-xo1.c b/arch/x86/platform/olpc/olpc-xo1.c index 127775696d6c..f4155354a7b0 100644 --- a/arch/x86/platform/olpc/olpc-xo1.c +++ b/arch/x86/platform/olpc/olpc-xo1.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/pm.h> | 17 | #include <linux/pm.h> |
18 | #include <linux/mfd/core.h> | ||
18 | 19 | ||
19 | #include <asm/io.h> | 20 | #include <asm/io.h> |
20 | #include <asm/olpc.h> | 21 | #include <asm/olpc.h> |
@@ -56,25 +57,24 @@ static void xo1_power_off(void) | |||
56 | static int __devinit olpc_xo1_probe(struct platform_device *pdev) | 57 | static int __devinit olpc_xo1_probe(struct platform_device *pdev) |
57 | { | 58 | { |
58 | struct resource *res; | 59 | struct resource *res; |
60 | int err; | ||
59 | 61 | ||
60 | /* don't run on non-XOs */ | 62 | /* don't run on non-XOs */ |
61 | if (!machine_is_olpc()) | 63 | if (!machine_is_olpc()) |
62 | return -ENODEV; | 64 | return -ENODEV; |
63 | 65 | ||
66 | err = mfd_shared_cell_enable(pdev); | ||
67 | if (err) | ||
68 | return err; | ||
69 | |||
64 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 70 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
65 | if (!res) { | 71 | if (!res) { |
66 | dev_err(&pdev->dev, "can't fetch device resource info\n"); | 72 | dev_err(&pdev->dev, "can't fetch device resource info\n"); |
67 | return -EIO; | 73 | return -EIO; |
68 | } | 74 | } |
69 | 75 | if (strcmp(pdev->name, "olpc-xo1-pms") == 0) | |
70 | if (!request_region(res->start, resource_size(res), DRV_NAME)) { | ||
71 | dev_err(&pdev->dev, "can't request region\n"); | ||
72 | return -EIO; | ||
73 | } | ||
74 | |||
75 | if (strcmp(pdev->name, "cs5535-pms") == 0) | ||
76 | pms_base = res->start; | 76 | pms_base = res->start; |
77 | else if (strcmp(pdev->name, "cs5535-acpi") == 0) | 77 | else if (strcmp(pdev->name, "olpc-xo1-ac-acpi") == 0) |
78 | acpi_base = res->start; | 78 | acpi_base = res->start; |
79 | 79 | ||
80 | /* If we have both addresses, we can override the poweroff hook */ | 80 | /* If we have both addresses, we can override the poweroff hook */ |
@@ -88,14 +88,11 @@ static int __devinit olpc_xo1_probe(struct platform_device *pdev) | |||
88 | 88 | ||
89 | static int __devexit olpc_xo1_remove(struct platform_device *pdev) | 89 | static int __devexit olpc_xo1_remove(struct platform_device *pdev) |
90 | { | 90 | { |
91 | struct resource *r; | 91 | mfd_shared_cell_disable(pdev); |
92 | |||
93 | r = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
94 | release_region(r->start, resource_size(r)); | ||
95 | 92 | ||
96 | if (strcmp(pdev->name, "cs5535-pms") == 0) | 93 | if (strcmp(pdev->name, "olpc-xo1-pms") == 0) |
97 | pms_base = 0; | 94 | pms_base = 0; |
98 | else if (strcmp(pdev->name, "cs5535-acpi") == 0) | 95 | else if (strcmp(pdev->name, "olpc-xo1-acpi") == 0) |
99 | acpi_base = 0; | 96 | acpi_base = 0; |
100 | 97 | ||
101 | pm_power_off = NULL; | 98 | pm_power_off = NULL; |
@@ -104,7 +101,7 @@ static int __devexit olpc_xo1_remove(struct platform_device *pdev) | |||
104 | 101 | ||
105 | static struct platform_driver cs5535_pms_drv = { | 102 | static struct platform_driver cs5535_pms_drv = { |
106 | .driver = { | 103 | .driver = { |
107 | .name = "cs5535-pms", | 104 | .name = "olpc-xo1-pms", |
108 | .owner = THIS_MODULE, | 105 | .owner = THIS_MODULE, |
109 | }, | 106 | }, |
110 | .probe = olpc_xo1_probe, | 107 | .probe = olpc_xo1_probe, |
@@ -113,7 +110,7 @@ static struct platform_driver cs5535_pms_drv = { | |||
113 | 110 | ||
114 | static struct platform_driver cs5535_acpi_drv = { | 111 | static struct platform_driver cs5535_acpi_drv = { |
115 | .driver = { | 112 | .driver = { |
116 | .name = "cs5535-acpi", | 113 | .name = "olpc-xo1-acpi", |
117 | .owner = THIS_MODULE, | 114 | .owner = THIS_MODULE, |
118 | }, | 115 | }, |
119 | .probe = olpc_xo1_probe, | 116 | .probe = olpc_xo1_probe, |
@@ -124,26 +121,27 @@ static int __init olpc_xo1_init(void) | |||
124 | { | 121 | { |
125 | int r; | 122 | int r; |
126 | 123 | ||
127 | r = platform_driver_register(&cs5535_pms_drv); | 124 | r = mfd_shared_platform_driver_register(&cs5535_pms_drv, "cs5535-pms"); |
128 | if (r) | 125 | if (r) |
129 | return r; | 126 | return r; |
130 | 127 | ||
131 | r = platform_driver_register(&cs5535_acpi_drv); | 128 | r = mfd_shared_platform_driver_register(&cs5535_acpi_drv, |
129 | "cs5535-acpi"); | ||
132 | if (r) | 130 | if (r) |
133 | platform_driver_unregister(&cs5535_pms_drv); | 131 | mfd_shared_platform_driver_unregister(&cs5535_pms_drv); |
134 | 132 | ||
135 | return r; | 133 | return r; |
136 | } | 134 | } |
137 | 135 | ||
138 | static void __exit olpc_xo1_exit(void) | 136 | static void __exit olpc_xo1_exit(void) |
139 | { | 137 | { |
140 | platform_driver_unregister(&cs5535_acpi_drv); | 138 | mfd_shared_platform_driver_unregister(&cs5535_acpi_drv); |
141 | platform_driver_unregister(&cs5535_pms_drv); | 139 | mfd_shared_platform_driver_unregister(&cs5535_pms_drv); |
142 | } | 140 | } |
143 | 141 | ||
144 | MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>"); | 142 | MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>"); |
145 | MODULE_LICENSE("GPL"); | 143 | MODULE_LICENSE("GPL"); |
146 | MODULE_ALIAS("platform:olpc-xo1"); | 144 | MODULE_ALIAS("platform:cs5535-pms"); |
147 | 145 | ||
148 | module_init(olpc_xo1_init); | 146 | module_init(olpc_xo1_init); |
149 | module_exit(olpc_xo1_exit); | 147 | module_exit(olpc_xo1_exit); |