wil_platform.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2014-2016 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. enum wil_platform_event {
  20. WIL_PLATFORM_EVT_FW_CRASH = 0,
  21. WIL_PLATFORM_EVT_PRE_RESET = 1,
  22. WIL_PLATFORM_EVT_FW_RDY = 2,
  23. WIL_PLATFORM_EVT_PRE_SUSPEND = 3,
  24. WIL_PLATFORM_EVT_POST_SUSPEND = 4,
  25. };
  26. /**
  27. * struct wil_platform_ops - wil platform module calls from this
  28. * driver to platform driver
  29. */
  30. struct wil_platform_ops {
  31. int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */);
  32. int (*suspend)(void *handle);
  33. int (*resume)(void *handle);
  34. void (*uninit)(void *handle);
  35. int (*notify)(void *handle, enum wil_platform_event evt);
  36. };
  37. /**
  38. * struct wil_platform_rops - wil platform module callbacks from
  39. * platform driver to this driver
  40. * @ramdump: store a ramdump from the wil firmware. The platform
  41. * driver may add additional data to the ramdump to
  42. * generate the final crash dump.
  43. * @fw_recovery: start a firmware recovery process. Called as
  44. * part of a crash recovery process which may include other
  45. * related platform subsystems.
  46. */
  47. struct wil_platform_rops {
  48. int (*ramdump)(void *wil_handle, void *buf, uint32_t size);
  49. int (*fw_recovery)(void *wil_handle);
  50. };
  51. /**
  52. * wil_platform_init - initialize the platform driver
  53. *
  54. * @dev - pointer to the wil6210 device
  55. * @ops - structure with platform driver operations. Platform
  56. * driver will fill this structure with function pointers.
  57. * @rops - structure with callbacks from platform driver to
  58. * this driver. The platform driver copies the structure to
  59. * its own storage. Can be NULL if this driver does not
  60. * support crash recovery.
  61. * @wil_handle - context for this driver that will be passed
  62. * when platform driver invokes one of the callbacks in
  63. * rops. May be NULL if rops is NULL.
  64. */
  65. void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops,
  66. const struct wil_platform_rops *rops, void *wil_handle);
  67. int __init wil_platform_modinit(void);
  68. void wil_platform_modexit(void);
  69. #endif /* __WIL_PLATFORM_H__ */