aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-14 23:21:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-14 23:21:54 -0400
commit2481bc75283ea10e75d5fb1a8b42af363fc4b45c (patch)
tree42dd659a23041a08955aceebab859b616164c2f6 /include
parent8691c130fae136bb2b7d0554422a2dff4c6ac169 (diff)
parent518b4e272d99dcb13699b229ea480bc845c141f6 (diff)
Merge tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI updates from Rafael Wysocki: "These are mostly fixes and cleanups all over, although there are a few items that sort of fall into the new feature category. First off, we have new callbacks for PM domains that should help us to handle some issues related to device initialization in a better way. There also is some consolidation in the unified device properties API area allowing us to use that inferface for accessing data coming from platform initialization code in addition to firmware-provided data. We have some new device/CPU IDs in a few drivers, support for new chips and a new cpufreq driver too. Specifics: - Generic PM domains support update including new PM domain callbacks to handle device initialization better (Russell King, Rafael J Wysocki, Kevin Hilman) - Unified device properties API update including a new mechanism for accessing data provided by platform initialization code (Rafael J Wysocki, Adrian Hunter) - ARM cpuidle update including ARM32/ARM64 handling consolidation (Daniel Lezcano) - intel_idle update including support for the Silvermont Core in the Baytrail SOC and for the Airmont Core in the Cherrytrail and Braswell SOCs (Len Brown, Mathias Krause) - New cpufreq driver for Hisilicon ACPU (Leo Yan) - intel_pstate update including support for the Knights Landing chip (Dasaratharaman Chandramouli, Kristen Carlson Accardi) - QorIQ cpufreq driver update (Tang Yuantian, Arnd Bergmann) - powernv cpufreq driver update (Shilpasri G Bhat) - devfreq update including Tegra support changes (Tomeu Vizoso, MyungJoo Ham, Chanwoo Choi) - powercap RAPL (Running-Average Power Limit) driver update including support for Intel Broadwell server chips (Jacob Pan, Mathias Krause) - ACPI device enumeration update related to the handling of the special PRP0001 device ID allowing DT-style 'compatible' property to be used for ACPI device identification (Rafael J Wysocki) - ACPI EC driver update including limited _DEP support (Lan Tianyu, Lv Zheng) - ACPI backlight driver update including a new mechanism to allow native backlight handling to be forced on non-Windows 8 systems and a new quirk for Lenovo Ideapad Z570 (Aaron Lu, Hans de Goede) - New Windows Vista compatibility quirk for Sony VGN-SR19XN (Chen Yu) - Assorted ACPI fixes and cleanups (Aaron Lu, Martin Kepplinger, Masanari Iida, Mika Westerberg, Nan Li, Rafael J Wysocki) - Fixes related to suspend-to-idle for the iTCO watchdog driver and the ACPI core system suspend/resume code (Rafael J Wysocki, Chen Yu) - PM tracing support for the suspend phase of system suspend/resume transitions (Zhonghui Fu) - Configurable delay for the system suspend/resume testing facility (Brian Norris) - PNP subsystem cleanups (Peter Huewe, Rafael J Wysocki)" * tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (74 commits) ACPI / scan: Fix NULL pointer dereference in acpi_companion_match() ACPI / scan: Rework modalias creation when "compatible" is present intel_idle: mark cpu id array as __initconst powercap / RAPL: mark rapl_ids array as __initconst powercap / RAPL: add ID for Broadwell server intel_pstate: Knights Landing support intel_pstate: remove MSR test cpufreq: fix qoriq uniprocessor build ACPI / scan: Take the PRP0001 position in the list of IDs into account ACPI / scan: Simplify acpi_match_device() ACPI / scan: Generalize of_compatible matching device property: Introduce firmware node type for platform data device property: Make it possible to use secondary firmware nodes PM / watchdog: iTCO: stop watchdog during system suspend cpufreq: hisilicon: add acpu driver ACPI / EC: Call acpi_walk_dep_device_list() after installing EC opregion handler cpufreq: powernv: Report cpu frequency throttling intel_idle: Add support for the Airmont Core in the Cherrytrail and Braswell SOCs intel_idle: Update support for Silvermont Core in Baytrail SOC PM / devfreq: tegra: Register governor on module init ...
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h4
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-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
13 files changed, 117 insertions, 34 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 61e32ec1fc4d..8de4fa90e8c4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -252,6 +252,7 @@ struct acpi_device_pnp {
252#define acpi_device_bid(d) ((d)->pnp.bus_id) 252#define acpi_device_bid(d) ((d)->pnp.bus_id)
253#define acpi_device_adr(d) ((d)->pnp.bus_address) 253#define acpi_device_adr(d) ((d)->pnp.bus_address)
254const char *acpi_device_hid(struct acpi_device *device); 254const char *acpi_device_hid(struct acpi_device *device);
255#define acpi_device_uid(d) ((d)->pnp.unique_id)
255#define acpi_device_name(d) ((d)->pnp.device_name) 256#define acpi_device_name(d) ((d)->pnp.device_name)
256#define acpi_device_class(d) ((d)->pnp.device_class) 257#define acpi_device_class(d) ((d)->pnp.device_class)
257 258
@@ -386,7 +387,8 @@ static inline bool is_acpi_node(struct fwnode_handle *fwnode)
386 387
387static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode) 388static inline struct acpi_device *acpi_node(struct fwnode_handle *fwnode)
388{ 389{
389 return fwnode ? container_of(fwnode, struct acpi_device, fwnode) : NULL; 390 return is_acpi_node(fwnode) ?
391 container_of(fwnode, struct acpi_device, fwnode) : NULL;
390} 392}
391 393
392static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev) 394static inline struct fwnode_handle *acpi_fwnode_handle(struct acpi_device *adev)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f8e8b34dc427..392c74c40056 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -170,6 +170,7 @@
170#define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu) 170#define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu)
171#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem) 171#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
172#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method) 172#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
173#define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
173#define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon) 174#define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon)
174 175
175#define KERNEL_DTB() \ 176#define KERNEL_DTB() \
@@ -504,6 +505,7 @@
504 CLKSRC_OF_TABLES() \ 505 CLKSRC_OF_TABLES() \
505 IOMMU_OF_TABLES() \ 506 IOMMU_OF_TABLES() \
506 CPU_METHOD_OF_TABLES() \ 507 CPU_METHOD_OF_TABLES() \
508 CPUIDLE_METHOD_OF_TABLES() \
507 KERNEL_DTB() \ 509 KERNEL_DTB() \
508 IRQCHIP_OF_MATCH_TABLE() \ 510 IRQCHIP_OF_MATCH_TABLE() \
509 EARLYCON_OF_TABLES() 511 EARLYCON_OF_TABLES()
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_ */