Search Linux Wireless

Re: [PATCH 2/2] b43: N-PHY: support setting custom TX power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 20 Jul 2014 13:00:22 +0200
Rafał Miłecki <zajec5@xxxxxxxxx> wrote:

> +	/* Apply */
> +	tx_pwr_state = nphy->txpwrctrl;
> +	b43_mac_suspend(dev);
> +	b43_nphy_tx_power_ctl_setup(dev);
> +	if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) {
> +		b43_maskset32(dev, B43_MMIO_MACCTL, ~0, B43_MACCTL_PHY_LOCK);
> +		b43_read32(dev, B43_MMIO_MACCTL);
> +		udelay(1);
> +	}

You could probably write a function b43_phy_lock/unlock() similar to b43_mac_suspend/enable
to make this more readable.
The PHY_LOCK bit is related to the mac-suspend bit, after all. These are both used to lock
the firmware in one way or the other.

> +	b43_nphy_tx_power_ctrl(dev, nphy->txpwrctrl);
> +	if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12)
> +		b43_maskset32(dev, B43_MMIO_MACCTL, ~B43_MACCTL_PHY_LOCK, 0);
> +	b43_mac_enable(dev);
> +
> +	nphy->tx_pwr_last_recalc_freq = channel->center_freq;
> +	nphy->tx_pwr_last_recalc_limit = phy->desired_txpower;
> +
> +	return B43_TXPWR_RES_DONE;
> +}

> @@ -6656,5 +6721,4 @@ const struct b43_phy_operations b43_phyops_n = {
>  	.switch_channel		= b43_nphy_op_switch_channel,
>  	.get_default_chan	= b43_nphy_op_get_default_chan,
>  	.recalc_txpower		= b43_nphy_op_recalc_txpower,
> -	.adjust_txpower		= b43_nphy_op_adjust_txpower,

recalc_txpower once was designed to just recalculate the txpower and not write it
to hardware. adjust_txpower was supposed to write it to hardware afterwards.
That had to do with some locking foo and stuff I forgot (AFAIR these callbacks are called
in different contexts, but I may be wrong).
But I don't think it really matters. Just as a general hint here.

-- 
Michael

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux