wil_platform.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2014-2015 Qualcomm Atheros, Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef __WIL_PLATFORM_H__
  17. #define __WIL_PLATFORM_H__
  18. struct device;
  19. /**
  20. * struct wil_platform_ops - wil platform module calls from this
  21. * driver to platform driver
  22. */
  23. struct wil_platform_ops {
  24. int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */);
  25. int (*suspend)(void *handle);
  26. int (*resume)(void *handle);
  27. void (*uninit)(void *handle);
  28. int (*notify_crash)(void *handle);
  29. };
  30. /**
  31. * struct wil_platform_rops - wil platform module callbacks from
  32. * platform driver to this driver
  33. * @ramdump: store a ramdump from the wil firmware. The platform
  34. * driver may add additional data to the ramdump to
  35. * generate the final crash dump.
  36. * @fw_recovery: start a firmware recovery process. Called as
  37. * part of a crash recovery process which may include other
  38. * related platform subsystems.
  39. */
  40. struct wil_platform_rops {
  41. int (*ramdump)(void *wil_handle, void *buf, uint32_t size);
  42. int (*fw_recovery)(void *wil_handle);
  43. };
  44. /**
  45. * wil_platform_init - initialize the platform driver
  46. *
  47. * @dev - pointer to the wil6210 device
  48. * @ops - structure with platform driver operations. Platform
  49. * driver will fill this structure with function pointers.
  50. * @rops - structure with callbacks from platform driver to
  51. * this driver. The platform driver copies the structure to
  52. * its own storage. Can be NULL if this driver does not
  53. * support crash recovery.
  54. * @wil_handle - context for this driver that will be passed
  55. * when platform driver invokes one of the callbacks in
  56. * rops. May be NULL if rops is NULL.
  57. */
  58. void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops,
  59. const struct wil_platform_rops *rops, void *wil_handle);
  60. int __init wil_platform_modinit(void);
  61. void wil_platform_modexit(void);
  62. #endif /* __WIL_PLATFORM_H__ */