of_platform.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef _LINUX_OF_PLATFORM_H
  2. #define _LINUX_OF_PLATFORM_H
  3. /*
  4. * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
  5. * <benh@kernel.crashing.org>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. *
  12. */
  13. #ifdef CONFIG_OF_DEVICE
  14. #include <linux/module.h>
  15. #include <linux/device.h>
  16. #include <linux/mod_devicetable.h>
  17. #include <linux/pm.h>
  18. #include <linux/of_device.h>
  19. #include <linux/platform_device.h>
  20. /**
  21. * of_platform_driver - Legacy of-aware driver for platform devices.
  22. *
  23. * An of_platform_driver driver is attached to a basic platform_device on
  24. * the ibm ebus (ibmebus_bus_type).
  25. */
  26. struct of_platform_driver
  27. {
  28. int (*probe)(struct platform_device* dev,
  29. const struct of_device_id *match);
  30. int (*remove)(struct platform_device* dev);
  31. int (*suspend)(struct platform_device* dev, pm_message_t state);
  32. int (*resume)(struct platform_device* dev);
  33. int (*shutdown)(struct platform_device* dev);
  34. struct device_driver driver;
  35. };
  36. #define to_of_platform_driver(drv) \
  37. container_of(drv,struct of_platform_driver, driver)
  38. extern const struct of_device_id of_default_bus_match_table[];
  39. /* Platform drivers register/unregister */
  40. extern struct platform_device *of_device_alloc(struct device_node *np,
  41. const char *bus_id,
  42. struct device *parent);
  43. extern struct platform_device *of_find_device_by_node(struct device_node *np);
  44. #if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
  45. /* Platform devices and busses creation */
  46. extern struct platform_device *of_platform_device_create(struct device_node *np,
  47. const char *bus_id,
  48. struct device *parent);
  49. extern int of_platform_bus_probe(struct device_node *root,
  50. const struct of_device_id *matches,
  51. struct device *parent);
  52. extern int of_platform_populate(struct device_node *root,
  53. const struct of_device_id *matches,
  54. struct device *parent);
  55. #endif /* !CONFIG_SPARC */
  56. #endif /* CONFIG_OF_DEVICE */
  57. #endif /* _LINUX_OF_PLATFORM_H */