162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Qualcomm USB Auxiliary Serial Port driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com>
662306a36Sopenharmony_ci * Copyright (C) 2010 Dan Williams <dcbw@redhat.com>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Devices listed here usually provide a CDC ACM port on which normal modem
962306a36Sopenharmony_ci * AT commands and PPP can be used.  But when that port is in-use by PPP it
1062306a36Sopenharmony_ci * cannot be used simultaneously for status or signal strength.  Instead, the
1162306a36Sopenharmony_ci * ports here can be queried for that information using the Qualcomm DM
1262306a36Sopenharmony_ci * protocol.
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include <linux/kernel.h>
1662306a36Sopenharmony_ci#include <linux/tty.h>
1762306a36Sopenharmony_ci#include <linux/module.h>
1862306a36Sopenharmony_ci#include <linux/usb.h>
1962306a36Sopenharmony_ci#include <linux/usb/serial.h>
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/* NOTE: for now, only use this driver for devices that provide a CDC-ACM port
2262306a36Sopenharmony_ci * for normal AT commands, but also provide secondary USB interfaces for the
2362306a36Sopenharmony_ci * QCDM-capable ports.  Devices that do not provide a CDC-ACM port should
2462306a36Sopenharmony_ci * probably be driven by option.ko.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/* UTStarcom/Pantech/Curitel devices */
2862306a36Sopenharmony_ci#define UTSTARCOM_VENDOR_ID			0x106c
2962306a36Sopenharmony_ci#define UTSTARCOM_PRODUCT_PC5740		0x3701
3062306a36Sopenharmony_ci#define UTSTARCOM_PRODUCT_PC5750		0x3702 /* aka Pantech PX-500 */
3162306a36Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM150			0x3711
3262306a36Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM175_V1		0x3712
3362306a36Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM175_V2		0x3714
3462306a36Sopenharmony_ci#define UTSTARCOM_PRODUCT_UM175_ALLTEL		0x3715
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/* CMOTECH devices */
3762306a36Sopenharmony_ci#define CMOTECH_VENDOR_ID			0x16d8
3862306a36Sopenharmony_ci#define CMOTECH_PRODUCT_CDU550			0x5553
3962306a36Sopenharmony_ci#define CMOTECH_PRODUCT_CDX650			0x6512
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* LG devices */
4262306a36Sopenharmony_ci#define LG_VENDOR_ID				0x1004
4362306a36Sopenharmony_ci#define LG_PRODUCT_VX4400_6000			0x6000 /* VX4400/VX6000/Rumor */
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/* Sanyo devices */
4662306a36Sopenharmony_ci#define SANYO_VENDOR_ID				0x0474
4762306a36Sopenharmony_ci#define SANYO_PRODUCT_KATANA_LX			0x0754 /* SCP-3800 (Katana LX) */
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci/* Samsung devices */
5062306a36Sopenharmony_ci#define SAMSUNG_VENDOR_ID			0x04e8
5162306a36Sopenharmony_ci#define SAMSUNG_PRODUCT_U520			0x6640 /* SCH-U520 */
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cistatic const struct usb_device_id id_table[] = {
5462306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5740, 0xff, 0x00, 0x00) },
5562306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_PC5750, 0xff, 0x00, 0x00) },
5662306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM150, 0xff, 0x00, 0x00) },
5762306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_V1, 0xff, 0x00, 0x00) },
5862306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_V2, 0xff, 0x00, 0x00) },
5962306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, UTSTARCOM_PRODUCT_UM175_ALLTEL, 0xff, 0x00, 0x00) },
6062306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU550, 0xff, 0xff, 0x00) },
6162306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDX650, 0xff, 0xff, 0x00) },
6262306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
6362306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
6462306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) },
6562306a36Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) },  /* NMEA */
6662306a36Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) },  /* WMC */
6762306a36Sopenharmony_ci	{ USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) },  /* DIAG */
6862306a36Sopenharmony_ci	{ USB_DEVICE_AND_INTERFACE_INFO(0x1fac, 0x0151, 0xff, 0xff, 0xff) },
6962306a36Sopenharmony_ci	{ },
7062306a36Sopenharmony_ci};
7162306a36Sopenharmony_ciMODULE_DEVICE_TABLE(usb, id_table);
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_cistatic struct usb_serial_driver qcaux_device = {
7462306a36Sopenharmony_ci	.driver = {
7562306a36Sopenharmony_ci		.owner =	THIS_MODULE,
7662306a36Sopenharmony_ci		.name =		"qcaux",
7762306a36Sopenharmony_ci	},
7862306a36Sopenharmony_ci	.id_table =		id_table,
7962306a36Sopenharmony_ci	.num_ports =		1,
8062306a36Sopenharmony_ci};
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_cistatic struct usb_serial_driver * const serial_drivers[] = {
8362306a36Sopenharmony_ci	&qcaux_device, NULL
8462306a36Sopenharmony_ci};
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_cimodule_usb_serial_driver(serial_drivers, id_table);
8762306a36Sopenharmony_ciMODULE_LICENSE("GPL v2");
88