From patchwork Wed Jan 1 18:34:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Nuzaihan X-Patchwork-Id: 13924255 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8465517C21C for ; Wed, 1 Jan 2025 18:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735756864; cv=none; b=Ztj0gwhtGjmFgNRfybSqRYvcNvLghD1+DlsulvoCC+X9mRI7ZY9Y8kv6pQXQ8e67OO2ZQU/HRFu2nJZSSP2M60clTr1Pp/6FbECd8l0k9vvUjjjxD9so5INzwMmyhjn9Hh5g0HPXyBsF83fZOfc0Goy1ZPMdgko3h0dmzpIz3yA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735756864; c=relaxed/simple; bh=LU3G7wVy+RttZT3KWyNpCn8FF/RWmWVyw+isdgQlwcc=; h=Date:From:Subject:To:Cc:Message-Id:MIME-Version:Content-Type; b=aUNL0EMYREJvZDZN6wtucEr0V7qseB/JI3Y3vdbHqjZQkT3rEETH/cIPc608+V1Wuwb9ctztImfbAqq/VNnKqNTBYlBM3DBbu5Of56fKou7HOEI/SMBeEVBRZ0PYxc7AYdAeME+yhykGtvvvWrILLANOj3XjavtZQWXRC4CyOW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unrealasia.net; spf=pass smtp.mailfrom=unrealasia.net; dkim=pass (2048-bit key) header.d=unrealasia-net.20230601.gappssmtp.com header.i=@unrealasia-net.20230601.gappssmtp.com header.b=zevC39gF; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unrealasia.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unrealasia.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=unrealasia-net.20230601.gappssmtp.com header.i=@unrealasia-net.20230601.gappssmtp.com header.b="zevC39gF" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2efb17478adso14516369a91.1 for ; Wed, 01 Jan 2025 10:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unrealasia-net.20230601.gappssmtp.com; s=20230601; t=1735756861; x=1736361661; darn=vger.kernel.org; h=mime-version:message-id:cc:to:subject:from:date:from:to:cc:subject :date:message-id:reply-to; bh=V9ANSMwBXQIw9fPQUhhtEY8uNvGZwuLxXrj3cDGzSWA=; b=zevC39gFJXTcA+74H5Uxzp9vB6Yd74MzP6tVqhpB1m9vUOJpsUCSDgJxTyrCNqe0ZZ 5koHaUxk+jy92H/PHqx1brhN2BEomFIqtDCj/NTelFIulJUoSH7PA9mLQ+y9ub/AQvy9 VyrEwMDf6F/T+faHYTR3a1JZfOocGdlzNp2RXO9jOWkPn6000K+uSYrByMmuGTxKZ97T HbEcuDLMlJXR+N1ww8mDe7xafLGLyc5aorI/EFiWdCy91wEw6T2gYzEjqe6gQd0+MUN6 7rZms/UM5v19wzRkkwc7PipSXeQ5caGRGfiwxXX2ypeUNGgFpadVhjv9JyjXJfw3PYvu META== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735756861; x=1736361661; h=mime-version:message-id:cc:to:subject:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=V9ANSMwBXQIw9fPQUhhtEY8uNvGZwuLxXrj3cDGzSWA=; b=VdsxaDY9xTgGVZlS3BHMrL3YnccHbn9llSXNoeLytibDt7+6t0G6Cw8c2ykZT3D+Ur AW8PhNq/rvAQX4g2a5KaUsnKxBgJtIlXhqhwvBxpxNZzttkAai77RS/y+oJvNe+jV4Mj s14C37MINeQm2/USDvDBuJjmnqU7r1RFnqJNrlaeLqCWe57xIKKCK6BUW3B0F26Vxc80 DhDVvy440MoFg4j82oWjnyBRUjaT7ZHZz3hDnARP3QR1KrW6k4V32bB77D49fNQ86scH qiRPsB1amP/IGOjb6SleWrayFRRzJJQ5hNslx9OoKyyVTdU9Qy+AjmtK53/8vf9PIW9b FtFQ== X-Gm-Message-State: AOJu0YzeGE8gau/8/qRwX0Ei1s/SBOg5emY2QAXC25mHQf1R/HGJMdFb 7ya847/GpFoZRPsNycLYy2eY/IQMK4fhXI+wU2oVTKmEkvtiT/JkxuNPqlmGtAMMK3VYc/53Upt 1tZsBTQ== X-Gm-Gg: ASbGncti47Evt83CvVLB3WlWQsQLtbw5juFMJoxiqq+mDQZf7uDoy9gLGT6LGofqBYn 1OGNMCYiGZZwcxyxxZr/3BVEHFJUxCpt7USxl7UFTPZWvr89U6rIiHXBS3bVQ0ulw+84GQ3qyyP bj4uTxSiC6yJKxgucmLVUUwoVNhlCXIhp+gx2D9vAZjeTQK6A8/HBLI3HFNW4TsbDFB86/znUhQ dHGMLOfPuimWTJsTlIfcRJ8m5EF+9qcov/0nB6ZBfA2PSc8MyXk+t3VDhxtBKA= X-Google-Smtp-Source: AGHT+IFE0bD3Ch5DK/YWmtdL6RDV1VMmTCn9McSg1J5iWgWQQuuToJPMCRHTGOSxY/IYGFFoV9L9pg== X-Received: by 2002:a17:90b:2b8b:b0:2ee:7862:1b10 with SMTP id 98e67ed59e1d1-2f452e2256bmr63405306a91.11.1735756861015; Wed, 01 Jan 2025 10:41:01 -0800 (PST) Received: from [10.23.230.78] ([175.143.24.165]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f4da93a04esm2033428a91.11.2025.01.01.10.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jan 2025 10:41:00 -0800 (PST) Date: Thu, 02 Jan 2025 02:34:03 +0800 From: Muhammad Nuzaihan Subject: [PATCH] Add NMEA GPS character device for PCIe MHI Quectel Module to read NMEA statements. To: netdev@vger.kernel.org Cc: Loic Poulain , Sergey Ryazanov , Johannes Berg Message-Id: X-Mailer: geary/40.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hi netdev, I am using a Quectel RM520N-GL *PCIe* (not USB) module which uses the MHI interface. In /devices/pci0000:00/0000:00:1c.6/0000:08:00.0/mhi0 i can see "mhi0_NMEA" but the actual NMEA device is missing in /dev and needs a character device to be useful with tty programs. NMEA statements are a stream of GPS information which is used to tell the current device location in the console (like minicom). Attached is the patch to ensure a device is registered (as /dev/wwan0nmea0) so this device will stream GPS NMEA statements and can be used to be read by popular GPS tools like gpsd and then tracking with cgps, xgps, QGIS, etc. Regards, Muhammad Nuzaihan Signed-off-by: Muhammad Nuzaihan Bin Kamal Luddin Signed-off-by: Muhammad Nuzaihan Bin Kamal Luddin diff --git a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c index bcfbc6b3d617..4d4fc3813c86 100644 --- a/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c +++ b/drivers/net/wwan/iosm/iosm_ipc_chnl_cfg.c @@ -60,6 +60,10 @@ static struct ipc_chnl_cfg modem_cfg[] = { { IPC_MEM_CTRL_CHL_ID_6, IPC_MEM_PIPE_12, IPC_MEM_PIPE_13, IPC_MEM_MAX_TDS_MBIM, IPC_MEM_MAX_TDS_MBIM, IPC_MEM_MAX_DL_MBIM_BUF_SIZE, WWAN_PORT_MBIM }, + /* NMEA */ + { IPC_MEM_CTRL_CHL_ID_7, IPC_MEM_PIPE_14, IPC_MEM_PIPE_15, + IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_TDS_AT, IPC_MEM_MAX_DL_AT_BUF_SIZE, + WWAN_PORT_NMEA }, /* Flash Channel/Coredump Channel */ { IPC_MEM_CTRL_CHL_ID_7, IPC_MEM_PIPE_0, IPC_MEM_PIPE_1, IPC_MEM_MAX_TDS_FLASH_UL, IPC_MEM_MAX_TDS_FLASH_DL, diff --git a/drivers/net/wwan/mhi_wwan_ctrl.c b/drivers/net/wwan/mhi_wwan_ctrl.c index e9f979d2d851..e13c0b078175 100644 --- a/drivers/net/wwan/mhi_wwan_ctrl.c +++ b/drivers/net/wwan/mhi_wwan_ctrl.c @@ -263,6 +263,7 @@ static const struct mhi_device_id mhi_wwan_ctrl_match_table[] = { { .chan = "QMI", .driver_data = WWAN_PORT_QMI }, { .chan = "DIAG", .driver_data = WWAN_PORT_QCDM }, { .chan = "FIREHOSE", .driver_data = WWAN_PORT_FIREHOSE }, + { .chan = "NMEA", .driver_data = WWAN_PORT_NMEA }, {}, }; MODULE_DEVICE_TABLE(mhi, mhi_wwan_ctrl_match_table); diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c index a51e2755991a..0131d9795d6c 100644 --- a/drivers/net/wwan/wwan_core.c +++ b/drivers/net/wwan/wwan_core.c @@ -342,6 +342,10 @@ static const struct { .name = "MIPC", .devsuf = "mipc", }, + [WWAN_PORT_NMEA] = { + .name = "NMEA", + .devsuf = "nmea", + }, }; static ssize_t type_show(struct device *dev, struct device_attribute *attr, @@ -876,7 +880,8 @@ static long wwan_port_fops_ioctl(struct file *filp, unsigned int cmd, struct wwan_port *port = filp->private_data; int res; - if (port->type == WWAN_PORT_AT) { /* AT port specific IOCTLs */ + if (port->type == WWAN_PORT_AT || + WWAN_PORT_NMEA) { /* AT or NMEA port specific IOCTLs */ res = wwan_port_fops_at_ioctl(port, cmd, arg); if (res != -ENOIOCTLCMD) return res; diff --git a/include/linux/wwan.h b/include/linux/wwan.h index 79c781875c09..9e794fc53a7e 100644 --- a/include/linux/wwan.h +++ b/include/linux/wwan.h @@ -19,6 +19,7 @@ * @WWAN_PORT_FASTBOOT: Fastboot protocol control * @WWAN_PORT_ADB: ADB protocol control * @WWAN_PORT_MIPC: MTK MIPC diagnostic interface + * @WWAN_PORT_NMEA: NMEA GPS statements interface * * @WWAN_PORT_MAX: Highest supported port types * @WWAN_PORT_UNKNOWN: Special value to indicate an unknown port type @@ -34,6 +35,7 @@ enum wwan_port_type { WWAN_PORT_FASTBOOT, WWAN_PORT_ADB, WWAN_PORT_MIPC, + WWAN_PORT_NMEA, /* Add new port types above this line */