28
/* refcounting for multiple drivers to use a single cell */
29
atomic_t *usage_count;
28
30
int (*enable)(struct platform_device *dev);
29
31
int (*disable)(struct platform_device *dev);
30
33
int (*suspend)(struct platform_device *dev);
31
34
int (*resume)(struct platform_device *dev);
33
/* driver-specific data for MFD-aware "cell" drivers */
36
/* platform_data can be used to either pass data to "generic"
37
driver or as a hook to mfd_cell for the "cell" drivers */
36
/* mfd_data can be used to pass data to client drivers */
42
* This resources can be specified relatively to the parent device.
43
* For accessing device you should use resources from device
40
* These resources can be specified relative to the parent device.
41
* For accessing hardware you should use resources from the platform dev
46
44
const struct resource *resources;
55
53
bool pm_runtime_no_callbacks;
57
* Convenience functions for clients using shared cells. Refcounting
58
* happens automatically, with the cell's enable/disable callbacks
59
* being called only when a device is first being enabled or no other
60
* clients are making use of it.
62
extern int mfd_cell_enable(struct platform_device *pdev);
63
extern int mfd_cell_disable(struct platform_device *pdev);
66
* Given a platform device that's been created by mfd_add_devices(), fetch
67
* the mfd_cell that created it.
69
static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
71
return pdev->dev.platform_data;
75
* Given a platform device that's been created by mfd_add_devices(), fetch
76
* the .mfd_data entry from the mfd_cell that created it.
78
static inline void *mfd_get_data(struct platform_device *pdev)
80
return mfd_get_cell(pdev)->mfd_data;
58
83
extern int mfd_add_devices(struct device *parent, int id,
59
const struct mfd_cell *cells, int n_devs,
84
struct mfd_cell *cells, int n_devs,
60
85
struct resource *mem_base,
63
88
extern void mfd_remove_devices(struct device *parent);
91
* For MFD drivers with clients sharing access to resources, these create
92
* multiple platform devices per cell. Contention handling must still be
93
* handled via drivers (ie, with enable/disable hooks).
95
extern int mfd_shared_platform_driver_register(struct platform_driver *drv,
96
const char *cellname);
97
extern void mfd_shared_platform_driver_unregister(struct platform_driver *drv);