wcnss_wlan.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* Copyright (c) 2011-2013,2015 The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef _WCNSS_WLAN_H_
  14. #define _WCNSS_WLAN_H_
  15. #include <linux/device.h>
  16. #include <linux/sched.h>
  17. enum wcnss_opcode {
  18. WCNSS_WLAN_SWITCH_OFF = 0,
  19. WCNSS_WLAN_SWITCH_ON,
  20. };
  21. enum wcnss_hw_type {
  22. WCNSS_RIVA_HW = 0,
  23. WCNSS_PRONTO_HW,
  24. };
  25. struct wcnss_wlan_config {
  26. int use_48mhz_xo;
  27. int is_pronto_v3;
  28. int iris_id;
  29. };
  30. enum {
  31. WCNSS_XO_48MHZ = 1,
  32. WCNSS_XO_19MHZ,
  33. WCNSS_XO_INVALID,
  34. };
  35. #define WCNSS_WLAN_IRQ_INVALID -1
  36. #define HAVE_WCNSS_SUSPEND_RESUME_NOTIFY 1
  37. #define HAVE_WCNSS_RESET_INTR 1
  38. #define HAVE_WCNSS_CAL_DOWNLOAD 1
  39. #define HAVE_CBC_DONE 1
  40. #define HAVE_WCNSS_RX_BUFF_COUNT 1
  41. #define WLAN_MAC_ADDR_SIZE (6)
  42. #define PRONTO_PMU_OFFSET 0x1004
  43. #define WCNSS_PMU_CFG_GC_BUS_MUX_SEL_TOP BIT(5)
  44. void wcnss_get_monotonic_boottime(struct timespec *ts);
  45. struct device *wcnss_wlan_get_device(void);
  46. struct resource *wcnss_wlan_get_memory_map(struct device *dev);
  47. int wcnss_wlan_get_dxe_tx_irq(struct device *dev);
  48. int wcnss_wlan_get_dxe_rx_irq(struct device *dev);
  49. void wcnss_wlan_register_pm_ops(struct device *dev,
  50. const struct dev_pm_ops *pm_ops);
  51. void wcnss_wlan_unregister_pm_ops(struct device *dev,
  52. const struct dev_pm_ops *pm_ops);
  53. void wcnss_register_thermal_mitigation(struct device *dev,
  54. void (*tm_notify)(struct device *dev, int));
  55. void wcnss_unregister_thermal_mitigation(
  56. void (*tm_notify)(struct device *dev, int));
  57. struct platform_device *wcnss_get_platform_device(void);
  58. struct wcnss_wlan_config *wcnss_get_wlan_config(void);
  59. int wcnss_wlan_power(struct device *dev,
  60. struct wcnss_wlan_config *cfg,
  61. enum wcnss_opcode opcode,
  62. int *iris_xo_mode_set);
  63. int wcnss_req_power_on_lock(char *driver_name);
  64. int wcnss_free_power_on_lock(char *driver_name);
  65. unsigned int wcnss_get_serial_number(void);
  66. void wcnss_flush_delayed_boot_votes(void);
  67. int wcnss_get_wlan_mac_address(char mac_addr[WLAN_MAC_ADDR_SIZE]);
  68. void wcnss_allow_suspend(void);
  69. void wcnss_prevent_suspend(void);
  70. int wcnss_hardware_type(void);
  71. void *wcnss_prealloc_get(unsigned int size);
  72. int wcnss_prealloc_put(void *ptr);
  73. void wcnss_reset_intr(void);
  74. void wcnss_reset_fiq(bool clk_chk_en);
  75. void wcnss_suspend_notify(void);
  76. void wcnss_resume_notify(void);
  77. void wcnss_riva_log_debug_regs(void);
  78. void wcnss_pronto_log_debug_regs(void);
  79. int wcnss_is_hw_pronto_ver3(void);
  80. int wcnss_device_ready(void);
  81. bool wcnss_cbc_complete(void);
  82. int wcnss_device_is_shutdown(void);
  83. void wcnss_riva_dump_pmic_regs(void);
  84. int wcnss_xo_auto_detect_enabled(void);
  85. u32 wcnss_get_wlan_rx_buff_count(void);
  86. int wcnss_wlan_iris_xo_mode(void);
  87. void wcnss_flush_work(struct work_struct *work);
  88. void wcnss_flush_delayed_work(struct delayed_work *dwork);
  89. int wcnss_get_iris_name(char *iris_version);
  90. void wcnss_dump_stack(struct task_struct *task);
  91. #ifdef CONFIG_WCNSS_REGISTER_DUMP_ON_BITE
  92. void wcnss_log_debug_regs_on_bite(void);
  93. #else
  94. static inline void wcnss_log_debug_regs_on_bite(void)
  95. {
  96. }
  97. #endif
  98. int wcnss_set_wlan_unsafe_channel(
  99. u16 *unsafe_ch_list, u16 ch_count);
  100. int wcnss_get_wlan_unsafe_channel(
  101. u16 *unsafe_ch_list, u16 buffer_size,
  102. u16 *ch_count);
  103. #define wcnss_wlan_get_drvdata(dev) dev_get_drvdata(dev)
  104. #define wcnss_wlan_set_drvdata(dev, data) dev_set_drvdata((dev), (data))
  105. /* WLAN driver uses these names */
  106. #define req_riva_power_on_lock(name) wcnss_req_power_on_lock(name)
  107. #define free_riva_power_on_lock(name) wcnss_free_power_on_lock(name)
  108. #endif /* _WCNSS_WLAN_H_ */