hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/platform_device.h
....@@ -1,17 +1,17 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * platform_device.h - generic, centralized driver model
34 *
45 * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
56 *
6
- * This file is released under the GPLv2
7
- *
8
- * See Documentation/driver-model/ for more information.
7
+ * See Documentation/driver-api/driver-model/ for more information.
98 */
109
1110 #ifndef _PLATFORM_DEVICE_H_
1211 #define _PLATFORM_DEVICE_H_
1312
1413 #include <linux/device.h>
14
+#include <linux/android_kabi.h>
1515
1616 #define PLATFORM_DEVID_NONE (-1)
1717 #define PLATFORM_DEVID_AUTO (-2)
....@@ -25,6 +25,8 @@
2525 int id;
2626 bool id_auto;
2727 struct device dev;
28
+ u64 platform_dma_mask;
29
+ struct device_dma_parameters dma_parms;
2830 u32 num_resources;
2931 struct resource *resource;
3032
....@@ -36,10 +38,14 @@
3638
3739 /* arch specific additions */
3840 struct pdev_archdata archdata;
41
+
42
+ ANDROID_KABI_RESERVE(1);
43
+ ANDROID_KABI_RESERVE(2);
3944 };
4045
4146 #define platform_get_device_id(pdev) ((pdev)->id_entry)
4247
48
+#define dev_is_platform(dev) ((dev)->bus == &platform_bus_type)
4349 #define to_platform_device(x) container_of((x), struct platform_device, dev)
4450
4551 extern int platform_device_register(struct platform_device *);
....@@ -48,26 +54,38 @@
4854 extern struct bus_type platform_bus_type;
4955 extern struct device platform_bus;
5056
51
-extern void arch_setup_pdev_archdata(struct platform_device *);
5257 extern struct resource *platform_get_resource(struct platform_device *,
5358 unsigned int, unsigned int);
59
+extern struct device *
60
+platform_find_device_by_driver(struct device *start,
61
+ const struct device_driver *drv);
5462 extern void __iomem *
5563 devm_platform_get_and_ioremap_resource(struct platform_device *pdev,
5664 unsigned int index, struct resource **res);
5765 extern void __iomem *
5866 devm_platform_ioremap_resource(struct platform_device *pdev,
5967 unsigned int index);
68
+extern void __iomem *
69
+devm_platform_ioremap_resource_wc(struct platform_device *pdev,
70
+ unsigned int index);
71
+extern void __iomem *
72
+devm_platform_ioremap_resource_byname(struct platform_device *pdev,
73
+ const char *name);
6074 extern int platform_get_irq(struct platform_device *, unsigned int);
75
+extern int platform_get_irq_optional(struct platform_device *, unsigned int);
6176 extern int platform_irq_count(struct platform_device *);
6277 extern struct resource *platform_get_resource_byname(struct platform_device *,
6378 unsigned int,
6479 const char *);
6580 extern int platform_get_irq_byname(struct platform_device *, const char *);
81
+extern int platform_get_irq_byname_optional(struct platform_device *dev,
82
+ const char *name);
6683 extern int platform_add_devices(struct platform_device **, int);
6784
6885 struct platform_device_info {
6986 struct device *parent;
7087 struct fwnode_handle *fwnode;
88
+ bool of_node_reused;
7189
7290 const char *name;
7391 int id;
....@@ -79,7 +97,9 @@
7997 size_t size_data;
8098 u64 dma_mask;
8199
82
- struct property_entry *properties;
100
+ const struct property_entry *properties;
101
+
102
+ ANDROID_KABI_RESERVE(1);
83103 };
84104 extern struct platform_device *platform_device_register_full(
85105 const struct platform_device_info *pdevinfo);
....@@ -192,6 +212,8 @@
192212 struct device_driver driver;
193213 const struct platform_device_id *id_table;
194214 bool prevent_deferred_probe;
215
+
216
+ ANDROID_KABI_RESERVE(1);
195217 };
196218
197219 #define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
....@@ -234,6 +256,7 @@
234256 module_driver(__platform_driver, platform_driver_register, \
235257 platform_driver_unregister)
236258
259
+
237260 #define module_platform_driver1(__platform_driver) \
238261 module_driver1(__platform_driver, platform_driver_register, \
239262 platform_driver_unregister)
....@@ -294,58 +317,6 @@
294317 #define platform_register_drivers(drivers, count) \
295318 __platform_register_drivers(drivers, count, THIS_MODULE)
296319
297
-/* early platform driver interface */
298
-struct early_platform_driver {
299
- const char *class_str;
300
- struct platform_driver *pdrv;
301
- struct list_head list;
302
- int requested_id;
303
- char *buffer;
304
- int bufsize;
305
-};
306
-
307
-#define EARLY_PLATFORM_ID_UNSET -2
308
-#define EARLY_PLATFORM_ID_ERROR -3
309
-
310
-extern int early_platform_driver_register(struct early_platform_driver *epdrv,
311
- char *buf);
312
-extern void early_platform_add_devices(struct platform_device **devs, int num);
313
-
314
-static inline int is_early_platform_device(struct platform_device *pdev)
315
-{
316
- return !pdev->dev.driver;
317
-}
318
-
319
-extern void early_platform_driver_register_all(char *class_str);
320
-extern int early_platform_driver_probe(char *class_str,
321
- int nr_probe, int user_only);
322
-extern void early_platform_cleanup(void);
323
-
324
-#define early_platform_init(class_string, platdrv) \
325
- early_platform_init_buffer(class_string, platdrv, NULL, 0)
326
-
327
-#ifndef MODULE
328
-#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
329
-static __initdata struct early_platform_driver early_driver = { \
330
- .class_str = class_string, \
331
- .buffer = buf, \
332
- .bufsize = bufsiz, \
333
- .pdrv = platdrv, \
334
- .requested_id = EARLY_PLATFORM_ID_UNSET, \
335
-}; \
336
-static int __init early_platform_driver_setup_func(char *buffer) \
337
-{ \
338
- return early_platform_driver_register(&early_driver, buffer); \
339
-} \
340
-early_param(class_string, early_platform_driver_setup_func)
341
-#else /* MODULE */
342
-#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
343
-static inline char *early_platform_driver_setup_func(void) \
344
-{ \
345
- return bufsiz ? buf : NULL; \
346
-}
347
-#endif /* MODULE */
348
-
349320 #ifdef CONFIG_SUSPEND
350321 extern int platform_pm_suspend(struct device *dev);
351322 extern int platform_pm_resume(struct device *dev);
....@@ -380,4 +351,19 @@
380351 #define USE_PLATFORM_PM_SLEEP_OPS
381352 #endif
382353
354
+#ifndef CONFIG_SUPERH
355
+/*
356
+ * REVISIT: This stub is needed for all non-SuperH users of early platform
357
+ * drivers. It should go away once we introduce the new platform_device-based
358
+ * early driver framework.
359
+ */
360
+static inline int is_sh_early_platform_device(struct platform_device *pdev)
361
+{
362
+ return 0;
363
+}
364
+#endif /* CONFIG_SUPERH */
365
+
366
+/* For now only SuperH uses it */
367
+void early_platform_cleanup(void);
368
+
383369 #endif /* _PLATFORM_DEVICE_H_ */