core.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #include <linux/platform_device.h>
  16. /*
  17. * This struct describes the MFD part ("cell").
  18. * After registration the copy of this structure will become the platform data
  19. * of the resulting platform_device
  20. */
  21. struct mfd_cell {
  22. const char *name;
  23. int (*enable)(struct platform_device *dev);
  24. int (*disable)(struct platform_device *dev);
  25. int (*suspend)(struct platform_device *dev);
  26. int (*resume)(struct platform_device *dev);
  27. void *driver_data; /* driver-specific data */
  28. /*
  29. * This resources can be specified relatievly to the parent device.
  30. * For accessing device you should use resources from device
  31. */
  32. int num_resources;
  33. const struct resource *resources;
  34. };
  35. static inline struct mfd_cell *
  36. mfd_get_cell(struct platform_device *pdev)
  37. {
  38. return (struct mfd_cell *)pdev->dev.platform_data;
  39. }
  40. extern int mfd_add_devices(
  41. struct platform_device *parent,
  42. const struct mfd_cell *cells, int n_devs,
  43. struct resource *mem_base,
  44. int irq_base);
  45. extern void mfd_remove_devices(struct platform_device *parent);
  46. #endif