From: Alexander Aring <alex.aring@gmail.com>
To: alex.bluesman.smirnov@gmail.com
Cc: dbaryshkov@gmail.com, linux-zigbee-devel@lists.sourceforge.net,
netdev@vger.kernel.org, stilwellt@openlabs.co,
Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH v2 net-next 05/13] at86rf230: add support for at86rf23x desense
Date: Wed, 2 Jul 2014 17:10:02 +0200 [thread overview]
Message-ID: <1404313810-30232-6-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1404313810-30232-1-git-send-email-alex.aring@gmail.com>
To set the CCA_ED_THRES register the calculation for at86rf23x is
different than for at86rf212. This patch adds a new callback for this
calculation in chip data struct.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
drivers/net/ieee802154/at86rf230.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 694f5cf..6556fece 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -46,6 +46,7 @@ struct at86rf2xx_chip_data {
int rssi_base_val;
int (*set_channel)(struct at86rf230_local *, int, int);
+ int (*get_desense_steps)(struct at86rf230_local *, s32);
};
struct at86rf230_local {
@@ -819,17 +820,27 @@ at86rf230_set_cca_mode(struct ieee802154_dev *dev, u8 mode)
}
static int
+at86rf212_get_desens_steps(struct at86rf230_local *lp, s32 level)
+{
+ return (level - lp->data->rssi_base_val) * 100 / 207;
+}
+
+static int
+at86rf23x_get_desens_steps(struct at86rf230_local *lp, s32 level)
+{
+ return (level - lp->data->rssi_base_val) / 2;
+}
+
+static int
at86rf230_set_cca_ed_level(struct ieee802154_dev *dev, s32 level)
{
struct at86rf230_local *lp = dev->priv;
- int desens_steps;
if (level < lp->data->rssi_base_val || level > 30)
return -EINVAL;
- desens_steps = (level - lp->data->rssi_base_val) * 100 / 207;
-
- return at86rf230_write_subreg(lp, SR_CCA_ED_THRES, desens_steps);
+ return at86rf230_write_subreg(lp, SR_CCA_ED_THRES,
+ lp->data->get_desense_steps(lp, level));
}
static int
@@ -889,16 +900,19 @@ static struct ieee802154_ops at86rf230_ops = {
static struct at86rf2xx_chip_data at86rf233_data = {
.rssi_base_val = -91,
.set_channel = at86rf23x_set_channel,
+ .get_desense_steps = at86rf23x_get_desens_steps
};
static struct at86rf2xx_chip_data at86rf231_data = {
.rssi_base_val = -91,
.set_channel = at86rf23x_set_channel,
+ .get_desense_steps = at86rf23x_get_desens_steps
};
static struct at86rf2xx_chip_data at86rf212_data = {
.rssi_base_val = -100,
.set_channel = at86rf212_set_channel,
+ .get_desense_steps = at86rf212_get_desens_steps
};
static void at86rf230_irqwork(struct work_struct *work)
--
2.0.1
next prev parent reply other threads:[~2014-07-02 15:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 15:09 [PATCH v2 net-next 00/13] at86rf230: rework driver implementation Alexander Aring
2014-07-02 15:09 ` [PATCH v2 net-next 01/13] mac802154: at86rf230: add hw flags and merge ops Alexander Aring
2014-07-02 15:09 ` [PATCH v2 net-next 02/13] at86rf230: add regmap support Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 03/13] at86rf230: rework detect device handling Alexander Aring
2014-07-02 15:10 ` Alexander Aring [this message]
[not found] ` <1404313810-30232-1-git-send-email-alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-02 15:10 ` [PATCH v2 net-next 04/13] at86rf230: remove is212 and add driver data Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 06/13] at86rf230: rework transmit and receive handling Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 07/13] at86rf230: move RX_SAFE_MODE setting to hw_init Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 11/13] at86rf230: add timing for channel switch Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 13/13] at86rf230: add new author Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 08/13] at86rf230: rework irq_pol setting Alexander Aring
2014-07-02 16:57 ` Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 09/13] at86rf230: rework state change and start/stop Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 10/13] at86rf230: rework reset to trx_off state change Alexander Aring
2014-07-02 15:10 ` [PATCH v2 net-next 12/13] at86rf230: add sleep cycle timing Alexander Aring
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=1404313810-30232-6-git-send-email-alex.aring@gmail.com \
--to=alex.aring@gmail.com \
--cc=alex.bluesman.smirnov@gmail.com \
--cc=dbaryshkov@gmail.com \
--cc=linux-zigbee-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=stilwellt@openlabs.co \
/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.