static void lo_read_power_vector(struct b43_wldev *dev) { struct b43_phy *phy = &dev->phy; struct b43_txpower_lo_control *lo = phy->lo_control; u16 i; u64 tmp; u64 power_vector = 0; int rf_offset, bb_offset; struct b43_loctl *loctl; for (i = 0; i < 8; i += 2) { tmp = b43_shm_read16(dev, B43_SHM_SHARED, 0x310 + i); /* Clear the top byte. We get holes in the bitmap... */ tmp &= 0xFF; power_vector |= (tmp << (i * 8)); /* Clear the vector on the device. */ b43_shm_write16(dev, B43_SHM_SHARED, 0x310 + i, 0); } if (power_vector) lo->power_vector = power_vector; power_vector = lo->power_vector; for (i = 0; i < 64; i++) { if (power_vector & ((u64) 1ULL << i)) { /* Now figure out which b43_loctl corresponds * to this bit. */ rf_offset = i / lo->rfatt_list.len; bb_offset = i % lo->rfatt_list.len; //FIXME? loctl = b43_get_lo_g_ctl(dev, &lo->rfatt_list.list[rf_offset], &lo->bbatt_list.list[bb_offset]); /* And mark it as "used", as the device told us * through the bitmap it is using it. */ loctl->used = 1; } } }
int b43_switch_channel(struct b43_wldev *dev, unsigned int new_channel) { struct b43_phy *phy = &(dev->phy); u16 channelcookie, savedcookie; int err; if (new_channel == B43_DEFAULT_CHANNEL) new_channel = phy->ops->get_default_chan(dev); /* First we set the channel radio code to prevent the * firmware from sending ghost packets. */ channelcookie = new_channel; if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) channelcookie |= B43_SHM_SH_CHAN_5GHZ; /* FIXME: set 40Mhz flag if required */ if (0) channelcookie |= B43_SHM_SH_CHAN_40MHZ; savedcookie = b43_shm_read16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN); b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN, channelcookie); /* Now try to switch the PHY hardware channel. */ err = phy->ops->switch_channel(dev, new_channel); if (err) goto err_restore_cookie; dev->phy.channel = new_channel; /* Wait for the radio to tune to the channel and stabilize. */ msleep(8); return 0; err_restore_cookie: b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_CHAN, savedcookie); return err; }