aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/tables_lpphy.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-02-04 13:55:22 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-11 11:44:23 -0500
commitce1a9ee33a5864f3d199baa1d3e154a1f9a6f3dd (patch)
tree2fc0e301b7d81a401b7114608134413897c4296a /drivers/net/wireless/b43/tables_lpphy.c
parent7a9470806053f765ecf7f3932acb4c95c204ad4b (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.c61
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 18f6e3256766..4ea734dce218 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)
303 return value; 303 return value;
304} 304}
305 305
306void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset,
307 unsigned int nr_elements, void *_data)
308{
309 u32 type, value;
310 u8 *data = _data;
311 unsigned int i;
312
313 type = offset & B43_LPTAB_TYPEMASK;
314 for (i = 0; i < nr_elements; i++) {
315 value = b43_lptab_read(dev, offset);
316 switch (type) {
317 case B43_LPTAB_8BIT:
318 *data = value;
319 data++;
320 break;
321 case B43_LPTAB_16BIT:
322 *((u16 *)data) = value;
323 data += 2;
324 break;
325 case B43_LPTAB_32BIT:
326 *((u32 *)data) = value;
327 data += 4;
328 break;
329 default:
330 B43_WARN_ON(1);
331 }
332 offset++;
333 }
334}
335
306void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value) 336void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value)
307{ 337{
308 u32 type; 338 u32 type;
@@ -331,3 +361,34 @@ void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value)
331 B43_WARN_ON(1); 361 B43_WARN_ON(1);
332 } 362 }
333} 363}
364
365void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset,
366 unsigned int nr_elements, const void *_data)
367{
368 u32 type, value;
369 const u8 *data = _data;
370 unsigned int i;
371
372 type = offset & B43_LPTAB_TYPEMASK;
373 for (i = 0; i < nr_elements; i++) {
374 switch (type) {
375 case B43_LPTAB_8BIT:
376 value = *data;
377 data++;
378 break;
379 case B43_LPTAB_16BIT:
380 value = *((u16 *)data);
381 data += 2;
382 break;
383 case B43_LPTAB_32BIT:
384 value = *((u32 *)data);
385 data += 4;
386 break;
387 default:
388 B43_WARN_ON(1);
389 value = 0;
390 }
391 b43_lptab_write(dev, offset, value);
392 offset++;
393 }
394}