Mario Limonciello | 1cb3629 | 2020-06-23 11:14:29 -0500 | [diff] [blame] | 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 | |
| 8 | #include "tb.h" |
| 9 | |
| 10 | static void quirk_force_power_link(struct tb_switch *sw) |
| 11 | { |
| 12 | sw->quirks |= QUIRK_FORCE_POWER_LINK_CONTROLLER; |
| 13 | } |
| 14 | |
| 15 | struct tb_quirk { |
| 16 | u16 vendor; |
| 17 | u16 device; |
| 18 | void (*hook)(struct tb_switch *sw); |
| 19 | }; |
| 20 | |
Wei Yongjun | ef7e120 | 2020-07-02 16:07:50 +0800 | [diff] [blame] | 21 | static const struct tb_quirk tb_quirks[] = { |
Mario Limonciello | 1cb3629 | 2020-06-23 11:14:29 -0500 | [diff] [blame] | 22 | /* Dell WD19TB supports self-authentication on unplug */ |
| 23 | { 0x00d4, 0xb070, quirk_force_power_link }, |
| 24 | }; |
| 25 | |
| 26 | /** |
| 27 | * tb_check_quirks() - Check for quirks to apply |
| 28 | * @sw: Thunderbolt switch |
| 29 | * |
Mika Westerberg | 9c8cac6 | 2020-08-26 08:57:00 +0300 | [diff] [blame] | 30 | * Apply any quirks for the Thunderbolt controller. |
Mario Limonciello | 1cb3629 | 2020-06-23 11:14:29 -0500 | [diff] [blame] | 31 | */ |
| 32 | void tb_check_quirks(struct tb_switch *sw) |
| 33 | { |
| 34 | int i; |
| 35 | |
| 36 | for (i = 0; i < ARRAY_SIZE(tb_quirks); i++) { |
| 37 | const struct tb_quirk *q = &tb_quirks[i]; |
| 38 | |
| 39 | if (sw->device == q->device && sw->vendor == q->vendor) |
| 40 | q->hook(sw); |
| 41 | } |
| 42 | } |