ssb: remove 5GHz antenna gain from sprom
authorHauke Mehrtens <hauke@hauke-m.de>
Mon, 27 Feb 2012 23:56:05 +0000 (00:56 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 5 Mar 2012 20:20:49 +0000 (15:20 -0500)
There is no 2.4 GHz or 5GHz antenna gain stored in sprom. The sprom
just stores the gain values for antenna 1 and 2 or 1 to 4 for more
recent sprom versions. On old devices antenna 2 was used for 5 GHz wifi.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43legacy/phy.c
drivers/ssb/pci.c
drivers/ssb/pcmcia.c
drivers/ssb/sdio.c
include/linux/ssb/ssb.h

index 96faaef3661b075fc2a3b52f8c08a7d91b708d20..950334197f403e12daaaf274b31bb78c9a792cee 100644 (file)
@@ -1860,7 +1860,7 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev)
         * which accounts for the factor of 4 */
 #define REG_MAX_PWR 20
        max_pwr = min(REG_MAX_PWR * 4
-                     - dev->dev->bus->sprom.antenna_gain.ghz24.a0
+                     - dev->dev->bus->sprom.antenna_gain.a0
                      - 0x6, max_pwr);
 
        /* find the desired power in Q5.2 - power_level is in dBm
index befa89eac6f3c9319d913744eb2ffd4b29a12ced..ed4124469a3a34493088db68b725c081620ab81d 100644 (file)
@@ -331,7 +331,6 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
 {
        int i;
        u16 v;
-       s8 gain;
        u16 loc[3];
 
        if (out->revision == 3)                 /* rev 3 moved MAC */
@@ -390,20 +389,12 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
                SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0);
 
        /* Extract the antenna gain values. */
-       gain = r123_extract_antgain(out->revision, in,
-                                   SSB_SPROM1_AGAIN_BG,
-                                   SSB_SPROM1_AGAIN_BG_SHIFT);
-       out->antenna_gain.ghz24.a0 = gain;
-       out->antenna_gain.ghz24.a1 = gain;
-       out->antenna_gain.ghz24.a2 = gain;
-       out->antenna_gain.ghz24.a3 = gain;
-       gain = r123_extract_antgain(out->revision, in,
-                                   SSB_SPROM1_AGAIN_A,
-                                   SSB_SPROM1_AGAIN_A_SHIFT);
-       out->antenna_gain.ghz5.a0 = gain;
-       out->antenna_gain.ghz5.a1 = gain;
-       out->antenna_gain.ghz5.a2 = gain;
-       out->antenna_gain.ghz5.a3 = gain;
+       out->antenna_gain.a0 = r123_extract_antgain(out->revision, in,
+                                                   SSB_SPROM1_AGAIN_BG,
+                                                   SSB_SPROM1_AGAIN_BG_SHIFT);
+       out->antenna_gain.a1 = r123_extract_antgain(out->revision, in,
+                                                   SSB_SPROM1_AGAIN_A,
+                                                   SSB_SPROM1_AGAIN_A_SHIFT);
 }
 
 /* Revs 4 5 and 8 have partially shared layout */
@@ -504,16 +495,14 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
        }
 
        /* Extract the antenna gain values. */
-       SPEX(antenna_gain.ghz24.a0, SSB_SPROM4_AGAIN01,
+       SPEX(antenna_gain.a0, SSB_SPROM4_AGAIN01,
             SSB_SPROM4_AGAIN0, SSB_SPROM4_AGAIN0_SHIFT);
-       SPEX(antenna_gain.ghz24.a1, SSB_SPROM4_AGAIN01,
+       SPEX(antenna_gain.a1, SSB_SPROM4_AGAIN01,
             SSB_SPROM4_AGAIN1, SSB_SPROM4_AGAIN1_SHIFT);
-       SPEX(antenna_gain.ghz24.a2, SSB_SPROM4_AGAIN23,
+       SPEX(antenna_gain.a2, SSB_SPROM4_AGAIN23,
             SSB_SPROM4_AGAIN2, SSB_SPROM4_AGAIN2_SHIFT);
-       SPEX(antenna_gain.ghz24.a3, SSB_SPROM4_AGAIN23,
+       SPEX(antenna_gain.a3, SSB_SPROM4_AGAIN23,
             SSB_SPROM4_AGAIN3, SSB_SPROM4_AGAIN3_SHIFT);
-       memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
-              sizeof(out->antenna_gain.ghz5));
 
        sprom_extract_r458(out, in);
 
@@ -602,16 +591,14 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
        SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0xFFFFFFFF, 0);
 
        /* Extract the antenna gain values. */
-       SPEX(antenna_gain.ghz24.a0, SSB_SPROM8_AGAIN01,
+       SPEX(antenna_gain.a0, SSB_SPROM8_AGAIN01,
             SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT);
-       SPEX(antenna_gain.ghz24.a1, SSB_SPROM8_AGAIN01,
+       SPEX(antenna_gain.a1, SSB_SPROM8_AGAIN01,
             SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT);
-       SPEX(antenna_gain.ghz24.a2, SSB_SPROM8_AGAIN23,
+       SPEX(antenna_gain.a2, SSB_SPROM8_AGAIN23,
             SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT);
-       SPEX(antenna_gain.ghz24.a3, SSB_SPROM8_AGAIN23,
+       SPEX(antenna_gain.a3, SSB_SPROM8_AGAIN23,
             SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT);
-       memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
-              sizeof(out->antenna_gain.ghz5));
 
        /* Extract cores power info info */
        for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) {
index c821c6b2a6a0b778da37a7994ad1ad2d57335428..fbafed5b729bdcf6ae57889c3c9d4f05ca0509c5 100644 (file)
@@ -676,14 +676,10 @@ static int ssb_pcmcia_do_get_invariants(struct pcmcia_device *p_dev,
        case SSB_PCMCIA_CIS_ANTGAIN:
                GOTO_ERROR_ON(tuple->TupleDataLen != 2,
                        "antg tpl size");
-               sprom->antenna_gain.ghz24.a0 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz24.a1 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz24.a2 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz24.a3 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz5.a0 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz5.a1 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz5.a2 = tuple->TupleData[1];
-               sprom->antenna_gain.ghz5.a3 = tuple->TupleData[1];
+               sprom->antenna_gain.a0 = tuple->TupleData[1];
+               sprom->antenna_gain.a1 = tuple->TupleData[1];
+               sprom->antenna_gain.a2 = tuple->TupleData[1];
+               sprom->antenna_gain.a3 = tuple->TupleData[1];
                break;
        case SSB_PCMCIA_CIS_BFLAGS:
                GOTO_ERROR_ON((tuple->TupleDataLen != 3) &&
index 63fd709038caed0d7bbb70121159f27028bd0b41..b2d36f7736c537ef5ba6ec65d6144f965b75f971 100644 (file)
@@ -551,14 +551,10 @@ int ssb_sdio_get_invariants(struct ssb_bus *bus,
                        case SSB_SDIO_CIS_ANTGAIN:
                                GOTO_ERROR_ON(tuple->size != 2,
                                              "antg tpl size");
-                               sprom->antenna_gain.ghz24.a0 = tuple->data[1];
-                               sprom->antenna_gain.ghz24.a1 = tuple->data[1];
-                               sprom->antenna_gain.ghz24.a2 = tuple->data[1];
-                               sprom->antenna_gain.ghz24.a3 = tuple->data[1];
-                               sprom->antenna_gain.ghz5.a0 = tuple->data[1];
-                               sprom->antenna_gain.ghz5.a1 = tuple->data[1];
-                               sprom->antenna_gain.ghz5.a2 = tuple->data[1];
-                               sprom->antenna_gain.ghz5.a3 = tuple->data[1];
+                               sprom->antenna_gain.a0 = tuple->data[1];
+                               sprom->antenna_gain.a1 = tuple->data[1];
+                               sprom->antenna_gain.a2 = tuple->data[1];
+                               sprom->antenna_gain.a3 = tuple->data[1];
                                break;
                        case SSB_SDIO_CIS_BFLAGS:
                                GOTO_ERROR_ON((tuple->size != 3) &&
index f1696213e3b59a6be2c8cb6dcf8ab121b46c9bf1..1de56757e94974f542a76b4f7395de54467293d8 100644 (file)
@@ -94,12 +94,7 @@ struct ssb_sprom {
         * on each band. Values in dBm/4 (Q5.2). Negative gain means the
         * loss in the connectors is bigger than the gain. */
        struct {
-               struct {
-                       s8 a0, a1, a2, a3;
-               } ghz24;        /* 2.4GHz band */
-               struct {
-                       s8 a0, a1, a2, a3;
-               } ghz5;         /* 5GHz band */
+               s8 a0, a1, a2, a3;
        } antenna_gain;
 
        struct {