From: "Michael Büsch" <m@bues.ch>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
b43-dev@lists.infradead.org
Subject: [PATCH 2/2] b43: N-PHY: support setting custom TX power
Date: Sun, 20 Jul 2014 13:26:34 +0200 [thread overview]
Message-ID: <20140720132634.2cb9e916@wiggum> (raw)
In-Reply-To: <1405854022-11833-2-git-send-email-zajec5@gmail.com>
On Sun, 20 Jul 2014 13:00:22 +0200
Rafa? Mi?ecki <zajec5@gmail.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20140720/0e185e01/attachment.sig>
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Büsch" <m@bues.ch>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
b43-dev@lists.infradead.org
Subject: Re: [PATCH 2/2] b43: N-PHY: support setting custom TX power
Date: Sun, 20 Jul 2014 13:26:34 +0200 [thread overview]
Message-ID: <20140720132634.2cb9e916@wiggum> (raw)
In-Reply-To: <1405854022-11833-2-git-send-email-zajec5@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]
On Sun, 20 Jul 2014 13:00:22 +0200
Rafał Miłecki <zajec5@gmail.com> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-07-20 11:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-20 11:00 [PATCH 1/2] b43: implement PPR (Power Per Rate) management/API Rafał Miłecki
2014-07-20 11:00 ` Rafał Miłecki
2014-07-20 11:00 ` [PATCH 2/2] b43: N-PHY: support setting custom TX power Rafał Miłecki
2014-07-20 11:00 ` Rafał Miłecki
2014-07-20 11:02 ` Rafał Miłecki
2014-07-20 11:02 ` Rafał Miłecki
2014-07-20 11:26 ` Michael Büsch [this message]
2014-07-20 11:26 ` Michael Büsch
2014-07-20 11:50 ` Rafał Miłecki
2014-07-20 11:50 ` Rafał Miłecki
2014-07-20 12:03 ` Michael Büsch
2014-07-20 12:03 ` Michael Büsch
2014-07-20 11:49 ` Jonas Gorski
2014-07-20 11:49 ` Jonas Gorski
2014-07-20 11:53 ` Rafał Miłecki
2014-07-20 11:53 ` Rafał Miłecki
2014-07-20 12:10 ` Jonas Gorski
2014-07-20 12:10 ` Jonas Gorski
2014-07-20 11:19 ` [PATCH 1/2] b43: implement PPR (Power Per Rate) management/API Michael Büsch
2014-07-20 11:19 ` Michael Büsch
2014-07-20 11:34 ` Rafał Miłecki
2014-07-20 11:34 ` Rafał Miłecki
2014-07-20 11:38 ` Jonas Gorski
2014-07-20 11:38 ` Jonas Gorski
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=20140720132634.2cb9e916@wiggum \
--to=m@bues.ch \
--cc=b43-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=zajec5@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.