aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorPhoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>2014-02-17 05:34:08 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-17 16:42:38 -0500
commit9b2777d6089bcd7fb035847f907280560fe233c8 (patch)
tree868e579924e3c6cd154996acfef67fb9157e8b26 /net/mac802154
parent5b520bbb538da7f7122b1e5dc85f2b4c592d4781 (diff)
ieee802154: add TX power control to wpan_phy
Replace the current u8 transmit_power in wpan_phy with s8 transmit_power. The u8 field contained the actual tx power and a tolerance field, which no physical radio every used. Adjust sysfs entries to keep compatibility with userspace, give tolerances of +-1dB statically there. This patch only adds support for this in the at86rf230 driver and the RF212 chip. Configuration calculation for RF212 is also somewhat basic, but does the job - the RF212 datasheet gives a large table with suggested values for combinations of TX power and page/channel, if this does not work well, we might have to copy the whole table. 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 52ae6646a411..9eb49e0886a4 100644
--- a/net/mac802154/ieee802154_dev.c
+++ b/net/mac802154/ieee802154_dev.c
@@ -165,6 +165,16 @@ err:
165 return ERR_PTR(err); 165 return ERR_PTR(err);
166} 166}
167 167
168static int mac802154_set_txpower(struct wpan_phy *phy, int db)
169{
170 struct mac802154_priv *priv = wpan_phy_priv(phy);
171
172 if (!priv->ops->set_txpower)
173 return -ENOTSUPP;
174
175 return priv->ops->set_txpower(&priv->hw, db);
176}
177
168struct ieee802154_dev * 178struct ieee802154_dev *
169ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops) 179ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops)
170{ 180{
@@ -242,6 +252,7 @@ int ieee802154_register_device(struct ieee802154_dev *dev)
242 252
243 priv->phy->add_iface = mac802154_add_iface; 253 priv->phy->add_iface = mac802154_add_iface;
244 priv->phy->del_iface = mac802154_del_iface; 254 priv->phy->del_iface = mac802154_del_iface;
255 priv->phy->set_txpower = mac802154_set_txpower;
245 256
246 rc = wpan_phy_register(priv->phy); 257 rc = wpan_phy_register(priv->phy);
247 if (rc < 0) 258 if (rc < 0)