pal.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. static void wusbhc_channel_changed(struct uwb_pal *pal, int channel)
  10. {
  11. struct wusbhc *wusbhc = container_of(pal, struct wusbhc, pal);
  12. dev_dbg(wusbhc->dev, "%s: channel = %d\n", __func__, channel);
  13. if (channel < 0)
  14. wusbhc_stop(wusbhc);
  15. else
  16. wusbhc_start(wusbhc);
  17. }
  18. /**
  19. * wusbhc_pal_register - register the WUSB HC as a UWB PAL
  20. * @wusbhc: the WUSB HC
  21. */
  22. int wusbhc_pal_register(struct wusbhc *wusbhc)
  23. {
  24. uwb_pal_init(&wusbhc->pal);
  25. wusbhc->pal.name = "wusbhc";
  26. wusbhc->pal.device = wusbhc->usb_hcd.self.controller;
  27. wusbhc->pal.rc = wusbhc->uwb_rc;
  28. wusbhc->pal.channel_changed = wusbhc_channel_changed;
  29. return uwb_pal_register(&wusbhc->pal);
  30. }
  31. /**
  32. * wusbhc_pal_unregister - unregister the WUSB HC as a UWB PAL
  33. * @wusbhc: the WUSB HC
  34. */
  35. void wusbhc_pal_unregister(struct wusbhc *wusbhc)
  36. {
  37. if (wusbhc->uwb_rc)
  38. uwb_pal_unregister(&wusbhc->pal);
  39. }