18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * USB Serial "Simple" driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2001-2006,2008,2013 Greg Kroah-Hartman <greg@kroah.com>
68c2ecf20Sopenharmony_ci * Copyright (C) 2005 Arthur Huillet (ahuillet@users.sf.net)
78c2ecf20Sopenharmony_ci * Copyright (C) 2005 Thomas Hergenhahn <thomas.hergenhahn@suse.de>
88c2ecf20Sopenharmony_ci * Copyright (C) 2009 Outpost Embedded, LLC
98c2ecf20Sopenharmony_ci * Copyright (C) 2010 Zilogic Systems <code@zilogic.com>
108c2ecf20Sopenharmony_ci * Copyright (C) 2013 Wei Shuai <cpuwolf@gmail.com>
118c2ecf20Sopenharmony_ci * Copyright (C) 2013 Linux Foundation
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/kernel.h>
158c2ecf20Sopenharmony_ci#include <linux/tty.h>
168c2ecf20Sopenharmony_ci#include <linux/module.h>
178c2ecf20Sopenharmony_ci#include <linux/usb.h>
188c2ecf20Sopenharmony_ci#include <linux/usb/serial.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define DEVICE_N(vendor, IDS, nport)				\
218c2ecf20Sopenharmony_cistatic const struct usb_device_id vendor##_id_table[] = {	\
228c2ecf20Sopenharmony_ci	IDS(),							\
238c2ecf20Sopenharmony_ci	{ },							\
248c2ecf20Sopenharmony_ci};								\
258c2ecf20Sopenharmony_cistatic struct usb_serial_driver vendor##_device = {		\
268c2ecf20Sopenharmony_ci	.driver = {						\
278c2ecf20Sopenharmony_ci		.owner =	THIS_MODULE,			\
288c2ecf20Sopenharmony_ci		.name =		#vendor,			\
298c2ecf20Sopenharmony_ci	},							\
308c2ecf20Sopenharmony_ci	.id_table =		vendor##_id_table,		\
318c2ecf20Sopenharmony_ci	.num_ports =		nport,				\
328c2ecf20Sopenharmony_ci};
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define DEVICE(vendor, IDS)	DEVICE_N(vendor, IDS, 1)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* Medtronic CareLink USB driver */
378c2ecf20Sopenharmony_ci#define CARELINK_IDS()			\
388c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0a21, 0x8001) }	/* MMT-7305WW */
398c2ecf20Sopenharmony_ciDEVICE(carelink, CARELINK_IDS);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Infineon Flashloader driver */
428c2ecf20Sopenharmony_ci#define FLASHLOADER_IDS()		\
438c2ecf20Sopenharmony_ci	{ USB_DEVICE_INTERFACE_CLASS(0x058b, 0x0041, USB_CLASS_CDC_DATA) }, \
448c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x8087, 0x0716) }, \
458c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x8087, 0x0801) }
468c2ecf20Sopenharmony_ciDEVICE(flashloader, FLASHLOADER_IDS);
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* Funsoft Serial USB driver */
498c2ecf20Sopenharmony_ci#define FUNSOFT_IDS()			\
508c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x1404, 0xcddc) }
518c2ecf20Sopenharmony_ciDEVICE(funsoft, FUNSOFT_IDS);
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* Google Serial USB SubClass */
548c2ecf20Sopenharmony_ci#define GOOGLE_IDS()						\
558c2ecf20Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(0x18d1,			\
568c2ecf20Sopenharmony_ci					USB_CLASS_VENDOR_SPEC,	\
578c2ecf20Sopenharmony_ci					0x50,			\
588c2ecf20Sopenharmony_ci					0x01) }
598c2ecf20Sopenharmony_ciDEVICE(google, GOOGLE_IDS);
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* HP4x (48/49) Generic Serial driver */
628c2ecf20Sopenharmony_ci#define HP4X_IDS()			\
638c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x03f0, 0x0121) }
648c2ecf20Sopenharmony_ciDEVICE(hp4x, HP4X_IDS);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* KAUFMANN RKS+CAN VCP */
678c2ecf20Sopenharmony_ci#define KAUFMANN_IDS()			\
688c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x16d0, 0x0870) }
698c2ecf20Sopenharmony_ciDEVICE(kaufmann, KAUFMANN_IDS);
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Libtransistor USB console */
728c2ecf20Sopenharmony_ci#define LIBTRANSISTOR_IDS()			\
738c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x1209, 0x8b00) }
748c2ecf20Sopenharmony_ciDEVICE(libtransistor, LIBTRANSISTOR_IDS);
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* Motorola USB Phone driver */
778c2ecf20Sopenharmony_ci#define MOTO_IDS()			\
788c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x05c6, 0x3197) },	/* unknown Motorola phone */	\
798c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0c44, 0x0022) },	/* unknown Motorola phone */	\
808c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x22b8, 0x2a64) },	/* Motorola KRZR K1m */		\
818c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x22b8, 0x2c84) },	/* Motorola VE240 phone */	\
828c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x22b8, 0x2c64) }	/* Motorola V950 phone */
838c2ecf20Sopenharmony_ciDEVICE(moto_modem, MOTO_IDS);
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Motorola Tetra driver */
868c2ecf20Sopenharmony_ci#define MOTOROLA_TETRA_IDS()			\
878c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0cad, 0x9011) },	/* Motorola Solutions TETRA PEI */ \
888c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0cad, 0x9012) },	/* MTP6550 */ \
898c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0cad, 0x9013) },	/* MTP3xxx */ \
908c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0cad, 0x9015) },	/* MTP85xx */ \
918c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0cad, 0x9016) }	/* TPG2200 */
928c2ecf20Sopenharmony_ciDEVICE(motorola_tetra, MOTOROLA_TETRA_IDS);
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* Nokia mobile phone driver */
958c2ecf20Sopenharmony_ci#define NOKIA_IDS()			\
968c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0421, 0x069a) }	/* Nokia 130 (RM-1035) */
978c2ecf20Sopenharmony_ciDEVICE(nokia, NOKIA_IDS);
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/* Novatel Wireless GPS driver */
1008c2ecf20Sopenharmony_ci#define NOVATEL_IDS()			\
1018c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x09d7, 0x0100) }	/* NovAtel FlexPack GPS */
1028c2ecf20Sopenharmony_ciDEVICE_N(novatel_gps, NOVATEL_IDS, 3);
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Siemens USB/MPI adapter */
1058c2ecf20Sopenharmony_ci#define SIEMENS_IDS()			\
1068c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x908, 0x0004) }
1078c2ecf20Sopenharmony_ciDEVICE(siemens_mpi, SIEMENS_IDS);
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* Suunto ANT+ USB Driver */
1108c2ecf20Sopenharmony_ci#define SUUNTO_IDS()			\
1118c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0fcf, 0x1008) },	\
1128c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x0fcf, 0x1009) } /* Dynastream ANT USB-m Stick */
1138c2ecf20Sopenharmony_ciDEVICE(suunto, SUUNTO_IDS);
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* ViVOpay USB Serial Driver */
1168c2ecf20Sopenharmony_ci#define VIVOPAY_IDS()			\
1178c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x1d5f, 0x1004) }	/* ViVOpay 8800 */
1188c2ecf20Sopenharmony_ciDEVICE(vivopay, VIVOPAY_IDS);
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* ZIO Motherboard USB driver */
1218c2ecf20Sopenharmony_ci#define ZIO_IDS()			\
1228c2ecf20Sopenharmony_ci	{ USB_DEVICE(0x1CBE, 0x0103) }
1238c2ecf20Sopenharmony_ciDEVICE(zio, ZIO_IDS);
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* All of the above structures mushed into two lists */
1268c2ecf20Sopenharmony_cistatic struct usb_serial_driver * const serial_drivers[] = {
1278c2ecf20Sopenharmony_ci	&carelink_device,
1288c2ecf20Sopenharmony_ci	&flashloader_device,
1298c2ecf20Sopenharmony_ci	&funsoft_device,
1308c2ecf20Sopenharmony_ci	&google_device,
1318c2ecf20Sopenharmony_ci	&hp4x_device,
1328c2ecf20Sopenharmony_ci	&kaufmann_device,
1338c2ecf20Sopenharmony_ci	&libtransistor_device,
1348c2ecf20Sopenharmony_ci	&moto_modem_device,
1358c2ecf20Sopenharmony_ci	&motorola_tetra_device,
1368c2ecf20Sopenharmony_ci	&nokia_device,
1378c2ecf20Sopenharmony_ci	&novatel_gps_device,
1388c2ecf20Sopenharmony_ci	&siemens_mpi_device,
1398c2ecf20Sopenharmony_ci	&suunto_device,
1408c2ecf20Sopenharmony_ci	&vivopay_device,
1418c2ecf20Sopenharmony_ci	&zio_device,
1428c2ecf20Sopenharmony_ci	NULL
1438c2ecf20Sopenharmony_ci};
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cistatic const struct usb_device_id id_table[] = {
1468c2ecf20Sopenharmony_ci	CARELINK_IDS(),
1478c2ecf20Sopenharmony_ci	FLASHLOADER_IDS(),
1488c2ecf20Sopenharmony_ci	FUNSOFT_IDS(),
1498c2ecf20Sopenharmony_ci	GOOGLE_IDS(),
1508c2ecf20Sopenharmony_ci	HP4X_IDS(),
1518c2ecf20Sopenharmony_ci	KAUFMANN_IDS(),
1528c2ecf20Sopenharmony_ci	LIBTRANSISTOR_IDS(),
1538c2ecf20Sopenharmony_ci	MOTO_IDS(),
1548c2ecf20Sopenharmony_ci	MOTOROLA_TETRA_IDS(),
1558c2ecf20Sopenharmony_ci	NOKIA_IDS(),
1568c2ecf20Sopenharmony_ci	NOVATEL_IDS(),
1578c2ecf20Sopenharmony_ci	SIEMENS_IDS(),
1588c2ecf20Sopenharmony_ci	SUUNTO_IDS(),
1598c2ecf20Sopenharmony_ci	VIVOPAY_IDS(),
1608c2ecf20Sopenharmony_ci	ZIO_IDS(),
1618c2ecf20Sopenharmony_ci	{ },
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(usb, id_table);
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_cimodule_usb_serial_driver(serial_drivers, id_table);
1668c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
167