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 /* ZIO Motherboard USB driver */
421f923071SGreg Kroah-Hartman #define ZIO_IDS()			\
431f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x1CBE, 0x0103) }
441f923071SGreg Kroah-Hartman DEVICE(zio, ZIO_IDS);
451f923071SGreg Kroah-Hartman 
461f923071SGreg Kroah-Hartman /* Funsoft Serial USB driver */
471f923071SGreg Kroah-Hartman #define FUNSOFT_IDS()			\
481f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x1404, 0xcddc) }
491f923071SGreg Kroah-Hartman DEVICE(funsoft, FUNSOFT_IDS);
501f923071SGreg Kroah-Hartman 
511f923071SGreg Kroah-Hartman /* Infineon Flashloader driver */
521f923071SGreg Kroah-Hartman #define FLASHLOADER_IDS()		\
53a0e80fbdSJonas Jonsson 	{ USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \
54f190fd92SDaniele Palmas 	{ USB_DEVICE(0x8087, 0x0716) }, \
55f190fd92SDaniele Palmas 	{ USB_DEVICE(0x8087, 0x0801) }
561f923071SGreg Kroah-Hartman DEVICE(flashloader, FLASHLOADER_IDS);
571f923071SGreg Kroah-Hartman 
58679315e5SAnton Staaf /* Google Serial USB SubClass */
59679315e5SAnton Staaf #define GOOGLE_IDS()						\
60679315e5SAnton Staaf 	{ USB_VENDOR_AND_INTERFACE_INFO(0x18d1,			\
61679315e5SAnton Staaf 					USB_CLASS_VENDOR_SPEC,	\
62679315e5SAnton Staaf 					0x50,			\
63679315e5SAnton Staaf 					0x01) }
64679315e5SAnton Staaf DEVICE(google, GOOGLE_IDS);
65679315e5SAnton Staaf 
66fe710508SCollin May /* Libtransistor USB console */
67fe710508SCollin May #define LIBTRANSISTOR_IDS()			\
68fe710508SCollin May 	{ USB_DEVICE(0x1209, 0x8b00) }
69fe710508SCollin May DEVICE(libtransistor, LIBTRANSISTOR_IDS);
70fe710508SCollin May 
711f923071SGreg Kroah-Hartman /* ViVOpay USB Serial Driver */
721f923071SGreg Kroah-Hartman #define VIVOPAY_IDS()			\
731f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x1d5f, 0x1004) }	/* ViVOpay 8800 */
741f923071SGreg Kroah-Hartman DEVICE(vivopay, VIVOPAY_IDS);
751f923071SGreg Kroah-Hartman 
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 */ \
88f5fad711SJohan Hovold 	{ USB_DEVICE(0x0cad, 0x9012) }	/* MTP6550 */
8946fe895eSJohan Hovold DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
9046fe895eSJohan Hovold 
91c5cd24d7SJohan Hovold /* Novatel Wireless GPS driver */
92c5cd24d7SJohan Hovold #define NOVATEL_IDS()			\
93c5cd24d7SJohan Hovold 	{ USB_DEVICE(0x09d7, 0x0100) }	/* NovAtel FlexPack GPS */
94c5cd24d7SJohan Hovold DEVICE_N(novatel_gps, NOVATEL_IDS, 3);
95c5cd24d7SJohan Hovold 
961f923071SGreg Kroah-Hartman /* HP4x (48/49) Generic Serial driver */
971f923071SGreg Kroah-Hartman #define HP4X_IDS()			\
981f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x03f0, 0x0121) }
991f923071SGreg Kroah-Hartman DEVICE(hp4x, HP4X_IDS);
1001f923071SGreg Kroah-Hartman 
1011f923071SGreg Kroah-Hartman /* Suunto ANT+ USB Driver */
1021f923071SGreg Kroah-Hartman #define SUUNTO_IDS()			\
1032240c365SKristóf Ralovich 	{ USB_DEVICE(0x0fcf, 0x1008) },	\
1042240c365SKristóf Ralovich 	{ USB_DEVICE(0x0fcf, 0x1009) } /* Dynastream ANT USB-m Stick */
1051f923071SGreg Kroah-Hartman DEVICE(suunto, SUUNTO_IDS);
1061f923071SGreg Kroah-Hartman 
1071f923071SGreg Kroah-Hartman /* Siemens USB/MPI adapter */
1081f923071SGreg Kroah-Hartman #define SIEMENS_IDS()			\
1091f923071SGreg Kroah-Hartman 	{ USB_DEVICE(0x908, 0x0004) }
1101f923071SGreg Kroah-Hartman DEVICE(siemens_mpi, SIEMENS_IDS);
1111f923071SGreg Kroah-Hartman 
1121f923071SGreg Kroah-Hartman /* All of the above structures mushed into two lists */
1131f923071SGreg Kroah-Hartman static struct usb_serial_driver * const serial_drivers[] = {
114cff9c233SJohan Hovold 	&carelink_device,
1151f923071SGreg Kroah-Hartman 	&zio_device,
1161f923071SGreg Kroah-Hartman 	&funsoft_device,
1171f923071SGreg Kroah-Hartman 	&flashloader_device,
118679315e5SAnton Staaf 	&google_device,
119fe710508SCollin May 	&libtransistor_device,
1201f923071SGreg Kroah-Hartman 	&vivopay_device,
1211f923071SGreg Kroah-Hartman 	&moto_modem_device,
12246fe895eSJohan Hovold 	&motorola_tetra_device,
123c5cd24d7SJohan Hovold 	&novatel_gps_device,
1241f923071SGreg Kroah-Hartman 	&hp4x_device,
1251f923071SGreg Kroah-Hartman 	&suunto_device,
1261f923071SGreg Kroah-Hartman 	&siemens_mpi_device,
1271f923071SGreg Kroah-Hartman 	NULL
1281f923071SGreg Kroah-Hartman };
1291f923071SGreg Kroah-Hartman 
1301f923071SGreg Kroah-Hartman static const struct usb_device_id id_table[] = {
131cff9c233SJohan Hovold 	CARELINK_IDS(),
1321f923071SGreg Kroah-Hartman 	ZIO_IDS(),
1331f923071SGreg Kroah-Hartman 	FUNSOFT_IDS(),
1341f923071SGreg Kroah-Hartman 	FLASHLOADER_IDS(),
135679315e5SAnton Staaf 	GOOGLE_IDS(),
136fe710508SCollin May 	LIBTRANSISTOR_IDS(),
1371f923071SGreg Kroah-Hartman 	VIVOPAY_IDS(),
1381f923071SGreg Kroah-Hartman 	MOTO_IDS(),
13946fe895eSJohan Hovold 	MOTOROLA_TETRA_IDS(),
140c5cd24d7SJohan Hovold 	NOVATEL_IDS(),
1411f923071SGreg Kroah-Hartman 	HP4X_IDS(),
1421f923071SGreg Kroah-Hartman 	SUUNTO_IDS(),
1431f923071SGreg Kroah-Hartman 	SIEMENS_IDS(),
1441f923071SGreg Kroah-Hartman 	{ },
1451f923071SGreg Kroah-Hartman };
1461f923071SGreg Kroah-Hartman MODULE_DEVICE_TABLE(usb, id_table);
1471f923071SGreg Kroah-Hartman 
1481f923071SGreg Kroah-Hartman module_usb_serial_driver(serial_drivers, id_table);
149627cfa89SJohan Hovold MODULE_LICENSE("GPL v2");
150