Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2009-2011 Atheros Communications Inc.
  3. *
  4. * Modified for iPXE by Scott K Logan <logans@cottsay.net> July 2011
  5. * Original from Linux kernel 3.0.1
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for any
  8. * purpose with or without fee is hereby granted, provided that the above
  9. * copyright notice and this permission notice appear in all copies.
  10. *
  11. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  13. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  14. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  15. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  16. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  17. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /*
  20. * Module for common driver code between ath9k and ath9k_htc
  21. */
  22. #include "common.h"
  23. /*
  24. * Update internal channel flags.
  25. */
  26. void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
  27. struct net80211_channel *chan)
  28. {
  29. ichan->channel = chan->center_freq;
  30. ichan->chan = chan;
  31. if (chan->band == NET80211_BAND_2GHZ) {
  32. ichan->chanmode = CHANNEL_G;
  33. ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM;
  34. } else {
  35. ichan->chanmode = CHANNEL_A;
  36. ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM;
  37. }
  38. }
  39. /*
  40. * Get the internal channel reference.
  41. */
  42. struct ath9k_channel *ath9k_cmn_get_curchannel(struct net80211_device *dev,
  43. struct ath_hw *ah)
  44. {
  45. struct net80211_channel *curchan = dev->channels + dev->channel;
  46. struct ath9k_channel *channel;
  47. u8 chan_idx;
  48. chan_idx = curchan->hw_value;
  49. channel = &ah->channels[chan_idx];
  50. ath9k_cmn_update_ichannel(channel, curchan);
  51. return channel;
  52. }
  53. void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow,
  54. u16 new_txpow, u16 *txpower)
  55. {
  56. if (cur_txpow != new_txpow) {
  57. ath9k_hw_set_txpowerlimit(ah, new_txpow, 0);
  58. /* read back in case value is clamped */
  59. *txpower = ath9k_hw_regulatory(ah)->power_limit;
  60. }
  61. }