1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
4 *
5 * NVIDIA USB Type-C Alt Mode Driver
6 */
7 #include <linux/module.h>
8 #include <linux/usb/typec_altmode.h>
9 #include <linux/usb/typec_dp.h>
10 #include "displayport.h"
11
nvidia_altmode_probe(struct typec_altmode * alt)12 static int nvidia_altmode_probe(struct typec_altmode *alt)
13 {
14 if (alt->svid == USB_TYPEC_NVIDIA_VLINK_SID)
15 return dp_altmode_probe(alt);
16 else
17 return -ENOTSUPP;
18 }
19
nvidia_altmode_remove(struct typec_altmode * alt)20 static void nvidia_altmode_remove(struct typec_altmode *alt)
21 {
22 if (alt->svid == USB_TYPEC_NVIDIA_VLINK_SID)
23 dp_altmode_remove(alt);
24 }
25
26 static const struct typec_device_id nvidia_typec_id[] = {
27 { USB_TYPEC_NVIDIA_VLINK_SID, TYPEC_ANY_MODE },
28 { },
29 };
30 MODULE_DEVICE_TABLE(typec, nvidia_typec_id);
31
32 static struct typec_altmode_driver nvidia_altmode_driver = {
33 .id_table = nvidia_typec_id,
34 .probe = nvidia_altmode_probe,
35 .remove = nvidia_altmode_remove,
36 .driver = {
37 .name = "typec_nvidia",
38 .owner = THIS_MODULE,
39 },
40 };
41 module_typec_altmode_driver(nvidia_altmode_driver);
42
43 MODULE_LICENSE("GPL v2");
44 MODULE_DESCRIPTION("NVIDIA USB Type-C Alt Mode Driver");
45