alistair23-linux/include/linux/mfd/core.h
Linus Torvalds 571d54ed91 Devicetree updates for v5.8:
- Convert various DT (non-binding) doc files to ReST
 
 - Various improvements to device link code
 
 - Fix __of_attach_node_sysfs refcounting bug
 
 - Add support for 'memory-region-names' with reserved-memory binding
 
 - Vendor prefixes for Protonic Holland, BeagleBoard.org, Alps, Check
   Point, Würth Elektronik, U-Boot, Vaisala, Baikal Electronics, Shanghai
   Awinic Technology Co., MikroTik, Silex Insight
 
 - A bunch more binding conversions to DT schema. Only 3K to go.
 
 - Add a minimum version check for schema tools
 
 - Treewide dropping of 'allOf' usage with schema references. Not needed
   in new json-schema spec.
 
 - Some formatting clean-ups of schemas
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEktVUI4SxYhzZyEuo+vtdtY28YcMFAl7ZYa8QHHJvYmhAa2Vy
 bmVsLm9yZwAKCRD6+121jbxhw/zyD/42ZlYc2mKW5cHjGWr6vGAXG0KZq6AvHbeY
 setNPMhjKRKjWs/s3u0WVhEH7ZchzBhBi0PEVjqZCnxLTqkt+mdlelJVv3uYJVho
 2ZJiIi5Iso+nNQ+wAEFG2EzhnLH35RXTdlECANnhGUht/JOJlgEqdjjxdj8CVyWG
 0aGJRCRRGvzPiWAUyqcR/DpB+lz0ipaSNhxxECinT0OQ4OSheCJL811tQ5RGKZ24
 z7C/W+iQbFKHu2Yf7+7vHWNCo6F3vW1LK36mfdwNYEvhg2edJRkW1kr9flkJCjCj
 Hhe2nIQmPQFJkeI/NkccowJRs5onwv3UIuPqOuAhx49XiI/a1aJKD0Md9ljeCJKd
 HOybAltDiYMHVBwWGtdednMbPNvHSlsjRby4PRGdmLBsOlgjaihosx/5Byx80JP3
 CNNJVm712qgMh6VbG9FIJ0rCKmXO3LxsVraptosK271+uZqWeHB0+yJnsLXWje2M
 kY6YYVLtnc4j4eOeFgX7RQqagXdgZ3dc+MCVFVU6rq2WIiqLycEeiMLzr/WV78O5
 wA0iX8Z7m+hkYPAEcbvt6Uhf0/KbeFlhb6dMGg2uE0ISgdCpXhpw1s4AeOQTKKuv
 vClzMPSXYkStD58CiYlUFqo01qoOvFVuPSLUa8ZbU5TMTYrwpcNX8FYXCEjz0tfc
 j7PbUy9YvA==
 =/MDi
 -----END PGP SIGNATURE-----

Merge tag 'devicetree-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring:

 - Convert various DT (non-binding) doc files to ReST

 - Various improvements to device link code

 - Fix __of_attach_node_sysfs refcounting bug

 - Add support for 'memory-region-names' with reserved-memory binding

 - Vendor prefixes for Protonic Holland, BeagleBoard.org, Alps, Check
   Point, Würth Elektronik, U-Boot, Vaisala, Baikal Electronics,
   Shanghai Awinic Technology Co., MikroTik, Silex Insight

 - A bunch more binding conversions to DT schema. Only 3K to go.

 - Add a minimum version check for schema tools

 - Treewide dropping of 'allOf' usage with schema references. Not needed
   in new json-schema spec.

 - Some formatting clean-ups of schemas

* tag 'devicetree-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (194 commits)
  dt-bindings: clock: Add documentation for X1830 bindings.
  dt-bindings: mailbox: Convert imx mu to json-schema
  dt-bindings: power: Convert imx gpcv2 to json-schema
  dt-bindings: power: Convert imx gpc to json-schema
  dt-bindings: Merge gpio-usb-b-connector with usb-connector
  dt-bindings: timer: renesas: cmt: Convert to json-schema
  dt-bindings: clock: Convert i.MX8QXP LPCG to json-schema
  dt-bindings: timer: Convert i.MX GPT to json-schema
  dt-bindings: thermal: rcar-thermal: Add device tree support for r8a7742
  dt-bindings: serial: Add binding for UART pin swap
  dt-bindings: geni-se: Add interconnect binding for GENI QUP
  dt-bindings: geni-se: Convert QUP geni-se bindings to YAML
  dt-bindings: vendor-prefixes: Add Silex Insight vendor prefix
  dt-bindings: input: touchscreen: edt-ft5x06: change reg property
  dt-bindings: usb: qcom,dwc3: Introduce interconnect properties for Qualcomm DWC3 driver
  dt-bindings: timer: renesas: mtu2: Convert to json-schema
  of/fdt: Remove redundant kbasename function call
  dt-bindings: clock: Convert i.MX1 clock to json-schema
  dt-bindings: clock: Convert i.MX21 clock to json-schema
  dt-bindings: clock: Convert i.MX25 clock to json-schema
  ...
2020-06-04 20:11:25 -07:00

144 lines
4 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* drivers/mfd/mfd-core.h
*
* core MFD support
* Copyright (c) 2006 Ian Molton
* Copyright (c) 2007 Dmitry Baryshkov
*/
#ifndef MFD_CORE_H
#define MFD_CORE_H
#include <linux/platform_device.h>
#define MFD_RES_SIZE(arr) (sizeof(arr) / sizeof(struct resource))
#define MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, _match)\
{ \
.name = (_name), \
.resources = (_res), \
.num_resources = MFD_RES_SIZE((_res)), \
.platform_data = (_pdata), \
.pdata_size = (_pdsize), \
.of_compatible = (_compat), \
.acpi_match = (_match), \
.id = (_id), \
}
#define OF_MFD_CELL(_name, _res, _pdata, _pdsize,_id, _compat) \
MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, _compat, NULL) \
#define ACPI_MFD_CELL(_name, _res, _pdata, _pdsize, _id, _match) \
MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, _match) \
#define MFD_CELL_BASIC(_name, _res, _pdata, _pdsize, _id) \
MFD_CELL_ALL(_name, _res, _pdata, _pdsize, _id, NULL, NULL) \
#define MFD_CELL_RES(_name, _res) \
MFD_CELL_ALL(_name, _res, NULL, 0, 0, NULL, NULL) \
#define MFD_CELL_NAME(_name) \
MFD_CELL_ALL(_name, NULL, NULL, 0, 0, NULL, NULL) \
struct irq_domain;
struct property_entry;
/* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
struct mfd_cell_acpi_match {
const char *pnpid;
const unsigned long long adr;
};
/*
* This struct describes the MFD part ("cell").
* After registration the copy of this structure will become the platform data
* of the resulting platform_device
*/
struct mfd_cell {
const char *name;
int id;
int (*enable)(struct platform_device *dev);
int (*disable)(struct platform_device *dev);
int (*suspend)(struct platform_device *dev);
int (*resume)(struct platform_device *dev);
/* platform data passed to the sub devices drivers */
void *platform_data;
size_t pdata_size;
/* device properties passed to the sub devices drivers */
const struct property_entry *properties;
/*
* Device Tree compatible string
* See: Documentation/devicetree/usage-model.rst Chapter 2.2 for details
*/
const char *of_compatible;
/* Matches ACPI */
const struct mfd_cell_acpi_match *acpi_match;
/*
* These resources can be specified relative to the parent device.
* For accessing hardware you should use resources from the platform dev
*/
int num_resources;
const struct resource *resources;
/* don't check for resource conflicts */
bool ignore_resource_conflicts;
/*
* Disable runtime PM callbacks for this subdevice - see
* pm_runtime_no_callbacks().
*/
bool pm_runtime_no_callbacks;
/* A list of regulator supplies that should be mapped to the MFD
* device rather than the child device when requested
*/
const char * const *parent_supplies;
int num_parent_supplies;
};
/*
* Convenience functions for clients using shared cells. Refcounting
* happens automatically, with the cell's enable/disable callbacks
* being called only when a device is first being enabled or no other
* clients are making use of it.
*/
extern int mfd_cell_enable(struct platform_device *pdev);
extern int mfd_cell_disable(struct platform_device *pdev);
/*
* Given a platform device that's been created by mfd_add_devices(), fetch
* the mfd_cell that created it.
*/
static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
{
return pdev->mfd_cell;
}
extern int mfd_add_devices(struct device *parent, int id,
const struct mfd_cell *cells, int n_devs,
struct resource *mem_base,
int irq_base, struct irq_domain *irq_domain);
static inline int mfd_add_hotplug_devices(struct device *parent,
const struct mfd_cell *cells, int n_devs)
{
return mfd_add_devices(parent, PLATFORM_DEVID_AUTO, cells, n_devs,
NULL, 0, NULL);
}
extern void mfd_remove_devices(struct device *parent);
extern int devm_mfd_add_devices(struct device *dev, int id,
const struct mfd_cell *cells, int n_devs,
struct resource *mem_base,
int irq_base, struct irq_domain *irq_domain);
#endif