xref: /linux-6.15/include/linux/mfd/core.h (revision f15cbe6f)
1 #ifndef MFD_CORE_H
2 #define MFD_CORE_H
3 /*
4  * drivers/mfd/mfd-core.h
5  *
6  * core MFD support
7  * Copyright (c) 2006 Ian Molton
8  * Copyright (c) 2007 Dmitry Baryshkov
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14  */
15 
16 #include <linux/platform_device.h>
17 
18 /*
19  * This struct describes the MFD part ("cell").
20  * After registration the copy of this structure will become the platform data
21  * of the resulting platform_device
22  */
23 struct mfd_cell {
24 	const char		*name;
25 
26 	int			(*enable)(struct platform_device *dev);
27 	int			(*disable)(struct platform_device *dev);
28 	int			(*suspend)(struct platform_device *dev);
29 	int			(*resume)(struct platform_device *dev);
30 
31 	void			*driver_data; /* driver-specific data */
32 
33 	/*
34 	 * This resources can be specified relatievly to the parent device.
35 	 * For accessing device you should use resources from device
36 	 */
37 	int			num_resources;
38 	const struct resource	*resources;
39 };
40 
41 static inline struct mfd_cell *
42 mfd_get_cell(struct platform_device *pdev)
43 {
44 	return (struct mfd_cell *)pdev->dev.platform_data;
45 }
46 
47 extern int mfd_add_devices(
48 		struct platform_device *parent,
49 		const struct mfd_cell *cells, int n_devs,
50 		struct resource *mem_base,
51 		int irq_base);
52 
53 extern void mfd_remove_devices(struct platform_device *parent);
54 
55 #endif
56