blob: 57e2978a3c21ecb8e9000cc81092f70b251bb35f [file] [log] [blame]
Mario Limonciello1cb36292020-06-23 11:14:29 -05001// 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
10static void quirk_force_power_link(struct tb_switch *sw)
11{
12 sw->quirks |= QUIRK_FORCE_POWER_LINK_CONTROLLER;
13}
14
15struct tb_quirk {
16 u16 vendor;
17 u16 device;
18 void (*hook)(struct tb_switch *sw);
19};
20
Wei Yongjunef7e1202020-07-02 16:07:50 +080021static const struct tb_quirk tb_quirks[] = {
Mario Limonciello1cb36292020-06-23 11:14:29 -050022 /* 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 Westerberg9c8cac62020-08-26 08:57:00 +030030 * Apply any quirks for the Thunderbolt controller.
Mario Limonciello1cb36292020-06-23 11:14:29 -050031 */
32void 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}