15fd54aceSGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21f923071SGreg Kroah-Hartman /*
31f923071SGreg Kroah-Hartman  * USB Serial "Simple" driver
41f923071SGreg Kroah-Hartman  *
51f923071SGreg Kroah-Hartman  * Copyright (C) 2001-2006,2008,2013 Greg Kroah-Hartman <greg@kroah.com>
61f923071SGreg Kroah-Hartman  * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net)
71f923071SGreg Kroah-Hartman  * Copyright (C) 2005 Thomas Hergenhahn <thomas.hergenhahn@suse.de>
81f923071SGreg Kroah-Hartman  * Copyright (C) 2009 Outpost Embedded, LLC
91f923071SGreg Kroah-Hartman  * Copyright (C) 2010 Zilogic Systems <code@zilogic.com>
101f923071SGreg Kroah-Hartman  * Copyright (C) 2013 Wei Shuai <cpuwolf@gmail.com>
111f923071SGreg Kroah-Hartman  * Copyright (C) 2013 Linux Foundation
121f923071SGreg Kroah-Hartman  */
131f923071SGreg Kroah-Hartman 
141f923071SGreg Kroah-Hartman #include <linux/kernel.h>
151f923071SGreg Kroah-Hartman #include <linux/tty.h>
161f923071SGreg Kroah-Hartman #include <linux/module.h>
171f923071SGreg Kroah-Hartman #include <linux/usb.h>
181f923071SGreg Kroah-Hartman #include <linux/usb/serial.h>
191f923071SGreg Kroah-Hartman 
20b9f04038SJohan Hovold #define DEVICE_N(vendor, IDS, nport)				\
211f923071SGreg Kroah-Hartman static const struct usb_device_id vendor##_id_table[] = {	\
221f923071SGreg Kroah-Hartman 	IDS(),							\
231f923071SGreg Kroah-Hartman 	{ },							\
241f923071SGreg Kroah-Hartman };								\
251f923071SGreg Kroah-Hartman static struct usb_serial_driver vendor##_device = {		\
261f923071SGreg Kroah-Hartman 	.driver = {						\
271f923071SGreg Kroah-Hartman 		.owner =	THIS_MODULE,			\
2868c91d37SYann Droneaud 		.name =		#vendor,			\
291f923071SGreg Kroah-Hartman 	},							\
301f923071SGreg Kroah-Hartman 	.id_table =		vendor##_id_table,		\
31b9f04038SJohan Hovold 	.num_ports =		nport,				\
321f923071SGreg Kroah-Hartman };
331f923071SGreg Kroah-Hartman 
34b9f04038SJohan Hovold #define DEVICE(vendor, IDS)	DEVICE_N(vendor, IDS, 1)
351f923071SGreg Kroah-Hartman 
36cff9c233SJohan Hovold /* Medtronic CareLink USB driver */
37cff9c233SJohan Hovold #define CARELINK_IDS()			\
38cff9c233SJohan Hovold 	{ USB_DEVICE(0x0a21, 0x8001) }	/* MMT-7305WW */
39cff9c233SJohan Hovold DEVICE(carelink, CARELINK_IDS);
401f923071SGreg Kroah-Hartman 
411f923071SGreg Kroah-Hartman /* Infineon Flashloader driver */
421f923071SGreg Kroah-Hartman #define FLASHLOADER_IDS()		\
43a0e80fbdSJonas Jonsson 	{ USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \
44f190fd92SDaniele Palmas 	{ USB_DEVICE(0x8087, 0x0716) }, \
45f190fd92SDaniele Palmas 	{ USB_DEVICE(0x8087, 0x0801) }
461f923071SGreg Kroah-Hartman DEVICE(flashloader, FLASHLOADER_IDS);
471f923071SGreg Kroah-Hartman 
48*d245aedcSJohan Hovold /* Funsoft Serial USB driver */
49*d245aedcSJohan Hovold #define FUNSOFT_IDS()			\
50*d245aedcSJohan Hovold 	{ USB_DEVICE(0x1404, 0xcddc) }
51*d245aedcSJohan Hovold DEVICE(funsoft, FUNSOFT_IDS);
52*d245aedcSJohan Hovold 
53679315e5SAnton Staaf /* Google Serial USB SubClass */
54679315e5SAnton Staaf #define GOOGLE_IDS()						\
55679315e5SAnton Staaf 	{ USB_VENDOR_AND_INTERFACE_INFO(0x18d1,			\
56679315e5SAnton Staaf 					USB_CLASS_VENDOR_SPEC,	\
57679315e5SAnton Staaf 					0x50,			\
58679315e5SAnton Staaf 					0x01) }
59679315e5SAnton Staaf DEVICE(google, GOOGLE_IDS);
60679315e5SAnton Staaf 
61*d245aedcSJohan Hovold /* HP4x (48/49) Generic Serial driver */
62*d245aedcSJohan Hovold #define HP4X_IDS()			\
63*d245aedcSJohan Hovold 	{ USB_DEVICE(0x03f0, 0x0121) }
64*d245aedcSJohan Hovold DEVICE(hp4x, HP4X_IDS);
65*d245aedcSJohan Hovold 
66dd92c8a1SOliver Neukum /* KAUFMANN RKS+CAN VCP */
67dd92c8a1SOliver Neukum #define KAUFMANN_IDS()			\
68dd92c8a1SOliver Neukum 	{ USB_DEVICE(0x16d0, 0x0870) }
69dd92c8a1SOliver Neukum DEVICE(kaufmann, KAUFMANN_IDS);
70dd92c8a1SOliver Neukum 
71fe710508SCollin May /* Libtransistor USB console */
72fe710508SCollin May #define LIBTRANSISTOR_IDS()			\
73fe710508SCollin May 	{ USB_DEVICE(0x1209, 0x8b00) }
74fe710508SCollin May DEVICE(libtransistor, LIBTRANSISTOR_IDS);
75fe710508SCollin May 
761f923071SGreg Kroah-Hartman /* Motorola USB Phone driver */
771f923071SGreg Kroah-Hartman #define MOTO_IDS()			\
781f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x05c6, 0x3197) },	/* unknown Motorola phone */	\
798b648f13SRoman Mindalev 	{ USB_DEVICE(0x0c44, 0x0022) },	/* unknown Motorola phone */	\
801f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x22b8, 0x2a64) },	/* Motorola KRZR K1m */		\
811f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x22b8, 0x2c84) },	/* Motorola VE240 phone */	\
821f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x22b8, 0x2c64) }	/* Motorola V950 phone */
831f923071SGreg Kroah-Hartman DEVICE(moto_modem, MOTO_IDS);
841f923071SGreg Kroah-Hartman 
8546fe895eSJohan Hovold /* Motorola Tetra driver */
8646fe895eSJohan Hovold #define MOTOROLA_TETRA_IDS()			\
87f5fad711SJohan Hovold 	{ USB_DEVICE(0x0cad, 0x9011) },	/* Motorola Solutions TETRA PEI */ \
88b81c2c33SMax Schulze 	{ USB_DEVICE(0x0cad, 0x9012) },	/* MTP6550 */ \
89260e41acSJerónimo Borque 	{ USB_DEVICE(0x0cad, 0x9013) },	/* MTP3xxx */ \
90260e41acSJerónimo Borque 	{ USB_DEVICE(0x0cad, 0x9015) },	/* MTP85xx */ \
91b81c2c33SMax Schulze 	{ USB_DEVICE(0x0cad, 0x9016) }	/* TPG2200 */
9246fe895eSJohan Hovold DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
9346fe895eSJohan Hovold 
94c4b9c570SJohan Hovold /* Nokia mobile phone driver */
95c4b9c570SJohan Hovold #define NOKIA_IDS()			\
96c4b9c570SJohan Hovold 	{ USB_DEVICE(0x0421, 0x069a) }	/* Nokia 130 (RM-1035) */
97c4b9c570SJohan Hovold DEVICE(nokia, NOKIA_IDS);
98c4b9c570SJohan Hovold 
99c5cd24d7SJohan Hovold /* Novatel Wireless GPS driver */
100c5cd24d7SJohan Hovold #define NOVATEL_IDS()			\
101c5cd24d7SJohan Hovold 	{ USB_DEVICE(0x09d7, 0x0100) }	/* NovAtel FlexPack GPS */
102c5cd24d7SJohan Hovold DEVICE_N(novatel_gps, NOVATEL_IDS, 3);
103c5cd24d7SJohan Hovold 
104*d245aedcSJohan Hovold /* Siemens USB/MPI adapter */
105*d245aedcSJohan Hovold #define SIEMENS_IDS()			\
106*d245aedcSJohan Hovold 	{ USB_DEVICE(0x908, 0x0004) }
107*d245aedcSJohan Hovold DEVICE(siemens_mpi, SIEMENS_IDS);
1081f923071SGreg Kroah-Hartman 
1091f923071SGreg Kroah-Hartman /* Suunto ANT+ USB Driver */
1101f923071SGreg Kroah-Hartman #define SUUNTO_IDS()			\
1112240c365SKristóf Ralovich 	{ USB_DEVICE(0x0fcf, 0x1008) },	\
1122240c365SKristóf Ralovich 	{ USB_DEVICE(0x0fcf, 0x1009) } /* Dynastream ANT USB-m Stick */
1131f923071SGreg Kroah-Hartman DEVICE(suunto, SUUNTO_IDS);
1141f923071SGreg Kroah-Hartman 
115*d245aedcSJohan Hovold /* ViVOpay USB Serial Driver */
116*d245aedcSJohan Hovold #define VIVOPAY_IDS()			\
117*d245aedcSJohan Hovold 	{ USB_DEVICE(0x1d5f, 0x1004) }	/* ViVOpay 8800 */
118*d245aedcSJohan Hovold DEVICE(vivopay, VIVOPAY_IDS);
119*d245aedcSJohan Hovold 
120*d245aedcSJohan Hovold /* ZIO Motherboard USB driver */
121*d245aedcSJohan Hovold #define ZIO_IDS()			\
122*d245aedcSJohan Hovold 	{ USB_DEVICE(0x1CBE, 0x0103) }
123*d245aedcSJohan Hovold DEVICE(zio, ZIO_IDS);
1241f923071SGreg Kroah-Hartman 
1251f923071SGreg Kroah-Hartman /* All of the above structures mushed into two lists */
1261f923071SGreg Kroah-Hartman static struct usb_serial_driver * const serial_drivers[] = {
127cff9c233SJohan Hovold 	&carelink_device,
1281f923071SGreg Kroah-Hartman 	&flashloader_device,
129*d245aedcSJohan Hovold 	&funsoft_device,
130679315e5SAnton Staaf 	&google_device,
131*d245aedcSJohan Hovold 	&hp4x_device,
132dd92c8a1SOliver Neukum 	&kaufmann_device,
133fe710508SCollin May 	&libtransistor_device,
1341f923071SGreg Kroah-Hartman 	&moto_modem_device,
13546fe895eSJohan Hovold 	&motorola_tetra_device,
136c4b9c570SJohan Hovold 	&nokia_device,
137c5cd24d7SJohan Hovold 	&novatel_gps_device,
1381f923071SGreg Kroah-Hartman 	&siemens_mpi_device,
139*d245aedcSJohan Hovold 	&suunto_device,
140*d245aedcSJohan Hovold 	&vivopay_device,
141*d245aedcSJohan Hovold 	&zio_device,
1421f923071SGreg Kroah-Hartman 	NULL
1431f923071SGreg Kroah-Hartman };
1441f923071SGreg Kroah-Hartman 
1451f923071SGreg Kroah-Hartman static const struct usb_device_id id_table[] = {
146cff9c233SJohan Hovold 	CARELINK_IDS(),
1471f923071SGreg Kroah-Hartman 	FLASHLOADER_IDS(),
148*d245aedcSJohan Hovold 	FUNSOFT_IDS(),
149679315e5SAnton Staaf 	GOOGLE_IDS(),
150*d245aedcSJohan Hovold 	HP4X_IDS(),
151dd92c8a1SOliver Neukum 	KAUFMANN_IDS(),
152fe710508SCollin May 	LIBTRANSISTOR_IDS(),
1531f923071SGreg Kroah-Hartman 	MOTO_IDS(),
15446fe895eSJohan Hovold 	MOTOROLA_TETRA_IDS(),
155c4b9c570SJohan Hovold 	NOKIA_IDS(),
156c5cd24d7SJohan Hovold 	NOVATEL_IDS(),
1571f923071SGreg Kroah-Hartman 	SIEMENS_IDS(),
158*d245aedcSJohan Hovold 	SUUNTO_IDS(),
159*d245aedcSJohan Hovold 	VIVOPAY_IDS(),
160*d245aedcSJohan Hovold 	ZIO_IDS(),
1611f923071SGreg Kroah-Hartman 	{ },
1621f923071SGreg Kroah-Hartman };
1631f923071SGreg Kroah-Hartman MODULE_DEVICE_TABLE(usb, id_table);
1641f923071SGreg Kroah-Hartman 
1651f923071SGreg Kroah-Hartman module_usb_serial_driver(serial_drivers, id_table);
166627cfa89SJohan Hovold MODULE_LICENSE("GPL v2");
167