Search Linux Wireless

Re: [RFC/RFT] rtl8187: Change TX power settings

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

 



Hi Larry,

I think one needs to be more careful about removing some of the
(priv->hw_rev == RTL8187BvB) in the 2nd half of the patch. The latest vendor driver can stop supporting the older 8187BvB chip (intentionally or by mistake), but linux users often/occasionally have older hardware. I
think one wants to make sure that numbers from the new code are no-bigger
than numbers from the old in the 2nd part of the patch below 
in the case of (priv->hw_rev == RTL8187BvB).

Hin-Tak

--- On Thu, 30/10/08, Larry Finger <Larry.Finger@xxxxxxxxxxxx> wrote:

> The latest vendor driver (rtl8187B_linux_26.1036.0708.2008)
> has changed the
> CCK and OFDM power setting code as compared with previous
> versions. This
> patch implements those changes for the Linux driver.
> 
> Signed-off-by: Larry Finger
> <Larry.Finger@xxxxxxxxxxxx>
> ---
> 
> Piter,
> 
> Does this help your devices?
> 
> Larry
> 
> 
> Index:
> wireless-testing/drivers/net/wireless/rtl8187_rtl8225.c
> ===================================================================
> ---
> wireless-testing.orig/drivers/net/wireless/rtl8187_rtl8225.c
> +++ wireless-testing/drivers/net/wireless/rtl8187_rtl8225.c
> @@ -578,23 +578,27 @@ static void
> rtl8225z2_b_rf_set_tx_power(
>  {
>  	struct rtl8187_priv *priv = dev->priv;
>  	u8 cck_power, ofdm_power;
> +	u8 min_cck_power = (priv->hw_rev == RTL8187BvB) ? 0 :
> 7;
> +	u8 max_cck_power = (priv->hw_rev == RTL8187BvB) ? 15 :
> 22;
> +	u8 min_ofdm_power = (priv->hw_rev == RTL8187BvB) ? 2 :
> 10;
> +	u8 max_ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17
> : 25;
>  	const u8 *tmp;
>  	int i;
> 
>  	cck_power = priv->channels[channel - 1].hw_value &
> 0xF;
>  	ofdm_power = priv->channels[channel - 1].hw_value
> >> 4;
> 
> -	if (cck_power > 15)
> -		cck_power = (priv->hw_rev == RTL8187BvB) ? 15 : 22;
> +	if (cck_power > max_cck_power - min_cck_power)
> +		cck_power = max_cck_power;
>  	else
> -		cck_power += (priv->hw_rev == RTL8187BvB) ? 0 : 7;
> +		cck_power += min_cck_power;
>  	cck_power += priv->txpwr_base & 0xF;
>  	cck_power = min(cck_power, (u8)35);
> 
> -	if (ofdm_power > 15)
> -		ofdm_power = (priv->hw_rev == RTL8187BvB) ? 17 : 25;
> +	if (ofdm_power > max_ofdm_power - min_ofdm_power)
> +		ofdm_power = max_ofdm_power;
>  	else
> -		ofdm_power += (priv->hw_rev == RTL8187BvB) ? 2 : 10;
> +		ofdm_power += min_ofdm_power;
>  	ofdm_power += (priv->txpwr_base >> 4) & 0xF;
>  	ofdm_power = min(ofdm_power, (u8)35);
> 
> @@ -625,7 +629,7 @@ static void
> rtl8225z2_b_rf_set_tx_power(
>  		rtl8225_write_phy_cck(dev, 0x44 + i, *tmp++);
> 
>  	rtl818x_iowrite8(priv, &priv->map->TX_GAIN_CCK,
> -			 rtl8225z2_tx_gain_cck_ofdm[cck_power]);
> +			 rtl8225z2_tx_gain_cck_ofdm[cck_power] << 1);
>  	msleep(1);
> 
>  	rtl818x_iowrite8(priv,
> &priv->map->TX_GAIN_OFDM,


      
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux