diff options
author | Michael Buesch <mb@bu3sch.de> | 2009-02-04 19:55:22 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-11 11:44:23 -0500 |
commit | ce1a9ee33a5864f3d199baa1d3e154a1f9a6f3dd (patch) | |
tree | 2fc0e301b7d81a401b7114608134413897c4296a /drivers/net/wireless/b43/tables_lpphy.c | |
parent | 7a9470806053f765ecf7f3932acb4c95c204ad4b (diff) |
b43: Add parts of LP-PHY TX power control
This adds the initial parts of the LP-PHY TX power control.
This also adds helper functions for bulk access of LP tables.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/tables_lpphy.c')
-rw-r--r-- | drivers/net/wireless/b43/tables_lpphy.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c index 18f6e325676..4ea734dce21 100644 --- a/drivers/net/wireless/b43/tables_lpphy.c +++ b/drivers/net/wireless/b43/tables_lpphy.c @@ -303,6 +303,36 @@ u32 b43_lptab_read(struct b43_wldev *dev, u32 offset) return value; } +void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset, + unsigned int nr_elements, void *_data) +{ + u32 type, value; + u8 *data = _data; + unsigned int i; + + type = offset & B43_LPTAB_TYPEMASK; + for (i = 0; i < nr_elements; i++) { + value = b43_lptab_read(dev, offset); + switch (type) { + case B43_LPTAB_8BIT: + *data = value; + data++; + break; + case B43_LPTAB_16BIT: + *((u16 *)data) = value; + data += 2; + break; + case B43_LPTAB_32BIT: + *((u32 *)data) = value; + data += 4; + break; + default: + B43_WARN_ON(1); + } + offset++; + } +} + void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value) { u32 type; @@ -331,3 +361,34 @@ void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value) B43_WARN_ON(1); } } + +void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset, + unsigned int nr_elements, const void *_data) +{ + u32 type, value; + const u8 *data = _data; + unsigned int i; + + type = offset & B43_LPTAB_TYPEMASK; + for (i = 0; i < nr_elements; i++) { + switch (type) { + case B43_LPTAB_8BIT: + value = *data; + data++; + break; + case B43_LPTAB_16BIT: + value = *((u16 *)data); + data += 2; + break; + case B43_LPTAB_32BIT: + value = *((u32 *)data); + data += 4; + break; + default: + B43_WARN_ON(1); + value = 0; + } + b43_lptab_write(dev, offset, value); + offset++; + } +} |