Loading...
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
21static void wusbhc_channel_changed(struct uwb_pal *pal, int channel)
22{
23 struct wusbhc *wusbhc = container_of(pal, struct wusbhc, pal);
24
25 if (channel < 0)
26 wusbhc_stop(wusbhc);
27 else
28 wusbhc_start(wusbhc);
29}
30
31/**
32 * wusbhc_pal_register - register the WUSB HC as a UWB PAL
33 * @wusbhc: the WUSB HC
34 */
35int wusbhc_pal_register(struct wusbhc *wusbhc)
36{
37 uwb_pal_init(&wusbhc->pal);
38
39 wusbhc->pal.name = "wusbhc";
40 wusbhc->pal.device = wusbhc->usb_hcd.self.controller;
41 wusbhc->pal.rc = wusbhc->uwb_rc;
42 wusbhc->pal.channel_changed = wusbhc_channel_changed;
43
44 return uwb_pal_register(&wusbhc->pal);
45}
46
47/**
48 * wusbhc_pal_register - unregister the WUSB HC as a UWB PAL
49 * @wusbhc: the WUSB HC
50 */
51void wusbhc_pal_unregister(struct wusbhc *wusbhc)
52{
53 uwb_pal_unregister(&wusbhc->pal);
54}
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Wireless USB Host Controller
4 * UWB Protocol Adaptation Layer (PAL) glue.
5 *
6 * Copyright (C) 2008 Cambridge Silicon Radio Ltd.
7 */
8#include "wusbhc.h"
9
10static void wusbhc_channel_changed(struct uwb_pal *pal, int channel)
11{
12 struct wusbhc *wusbhc = container_of(pal, struct wusbhc, pal);
13
14 dev_dbg(wusbhc->dev, "%s: channel = %d\n", __func__, channel);
15 if (channel < 0)
16 wusbhc_stop(wusbhc);
17 else
18 wusbhc_start(wusbhc);
19}
20
21/**
22 * wusbhc_pal_register - register the WUSB HC as a UWB PAL
23 * @wusbhc: the WUSB HC
24 */
25int wusbhc_pal_register(struct wusbhc *wusbhc)
26{
27 uwb_pal_init(&wusbhc->pal);
28
29 wusbhc->pal.name = "wusbhc";
30 wusbhc->pal.device = wusbhc->usb_hcd.self.controller;
31 wusbhc->pal.rc = wusbhc->uwb_rc;
32 wusbhc->pal.channel_changed = wusbhc_channel_changed;
33
34 return uwb_pal_register(&wusbhc->pal);
35}
36
37/**
38 * wusbhc_pal_unregister - unregister the WUSB HC as a UWB PAL
39 * @wusbhc: the WUSB HC
40 */
41void wusbhc_pal_unregister(struct wusbhc *wusbhc)
42{
43 if (wusbhc->uwb_rc)
44 uwb_pal_unregister(&wusbhc->pal);
45}