18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Qualcomm USB Auxiliary Serial Port driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com>
68c2ecf20Sopenharmony_ci * Copyright (C) 2010 Dan Williams <dcbw@redhat.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Devices listed here usually provide a CDC ACM port on which normal modem
98c2ecf20Sopenharmony_ci * AT commands and PPP can be used.  But when that port is in-use by PPP it
108c2ecf20Sopenharmony_ci * cannot be used simultaneously for status or signal strength.  Instead, the
118c2ecf20Sopenharmony_ci * ports here can be queried for that information using the Qualcomm DM
128c2ecf20Sopenharmony_ci * protocol.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <linux/kernel.h>
168c2ecf20Sopenharmony_ci#include <linux/tty.h>
178c2ecf20Sopenharmony_ci#include <linux/module.h>
188c2ecf20Sopenharmony_ci#include <linux/usb.h>
198c2ecf20Sopenharmony_ci#include <linux/usb/serial.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* NOTE: for now, only use this driver for devices that provide a CDC-ACM port
228c2ecf20Sopenharmony_ci * for normal AT commands, but also provide secondary USB interfaces for the
238c2ecf20Sopenharmony_ci * QCDM-capable ports.  Devices that do not provide a CDC-ACM port should
248c2ecf20Sopenharmony_ci * probably be driven by option.ko.
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* UTStarcom/Pantech/Curitel devices */
288c2ecf20Sopenharmony_ci#define UTSTARCOM_VENDOR_ID			0x106c
298c2ecf20Sopenharmony_ci#define UTSTARCOM_PRODUCT_PC5740		0x3701
308c2ecf20Sopenharmony_ci#define UTSTARCOM_PRODUCT_PC5750		0x3702 /* aka Pantech PX-500 */
318c2ecf20Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM150			0x3711
328c2ecf20Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM175_V1		0x3712
338c2ecf20Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM175_V2		0x3714
348c2ecf20Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM175_ALLTEL		0x3715
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/* CMOTECH devices */
378c2ecf20Sopenharmony_ci#define CMOTECH_VENDOR_ID			0x16d8
388c2ecf20Sopenharmony_ci#define CMOTECH_PRODUCT_CDU550			0x5553
398c2ecf20Sopenharmony_ci#define CMOTECH_PRODUCT_CDX650			0x6512
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* LG devices */
428c2ecf20Sopenharmony_ci#define LG_VENDOR_ID				0x1004
438c2ecf20Sopenharmony_ci#define LG_PRODUCT_VX4400_6000			0x6000 /* VX4400/VX6000/Rumor */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Sanyo devices */
468c2ecf20Sopenharmony_ci#define SANYO_VENDOR_ID				0x0474
478c2ecf20Sopenharmony_ci#define SANYO_PRODUCT_KATANA_LX			0x0754 /* SCP-3800 (Katana LX) */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Samsung devices */
508c2ecf20Sopenharmony_ci#define SAMSUNG_VENDOR_ID			0x04e8
518c2ecf20Sopenharmony_ci#define SAMSUNG_PRODUCT_U520			0x6640 /* SCH-U520 */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_cistatic const struct usb_device_id id_table[] = {
548c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5740, 0xff, 0x00, 0x00) },
558c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5750, 0xff, 0x00, 0x00) },
568c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM150, 0xff, 0x00, 0x00) },
578c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_V1, 0xff, 0x00, 0x00) },
588c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_V2, 0xff, 0x00, 0x00) },
598c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_ALLTEL, 0xff, 0x00, 0x00) },
608c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU550, 0xff, 0xff, 0x00) },
618c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDX650, 0xff, 0xff, 0x00) },
628c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
638c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
648c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) },
658c2ecf20Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) },  /* NMEA */
668c2ecf20Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) },  /* WMC */
678c2ecf20Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) },  /* DIAG */
688c2ecf20Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(0x1fac, 0x0151, 0xff, 0xff, 0xff) },
698c2ecf20Sopenharmony_ci	{ },
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(usb, id_table);
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistatic struct usb_serial_driver qcaux_device = {
748c2ecf20Sopenharmony_ci	.driver = {
758c2ecf20Sopenharmony_ci		.owner =	THIS_MODULE,
768c2ecf20Sopenharmony_ci		.name =		"qcaux",
778c2ecf20Sopenharmony_ci	},
788c2ecf20Sopenharmony_ci	.id_table =		id_table,
798c2ecf20Sopenharmony_ci	.num_ports =		1,
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistatic struct usb_serial_driver * const serial_drivers[] = {
838c2ecf20Sopenharmony_ci	&qcaux_device, NULL
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cimodule_usb_serial_driver(serial_drivers, id_table);
878c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2");
88