quirks.c 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Thunderbolt driver - quirks
  4. *
  5. * Copyright (c) 2020 Mario Limonciello <mario.limonciello@dell.com>
  6. */
  7. #include "tb.h"
  8. static void quirk_force_power_link(struct tb_switch *sw)
  9. {
  10. sw->quirks |= QUIRK_FORCE_POWER_LINK_CONTROLLER;
  11. }
  12. struct tb_quirk {
  13. u16 vendor;
  14. u16 device;
  15. void (*hook)(struct tb_switch *sw);
  16. };
  17. static const struct tb_quirk tb_quirks[] = {
  18. /* Dell WD19TB supports self-authentication on unplug */
  19. { 0x00d4, 0xb070, quirk_force_power_link },
  20. };
  21. /**
  22. * tb_check_quirks() - Check for quirks to apply
  23. * @sw: Thunderbolt switch
  24. *
  25. * Apply any quirks for the Thunderbolt controller.
  26. */
  27. void tb_check_quirks(struct tb_switch *sw)
  28. {
  29. int i;
  30. for (i = 0; i < ARRAY_SIZE(tb_quirks); i++) {
  31. const struct tb_quirk *q = &tb_quirks[i];
  32. if (sw->device == q->device && sw->vendor == q->vendor)
  33. q->hook(sw);
  34. }
  35. }