pld_common.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * Copyright (c) 2016 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #ifndef __PLD_COMMON_H__
  19. #define __PLD_COMMON_H__
  20. #ifdef CONFIG_PLD_STUB
  21. /**
  22. * struct pld_ce_tgt_pipe_cfg - copy engine target pipe configuration
  23. * @pipe_num: pipe number
  24. * @pipe_dir: pipe direction
  25. * @nentries: number of entries
  26. * @nbytes_max: max number of bytes
  27. * @flags: flags
  28. * @reserved: reserved
  29. *
  30. * pld_ce_tgt_pipe_cfg is used to store copy engine target pipe
  31. * configuration.
  32. */
  33. struct pld_ce_tgt_pipe_cfg {
  34. u32 pipe_num;
  35. u32 pipe_dir;
  36. u32 nentries;
  37. u32 nbytes_max;
  38. u32 flags;
  39. u32 reserved;
  40. };
  41. /**
  42. * struct pld_ce_svc_pipe_cfg - copy engine service pipe configuration
  43. * @service_id: service ID
  44. * @pipe_dir: pipe direction
  45. * @pipe_num: pipe number
  46. *
  47. * pld_ce_svc_pipe_cfg is used to store copy engine service pipe
  48. * configuration.
  49. */
  50. struct pld_ce_svc_pipe_cfg {
  51. u32 service_id;
  52. u32 pipe_dir;
  53. u32 pipe_num;
  54. };
  55. /**
  56. * struct pld_shadow_reg_cfg - shadow register configuration
  57. * @ce_id: copy engine ID
  58. * @reg_offset: register offset
  59. *
  60. * pld_shadow_reg_cfg is used to store shadow register configuration.
  61. */
  62. struct pld_shadow_reg_cfg {
  63. u16 ce_id;
  64. u16 reg_offset;
  65. };
  66. /**
  67. * struct pld_wlan_enable_cfg - WLAN FW configuration
  68. * @num_ce_tgt_cfg: number of CE target configuration
  69. * @ce_tgt_cfg: CE target configuration
  70. * @num_ce_svc_pipe_cfg: number of CE service configuration
  71. * @ce_svc_cfg: CE service configuration
  72. * @num_shadow_reg_cfg: number of shadow register configuration
  73. * @shadow_reg_cfg: shadow register configuration
  74. *
  75. * pld_wlan_enable_cfg stores WLAN FW configurations. It will be
  76. * passed to WLAN FW when WLAN host driver calls wlan_enable.
  77. */
  78. struct pld_wlan_enable_cfg {
  79. u32 num_ce_tgt_cfg;
  80. struct pld_ce_tgt_pipe_cfg *ce_tgt_cfg;
  81. u32 num_ce_svc_pipe_cfg;
  82. struct pld_ce_svc_pipe_cfg *ce_svc_cfg;
  83. u32 num_shadow_reg_cfg;
  84. struct pld_shadow_reg_cfg *shadow_reg_cfg;
  85. };
  86. /**
  87. * enum pld_driver_mode - WLAN host driver mode
  88. * @PLD_MISSION: mission mode
  89. * @PLD_FTM: FTM mode
  90. * @PLD_EPPING: EPPING mode
  91. * @PLD_WALTEST: WAL test mode, FW standalone test mode
  92. * @PLD_OFF: OFF mode
  93. */
  94. enum pld_driver_mode {
  95. PLD_MISSION,
  96. PLD_FTM,
  97. PLD_EPPING,
  98. PLD_WALTEST,
  99. PLD_OFF
  100. };
  101. /**
  102. * struct pld_soc_info - SOC information
  103. * @v_addr: virtual address of preallocated memory
  104. * @p_addr: physical address of preallcoated memory
  105. * @version: version number
  106. *
  107. * pld_soc_info is used to store WLAN SOC information.
  108. */
  109. struct pld_soc_info {
  110. void __iomem *v_addr;
  111. phys_addr_t p_addr;
  112. u32 version;
  113. };
  114. /**
  115. * enum pld_runtime_request - PM runtime request
  116. * @PLD_PM_RUNTIME_GET: pm_runtime_get
  117. * @PLD_PM_RUNTIME_PUT: pm_runtime_put
  118. * @PLD_PM_RUNTIME_MARK_LAST_BUSY: pm_runtime_mark_last_busy
  119. * @PLD_PM_RUNTIME_RESUME: pm_runtime_resume
  120. * @PLD_PM_RUNTIME_PUT_NOIDLE: pm_runtime_put_noidle
  121. * @PLD_PM_REQUEST_RESUME: pm_request_resume
  122. * @PLD_PM_RUNTIME_PUT_AUTO: pm_runtime_put_auto
  123. */
  124. enum pld_runtime_request {
  125. PLD_PM_RUNTIME_GET,
  126. PLD_PM_RUNTIME_PUT,
  127. PLD_PM_RUNTIME_MARK_LAST_BUSY,
  128. PLD_PM_RUNTIME_RESUME,
  129. PLD_PM_RUNTIME_PUT_NOIDLE,
  130. PLD_PM_REQUEST_RESUME,
  131. PLD_PM_RUNTIME_PUT_AUTO,
  132. };
  133. static inline int pld_wlan_enable(struct device *dev,
  134. struct pld_wlan_enable_cfg *config,
  135. enum pld_driver_mode mode,
  136. const char *host_version)
  137. {
  138. return 0;
  139. }
  140. static inline int pld_wlan_disable(struct device *dev,
  141. enum pld_driver_mode mode)
  142. {
  143. return 0;
  144. }
  145. static inline void pld_is_pci_link_down(struct device *dev)
  146. {
  147. return;
  148. }
  149. static inline int pld_wlan_pm_control(struct device *dev, bool vote)
  150. {
  151. return 0;
  152. }
  153. static inline void pld_intr_notify_q6(struct device *dev)
  154. {
  155. return;
  156. }
  157. static inline int pld_ce_request_irq(struct device *dev, unsigned int ce_id,
  158. irqreturn_t (*handler)(int, void *),
  159. unsigned long flags, const char *name,
  160. void *ctx)
  161. {
  162. return 0;
  163. }
  164. static inline int pld_ce_free_irq(struct device *dev,
  165. unsigned int ce_id, void *ctx)
  166. {
  167. return 0;
  168. }
  169. static inline int pld_get_soc_info(struct device *dev,
  170. struct pld_soc_info *info)
  171. {
  172. return 0;
  173. }
  174. static inline int pld_get_ce_id(struct device *dev, int irq)
  175. {
  176. return 0;
  177. }
  178. static inline int pld_pm_runtime_request(struct device *dev,
  179. enum pld_runtime_request request)
  180. {
  181. return 0;
  182. }
  183. static inline void pld_runtime_init(struct device *dev, int auto_delay)
  184. {
  185. return;
  186. }
  187. static inline void pld_runtime_exit(struct device *dev)
  188. {
  189. return;
  190. }
  191. #endif
  192. #endif