Commit a0b4a738e0e03f5e0d6ca366560f9a48e5adf83a
1 parent
375bb0e04b
Exists in
master
and in
7 other branches
wpan-phy: allow specifying a per-page channel mask
IEEE 802.15.4-2006 defines channel pages that hold channels (max 32 pages, 27 channels per page). Allow the driver to specify supported channels on pages, other than the first one. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Showing 3 changed files with 21 additions and 3 deletions Side-by-side Diff
drivers/ieee802154/fakehard.c
include/net/wpan-phy.h
net/ieee802154/wpan-class.c
... | ... | @@ -40,11 +40,29 @@ |
40 | 40 | |
41 | 41 | MASTER_SHOW(current_channel, "%d"); |
42 | 42 | MASTER_SHOW(current_page, "%d"); |
43 | -MASTER_SHOW(channels_supported, "%#x"); | |
44 | 43 | MASTER_SHOW_COMPLEX(transmit_power, "%d +- %d dB", |
45 | 44 | ((signed char) (phy->transmit_power << 2)) >> 2, |
46 | 45 | (phy->transmit_power >> 6) ? (phy->transmit_power >> 6) * 3 : 1 ); |
47 | 46 | MASTER_SHOW(cca_mode, "%d"); |
47 | + | |
48 | +static ssize_t channels_supported_show(struct device *dev, | |
49 | + struct device_attribute *attr, char *buf) | |
50 | +{ | |
51 | + struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); | |
52 | + int ret; | |
53 | + int i, len = 0; | |
54 | + | |
55 | + mutex_lock(&phy->pib_lock); | |
56 | + for (i = 0; i < 32; i++) { | |
57 | + ret = snprintf(buf + len, PAGE_SIZE - len, | |
58 | + "%#09x\n", phy->channels_supported[i]); | |
59 | + if (ret < 0) | |
60 | + break; | |
61 | + len += ret; | |
62 | + } | |
63 | + mutex_unlock(&phy->pib_lock); | |
64 | + return len; | |
65 | +} | |
48 | 66 | |
49 | 67 | static struct device_attribute pmib_attrs[] = { |
50 | 68 | __ATTR_RO(current_channel), |