linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "Gábor Stefanik" <netrolller.3d@gmail.com>
Cc: John Linville <linville@tuxdriver.com>,
	Michael Buesch <mb@bu3sch.de>, Mark Huijgen <mark@huijgen.tk>,
	Broadcom Wireless <bcm43xx-dev@lists.berlios.de>,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [RFC/RFT] b43: Implement antenna diversity support for LP-PHY
Date: Thu, 27 Aug 2009 13:39:40 -0500	[thread overview]
Message-ID: <4A96D2EC.6060906@lwfinger.net> (raw)
In-Reply-To: <4A96CE28.3040800@gmail.com>

Gábor Stefanik wrote:
> Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com>
> ---
> This intentionally deviates slightly from the spec (writing
> the antenna ID in one pass instead of two) - please test if
> this works. (I don't have the tools to test if it actually
> selects the right antenna.)
> 
> The A/G-PHY changes are fallout fixes from the enum change,
> which in turn allows the LP-PHY code to be much simpler.
> The antenna_to_phyctl change is a fix for a potential
> existing bug that this patch may otherwise trigger.
> 
> drivers/net/wireless/b43/main.c       |    3 ++-
> drivers/net/wireless/b43/phy_a.c      |    2 +-
> drivers/net/wireless/b43/phy_common.h |   10 +++++-----
> drivers/net/wireless/b43/phy_g.c      |    2 +-
> drivers/net/wireless/b43/phy_lp.c     |   11 ++++++++++-
> 5 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/main.c
> b/drivers/net/wireless/b43/main.c
> index 289e06c..3b038c9 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -1456,7 +1456,8 @@ static u16 b43_antenna_to_phyctl(int antenna)
>         return B43_TXH_PHY_ANT2;
>     case B43_ANTENNA3:
>         return B43_TXH_PHY_ANT3;
> -    case B43_ANTENNA_AUTO:
> +    case B43_ANTENNA_AUTO0:
> +    case B43_ANTENNA_AUTO1:
>         return B43_TXH_PHY_ANT01AUTO;
>     }
>     B43_WARN_ON(1);
> diff --git a/drivers/net/wireless/b43/phy_a.c
> b/drivers/net/wireless/b43/phy_a.c
> index 816e028..809ec97 100644
> --- a/drivers/net/wireless/b43/phy_a.c
> +++ b/drivers/net/wireless/b43/phy_a.c
> @@ -531,7 +531,7 @@ static void b43_aphy_op_set_rx_antenna(struct
> b43_wldev *dev, int antenna)
> 
>     tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>     tmp &= ~B43_PHY_BBANDCFG_RXANT;
> -    tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
> +    tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>         << B43_PHY_BBANDCFG_RXANT_SHIFT;
>     b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
> 
> diff --git a/drivers/net/wireless/b43/phy_common.h
> b/drivers/net/wireless/b43/phy_common.h
> index b47a0f5..a6a90df 100644
> --- a/drivers/net/wireless/b43/phy_common.h
> +++ b/drivers/net/wireless/b43/phy_common.h
> @@ -49,11 +49,11 @@ enum b43_interference_mitigation {
> 
> /* Antenna identifiers */
> enum {
> -    B43_ANTENNA0,        /* Antenna 0 */
> -    B43_ANTENNA1,        /* Antenna 0 */
> -    B43_ANTENNA_AUTO1,    /* Automatic, starting with antenna 1 */
> -    B43_ANTENNA_AUTO0,    /* Automatic, starting with antenna 0 */
> -    B43_ANTENNA2,
> +    B43_ANTENNA0 = 0,    /* Antenna 0 */
> +    B43_ANTENNA1 = 1,    /* Antenna 1 */
> +    B43_ANTENNA_AUTO0 = 2,    /* Automatic, starting with antenna 0 */
> +    B43_ANTENNA_AUTO1 = 3,    /* Automatic, starting with antenna 1 */
> +    B43_ANTENNA2 = 4,
>     B43_ANTENNA3 = 8,
> 
>     B43_ANTENNA_AUTO = B43_ANTENNA_AUTO0,
> diff --git a/drivers/net/wireless/b43/phy_g.c
> b/drivers/net/wireless/b43/phy_g.c
> index c6c9d2f..c6d639d 100644
> --- a/drivers/net/wireless/b43/phy_g.c
> +++ b/drivers/net/wireless/b43/phy_g.c
> @@ -2651,7 +2651,7 @@ static void b43_gphy_op_set_rx_antenna(struct
> b43_wldev *dev, int antenna)
> 
>     tmp = b43_phy_read(dev, B43_PHY_BBANDCFG);
>     tmp &= ~B43_PHY_BBANDCFG_RXANT;
> -    tmp |= (autodiv ? B43_ANTENNA_AUTO0 : antenna)
> +    tmp |= (autodiv ? B43_ANTENNA_AUTO1 : antenna)
>             << B43_PHY_BBANDCFG_RXANT_SHIFT;
>     b43_phy_write(dev, B43_PHY_BBANDCFG, tmp);
> 
> diff --git a/drivers/net/wireless/b43/phy_lp.c
> b/drivers/net/wireless/b43/phy_lp.c
> index 837d952..457357a 100644
> --- a/drivers/net/wireless/b43/phy_lp.c
> +++ b/drivers/net/wireless/b43/phy_lp.c
> @@ -2204,7 +2204,16 @@ static int b43_lpphy_op_init(struct b43_wldev *dev)
> 
> static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
> {
> -    //TODO
> +    int autodiv = ;
> +
> +    if (dev->phy.rev >= 2)
> +        return; // rev2+ doesn't support antenna diversity
> +
> +    if (B43_WARN_ON(antenna > B43_ANTENNA_AUTO1))
> +        return;
> +
> +    /* NOTE: The spec breaks this up into 2 writes - please test */
> +    b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xFFFC, antenna);
> }
> 
> static void b43_lpphy_op_adjust_txpower(struct b43_wldev *dev)

Sorry, but the spec for this routine was updated 1.5 hours ago.

As to the two-stage write, the spec does match the original code. Who
knows what happens in the device. As it adds little to the routine, I
would suggest implementing it the way the original code does.

Larry

      reply	other threads:[~2009-08-27 18:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-27 18:19 [RFC/RFT] b43: Implement antenna diversity support for LP-PHY Gábor Stefanik
2009-08-27 18:39 ` Larry Finger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A96D2EC.6060906@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=bcm43xx-dev@lists.berlios.de \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mark@huijgen.tk \
    --cc=mb@bu3sch.de \
    --cc=netrolller.3d@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).