aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/uwb-debug.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-11-17 10:53:42 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-11-19 09:46:33 -0500
commit6fae35f9cea92793a98b2d9ab21235e5ae035581 (patch)
tree82142169ff2ccada8c6c98beb6da59cafe8d913d /drivers/uwb/uwb-debug.c
parente17be2b2a95b43fe0d5878adf330701bb7a77115 (diff)
uwb: add basic radio manager
The UWB radio manager coordinates the use of the radio between the PALs that may be using it. PALs request use of the radio with uwb_radio_start() and the radio manager will start beaconing if its not already doing so. When the last PAL has called uwb_radio_stop() beaconing will be stopped. In the future, the radio manager will have a more sophisticated channel selection algorithm, probably following the Channel Selection Policy from the WiMedia Alliance when it is finalized. For now, channel 9 (BG1, TFC1) is selected. The user may override the channel selected by the radio manager and may force the radio to stop beaconing. The WUSB Host Controller PAL makes use of this and there are two new debug PAL commands that can be used for testing. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/uwb/uwb-debug.c')
-rw-r--r--drivers/uwb/uwb-debug.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c
index 217ebaac128d..0e58071a232d 100644
--- a/drivers/uwb/uwb-debug.c
+++ b/drivers/uwb/uwb-debug.c
@@ -192,7 +192,7 @@ static ssize_t command_write(struct file *file, const char __user *buf,
192{ 192{
193 struct uwb_rc *rc = file->private_data; 193 struct uwb_rc *rc = file->private_data;
194 struct uwb_dbg_cmd cmd; 194 struct uwb_dbg_cmd cmd;
195 int ret; 195 int ret = 0;
196 196
197 if (len != sizeof(struct uwb_dbg_cmd)) 197 if (len != sizeof(struct uwb_dbg_cmd))
198 return -EINVAL; 198 return -EINVAL;
@@ -213,6 +213,12 @@ static ssize_t command_write(struct file *file, const char __user *buf,
213 case UWB_DBG_CMD_IE_RM: 213 case UWB_DBG_CMD_IE_RM:
214 ret = cmd_ie_rm(rc, &cmd.ie_rm); 214 ret = cmd_ie_rm(rc, &cmd.ie_rm);
215 break; 215 break;
216 case UWB_DBG_CMD_RADIO_START:
217 ret = uwb_radio_start(&rc->dbg->pal);
218 break;
219 case UWB_DBG_CMD_RADIO_STOP:
220 uwb_radio_stop(&rc->dbg->pal);
221 break;
216 default: 222 default:
217 return -EINVAL; 223 return -EINVAL;
218 } 224 }
@@ -306,6 +312,17 @@ static struct file_operations drp_avail_fops = {
306 .owner = THIS_MODULE, 312 .owner = THIS_MODULE,
307}; 313};
308 314
315static void uwb_dbg_channel_changed(struct uwb_pal *pal, int channel)
316{
317 struct uwb_dbg *dbg = container_of(pal, struct uwb_dbg, pal);
318 struct device *dev = &pal->rc->uwb_dev.dev;
319
320 if (channel > 0)
321 dev_info(dev, "debug: channel %d started\n", channel);
322 else
323 dev_info(dev, "debug: channel stopped\n");
324}
325
309static void uwb_dbg_new_rsv(struct uwb_pal *pal, struct uwb_rsv *rsv) 326static void uwb_dbg_new_rsv(struct uwb_pal *pal, struct uwb_rsv *rsv)
310{ 327{
311 struct uwb_dbg *dbg = container_of(pal, struct uwb_dbg, pal); 328 struct uwb_dbg *dbg = container_of(pal, struct uwb_dbg, pal);
@@ -329,8 +346,11 @@ void uwb_dbg_add_rc(struct uwb_rc *rc)
329 INIT_LIST_HEAD(&rc->dbg->rsvs); 346 INIT_LIST_HEAD(&rc->dbg->rsvs);
330 347
331 uwb_pal_init(&rc->dbg->pal); 348 uwb_pal_init(&rc->dbg->pal);
349 rc->dbg->pal.rc = rc;
350 rc->dbg->pal.channel_changed = uwb_dbg_channel_changed;
332 rc->dbg->pal.new_rsv = uwb_dbg_new_rsv; 351 rc->dbg->pal.new_rsv = uwb_dbg_new_rsv;
333 uwb_pal_register(rc, &rc->dbg->pal); 352 uwb_pal_register(&rc->dbg->pal);
353
334 if (root_dir) { 354 if (root_dir) {
335 rc->dbg->root_d = debugfs_create_dir(dev_name(&rc->uwb_dev.dev), 355 rc->dbg->root_d = debugfs_create_dir(dev_name(&rc->uwb_dev.dev),
336 root_dir); 356 root_dir);
@@ -364,7 +384,7 @@ void uwb_dbg_del_rc(struct uwb_rc *rc)
364 uwb_rsv_terminate(rsv); 384 uwb_rsv_terminate(rsv);
365 } 385 }
366 386
367 uwb_pal_unregister(rc, &rc->dbg->pal); 387 uwb_pal_unregister(&rc->dbg->pal);
368 388
369 if (root_dir) { 389 if (root_dir) {
370 debugfs_remove(rc->dbg->drp_avail_f); 390 debugfs_remove(rc->dbg->drp_avail_f);