root/drivers/net/wireless/broadcom/b43/phy_ac.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. b43_phy_ac_op_allocate
  2. b43_phy_ac_op_free
  3. b43_phy_ac_op_maskset
  4. b43_phy_ac_op_radio_read
  5. b43_phy_ac_op_radio_write
  6. b43_phy_ac_op_get_default_chan
  7. b43_phy_ac_op_recalc_txpower
  8. b43_phy_ac_op_adjust_txpower

   1 // SPDX-License-Identifier: GPL-2.0-or-later
   2 /*
   3  * Broadcom B43 wireless driver
   4  * IEEE 802.11ac AC-PHY support
   5  *
   6  * Copyright (c) 2015 Rafał Miłecki <zajec5@gmail.com>
   7  */
   8 
   9 #include "b43.h"
  10 #include "phy_ac.h"
  11 
  12 /**************************************************
  13  * Basic PHY ops
  14  **************************************************/
  15 
  16 static int b43_phy_ac_op_allocate(struct b43_wldev *dev)
  17 {
  18         struct b43_phy_ac *phy_ac;
  19 
  20         phy_ac = kzalloc(sizeof(*phy_ac), GFP_KERNEL);
  21         if (!phy_ac)
  22                 return -ENOMEM;
  23         dev->phy.ac = phy_ac;
  24 
  25         return 0;
  26 }
  27 
  28 static void b43_phy_ac_op_free(struct b43_wldev *dev)
  29 {
  30         struct b43_phy *phy = &dev->phy;
  31         struct b43_phy_ac *phy_ac = phy->ac;
  32 
  33         kfree(phy_ac);
  34         phy->ac = NULL;
  35 }
  36 
  37 static void b43_phy_ac_op_maskset(struct b43_wldev *dev, u16 reg, u16 mask,
  38                                   u16 set)
  39 {
  40         b43_write16f(dev, B43_MMIO_PHY_CONTROL, reg);
  41         b43_write16(dev, B43_MMIO_PHY_DATA,
  42                     (b43_read16(dev, B43_MMIO_PHY_DATA) & mask) | set);
  43 }
  44 
  45 static u16 b43_phy_ac_op_radio_read(struct b43_wldev *dev, u16 reg)
  46 {
  47         b43_write16f(dev, B43_MMIO_RADIO24_CONTROL, reg);
  48         return b43_read16(dev, B43_MMIO_RADIO24_DATA);
  49 }
  50 
  51 static void b43_phy_ac_op_radio_write(struct b43_wldev *dev, u16 reg,
  52                                       u16 value)
  53 {
  54         b43_write16f(dev, B43_MMIO_RADIO24_CONTROL, reg);
  55         b43_write16(dev, B43_MMIO_RADIO24_DATA, value);
  56 }
  57 
  58 static unsigned int b43_phy_ac_op_get_default_chan(struct b43_wldev *dev)
  59 {
  60         if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ)
  61                 return 11;
  62         return 36;
  63 }
  64 
  65 static enum b43_txpwr_result
  66 b43_phy_ac_op_recalc_txpower(struct b43_wldev *dev, bool ignore_tssi)
  67 {
  68         return B43_TXPWR_RES_DONE;
  69 }
  70 
  71 static void b43_phy_ac_op_adjust_txpower(struct b43_wldev *dev)
  72 {
  73 }
  74 
  75 /**************************************************
  76  * PHY ops struct
  77  **************************************************/
  78 
  79 const struct b43_phy_operations b43_phyops_ac = {
  80         .allocate               = b43_phy_ac_op_allocate,
  81         .free                   = b43_phy_ac_op_free,
  82         .phy_maskset            = b43_phy_ac_op_maskset,
  83         .radio_read             = b43_phy_ac_op_radio_read,
  84         .radio_write            = b43_phy_ac_op_radio_write,
  85         .get_default_chan       = b43_phy_ac_op_get_default_chan,
  86         .recalc_txpower         = b43_phy_ac_op_recalc_txpower,
  87         .adjust_txpower         = b43_phy_ac_op_adjust_txpower,
  88 };

/* [<][>][^][v][top][bottom][index][help] */