mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 12:57:07 +07:00
67990608c8
- Add a debugfs-based interface for interacting with the ACPICA's AML debugger introduced in the previous cycle and a new user space tool for that, fix some bugs related to the AML debugger and clean up the code in question (Lv Zheng, Dan Carpenter, Colin Ian King, Markus Elfring). - Update ACPICA to upstream revision 20151218 including a number of fixes and cleanups in the ACPICA core (Bob Moore, Lv Zheng, Labbe Corentin, Prarit Bhargava, Colin Ian King, David E Box, Rafael Wysocki). In particular, the previously added erroneous support for the _SUB object is dropped, the concatenate operator will support all ACPI objects now, the Debug Object handling is improved, the SuperName handling of parameters being control methods is fixed, the ObjectType operator handling is updated to follow ACPI 5.0A and the handling of CondRefOf and RefOf is updated accordingly, module-level code will be executed after loading each ACPI table now (instead of being run once after all tables containing AML have been loaded), the Operation Region handlers management is updated to fix some reported problems and a the ACPICA code in the kernel is more in line with the upstream now. - Update the ACPI backlight driver to provide information on whether or not it will generate key-presses for brightness change hotkeys and update some platform drivers (dell-wmi, thinkpad_acpi) to use that information to avoid sending double key-events to users pace for these, add new ACPI backlight quirks (Hans de Goede, Aaron Lu, Adrien Schildknecht). - Improve the ACPI handling of interrupt GPIOs (Christophe Ricard). - Fix the handling of the list of device IDs of device objects found in the ACPI namespace and add a helper for checking if there is a device object for a given device ID (Lukas Wunner). - Change the logic in the ACPI namespace scanning code to create struct acpi_device objects for all ACPI device objects found in the namespace even if _STA fails for them which helps to avoid device enumeration problems on Microsoft Surface 3 (Aaron Lu). - Add support for the APM X-Gene ACPI I2C device to the ACPI driver for AMD SoCs (Loc Ho). - Fix the long-standing issue with the DMA controller on Intel SoCs where ACPI tables have no power management support for the DMA controller itself, but it can be powered off automatically when the last (other) device on the SoC is powered off via ACPI and clean up the ACPI driver for Intel SoCs (acpi-lpss) after previous attempts to fix that problem (Andy Shevchenko). - Assorted ACPI fixes and cleanups (Andy Lutomirski, Colin Ian King, Javier Martinez Canillas, Ken Xue, Mathias Krause, Rafael Wysocki, Sinan Kaya). - Update the device properties framework for better handling of built-in properties, add support for built-in properties to the platform bus type, update the MFD subsystem's handling of device properties and add support for passing default configuration data as device properties to the intel-lpss MFD drivers, convert the designware I2C driver to use the unified device properties API and add a fallback mechanism for using default built-in properties if the platform firmware fails to provide the properties as expected by drivers (Andy Shevchenko, Mika Westerberg, Heikki Krogerus, Andrew Morton). - Add new Device Tree bindings to the Operating Performance Points (OPP) framework and update the exynos4412 DT binding accordingly, introduce debugfs support for the OPP framework (Viresh Kumar, Bartlomiej Zolnierkiewicz). - Migrate the mt8173 cpufreq driver to the new OPP bindings (Pi-Cheng Chen). - Update the cpufreq core to make the handling of governors more efficient, especially on systems where policy objects are shared between multiple CPUs (Viresh Kumar, Rafael Wysocki). - Fix cpufreq governor handling on configurations with CONFIG_HZ_PERIODIC set (Chen Yu). - Clean up the cpufreq core code related to the boost sysfs knob support and update the ACPI cpufreq driver accordingly (Rafael Wysocki). - Add a new cpufreq driver for ST platforms and corresponding Device Tree bindings (Lee Jones). - Update the intel_pstate driver to allow the P-state selection algorithm used by it to depend on the CPU ID of the processor it is running on, make it use a special P-state selection algorithm (with an IO wait time compensation tweak) on Atom CPUs based on the Airmont and Silvermont cores so as to reduce their energy consumption and improve intel_pstate documentation (Philippe Longepe, Srinivas Pandruvada). - Update the cpufreq-dt driver to support registering cooling devices that use the (P * V^2 * f) dynamic power draw formula where V is the voltage, f is the frequency and P is a constant coefficient provided by Device Tree and update the arm_big_little cpufreq driver to use that support (Punit Agrawal). - Assorted cpufreq driver (cpufreq-dt, qoriq, pcc-cpufreq, blackfin-cpufreq) updates (Andrzej Hajda, Hongtao Jia, Jacob Tanenbaum, Markus Elfring). - cpuidle core tweaks related to polling and measured_us calculation (Rik van Riel). - Removal of modularity from a few cpuidle drivers (clps711x, ux500, exynos) that cannot be built as modules in practice (Paul Gortmaker). - PM core update to prevent devices from being probed during system suspend/resume which is generally problematic and may lead to inconsistent behavior (Grygorii Strashko). - Assorted updates of the PM core and related code (Julia Lawall, Manuel Pégourié-Gonnard, Maruthi Bayyavarapu, Rafael Wysocki, Ulf Hansson). - PNP bus type updates (Christophe Le Roy, Heiner Kallweit). - PCI PM code cleanups (Jarkko Nikula, Julia Lawall). - cpupower tool updates (Jacob Tanenbaum, Thomas Renninger). / -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABCAAGBQJWlZOmAAoJEILEb/54YlRxxtEP/ioR0xMOJQcWd5F6Oyj1PZsx vJeXsmL3fXFAlr6riaE966QqclhUTDhhex3kbFmNQvM8WukxOmBWy5UMSjRg2UmM PHrogc/KrrE+xb8hjGZPgqVr+/L9O3C6lZmM+AUciT0hWZJckYgRh5TpHb1xN/Kx MptvtSXRBM62LWytug+EwA4SHt7OFS0yJ/CI1pKvODVtLaYDIPI5k+4ilPU7y6Be vfoysvmUozNTEYxgPOPXfoQqW2P5t2df32Re31uKtLenLXbc8KW0wIYm24DXgSK6 V/TyDVZTNaZk6OpTqWrjqFbedpGvcBpViwYEY7yv33GDCpXGdHQl3ga+Jy6PAUem 7oGDZtA+5Di/8szhH/wSdpXwSaKEeUdFiaj6Uw2MAwiY4wzv5+WmLRcuIjQFDAxT elrTbQhAgaMlMsUkQ9NV4GC7ByUeeQX2NpCielsHngOQgKdYRQHyYUgGXc2Wgjdq UnVrIWRHzXSED0RtPI7IT0Y4PSxkM9UoSEiVUwt3srCue2CFzuENs23qaDgAzeDa 5uwnDl4RhI2BrLVT1WhioIFgFE5Yh5Xx6dSGC+jcU2ss8r2oN6DdUbqOzWAa1iR4 sFhgwwwizpCCfB6pSqEuDdg8W56HjvE9kQY9kcTPPNPbktL0VImC+iiSN/CgZJv9 MH9NbQM8uHkfNcpjsN7V =OlYA -----END PGP SIGNATURE----- Merge tag 'pm+acpi-4.5-rc1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull oower management and ACPI updates from Rafael Wysocki: "As far as the number of commits goes, ACPICA takes the lead this time, followed by cpufreq and the device properties framework changes. The most significant new feature is the debugfs-based interface to the ACPICA's AML debugger added in the previous cycle and a new user space tool for accessing it. On the cpufreq front, the core is updated to handle governors more efficiently, particularly on systems where a single cpufreq policy object is shared between multiple CPUs, and there are quite a few changes in drivers (intel_pstate, cpufreq-dt etc). The device properties framework is updated to handle built-in (ie included in the kernel itself) device properties better, among other things by adding a fallback mechanism that will allow drivers to provide default properties to be used in case the plaform firmware doesn't provide the properties expected by them. The Operating Performance Points (OPP) framework gets new DT bindings and debugfs support. A new cpufreq driver for ST platforms is added and the ACPI driver for AMD SoCs will now support the APM X-Gene ACPI I2C device. The rest is mostly fixes and cleanups all over. Specifics: - Add a debugfs-based interface for interacting with the ACPICA's AML debugger introduced in the previous cycle and a new user space tool for that, fix some bugs related to the AML debugger and clean up the code in question (Lv Zheng, Dan Carpenter, Colin Ian King, Markus Elfring). - Update ACPICA to upstream revision 20151218 including a number of fixes and cleanups in the ACPICA core (Bob Moore, Lv Zheng, Labbe Corentin, Prarit Bhargava, Colin Ian King, David E Box, Rafael Wysocki). In particular, the previously added erroneous support for the _SUB object is dropped, the concatenate operator will support all ACPI objects now, the Debug Object handling is improved, the SuperName handling of parameters being control methods is fixed, the ObjectType operator handling is updated to follow ACPI 5.0A and the handling of CondRefOf and RefOf is updated accordingly, module- level code will be executed after loading each ACPI table now (instead of being run once after all tables containing AML have been loaded), the Operation Region handlers management is updated to fix some reported problems and a the ACPICA code in the kernel is more in line with the upstream now. - Update the ACPI backlight driver to provide information on whether or not it will generate key-presses for brightness change hotkeys and update some platform drivers (dell-wmi, thinkpad_acpi) to use that information to avoid sending double key-events to users pace for these, add new ACPI backlight quirks (Hans de Goede, Aaron Lu, Adrien Schildknecht). - Improve the ACPI handling of interrupt GPIOs (Christophe Ricard). - Fix the handling of the list of device IDs of device objects found in the ACPI namespace and add a helper for checking if there is a device object for a given device ID (Lukas Wunner). - Change the logic in the ACPI namespace scanning code to create struct acpi_device objects for all ACPI device objects found in the namespace even if _STA fails for them which helps to avoid device enumeration problems on Microsoft Surface 3 (Aaron Lu). - Add support for the APM X-Gene ACPI I2C device to the ACPI driver for AMD SoCs (Loc Ho). - Fix the long-standing issue with the DMA controller on Intel SoCs where ACPI tables have no power management support for the DMA controller itself, but it can be powered off automatically when the last (other) device on the SoC is powered off via ACPI and clean up the ACPI driver for Intel SoCs (acpi-lpss) after previous attempts to fix that problem (Andy Shevchenko). - Assorted ACPI fixes and cleanups (Andy Lutomirski, Colin Ian King, Javier Martinez Canillas, Ken Xue, Mathias Krause, Rafael Wysocki, Sinan Kaya). - Update the device properties framework for better handling of built-in properties, add support for built-in properties to the platform bus type, update the MFD subsystem's handling of device properties and add support for passing default configuration data as device properties to the intel-lpss MFD drivers, convert the designware I2C driver to use the unified device properties API and add a fallback mechanism for using default built-in properties if the platform firmware fails to provide the properties as expected by drivers (Andy Shevchenko, Mika Westerberg, Heikki Krogerus, Andrew Morton). - Add new Device Tree bindings to the Operating Performance Points (OPP) framework and update the exynos4412 DT binding accordingly, introduce debugfs support for the OPP framework (Viresh Kumar, Bartlomiej Zolnierkiewicz). - Migrate the mt8173 cpufreq driver to the new OPP bindings (Pi-Cheng Chen). - Update the cpufreq core to make the handling of governors more efficient, especially on systems where policy objects are shared between multiple CPUs (Viresh Kumar, Rafael Wysocki). - Fix cpufreq governor handling on configurations with CONFIG_HZ_PERIODIC set (Chen Yu). - Clean up the cpufreq core code related to the boost sysfs knob support and update the ACPI cpufreq driver accordingly (Rafael Wysocki). - Add a new cpufreq driver for ST platforms and corresponding Device Tree bindings (Lee Jones). - Update the intel_pstate driver to allow the P-state selection algorithm used by it to depend on the CPU ID of the processor it is running on, make it use a special P-state selection algorithm (with an IO wait time compensation tweak) on Atom CPUs based on the Airmont and Silvermont cores so as to reduce their energy consumption and improve intel_pstate documentation (Philippe Longepe, Srinivas Pandruvada). - Update the cpufreq-dt driver to support registering cooling devices that use the (P * V^2 * f) dynamic power draw formula where V is the voltage, f is the frequency and P is a constant coefficient provided by Device Tree and update the arm_big_little cpufreq driver to use that support (Punit Agrawal). - Assorted cpufreq driver (cpufreq-dt, qoriq, pcc-cpufreq, blackfin-cpufreq) updates (Andrzej Hajda, Hongtao Jia, Jacob Tanenbaum, Markus Elfring). - cpuidle core tweaks related to polling and measured_us calculation (Rik van Riel). - Removal of modularity from a few cpuidle drivers (clps711x, ux500, exynos) that cannot be built as modules in practice (Paul Gortmaker). - PM core update to prevent devices from being probed during system suspend/resume which is generally problematic and may lead to inconsistent behavior (Grygorii Strashko). - Assorted updates of the PM core and related code (Julia Lawall, Manuel Pégourié-Gonnard, Maruthi Bayyavarapu, Rafael Wysocki, Ulf Hansson). - PNP bus type updates (Christophe Le Roy, Heiner Kallweit). - PCI PM code cleanups (Jarkko Nikula, Julia Lawall). - cpupower tool updates (Jacob Tanenbaum, Thomas Renninger)" * tag 'pm+acpi-4.5-rc1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (177 commits) PM / clk: don't leave clocks enabled when driver not bound i2c: dw: Add APM X-Gene ACPI I2C device support ACPI / APD: Add APM X-Gene ACPI I2C device support ACPI / LPSS: change 'does not have' to 'has' in comment Revert "dmaengine: dw: platform: provide platform data for Intel" dmaengine: dw: return immediately from IRQ when DMA isn't in use dmaengine: dw: platform: power on device on shutdown ACPI / LPSS: override power state for LPSS DMA device PM / OPP: Use snprintf() instead of sprintf() Documentation: cpufreq: intel_pstate: enhance documentation ACPI, PCI, irq: remove redundant check for null string pointer ACPI / video: driver must be registered before checking for keypresses cpufreq-dt: fix handling regulator_get_voltage() result cpufreq: governor: Fix negative idle_time when configured with CONFIG_HZ_PERIODIC PM / sleep: Add support for read-only sysfs attributes ACPI: Fix white space in a structure definition ACPI / SBS: fix inconsistent indenting inside if statement PNP: respect PNP_DRIVER_RES_DO_NOT_CHANGE when detaching ACPI / PNP: constify device IDs ACPI / PCI: Simplify acpi_penalize_isa_irq() ...
372 lines
12 KiB
C
372 lines
12 KiB
C
/*
|
|
* platform_device.h - generic, centralized driver model
|
|
*
|
|
* Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
|
|
*
|
|
* This file is released under the GPLv2
|
|
*
|
|
* See Documentation/driver-model/ for more information.
|
|
*/
|
|
|
|
#ifndef _PLATFORM_DEVICE_H_
|
|
#define _PLATFORM_DEVICE_H_
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
#define PLATFORM_DEVID_NONE (-1)
|
|
#define PLATFORM_DEVID_AUTO (-2)
|
|
|
|
struct mfd_cell;
|
|
struct property_set;
|
|
|
|
struct platform_device {
|
|
const char *name;
|
|
int id;
|
|
bool id_auto;
|
|
struct device dev;
|
|
u32 num_resources;
|
|
struct resource *resource;
|
|
|
|
const struct platform_device_id *id_entry;
|
|
char *driver_override; /* Driver name to force a match */
|
|
|
|
/* MFD cell pointer */
|
|
struct mfd_cell *mfd_cell;
|
|
|
|
/* arch specific additions */
|
|
struct pdev_archdata archdata;
|
|
};
|
|
|
|
#define platform_get_device_id(pdev) ((pdev)->id_entry)
|
|
|
|
#define to_platform_device(x) container_of((x), struct platform_device, dev)
|
|
|
|
extern int platform_device_register(struct platform_device *);
|
|
extern void platform_device_unregister(struct platform_device *);
|
|
|
|
extern struct bus_type platform_bus_type;
|
|
extern struct device platform_bus;
|
|
|
|
extern void arch_setup_pdev_archdata(struct platform_device *);
|
|
extern struct resource *platform_get_resource(struct platform_device *,
|
|
unsigned int, unsigned int);
|
|
extern int platform_get_irq(struct platform_device *, unsigned int);
|
|
extern int platform_irq_count(struct platform_device *);
|
|
extern struct resource *platform_get_resource_byname(struct platform_device *,
|
|
unsigned int,
|
|
const char *);
|
|
extern int platform_get_irq_byname(struct platform_device *, const char *);
|
|
extern int platform_add_devices(struct platform_device **, int);
|
|
|
|
struct platform_device_info {
|
|
struct device *parent;
|
|
struct fwnode_handle *fwnode;
|
|
|
|
const char *name;
|
|
int id;
|
|
|
|
const struct resource *res;
|
|
unsigned int num_res;
|
|
|
|
const void *data;
|
|
size_t size_data;
|
|
u64 dma_mask;
|
|
|
|
const struct property_set *pset;
|
|
};
|
|
extern struct platform_device *platform_device_register_full(
|
|
const struct platform_device_info *pdevinfo);
|
|
|
|
/**
|
|
* platform_device_register_resndata - add a platform-level device with
|
|
* resources and platform-specific data
|
|
*
|
|
* @parent: parent device for the device we're adding
|
|
* @name: base name of the device we're adding
|
|
* @id: instance id
|
|
* @res: set of resources that needs to be allocated for the device
|
|
* @num: number of resources
|
|
* @data: platform specific data for this platform device
|
|
* @size: size of platform specific data
|
|
*
|
|
* Returns &struct platform_device pointer on success, or ERR_PTR() on error.
|
|
*/
|
|
static inline struct platform_device *platform_device_register_resndata(
|
|
struct device *parent, const char *name, int id,
|
|
const struct resource *res, unsigned int num,
|
|
const void *data, size_t size) {
|
|
|
|
struct platform_device_info pdevinfo = {
|
|
.parent = parent,
|
|
.name = name,
|
|
.id = id,
|
|
.res = res,
|
|
.num_res = num,
|
|
.data = data,
|
|
.size_data = size,
|
|
.dma_mask = 0,
|
|
};
|
|
|
|
return platform_device_register_full(&pdevinfo);
|
|
}
|
|
|
|
/**
|
|
* platform_device_register_simple - add a platform-level device and its resources
|
|
* @name: base name of the device we're adding
|
|
* @id: instance id
|
|
* @res: set of resources that needs to be allocated for the device
|
|
* @num: number of resources
|
|
*
|
|
* This function creates a simple platform device that requires minimal
|
|
* resource and memory management. Canned release function freeing memory
|
|
* allocated for the device allows drivers using such devices to be
|
|
* unloaded without waiting for the last reference to the device to be
|
|
* dropped.
|
|
*
|
|
* This interface is primarily intended for use with legacy drivers which
|
|
* probe hardware directly. Because such drivers create sysfs device nodes
|
|
* themselves, rather than letting system infrastructure handle such device
|
|
* enumeration tasks, they don't fully conform to the Linux driver model.
|
|
* In particular, when such drivers are built as modules, they can't be
|
|
* "hotplugged".
|
|
*
|
|
* Returns &struct platform_device pointer on success, or ERR_PTR() on error.
|
|
*/
|
|
static inline struct platform_device *platform_device_register_simple(
|
|
const char *name, int id,
|
|
const struct resource *res, unsigned int num)
|
|
{
|
|
return platform_device_register_resndata(NULL, name, id,
|
|
res, num, NULL, 0);
|
|
}
|
|
|
|
/**
|
|
* platform_device_register_data - add a platform-level device with platform-specific data
|
|
* @parent: parent device for the device we're adding
|
|
* @name: base name of the device we're adding
|
|
* @id: instance id
|
|
* @data: platform specific data for this platform device
|
|
* @size: size of platform specific data
|
|
*
|
|
* This function creates a simple platform device that requires minimal
|
|
* resource and memory management. Canned release function freeing memory
|
|
* allocated for the device allows drivers using such devices to be
|
|
* unloaded without waiting for the last reference to the device to be
|
|
* dropped.
|
|
*
|
|
* Returns &struct platform_device pointer on success, or ERR_PTR() on error.
|
|
*/
|
|
static inline struct platform_device *platform_device_register_data(
|
|
struct device *parent, const char *name, int id,
|
|
const void *data, size_t size)
|
|
{
|
|
return platform_device_register_resndata(parent, name, id,
|
|
NULL, 0, data, size);
|
|
}
|
|
|
|
extern struct platform_device *platform_device_alloc(const char *name, int id);
|
|
extern int platform_device_add_resources(struct platform_device *pdev,
|
|
const struct resource *res,
|
|
unsigned int num);
|
|
extern int platform_device_add_data(struct platform_device *pdev,
|
|
const void *data, size_t size);
|
|
extern int platform_device_add_properties(struct platform_device *pdev,
|
|
const struct property_set *pset);
|
|
extern int platform_device_add(struct platform_device *pdev);
|
|
extern void platform_device_del(struct platform_device *pdev);
|
|
extern void platform_device_put(struct platform_device *pdev);
|
|
|
|
struct platform_driver {
|
|
int (*probe)(struct platform_device *);
|
|
int (*remove)(struct platform_device *);
|
|
void (*shutdown)(struct platform_device *);
|
|
int (*suspend)(struct platform_device *, pm_message_t state);
|
|
int (*resume)(struct platform_device *);
|
|
struct device_driver driver;
|
|
const struct platform_device_id *id_table;
|
|
bool prevent_deferred_probe;
|
|
};
|
|
|
|
#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
|
|
driver))
|
|
|
|
/*
|
|
* use a macro to avoid include chaining to get THIS_MODULE
|
|
*/
|
|
#define platform_driver_register(drv) \
|
|
__platform_driver_register(drv, THIS_MODULE)
|
|
extern int __platform_driver_register(struct platform_driver *,
|
|
struct module *);
|
|
extern void platform_driver_unregister(struct platform_driver *);
|
|
|
|
/* non-hotpluggable platform devices may use this so that probe() and
|
|
* its support may live in __init sections, conserving runtime memory.
|
|
*/
|
|
#define platform_driver_probe(drv, probe) \
|
|
__platform_driver_probe(drv, probe, THIS_MODULE)
|
|
extern int __platform_driver_probe(struct platform_driver *driver,
|
|
int (*probe)(struct platform_device *), struct module *module);
|
|
|
|
static inline void *platform_get_drvdata(const struct platform_device *pdev)
|
|
{
|
|
return dev_get_drvdata(&pdev->dev);
|
|
}
|
|
|
|
static inline void platform_set_drvdata(struct platform_device *pdev,
|
|
void *data)
|
|
{
|
|
dev_set_drvdata(&pdev->dev, data);
|
|
}
|
|
|
|
/* module_platform_driver() - Helper macro for drivers that don't do
|
|
* anything special in module init/exit. This eliminates a lot of
|
|
* boilerplate. Each module may only use this macro once, and
|
|
* calling it replaces module_init() and module_exit()
|
|
*/
|
|
#define module_platform_driver(__platform_driver) \
|
|
module_driver(__platform_driver, platform_driver_register, \
|
|
platform_driver_unregister)
|
|
|
|
/* builtin_platform_driver() - Helper macro for builtin drivers that
|
|
* don't do anything special in driver init. This eliminates some
|
|
* boilerplate. Each driver may only use this macro once, and
|
|
* calling it replaces device_initcall(). Note this is meant to be
|
|
* a parallel of module_platform_driver() above, but w/o _exit stuff.
|
|
*/
|
|
#define builtin_platform_driver(__platform_driver) \
|
|
builtin_driver(__platform_driver, platform_driver_register)
|
|
|
|
/* module_platform_driver_probe() - Helper macro for drivers that don't do
|
|
* anything special in module init/exit. This eliminates a lot of
|
|
* boilerplate. Each module may only use this macro once, and
|
|
* calling it replaces module_init() and module_exit()
|
|
*/
|
|
#define module_platform_driver_probe(__platform_driver, __platform_probe) \
|
|
static int __init __platform_driver##_init(void) \
|
|
{ \
|
|
return platform_driver_probe(&(__platform_driver), \
|
|
__platform_probe); \
|
|
} \
|
|
module_init(__platform_driver##_init); \
|
|
static void __exit __platform_driver##_exit(void) \
|
|
{ \
|
|
platform_driver_unregister(&(__platform_driver)); \
|
|
} \
|
|
module_exit(__platform_driver##_exit);
|
|
|
|
/* builtin_platform_driver_probe() - Helper macro for drivers that don't do
|
|
* anything special in device init. This eliminates some boilerplate. Each
|
|
* driver may only use this macro once, and using it replaces device_initcall.
|
|
* This is meant to be a parallel of module_platform_driver_probe above, but
|
|
* without the __exit parts.
|
|
*/
|
|
#define builtin_platform_driver_probe(__platform_driver, __platform_probe) \
|
|
static int __init __platform_driver##_init(void) \
|
|
{ \
|
|
return platform_driver_probe(&(__platform_driver), \
|
|
__platform_probe); \
|
|
} \
|
|
device_initcall(__platform_driver##_init); \
|
|
|
|
#define platform_create_bundle(driver, probe, res, n_res, data, size) \
|
|
__platform_create_bundle(driver, probe, res, n_res, data, size, THIS_MODULE)
|
|
extern struct platform_device *__platform_create_bundle(
|
|
struct platform_driver *driver, int (*probe)(struct platform_device *),
|
|
struct resource *res, unsigned int n_res,
|
|
const void *data, size_t size, struct module *module);
|
|
|
|
int __platform_register_drivers(struct platform_driver * const *drivers,
|
|
unsigned int count, struct module *owner);
|
|
void platform_unregister_drivers(struct platform_driver * const *drivers,
|
|
unsigned int count);
|
|
|
|
#define platform_register_drivers(drivers, count) \
|
|
__platform_register_drivers(drivers, count, THIS_MODULE)
|
|
|
|
/* early platform driver interface */
|
|
struct early_platform_driver {
|
|
const char *class_str;
|
|
struct platform_driver *pdrv;
|
|
struct list_head list;
|
|
int requested_id;
|
|
char *buffer;
|
|
int bufsize;
|
|
};
|
|
|
|
#define EARLY_PLATFORM_ID_UNSET -2
|
|
#define EARLY_PLATFORM_ID_ERROR -3
|
|
|
|
extern int early_platform_driver_register(struct early_platform_driver *epdrv,
|
|
char *buf);
|
|
extern void early_platform_add_devices(struct platform_device **devs, int num);
|
|
|
|
static inline int is_early_platform_device(struct platform_device *pdev)
|
|
{
|
|
return !pdev->dev.driver;
|
|
}
|
|
|
|
extern void early_platform_driver_register_all(char *class_str);
|
|
extern int early_platform_driver_probe(char *class_str,
|
|
int nr_probe, int user_only);
|
|
extern void early_platform_cleanup(void);
|
|
|
|
#define early_platform_init(class_string, platdrv) \
|
|
early_platform_init_buffer(class_string, platdrv, NULL, 0)
|
|
|
|
#ifndef MODULE
|
|
#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
|
|
static __initdata struct early_platform_driver early_driver = { \
|
|
.class_str = class_string, \
|
|
.buffer = buf, \
|
|
.bufsize = bufsiz, \
|
|
.pdrv = platdrv, \
|
|
.requested_id = EARLY_PLATFORM_ID_UNSET, \
|
|
}; \
|
|
static int __init early_platform_driver_setup_func(char *buffer) \
|
|
{ \
|
|
return early_platform_driver_register(&early_driver, buffer); \
|
|
} \
|
|
early_param(class_string, early_platform_driver_setup_func)
|
|
#else /* MODULE */
|
|
#define early_platform_init_buffer(class_string, platdrv, buf, bufsiz) \
|
|
static inline char *early_platform_driver_setup_func(void) \
|
|
{ \
|
|
return bufsiz ? buf : NULL; \
|
|
}
|
|
#endif /* MODULE */
|
|
|
|
#ifdef CONFIG_SUSPEND
|
|
extern int platform_pm_suspend(struct device *dev);
|
|
extern int platform_pm_resume(struct device *dev);
|
|
#else
|
|
#define platform_pm_suspend NULL
|
|
#define platform_pm_resume NULL
|
|
#endif
|
|
|
|
#ifdef CONFIG_HIBERNATE_CALLBACKS
|
|
extern int platform_pm_freeze(struct device *dev);
|
|
extern int platform_pm_thaw(struct device *dev);
|
|
extern int platform_pm_poweroff(struct device *dev);
|
|
extern int platform_pm_restore(struct device *dev);
|
|
#else
|
|
#define platform_pm_freeze NULL
|
|
#define platform_pm_thaw NULL
|
|
#define platform_pm_poweroff NULL
|
|
#define platform_pm_restore NULL
|
|
#endif
|
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
#define USE_PLATFORM_PM_SLEEP_OPS \
|
|
.suspend = platform_pm_suspend, \
|
|
.resume = platform_pm_resume, \
|
|
.freeze = platform_pm_freeze, \
|
|
.thaw = platform_pm_thaw, \
|
|
.poweroff = platform_pm_poweroff, \
|
|
.restore = platform_pm_restore,
|
|
#else
|
|
#define USE_PLATFORM_PM_SLEEP_OPS
|
|
#endif
|
|
|
|
#endif /* _PLATFORM_DEVICE_H_ */
|