Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Wireless USB Host Controller |
| 3 | * UWB Protocol Adaptation Layer (PAL) glue. |
| 4 | * |
| 5 | * Copyright (C) 2008 Cambridge Silicon Radio Ltd. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License version |
| 9 | * 2 as published by the Free Software Foundation. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | #include "wusbhc.h" |
| 20 | |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 21 | static void wusbhc_channel_changed(struct uwb_pal *pal, int channel) |
| 22 | { |
| 23 | struct wusbhc *wusbhc = container_of(pal, struct wusbhc, pal); |
| 24 | |
Thomas Pugliese | b4a9dfb | 2013-12-20 11:45:02 -0600 | [diff] [blame] | 25 | dev_dbg(wusbhc->dev, "%s: channel = %d\n", __func__, channel); |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 26 | if (channel < 0) |
| 27 | wusbhc_stop(wusbhc); |
| 28 | else |
| 29 | wusbhc_start(wusbhc); |
| 30 | } |
| 31 | |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 32 | /** |
| 33 | * wusbhc_pal_register - register the WUSB HC as a UWB PAL |
| 34 | * @wusbhc: the WUSB HC |
| 35 | */ |
| 36 | int wusbhc_pal_register(struct wusbhc *wusbhc) |
| 37 | { |
| 38 | uwb_pal_init(&wusbhc->pal); |
| 39 | |
David Vrabel | b60066c | 2008-09-17 16:34:40 +0100 | [diff] [blame] | 40 | wusbhc->pal.name = "wusbhc"; |
| 41 | wusbhc->pal.device = wusbhc->usb_hcd.self.controller; |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 42 | wusbhc->pal.rc = wusbhc->uwb_rc; |
| 43 | wusbhc->pal.channel_changed = wusbhc_channel_changed; |
David Vrabel | b60066c | 2008-09-17 16:34:40 +0100 | [diff] [blame] | 44 | |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 45 | return uwb_pal_register(&wusbhc->pal); |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | /** |
Thomas Pugliese | a899575 | 2013-06-24 14:26:35 -0500 | [diff] [blame] | 49 | * wusbhc_pal_unregister - unregister the WUSB HC as a UWB PAL |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 50 | * @wusbhc: the WUSB HC |
| 51 | */ |
| 52 | void wusbhc_pal_unregister(struct wusbhc *wusbhc) |
| 53 | { |
Thomas Pugliese | a899575 | 2013-06-24 14:26:35 -0500 | [diff] [blame] | 54 | if (wusbhc->uwb_rc) |
| 55 | uwb_pal_unregister(&wusbhc->pal); |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 56 | } |