aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h15
-rw-r--r--include/linux/devfreq-event.h2
-rw-r--r--include/linux/device.h16
-rw-r--r--include/linux/fwnode.h27
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm-trace.h (renamed from include/linux/resume-trace.h)9
-rw-r--r--include/linux/pm.h8
-rw-r--r--include/linux/pm_domain.h6
-rw-r--r--include/linux/pnp.h12
-rw-r--r--include/linux/property.h44
11 files changed, 112 insertions, 33 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 24c7aa8b1d20..dd12127f171c 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -53,10 +53,16 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
53 return adev ? adev->handle : NULL; 53 return adev ? adev->handle : NULL;
54} 54}
55 55
56#define ACPI_COMPANION(dev) ((dev)->acpi_node.companion) 56#define ACPI_COMPANION(dev) acpi_node((dev)->fwnode)
57#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) 57#define ACPI_COMPANION_SET(dev, adev) set_primary_fwnode(dev, (adev) ? \
58 acpi_fwnode_handle(adev) : NULL)
58#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) 59#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
59 60
61static inline bool has_acpi_companion(struct device *dev)
62{
63 return is_acpi_node(dev->fwnode);
64}
65
60static inline void acpi_preset_companion(struct device *dev, 66static inline void acpi_preset_companion(struct device *dev,
61 struct acpi_device *parent, u64 addr) 67 struct acpi_device *parent, u64 addr)
62{ 68{
@@ -471,6 +477,11 @@ static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
471 return NULL; 477 return NULL;
472} 478}
473 479
480static inline bool has_acpi_companion(struct device *dev)
481{
482 return false;
483}
484
474static inline const char *acpi_dev_name(struct acpi_device *adev) 485static inline const char *acpi_dev_name(struct acpi_device *adev)
475{ 486{
476 return NULL; 487 return NULL;
diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
index 602fbbfcfeed..0a83a1e648b0 100644
--- a/include/linux/devfreq-event.h
+++ b/include/linux/devfreq-event.h
@@ -91,7 +91,7 @@ struct devfreq_event_desc {
91 const char *name; 91 const char *name;
92 void *driver_data; 92 void *driver_data;
93 93
94 struct devfreq_event_ops *ops; 94 const struct devfreq_event_ops *ops;
95}; 95};
96 96
97#if defined(CONFIG_PM_DEVFREQ_EVENT) 97#if defined(CONFIG_PM_DEVFREQ_EVENT)
diff --git a/include/linux/device.h b/include/linux/device.h
index f3f2c7e38060..6558af90c8fe 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -38,6 +38,7 @@ struct class;
38struct subsys_private; 38struct subsys_private;
39struct bus_type; 39struct bus_type;
40struct device_node; 40struct device_node;
41struct fwnode_handle;
41struct iommu_ops; 42struct iommu_ops;
42struct iommu_group; 43struct iommu_group;
43 44
@@ -650,14 +651,6 @@ struct device_dma_parameters {
650 unsigned long segment_boundary_mask; 651 unsigned long segment_boundary_mask;
651}; 652};
652 653
653struct acpi_device;
654
655struct acpi_dev_node {
656#ifdef CONFIG_ACPI
657 struct acpi_device *companion;
658#endif
659};
660
661/** 654/**
662 * struct device - The basic device structure 655 * struct device - The basic device structure
663 * @parent: The device's "parent" device, the device to which it is attached. 656 * @parent: The device's "parent" device, the device to which it is attached.
@@ -703,7 +696,7 @@ struct acpi_dev_node {
703 * @cma_area: Contiguous memory area for dma allocations 696 * @cma_area: Contiguous memory area for dma allocations
704 * @archdata: For arch-specific additions. 697 * @archdata: For arch-specific additions.
705 * @of_node: Associated device tree node. 698 * @of_node: Associated device tree node.
706 * @acpi_node: Associated ACPI device node. 699 * @fwnode: Associated device node supplied by platform firmware.
707 * @devt: For creating the sysfs "dev". 700 * @devt: For creating the sysfs "dev".
708 * @id: device instance 701 * @id: device instance
709 * @devres_lock: Spinlock to protect the resource of the device. 702 * @devres_lock: Spinlock to protect the resource of the device.
@@ -779,7 +772,7 @@ struct device {
779 struct dev_archdata archdata; 772 struct dev_archdata archdata;
780 773
781 struct device_node *of_node; /* associated device tree node */ 774 struct device_node *of_node; /* associated device tree node */
782 struct acpi_dev_node acpi_node; /* associated ACPI device node */ 775 struct fwnode_handle *fwnode; /* firmware device node */
783 776
784 dev_t devt; /* dev_t, creates the sysfs "dev" */ 777 dev_t devt; /* dev_t, creates the sysfs "dev" */
785 u32 id; /* device instance */ 778 u32 id; /* device instance */
@@ -954,6 +947,9 @@ extern void unlock_device_hotplug(void);
954extern int lock_device_hotplug_sysfs(void); 947extern int lock_device_hotplug_sysfs(void);
955extern int device_offline(struct device *dev); 948extern int device_offline(struct device *dev);
956extern int device_online(struct device *dev); 949extern int device_online(struct device *dev);
950extern void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
951extern void set_secondary_fwnode(struct device *dev, struct fwnode_handle *fwnode);
952
957/* 953/*
958 * Root device objects for grouping under /sys/devices 954 * Root device objects for grouping under /sys/devices
959 */ 955 */
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
new file mode 100644
index 000000000000..0408545bce42
--- /dev/null
+++ b/include/linux/fwnode.h
@@ -0,0 +1,27 @@
1/*
2 * fwnode.h - Firmware device node object handle type definition.
3 *
4 * Copyright (C) 2015, Intel Corporation
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_FWNODE_H_
13#define _LINUX_FWNODE_H_
14
15enum fwnode_type {
16 FWNODE_INVALID = 0,
17 FWNODE_OF,
18 FWNODE_ACPI,
19 FWNODE_PDATA,
20};
21
22struct fwnode_handle {
23 enum fwnode_type type;
24 struct fwnode_handle *secondary;
25};
26
27#endif
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 898033f41d76..e83a738a3b87 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -278,7 +278,7 @@ static inline int i2c_slave_event(struct i2c_client *client,
278 * @platform_data: stored in i2c_client.dev.platform_data 278 * @platform_data: stored in i2c_client.dev.platform_data
279 * @archdata: copied into i2c_client.dev.archdata 279 * @archdata: copied into i2c_client.dev.archdata
280 * @of_node: pointer to OpenFirmware device node 280 * @of_node: pointer to OpenFirmware device node
281 * @acpi_node: ACPI device node 281 * @fwnode: device node supplied by the platform firmware
282 * @irq: stored in i2c_client.irq 282 * @irq: stored in i2c_client.irq
283 * 283 *
284 * I2C doesn't actually support hardware probing, although controllers and 284 * I2C doesn't actually support hardware probing, although controllers and
@@ -299,7 +299,7 @@ struct i2c_board_info {
299 void *platform_data; 299 void *platform_data;
300 struct dev_archdata *archdata; 300 struct dev_archdata *archdata;
301 struct device_node *of_node; 301 struct device_node *of_node;
302 struct acpi_dev_node acpi_node; 302 struct fwnode_handle *fwnode;
303 int irq; 303 int irq;
304}; 304};
305 305
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ae4882ca4a64..58f1e75ba105 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -59,7 +59,7 @@ extern int platform_add_devices(struct platform_device **, int);
59 59
60struct platform_device_info { 60struct platform_device_info {
61 struct device *parent; 61 struct device *parent;
62 struct acpi_dev_node acpi_node; 62 struct fwnode_handle *fwnode;
63 63
64 const char *name; 64 const char *name;
65 int id; 65 int id;
diff --git a/include/linux/resume-trace.h b/include/linux/pm-trace.h
index f31db2368782..ecbde7a5548e 100644
--- a/include/linux/resume-trace.h
+++ b/include/linux/pm-trace.h
@@ -1,8 +1,8 @@
1#ifndef RESUME_TRACE_H 1#ifndef PM_TRACE_H
2#define RESUME_TRACE_H 2#define PM_TRACE_H
3 3
4#ifdef CONFIG_PM_TRACE 4#ifdef CONFIG_PM_TRACE
5#include <asm/resume-trace.h> 5#include <asm/pm-trace.h>
6#include <linux/types.h> 6#include <linux/types.h>
7 7
8extern int pm_trace_enabled; 8extern int pm_trace_enabled;
@@ -14,7 +14,7 @@ static inline int pm_trace_is_enabled(void)
14 14
15struct device; 15struct device;
16extern void set_trace_device(struct device *); 16extern void set_trace_device(struct device *);
17extern void generate_resume_trace(const void *tracedata, unsigned int user); 17extern void generate_pm_trace(const void *tracedata, unsigned int user);
18extern int show_trace_dev_match(char *buf, size_t size); 18extern int show_trace_dev_match(char *buf, size_t size);
19 19
20#define TRACE_DEVICE(dev) do { \ 20#define TRACE_DEVICE(dev) do { \
@@ -28,6 +28,7 @@ static inline int pm_trace_is_enabled(void) { return 0; }
28 28
29#define TRACE_DEVICE(dev) do { } while (0) 29#define TRACE_DEVICE(dev) do { } while (0)
30#define TRACE_RESUME(dev) do { } while (0) 30#define TRACE_RESUME(dev) do { } while (0)
31#define TRACE_SUSPEND(dev) do { } while (0)
31 32
32#endif 33#endif
33 34
diff --git a/include/linux/pm.h b/include/linux/pm.h
index e2f1be6dd9dd..2d29c64f8fb1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -603,10 +603,18 @@ extern void dev_pm_put_subsys_data(struct device *dev);
603 * Power domains provide callbacks that are executed during system suspend, 603 * Power domains provide callbacks that are executed during system suspend,
604 * hibernation, system resume and during runtime PM transitions along with 604 * hibernation, system resume and during runtime PM transitions along with
605 * subsystem-level and driver-level callbacks. 605 * subsystem-level and driver-level callbacks.
606 *
607 * @detach: Called when removing a device from the domain.
608 * @activate: Called before executing probe routines for bus types and drivers.
609 * @sync: Called after successful driver probe.
610 * @dismiss: Called after unsuccessful driver probe and after driver removal.
606 */ 611 */
607struct dev_pm_domain { 612struct dev_pm_domain {
608 struct dev_pm_ops ops; 613 struct dev_pm_ops ops;
609 void (*detach)(struct device *dev, bool power_off); 614 void (*detach)(struct device *dev, bool power_off);
615 int (*activate)(struct device *dev);
616 void (*sync)(struct device *dev);
617 void (*dismiss)(struct device *dev);
610}; 618};
611 619
612/* 620/*
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 080e778118ba..681ccb053f72 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -127,7 +127,7 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
127 return to_gpd_data(dev->power.subsys_data->domain_data); 127 return to_gpd_data(dev->power.subsys_data->domain_data);
128} 128}
129 129
130extern struct generic_pm_domain *dev_to_genpd(struct device *dev); 130extern struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev);
131extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, 131extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
132 struct device *dev, 132 struct device *dev,
133 struct gpd_timing_data *td); 133 struct gpd_timing_data *td);
@@ -163,9 +163,9 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
163{ 163{
164 return ERR_PTR(-ENOSYS); 164 return ERR_PTR(-ENOSYS);
165} 165}
166static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 166static inline struct generic_pm_domain *pm_genpd_lookup_dev(struct device *dev)
167{ 167{
168 return ERR_PTR(-ENOSYS); 168 return NULL;
169} 169}
170static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd, 170static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
171 struct device *dev, 171 struct device *dev,
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 6512e9cbc6d5..5df733b8f704 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -510,4 +510,16 @@ static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
510 510
511#endif /* CONFIG_PNP */ 511#endif /* CONFIG_PNP */
512 512
513/**
514 * module_pnp_driver() - Helper macro for registering a PnP driver
515 * @__pnp_driver: pnp_driver struct
516 *
517 * Helper macro for PnP drivers which do not do anything special in module
518 * init/exit. This eliminates a lot of boilerplate. Each module may only
519 * use this macro once, and calling it replaces module_init() and module_exit()
520 */
521#define module_pnp_driver(__pnp_driver) \
522 module_driver(__pnp_driver, pnp_register_driver, \
523 pnp_unregister_driver)
524
513#endif /* _LINUX_PNP_H */ 525#endif /* _LINUX_PNP_H */
diff --git a/include/linux/property.h b/include/linux/property.h
index a6a3d98bd7e9..de8bdf417a35 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -13,6 +13,7 @@
13#ifndef _LINUX_PROPERTY_H_ 13#ifndef _LINUX_PROPERTY_H_
14#define _LINUX_PROPERTY_H_ 14#define _LINUX_PROPERTY_H_
15 15
16#include <linux/fwnode.h>
16#include <linux/types.h> 17#include <linux/types.h>
17 18
18struct device; 19struct device;
@@ -40,16 +41,6 @@ int device_property_read_string_array(struct device *dev, const char *propname,
40int device_property_read_string(struct device *dev, const char *propname, 41int device_property_read_string(struct device *dev, const char *propname,
41 const char **val); 42 const char **val);
42 43
43enum fwnode_type {
44 FWNODE_INVALID = 0,
45 FWNODE_OF,
46 FWNODE_ACPI,
47};
48
49struct fwnode_handle {
50 enum fwnode_type type;
51};
52
53bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname); 44bool fwnode_property_present(struct fwnode_handle *fwnode, const char *propname);
54int fwnode_property_read_u8_array(struct fwnode_handle *fwnode, 45int fwnode_property_read_u8_array(struct fwnode_handle *fwnode,
55 const char *propname, u8 *val, 46 const char *propname, u8 *val,
@@ -140,4 +131,37 @@ static inline int fwnode_property_read_u64(struct fwnode_handle *fwnode,
140 return fwnode_property_read_u64_array(fwnode, propname, val, 1); 131 return fwnode_property_read_u64_array(fwnode, propname, val, 1);
141} 132}
142 133
134/**
135 * struct property_entry - "Built-in" device property representation.
136 * @name: Name of the property.
137 * @type: Type of the property.
138 * @nval: Number of items of type @type making up the value.
139 * @value: Value of the property (an array of @nval items of type @type).
140 */
141struct property_entry {
142 const char *name;
143 enum dev_prop_type type;
144 size_t nval;
145 union {
146 void *raw_data;
147 u8 *u8_data;
148 u16 *u16_data;
149 u32 *u32_data;
150 u64 *u64_data;
151 const char **str;
152 } value;
153};
154
155/**
156 * struct property_set - Collection of "built-in" device properties.
157 * @fwnode: Handle to be pointed to by the fwnode field of struct device.
158 * @properties: Array of properties terminated with a null entry.
159 */
160struct property_set {
161 struct fwnode_handle fwnode;
162 struct property_entry *properties;
163};
164
165void device_add_property_set(struct device *dev, struct property_set *pset);
166
143#endif /* _LINUX_PROPERTY_H_ */ 167#endif /* _LINUX_PROPERTY_H_ */