wldev_common.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Common function shared by Linux WEXT, cfg80211 and p2p drivers
  3. *
  4. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  5. *
  6. * Copyright (C) 1999-2020, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. *
  27. * <<Broadcom-WL-IPTag/Open:>>
  28. *
  29. * $Id: wldev_common.h 695669 2017-04-21 13:04:52Z $
  30. */
  31. #ifndef __WLDEV_COMMON_H__
  32. #define __WLDEV_COMMON_H__
  33. #include <wlioctl.h>
  34. /* wl_dev_ioctl - get/set IOCTLs, will call net_device's do_ioctl (or
  35. * netdev_ops->ndo_do_ioctl in new kernels)
  36. * @dev: the net_device handle
  37. */
  38. s32 wldev_ioctl_get(
  39. struct net_device *dev, u32 cmd, void *arg, u32 len);
  40. s32 wldev_ioctl_set(
  41. struct net_device *dev, u32 cmd, const void *arg, u32 len);
  42. /** Retrieve named IOVARs, this function calls wl_dev_ioctl with
  43. * WLC_GET_VAR IOCTL code
  44. */
  45. s32 wldev_iovar_getbuf(
  46. struct net_device *dev, s8 *iovar_name,
  47. const void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync);
  48. /** Set named IOVARs, this function calls wl_dev_ioctl with
  49. * WLC_SET_VAR IOCTL code
  50. */
  51. s32 wldev_iovar_setbuf(
  52. struct net_device *dev, s8 *iovar_name,
  53. const void *param, s32 paramlen, void *buf, s32 buflen, struct mutex* buf_sync);
  54. s32 wldev_iovar_setint(
  55. struct net_device *dev, s8 *iovar, s32 val);
  56. s32 wldev_iovar_getint(
  57. struct net_device *dev, s8 *iovar, s32 *pval);
  58. /** The following function can be implemented if there is a need for bsscfg
  59. * indexed IOVARs
  60. */
  61. s32 wldev_mkiovar_bsscfg(
  62. const s8 *iovar_name, const s8 *param, s32 paramlen,
  63. s8 *iovar_buf, s32 buflen, s32 bssidx);
  64. /** Retrieve named and bsscfg indexed IOVARs, this function calls wl_dev_ioctl with
  65. * WLC_GET_VAR IOCTL code
  66. */
  67. s32 wldev_iovar_getbuf_bsscfg(
  68. struct net_device *dev, s8 *iovar_name, void *param, s32 paramlen,
  69. void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync);
  70. /** Set named and bsscfg indexed IOVARs, this function calls wl_dev_ioctl with
  71. * WLC_SET_VAR IOCTL code
  72. */
  73. s32 wldev_iovar_setbuf_bsscfg(
  74. struct net_device *dev, const s8 *iovar_name, const void *param, s32 paramlen,
  75. void *buf, s32 buflen, s32 bsscfg_idx, struct mutex* buf_sync);
  76. s32 wldev_iovar_getint_bsscfg(
  77. struct net_device *dev, s8 *iovar, s32 *pval, s32 bssidx);
  78. s32 wldev_iovar_setint_bsscfg(
  79. struct net_device *dev, s8 *iovar, s32 val, s32 bssidx);
  80. extern int dhd_net_set_fw_path(struct net_device *dev, char *fw);
  81. extern int dhd_net_bus_suspend(struct net_device *dev);
  82. extern int dhd_net_bus_resume(struct net_device *dev, uint8 stage);
  83. extern int dhd_net_wifi_platform_set_power(struct net_device *dev, bool on,
  84. unsigned long delay_msec);
  85. extern void dhd_get_customized_country_code(struct net_device *dev, char *country_iso_code,
  86. wl_country_t *cspec);
  87. extern void dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec, bool notify);
  88. #ifdef OEM_ANDROID
  89. extern bool dhd_force_country_change(struct net_device *dev);
  90. #endif // endif
  91. extern void dhd_bus_band_set(struct net_device *dev, uint band);
  92. extern int wldev_set_country(struct net_device *dev, char *country_code, bool notify,
  93. bool user_enforced, int revinfo);
  94. extern int net_os_wake_lock(struct net_device *dev);
  95. extern int net_os_wake_unlock(struct net_device *dev);
  96. extern int net_os_wake_lock_timeout(struct net_device *dev);
  97. extern int net_os_wake_lock_timeout_enable(struct net_device *dev, int val);
  98. extern int net_os_set_dtim_skip(struct net_device *dev, int val);
  99. extern int net_os_set_suspend_disable(struct net_device *dev, int val);
  100. extern int net_os_set_suspend(struct net_device *dev, int val, int force);
  101. extern int net_os_set_suspend_bcn_li_dtim(struct net_device *dev, int val);
  102. extern int net_os_set_max_dtim_enable(struct net_device *dev, int val);
  103. #ifdef DISABLE_DTIM_IN_SUSPEND
  104. extern int net_os_set_disable_dtim_in_suspend(struct net_device *dev, int val);
  105. #endif /* DISABLE_DTIM_IN_SUSPEND */
  106. #if defined(OEM_ANDROID)
  107. extern int wl_parse_ssid_list_tlv(char** list_str, wlc_ssid_ext_t* ssid,
  108. int max, int *bytes_left);
  109. #endif /* defined(OEM_ANDROID) */
  110. /* Get the link speed from dongle, speed is in kpbs */
  111. int wldev_get_link_speed(struct net_device *dev, int *plink_speed);
  112. int wldev_get_rssi(struct net_device *dev, scb_val_t *prssi);
  113. int wldev_get_ssid(struct net_device *dev, wlc_ssid_t *pssid);
  114. int wldev_get_band(struct net_device *dev, uint *pband);
  115. int wldev_get_mode(struct net_device *dev, uint8 *pband, uint8 caplen);
  116. int wldev_get_datarate(struct net_device *dev, int *datarate);
  117. int wldev_set_band(struct net_device *dev, uint band);
  118. #endif /* __WLDEV_COMMON_H__ */