Thomas Gleixner | 55716d2 | 2019-06-01 10:08:42 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 2 | /* |
| 3 | * platform_device.h - generic, centralized driver model |
| 4 | * |
| 5 | * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org> |
| 6 | * |
Mauro Carvalho Chehab | fe34c89 | 2019-06-18 12:34:59 -0300 | [diff] [blame] | 7 | * See Documentation/driver-api/driver-model/ for more information. |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef _PLATFORM_DEVICE_H_ |
| 11 | #define _PLATFORM_DEVICE_H_ |
| 12 | |
| 13 | #include <linux/device.h> |
| 14 | |
Jean Delvare | 689ae23 | 2012-07-27 22:14:59 +0200 | [diff] [blame] | 15 | #define PLATFORM_DEVID_NONE (-1) |
| 16 | #define PLATFORM_DEVID_AUTO (-2) |
| 17 | |
Samuel Ortiz | e710d7d | 2011-04-08 00:43:01 +0200 | [diff] [blame] | 18 | struct mfd_cell; |
Heikki Krogerus | f4d0526 | 2016-03-29 14:52:23 +0300 | [diff] [blame] | 19 | struct property_entry; |
Randy Dunlap | ac31672 | 2018-06-19 22:47:28 -0700 | [diff] [blame] | 20 | struct platform_device_id; |
Samuel Ortiz | e710d7d | 2011-04-08 00:43:01 +0200 | [diff] [blame] | 21 | |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 22 | struct platform_device { |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 23 | const char *name; |
Jean Delvare | 1359555e | 2007-09-09 12:54:16 +0200 | [diff] [blame] | 24 | int id; |
Jean Delvare | 689ae23 | 2012-07-27 22:14:59 +0200 | [diff] [blame] | 25 | bool id_auto; |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 26 | struct device dev; |
Christoph Hellwig | e3a36eb | 2020-03-11 17:07:10 +0100 | [diff] [blame] | 27 | u64 platform_dma_mask; |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 28 | u32 num_resources; |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 29 | struct resource *resource; |
Eric Miao | 57fee4a | 2009-02-04 11:52:40 +0800 | [diff] [blame] | 30 | |
Eric Miao | 3d03ba4 | 2010-01-01 15:43:28 +0800 | [diff] [blame] | 31 | const struct platform_device_id *id_entry; |
Kim Phillips | 3d713e0 | 2014-06-02 19:42:58 -0500 | [diff] [blame] | 32 | char *driver_override; /* Driver name to force a match */ |
Magnus Damm | d7aacad | 2009-07-08 13:21:31 +0200 | [diff] [blame] | 33 | |
Samuel Ortiz | e710d7d | 2011-04-08 00:43:01 +0200 | [diff] [blame] | 34 | /* MFD cell pointer */ |
| 35 | struct mfd_cell *mfd_cell; |
| 36 | |
Magnus Damm | d7aacad | 2009-07-08 13:21:31 +0200 | [diff] [blame] | 37 | /* arch specific additions */ |
| 38 | struct pdev_archdata archdata; |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 39 | }; |
| 40 | |
Eric Miao | 57fee4a | 2009-02-04 11:52:40 +0800 | [diff] [blame] | 41 | #define platform_get_device_id(pdev) ((pdev)->id_entry) |
| 42 | |
Andy Shevchenko | 719cf71 | 2018-08-20 16:45:41 +0300 | [diff] [blame] | 43 | #define dev_is_platform(dev) ((dev)->bus == &platform_bus_type) |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 44 | #define to_platform_device(x) container_of((x), struct platform_device, dev) |
| 45 | |
| 46 | extern int platform_device_register(struct platform_device *); |
| 47 | extern void platform_device_unregister(struct platform_device *); |
| 48 | |
| 49 | extern struct bus_type platform_bus_type; |
| 50 | extern struct device platform_bus; |
| 51 | |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 52 | extern struct resource *platform_get_resource(struct platform_device *, |
| 53 | unsigned int, unsigned int); |
Suzuki K Poulose | 36f3313 | 2019-07-23 23:18:38 +0100 | [diff] [blame] | 54 | extern struct device * |
| 55 | platform_find_device_by_driver(struct device *start, |
| 56 | const struct device_driver *drv); |
Bartosz Golaszewski | 7945f92 | 2019-02-20 11:12:39 +0000 | [diff] [blame] | 57 | extern void __iomem * |
Dejin Zheng | 890cc39 | 2020-03-24 00:06:08 +0800 | [diff] [blame] | 58 | devm_platform_get_and_ioremap_resource(struct platform_device *pdev, |
| 59 | unsigned int index, struct resource **res); |
| 60 | extern void __iomem * |
Bartosz Golaszewski | 7945f92 | 2019-02-20 11:12:39 +0000 | [diff] [blame] | 61 | devm_platform_ioremap_resource(struct platform_device *pdev, |
| 62 | unsigned int index); |
Bartosz Golaszewski | bb6243b | 2019-10-22 10:43:14 +0200 | [diff] [blame] | 63 | extern void __iomem * |
| 64 | devm_platform_ioremap_resource_wc(struct platform_device *pdev, |
| 65 | unsigned int index); |
Bartosz Golaszewski | c9c8641 | 2019-10-22 10:43:16 +0200 | [diff] [blame] | 66 | extern void __iomem * |
| 67 | devm_platform_ioremap_resource_byname(struct platform_device *pdev, |
| 68 | const char *name); |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 69 | extern int platform_get_irq(struct platform_device *, unsigned int); |
Thierry Reding | 8973ea4 | 2019-08-28 10:34:10 +0200 | [diff] [blame] | 70 | extern int platform_get_irq_optional(struct platform_device *, unsigned int); |
Stephen Boyd | 4b83555 | 2016-01-06 17:12:47 -0800 | [diff] [blame] | 71 | extern int platform_irq_count(struct platform_device *); |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 72 | extern struct resource *platform_get_resource_byname(struct platform_device *, |
| 73 | unsigned int, |
| 74 | const char *); |
Linus Walleij | c0afe7b | 2009-04-27 02:38:16 +0200 | [diff] [blame] | 75 | extern int platform_get_irq_byname(struct platform_device *, const char *); |
Hans de Goede | f1da567 | 2019-10-05 23:04:47 +0200 | [diff] [blame] | 76 | extern int platform_get_irq_byname_optional(struct platform_device *dev, |
| 77 | const char *name); |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 78 | extern int platform_add_devices(struct platform_device **, int); |
| 79 | |
Uwe Kleine-König | 01dcc60 | 2011-08-25 11:16:00 +0200 | [diff] [blame] | 80 | struct platform_device_info { |
| 81 | struct device *parent; |
Rafael J. Wysocki | ce79348 | 2015-03-16 23:49:03 +0100 | [diff] [blame] | 82 | struct fwnode_handle *fwnode; |
Mans Rullgard | 2c1ea6a | 2019-02-21 11:29:35 +0000 | [diff] [blame] | 83 | bool of_node_reused; |
Uwe Kleine-König | 01dcc60 | 2011-08-25 11:16:00 +0200 | [diff] [blame] | 84 | |
| 85 | const char *name; |
| 86 | int id; |
| 87 | |
| 88 | const struct resource *res; |
| 89 | unsigned int num_res; |
| 90 | |
| 91 | const void *data; |
| 92 | size_t size_data; |
| 93 | u64 dma_mask; |
Mika Westerberg | 00bbc1d | 2015-11-30 17:11:38 +0200 | [diff] [blame] | 94 | |
Tomas Winkler | 469e190 | 2020-02-08 20:44:07 +0200 | [diff] [blame] | 95 | const struct property_entry *properties; |
Uwe Kleine-König | 01dcc60 | 2011-08-25 11:16:00 +0200 | [diff] [blame] | 96 | }; |
| 97 | extern struct platform_device *platform_device_register_full( |
Uwe Kleine-König | 5a3072b | 2011-12-08 22:53:29 +0100 | [diff] [blame] | 98 | const struct platform_device_info *pdevinfo); |
Uwe Kleine-König | 01dcc60 | 2011-08-25 11:16:00 +0200 | [diff] [blame] | 99 | |
| 100 | /** |
| 101 | * platform_device_register_resndata - add a platform-level device with |
| 102 | * resources and platform-specific data |
| 103 | * |
| 104 | * @parent: parent device for the device we're adding |
| 105 | * @name: base name of the device we're adding |
| 106 | * @id: instance id |
| 107 | * @res: set of resources that needs to be allocated for the device |
| 108 | * @num: number of resources |
| 109 | * @data: platform specific data for this platform device |
| 110 | * @size: size of platform specific data |
| 111 | * |
| 112 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. |
| 113 | */ |
| 114 | static inline struct platform_device *platform_device_register_resndata( |
Uwe Kleine-König | 44f28bd | 2010-06-21 16:11:44 +0200 | [diff] [blame] | 115 | struct device *parent, const char *name, int id, |
| 116 | const struct resource *res, unsigned int num, |
Uwe Kleine-König | 01dcc60 | 2011-08-25 11:16:00 +0200 | [diff] [blame] | 117 | const void *data, size_t size) { |
| 118 | |
| 119 | struct platform_device_info pdevinfo = { |
| 120 | .parent = parent, |
| 121 | .name = name, |
| 122 | .id = id, |
| 123 | .res = res, |
| 124 | .num_res = num, |
| 125 | .data = data, |
| 126 | .size_data = size, |
| 127 | .dma_mask = 0, |
| 128 | }; |
| 129 | |
| 130 | return platform_device_register_full(&pdevinfo); |
| 131 | } |
Uwe Kleine-König | 44f28bd | 2010-06-21 16:11:44 +0200 | [diff] [blame] | 132 | |
| 133 | /** |
| 134 | * platform_device_register_simple - add a platform-level device and its resources |
| 135 | * @name: base name of the device we're adding |
| 136 | * @id: instance id |
| 137 | * @res: set of resources that needs to be allocated for the device |
| 138 | * @num: number of resources |
| 139 | * |
| 140 | * This function creates a simple platform device that requires minimal |
| 141 | * resource and memory management. Canned release function freeing memory |
| 142 | * allocated for the device allows drivers using such devices to be |
| 143 | * unloaded without waiting for the last reference to the device to be |
| 144 | * dropped. |
| 145 | * |
| 146 | * This interface is primarily intended for use with legacy drivers which |
| 147 | * probe hardware directly. Because such drivers create sysfs device nodes |
| 148 | * themselves, rather than letting system infrastructure handle such device |
| 149 | * enumeration tasks, they don't fully conform to the Linux driver model. |
| 150 | * In particular, when such drivers are built as modules, they can't be |
| 151 | * "hotplugged". |
| 152 | * |
| 153 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. |
| 154 | */ |
| 155 | static inline struct platform_device *platform_device_register_simple( |
| 156 | const char *name, int id, |
| 157 | const struct resource *res, unsigned int num) |
| 158 | { |
| 159 | return platform_device_register_resndata(NULL, name, id, |
| 160 | res, num, NULL, 0); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * platform_device_register_data - add a platform-level device with platform-specific data |
| 165 | * @parent: parent device for the device we're adding |
| 166 | * @name: base name of the device we're adding |
| 167 | * @id: instance id |
| 168 | * @data: platform specific data for this platform device |
| 169 | * @size: size of platform specific data |
| 170 | * |
| 171 | * This function creates a simple platform device that requires minimal |
| 172 | * resource and memory management. Canned release function freeing memory |
| 173 | * allocated for the device allows drivers using such devices to be |
| 174 | * unloaded without waiting for the last reference to the device to be |
| 175 | * dropped. |
| 176 | * |
| 177 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. |
| 178 | */ |
| 179 | static inline struct platform_device *platform_device_register_data( |
| 180 | struct device *parent, const char *name, int id, |
| 181 | const void *data, size_t size) |
| 182 | { |
| 183 | return platform_device_register_resndata(parent, name, id, |
| 184 | NULL, 0, data, size); |
| 185 | } |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 186 | |
Jean Delvare | 1359555e | 2007-09-09 12:54:16 +0200 | [diff] [blame] | 187 | extern struct platform_device *platform_device_alloc(const char *name, int id); |
Geert Uytterhoeven | 0b7f1a7 | 2009-01-28 21:01:02 +0100 | [diff] [blame] | 188 | extern int platform_device_add_resources(struct platform_device *pdev, |
| 189 | const struct resource *res, |
| 190 | unsigned int num); |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 191 | extern int platform_device_add_data(struct platform_device *pdev, |
| 192 | const void *data, size_t size); |
Mika Westerberg | 00bbc1d | 2015-11-30 17:11:38 +0200 | [diff] [blame] | 193 | extern int platform_device_add_properties(struct platform_device *pdev, |
Jan Kiszka | 277036f | 2017-06-02 07:43:27 +0200 | [diff] [blame] | 194 | const struct property_entry *properties); |
Russell King | 37c12e7 | 2005-11-05 21:19:33 +0000 | [diff] [blame] | 195 | extern int platform_device_add(struct platform_device *pdev); |
Dmitry Torokhov | 93ce306 | 2005-12-10 01:36:27 -0500 | [diff] [blame] | 196 | extern void platform_device_del(struct platform_device *pdev); |
Russell King | 37c12e7 | 2005-11-05 21:19:33 +0000 | [diff] [blame] | 197 | extern void platform_device_put(struct platform_device *pdev); |
| 198 | |
Russell King | 00d3dcd | 2005-11-09 17:23:39 +0000 | [diff] [blame] | 199 | struct platform_driver { |
| 200 | int (*probe)(struct platform_device *); |
| 201 | int (*remove)(struct platform_device *); |
| 202 | void (*shutdown)(struct platform_device *); |
| 203 | int (*suspend)(struct platform_device *, pm_message_t state); |
| 204 | int (*resume)(struct platform_device *); |
| 205 | struct device_driver driver; |
Uwe Kleine-König | 831fad2 | 2010-01-26 09:35:00 +0100 | [diff] [blame] | 206 | const struct platform_device_id *id_table; |
Johan Hovold | 3f9120b | 2013-09-23 16:27:26 +0200 | [diff] [blame] | 207 | bool prevent_deferred_probe; |
Russell King | 00d3dcd | 2005-11-09 17:23:39 +0000 | [diff] [blame] | 208 | }; |
| 209 | |
Rob Herring | 10dbc5e | 2013-04-21 16:38:31 -0500 | [diff] [blame] | 210 | #define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ |
| 211 | driver)) |
| 212 | |
Libo Chen | 9447057 | 2013-05-25 12:40:50 +0800 | [diff] [blame] | 213 | /* |
| 214 | * use a macro to avoid include chaining to get THIS_MODULE |
| 215 | */ |
| 216 | #define platform_driver_register(drv) \ |
| 217 | __platform_driver_register(drv, THIS_MODULE) |
| 218 | extern int __platform_driver_register(struct platform_driver *, |
| 219 | struct module *); |
Russell King | 00d3dcd | 2005-11-09 17:23:39 +0000 | [diff] [blame] | 220 | extern void platform_driver_unregister(struct platform_driver *); |
| 221 | |
David Brownell | c67334f | 2006-11-16 23:28:47 -0800 | [diff] [blame] | 222 | /* non-hotpluggable platform devices may use this so that probe() and |
| 223 | * its support may live in __init sections, conserving runtime memory. |
| 224 | */ |
Wolfram Sang | c3b50dc | 2014-10-28 17:40:41 +0100 | [diff] [blame] | 225 | #define platform_driver_probe(drv, probe) \ |
| 226 | __platform_driver_probe(drv, probe, THIS_MODULE) |
| 227 | extern int __platform_driver_probe(struct platform_driver *driver, |
| 228 | int (*probe)(struct platform_device *), struct module *module); |
David Brownell | c67334f | 2006-11-16 23:28:47 -0800 | [diff] [blame] | 229 | |
Marc Kleine-Budde | 71d6429 | 2011-02-16 23:23:27 +0100 | [diff] [blame] | 230 | static inline void *platform_get_drvdata(const struct platform_device *pdev) |
| 231 | { |
| 232 | return dev_get_drvdata(&pdev->dev); |
| 233 | } |
| 234 | |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 235 | static inline void platform_set_drvdata(struct platform_device *pdev, |
| 236 | void *data) |
Marc Kleine-Budde | 71d6429 | 2011-02-16 23:23:27 +0100 | [diff] [blame] | 237 | { |
| 238 | dev_set_drvdata(&pdev->dev, data); |
| 239 | } |
Russell King | 00d3dcd | 2005-11-09 17:23:39 +0000 | [diff] [blame] | 240 | |
Grant Likely | 940ab88 | 2011-10-05 11:29:49 -0600 | [diff] [blame] | 241 | /* module_platform_driver() - Helper macro for drivers that don't do |
| 242 | * anything special in module init/exit. This eliminates a lot of |
| 243 | * boilerplate. Each module may only use this macro once, and |
| 244 | * calling it replaces module_init() and module_exit() |
| 245 | */ |
| 246 | #define module_platform_driver(__platform_driver) \ |
Lars-Peter Clausen | 907d0ed | 2011-11-16 10:13:35 +0100 | [diff] [blame] | 247 | module_driver(__platform_driver, platform_driver_register, \ |
| 248 | platform_driver_unregister) |
Grant Likely | 940ab88 | 2011-10-05 11:29:49 -0600 | [diff] [blame] | 249 | |
Paul Gortmaker | f309d44 | 2015-05-01 20:10:57 -0400 | [diff] [blame] | 250 | /* builtin_platform_driver() - Helper macro for builtin drivers that |
| 251 | * don't do anything special in driver init. This eliminates some |
| 252 | * boilerplate. Each driver may only use this macro once, and |
| 253 | * calling it replaces device_initcall(). Note this is meant to be |
| 254 | * a parallel of module_platform_driver() above, but w/o _exit stuff. |
| 255 | */ |
| 256 | #define builtin_platform_driver(__platform_driver) \ |
| 257 | builtin_driver(__platform_driver, platform_driver_register) |
| 258 | |
Fabio Porcedda | bab734f | 2013-01-09 12:15:26 +0100 | [diff] [blame] | 259 | /* module_platform_driver_probe() - Helper macro for drivers that don't do |
| 260 | * anything special in module init/exit. This eliminates a lot of |
| 261 | * boilerplate. Each module may only use this macro once, and |
| 262 | * calling it replaces module_init() and module_exit() |
| 263 | */ |
| 264 | #define module_platform_driver_probe(__platform_driver, __platform_probe) \ |
| 265 | static int __init __platform_driver##_init(void) \ |
| 266 | { \ |
| 267 | return platform_driver_probe(&(__platform_driver), \ |
| 268 | __platform_probe); \ |
| 269 | } \ |
| 270 | module_init(__platform_driver##_init); \ |
| 271 | static void __exit __platform_driver##_exit(void) \ |
| 272 | { \ |
| 273 | platform_driver_unregister(&(__platform_driver)); \ |
| 274 | } \ |
| 275 | module_exit(__platform_driver##_exit); |
| 276 | |
Paul Gortmaker | f309d44 | 2015-05-01 20:10:57 -0400 | [diff] [blame] | 277 | /* builtin_platform_driver_probe() - Helper macro for drivers that don't do |
| 278 | * anything special in device init. This eliminates some boilerplate. Each |
| 279 | * driver may only use this macro once, and using it replaces device_initcall. |
| 280 | * This is meant to be a parallel of module_platform_driver_probe above, but |
| 281 | * without the __exit parts. |
| 282 | */ |
| 283 | #define builtin_platform_driver_probe(__platform_driver, __platform_probe) \ |
| 284 | static int __init __platform_driver##_init(void) \ |
| 285 | { \ |
| 286 | return platform_driver_probe(&(__platform_driver), \ |
| 287 | __platform_probe); \ |
| 288 | } \ |
| 289 | device_initcall(__platform_driver##_init); \ |
| 290 | |
Wolfram Sang | 291f653 | 2014-10-28 17:40:42 +0100 | [diff] [blame] | 291 | #define platform_create_bundle(driver, probe, res, n_res, data, size) \ |
| 292 | __platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE) |
| 293 | extern struct platform_device *__platform_create_bundle( |
Fabio Porcedda | 6ae07f2 | 2013-03-26 10:35:17 +0100 | [diff] [blame] | 294 | struct platform_driver *driver, int (*probe)(struct platform_device *), |
| 295 | struct resource *res, unsigned int n_res, |
Wolfram Sang | 291f653 | 2014-10-28 17:40:42 +0100 | [diff] [blame] | 296 | const void *data, size_t size, struct module *module); |
Dmitry Torokhov | ecdf6ce | 2009-12-29 20:11:20 -0800 | [diff] [blame] | 297 | |
Thierry Reding | dbe2256 | 2015-09-25 17:29:04 +0200 | [diff] [blame] | 298 | int __platform_register_drivers(struct platform_driver * const *drivers, |
| 299 | unsigned int count, struct module *owner); |
| 300 | void platform_unregister_drivers(struct platform_driver * const *drivers, |
| 301 | unsigned int count); |
| 302 | |
| 303 | #define platform_register_drivers(drivers, count) \ |
| 304 | __platform_register_drivers(drivers, count, THIS_MODULE) |
| 305 | |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 306 | #ifdef CONFIG_SUSPEND |
| 307 | extern int platform_pm_suspend(struct device *dev); |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 308 | extern int platform_pm_resume(struct device *dev); |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 309 | #else |
| 310 | #define platform_pm_suspend NULL |
| 311 | #define platform_pm_resume NULL |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 312 | #endif |
| 313 | |
| 314 | #ifdef CONFIG_HIBERNATE_CALLBACKS |
| 315 | extern int platform_pm_freeze(struct device *dev); |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 316 | extern int platform_pm_thaw(struct device *dev); |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 317 | extern int platform_pm_poweroff(struct device *dev); |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 318 | extern int platform_pm_restore(struct device *dev); |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 319 | #else |
| 320 | #define platform_pm_freeze NULL |
| 321 | #define platform_pm_thaw NULL |
| 322 | #define platform_pm_poweroff NULL |
| 323 | #define platform_pm_restore NULL |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 324 | #endif |
| 325 | |
Nipun Gupta | 07397df | 2018-04-28 08:21:58 +0530 | [diff] [blame] | 326 | extern int platform_dma_configure(struct device *dev); |
| 327 | |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 328 | #ifdef CONFIG_PM_SLEEP |
| 329 | #define USE_PLATFORM_PM_SLEEP_OPS \ |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 330 | .suspend = platform_pm_suspend, \ |
| 331 | .resume = platform_pm_resume, \ |
| 332 | .freeze = platform_pm_freeze, \ |
| 333 | .thaw = platform_pm_thaw, \ |
| 334 | .poweroff = platform_pm_poweroff, \ |
Rafael J. Wysocki | 9b39e73 | 2011-12-18 00:34:24 +0100 | [diff] [blame] | 335 | .restore = platform_pm_restore, |
Rafael J. Wysocki | 69c9dd1 | 2011-04-29 00:36:05 +0200 | [diff] [blame] | 336 | #else |
| 337 | #define USE_PLATFORM_PM_SLEEP_OPS |
| 338 | #endif |
| 339 | |
Bartosz Golaszewski | 507fd01 | 2019-10-03 11:29:12 +0200 | [diff] [blame] | 340 | #ifndef CONFIG_SUPERH |
| 341 | /* |
| 342 | * REVISIT: This stub is needed for all non-SuperH users of early platform |
| 343 | * drivers. It should go away once we introduce the new platform_device-based |
| 344 | * early driver framework. |
| 345 | */ |
Bartosz Golaszewski | 201e910 | 2019-10-03 11:29:13 +0200 | [diff] [blame] | 346 | static inline int is_sh_early_platform_device(struct platform_device *pdev) |
Bartosz Golaszewski | 507fd01 | 2019-10-03 11:29:12 +0200 | [diff] [blame] | 347 | { |
| 348 | return 0; |
| 349 | } |
| 350 | #endif /* CONFIG_SUPERH */ |
| 351 | |
Russell King | bbbf508 | 2005-10-29 22:17:58 +0100 | [diff] [blame] | 352 | #endif /* _PLATFORM_DEVICE_H_ */ |