summaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-02-17 11:34:12 +0100
committerDavid S. Miller <davem@davemloft.net>2014-02-17 16:42:38 -0500
commit6ca001978dce0d50ebac01a38d6287f241a520c6 (patch)
tree2ed75aadbfb16ca006a2cd94bc30ebf614783ffc /net/mac802154
parentba08fea53a43e02b590d89224afdad976dece841 (diff)
downloadop-kernel-dev-6ca001978dce0d50ebac01a38d6287f241a520c6.zip
op-kernel-dev-6ca001978dce0d50ebac01a38d6287f241a520c6.tar.gz
ieee802154: add support for setting CCA energy detection levels
Since three of the four clear channel assesment modes make use of energy detection, provide an API to set the energy detection threshold. Driver support for this is available in at86rf230 for the RF212 chips. Since for these chips the minimal energy detection threshold depends on page and channel used, add a field to struct at86rf230_local that stores the minimal threshold. Actual ED thresholds are configured as offsets from this value. For RF212, setting the ED threshold will not work before a channel/page has been set due to the dependency of energy detection in the chip and the actual channel/page selected. Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/ieee802154_dev.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c
index 4965e4c..4707f36 100644
--- a/net/mac802154/ieee802154_dev.c
+++ b/net/mac802154/ieee802154_dev.c
@@ -195,6 +195,16 @@ static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
return priv->ops->set_cca_mode(&priv->hw, mode);
}
+static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
+{
+ struct mac802154_priv *priv = wpan_phy_priv(phy);
+
+ if (!priv->ops->set_cca_ed_level)
+ return -ENOTSUPP;
+
+ return priv->ops->set_cca_ed_level(&priv->hw, level);
+}
+
struct ieee802154_dev *
ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops)
{
@@ -275,6 +285,7 @@ int ieee802154_register_device(struct ieee802154_dev *dev)
priv->phy->set_txpower = mac802154_set_txpower;
priv->phy->set_lbt = mac802154_set_lbt;
priv->phy->set_cca_mode = mac802154_set_cca_mode;
+ priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
rc = wpan_phy_register(priv->phy);
if (rc < 0)
OpenPOWER on IntegriCloud