From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 72CD91F8669 for ; Wed, 8 Jan 2025 09:56:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736330168; cv=none; b=YFtbeWTJkRKebkLFnsdz70AUIvSrdJm+uFH+r6Iea6Tg1WNT2HsQ3t9EQt8XPLg54h5S9sRjcZ4xzCtl1lPQfkRbl3x3VvdVEkslk9+Jf8/wRtJZmzaDh6bHcNfk2qARze7lx30UyElxMGkCB8cJCuZR5srHMQqiFPn0iFYe73w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736330168; c=relaxed/simple; bh=unTnn6KQo5XitzCC/dKK2V1QVl5mnw753rU5j9p6tfI=; h=Date:From:Subject:To:Cc:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=AodY4a8W/lDl1uZxOSvFn8rT0CAHWSJ3utaJ6TR0ZYVBFF50IiVkRUDPk2sG6fSaYNkt6MM4INCbCz7aLlxVsYuFn39uZ3wQsqO+SZhUOPVFEqGILnrt09IGkj6Ys1uEw93rJMavaDJ+cyxbw/r7+umN/zYFEOXQL6MF02gQd88= 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=U2jsYLz1; arc=none smtp.client-ip=209.85.214.171 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="U2jsYLz1" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21669fd5c7cso248850165ad.3 for ; Wed, 08 Jan 2025 01:56:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unrealasia-net.20230601.gappssmtp.com; s=20230601; t=1736330166; x=1736934966; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:cc:to:subject:from :date:from:to:cc:subject:date:message-id:reply-to; bh=xZPFzNsNKz2iWDthJJl/XRnudiDnv5Z0MRal5mniU3o=; b=U2jsYLz1JQbQ0lnHvqaviHHBed5TavFfmBNR7KzZW+Gp8E/q3rt0pPGWw6ygnZJMYq g3bCuD7qUL4poRSTI48oj+OiIEQOSG5a8foL4ubsnj66V9grkmDC86npOwevi6qn4xu9 H6HiaJP7AmEGLrCv2wKjDQ3J4eq3iaFE4TCDweq+vPb8FOHRTVMX4PJ+ISEKujTvrhaz f0zgkdB9WcyExH//0W36FEKHwMoPIrEjRfNbrjjxCxhqyWVi4Hg3mYmxUx8l9bvIgoRs CbUJILx+3Vevj4yO+9s8NxrepALP6DoLtsTyLy9v9l/WmRFHP3n/D5GsOlyAxM9Uk+Vg xJpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736330166; x=1736934966; h=mime-version:references:in-reply-to:message-id:cc:to:subject:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xZPFzNsNKz2iWDthJJl/XRnudiDnv5Z0MRal5mniU3o=; b=i35p4qm7uf6ZXSmKoqsZIOWtifDBiKHs1Wz/QnqPrsP1MqFcORqd8NLSCFRFvfsACu fBD6hnXTm//DnCI0vxFvetIe/gAen/S4GBSscn9Jih3g0d2Df5BrAESreTxwQjU03Cca kJ83hojek4dZyipXHTxCnqu1q7pUp4ITFHmuO1ph2d+OjIvo2URCabYltE7Ts4S9p6vp pnNRBM6yBtZwdH6AZm27wQWthlB2v59j9J5myIfLMX+LEwjLfDIjjEZ69wdTNvQXiEPI 9pXjEB1ADF6R3Yw2G7hZQpobu89GifUezgT5tHT9FIYZ8qrHG4n3xpIV+GJN9Y+wjmRo ZNiQ== X-Forwarded-Encrypted: i=1; AJvYcCVaXH/IVP7NbD0vQS3zdYPXnYAvVkdHVIMyTI2C/0HvHPCi3TZ5WPH3dGzuXAiyDu3rHCcTWWo08yj/hXw=@vger.kernel.org X-Gm-Message-State: AOJu0YxKC4P55aFz+Wv/rI2MrQiIo6PzLDhVoXPp2C/LZ/x/PQ94NFES 6/74ROKOrF4/95kN1eKs/7+f4F0qnxgcS5K51oqHb72rh6OaUj9QtDI2PM85xpQ= X-Gm-Gg: ASbGncuLsYYcjEoOCn2bjEPhG+absrz8rh6bd4rlN+7Clx2zrpfND0LHslQe+acq1bu HnS76/FE1Q7gGlorhyW5byFeJEPbRqmFQdS6fMvH1uRZuRGZGyatv/I4mb9BcPeiy3SI3qY9qFZ h5MtH3Yn3VLehECWviNRK1Yi/EzDmSrqvvKG8g+c3a9A5dLjj9vffdEXYNR9gFb9s85mdw6hi4Y /10IvgXtaz3UVt7PKiZL96sCwAbBEOfFMBrrz5S1xkQWQrAj4BHubSFVTzH1h0puw1uDw== X-Google-Smtp-Source: AGHT+IHRzGHW/z8gUOplPboXdYVV+4IiRhE6gpyKdsdPPbJZQTNRRQWOF5az8I0Aaw1KP9NqS9LhjA== X-Received: by 2002:a05:6a00:3a01:b0:71d:eb7d:20d5 with SMTP id d2e1a72fcca58-72d21f31848mr3590682b3a.8.1736330165656; Wed, 08 Jan 2025 01:56:05 -0800 (PST) Received: from muhammads-ThinkPad ([2001:e68:5473:b14:8dac:609c:8660:55f3]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dacffsm35973908b3a.120.2025.01.08.01.56.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 01:56:05 -0800 (PST) Date: Wed, 08 Jan 2025 16:59:02 +0800 From: Muhammad Nuzaihan Subject: Re: [RFC v4] wwan dev: Add port for NMEA channel for WWAN devices To: Sergey Ryazanov Cc: Slark Xiao , Loic Poulain , Johannes Berg , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: References: <20250105124819.6950-1-zaihan@unrealasia.net> <3c7d38cb.5336.1943f5e66de.Coremail.slark_xiao@163.com> X-Mailer: geary/40.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Hi Sergey, On Wed, Jan 8 2025 at 01:42:00 AM +0200, Sergey Ryazanov wrote: > Hi Muhammad, Slark, > > I should clarify here a bit. Export through GNSS does not mean > creating a dedicated PCI driver. It means call the > gnss_register_device() function to export the device to the user > space as instance of the GNSS class. This should help for > ModemManager as well to avoid the NMEA port access. Since the device > class will clearly indicate that the NMEA port has nothing common > with a cell modem control. Yes, after reading Slark's email, i began to understand the requirements and i agree with your explanation since I use ModemManager and support for PCIe devices with MHI seems lacking in ModemManager compared to USB based WWAN devices because of the issue above. I did not try to create a dedicated PCI driver, after looking at the code i was trying to allocate the device from the parent driver. Which didn't work. Unlike most other use-case in IoT and Embedded, my use case is more for Desktop usage where interaction with ModemManager is important. > > Still, as it was pointed by Loic, it is a good idea to call > gnss_register_device() from WWAN core in order to make the WWAN > device a common parent of the NMEA port. This should help user space > applications as well. A user space application (e.g. GPSd) can easily > find a control AT/MBIM/etc port to activate the GNSS functionality of > the physical device by checking the NMEA port siblings. Which is what my patch was trying to achieve in wwan_core.c - with the wwan_create_port() function with this code. + /* NMEA check to attach GNSS port */ + if (type == WWAN_PORT_NMEA) { + struct gnss_device *gdev = gnss_allocate_device(parent); + + if (gdev) + gnss_register_device(gdev); + } This was what was suggested in the email by Slark. Maybe i am missing something. Do i need to allocate the gnss device with gnss_allocate_device()? I see from gnss code that i need a "gnss_device" to be able to register. Also this is a just a tip of the iceberg, i would have to look at deregistering the device - removal as well, along the way > >> But the patch i'm giving does not work. (NULL deference err, >> possibly due to gdev being NULL). >> >> Just sharing on some progress i've made. > > A small hint. If a patch is not going to be merged here and now, it's > good idea put "RFC" keyword in the subject. E.g.: > > [RFC v4] wwan dev: Add port for NMEA channel for WWAN devices Will do. > > And another small hint. Use the bottom/inline posting style please. > It's really hard to read the email conversation backward. Sorry about that, i'll follow the list etiquette from now on. > >> I'm still looking at it and trying to figure out though. > > It will be great if you will manage to create the discussed > infrastructure inside the WWAN core code. I've already promised Slark > to make a prototype, but have a hard time to find a time to do it > properly. Sorry :( You mean a new function to pass the parent device, allocate and register? Tried: Modem PCIe driver <-> WWAN core <-> GNSS core <-> /dev/gnss0 I can work on this but i would need some guidance on what needs to be done. The gnss patch above i did was all the understanding i had with what Slark mentioned in this email. The gnss patch did try to initialize gnss in dmesg but it just crashes. No /dev/gnss0 device. Eventhough it's not that urgent for me because i still can read gps data on the current setup but i hope to implement this for sake of completeness since USB WWAN support with GPS is already well supported with ModemManager. (mmcli CLI for GPS subcommands gets error all the time for my PCIe device but that problem's specific to ModemManager) and since i have the hardware, so why not i try to implement to support it. ;-) I think i'll figure something out. :-) > >> On Tue, Jan 7 2025 at 02:05:38 PM +0800, Slark Xiao >> wrote: >>> >>> At 2025-01-07 03:44:35, "Loic Poulain" >>> wrote: >>>> Hi Muhammad, >>>> >>>> + Slark