Greg Kroah-Hartman | 5fd54ac | 2017-11-03 11:28:30 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Wireless USB Host Controller |
| 4 | * UWB Protocol Adaptation Layer (PAL) glue. |
| 5 | * |
| 6 | * Copyright (C) 2008 Cambridge Silicon Radio Ltd. |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 7 | */ |
| 8 | #include "wusbhc.h" |
| 9 | |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 10 | static void wusbhc_channel_changed(struct uwb_pal *pal, int channel) |
| 11 | { |
| 12 | struct wusbhc *wusbhc = container_of(pal, struct wusbhc, pal); |
| 13 | |
Thomas Pugliese | b4a9dfb | 2013-12-20 11:45:02 -0600 | [diff] [blame] | 14 | dev_dbg(wusbhc->dev, "%s: channel = %d\n", __func__, channel); |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 15 | if (channel < 0) |
| 16 | wusbhc_stop(wusbhc); |
| 17 | else |
| 18 | wusbhc_start(wusbhc); |
| 19 | } |
| 20 | |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 21 | /** |
| 22 | * wusbhc_pal_register - register the WUSB HC as a UWB PAL |
| 23 | * @wusbhc: the WUSB HC |
| 24 | */ |
| 25 | int wusbhc_pal_register(struct wusbhc *wusbhc) |
| 26 | { |
| 27 | uwb_pal_init(&wusbhc->pal); |
| 28 | |
David Vrabel | b60066c | 2008-09-17 16:34:40 +0100 | [diff] [blame] | 29 | wusbhc->pal.name = "wusbhc"; |
| 30 | wusbhc->pal.device = wusbhc->usb_hcd.self.controller; |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 31 | wusbhc->pal.rc = wusbhc->uwb_rc; |
| 32 | wusbhc->pal.channel_changed = wusbhc_channel_changed; |
David Vrabel | b60066c | 2008-09-17 16:34:40 +0100 | [diff] [blame] | 33 | |
David Vrabel | 6fae35f | 2008-11-17 15:53:42 +0000 | [diff] [blame] | 34 | return uwb_pal_register(&wusbhc->pal); |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | /** |
Thomas Pugliese | a899575 | 2013-06-24 14:26:35 -0500 | [diff] [blame] | 38 | * wusbhc_pal_unregister - unregister the WUSB HC as a UWB PAL |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 39 | * @wusbhc: the WUSB HC |
| 40 | */ |
| 41 | void wusbhc_pal_unregister(struct wusbhc *wusbhc) |
| 42 | { |
Thomas Pugliese | a899575 | 2013-06-24 14:26:35 -0500 | [diff] [blame] | 43 | if (wusbhc->uwb_rc) |
| 44 | uwb_pal_unregister(&wusbhc->pal); |
Inaky Perez-Gonzalez | 90ff96f | 2008-09-17 16:34:23 +0100 | [diff] [blame] | 45 | } |