Received: by 10.223.148.5 with SMTP id 5csp6996977wrq; Wed, 17 Jan 2018 22:53:56 -0800 (PST) X-Google-Smtp-Source: ACJfBovjtQHh9GWuU7BU91NOvD6zuBXssi8j5j8OZE47DpJRUpt3XtHEafAcFzmazpJxQ5d5pIEd X-Received: by 10.84.241.12 with SMTP id a12mr37051579pll.115.1516258435944; Wed, 17 Jan 2018 22:53:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516258435; cv=none; d=google.com; s=arc-20160816; b=ZwVfIailzkPqnkeaTKvaYTxuPxP0d/q4HYgvMoC7k7rMxCaknOarKkQLe8IzhhIdQC KJqlRTKeyHIodyfaP0Oq1F/rffunlCWFU6fewZImvVxiRbJqqTE14QFCYyay2X/LX712 gbXZz97hAeIYSP/AexAue5mAEiqNoku+DiZ0LOYlFBpds38/Y01bofKW+LhY7KEww9Cs N7JkVNhgBT1Aw5Ayk41y6PvuoD8p9IpmQZ31UTnpq5QFB+6TSJAjG9ww21A6RSDy35t2 O0OT0hKx5Yzs320P+k6N6v1OrQnRIXNU97tS6vrH4CShVLWKOdKOAxC6s1StIOc0rTOp aTTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=cHfT8t+TyF/lQIdVte163QCmbr9SJEXKefT47tQcxbc=; b=s9n3SegpIM1FBIrEC64A0c2+KDXjfUM2fpvnl+gHRr26DI5HTFwp/1gXQRaFaxba7Z 9zzlQxDArlNPbhrPdfeh0FB2qFqstCEa56ogVIA92EKDHE4XdZoLHxtvSqiS5eDY3+sJ 0NgxN9NVndggKLRSGrd2FiG0tbUGAGDO0zjT5iNgjm8gDRbosWcMUHqHS9nNAodH2GRO nzZ7h0LvKZi5jfqLTxnRoF33FoUKYUWfWf8VbLXEXi3lO9JtBWRwuDyt7X76KAaLSwFe rB3sb/sp9X2GhkvH1RIVClm2jPetzfWReaOA0T7rOMc72CUE2nT/DknzJJseFInDNjs5 ooNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=bdraw65K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10si5946671plu.505.2018.01.17.22.53.41; Wed, 17 Jan 2018 22:53:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=bdraw65K; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754730AbeARGwb (ORCPT + 99 others); Thu, 18 Jan 2018 01:52:31 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36300 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754365AbeARGw2 (ORCPT ); Thu, 18 Jan 2018 01:52:28 -0500 Received: by mail-pg0-f65.google.com with SMTP id k68so5668785pga.3; Wed, 17 Jan 2018 22:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cHfT8t+TyF/lQIdVte163QCmbr9SJEXKefT47tQcxbc=; b=bdraw65Kc8iyzsFdF0PwlRJBTTiU2JuqZQ4N0yoMZCPDMNhV+/VkU2uiz9m03lZoF9 MC2qHRzOpPAgvPQa1kwYaT7macUv3kdlmXriA5IjWsRFQhkQN/XWa7EHK9ys42zCJFaG RZHGrROZBYeoKJmKRKv7vBJqdK+wq8QimeSKgecFDBtZgN7ZMSxNG1vJFzFOA3bjcbO8 WLCRANy0+w36vT2DNpH01rVCivdNjkucP+FW5BpHkkNbLGw1nQ8VysaCe+16MD3Bx/Ob XWpCJ6ugeNKECN/HXSOwDzmCgvznNDri3HD8R0kqt4m4a43YWEnG0pKSCpy/PdEntgzU GfAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=cHfT8t+TyF/lQIdVte163QCmbr9SJEXKefT47tQcxbc=; b=rfBvGOCm69a3SYhi1lBbq8aD9uGNC2ePWD7LlU/bajP0Ooe3gd9XU6PPWu+IvgCKzT q3QLKQYsDB1ZEBmvdtt8C5qwgik5M3rp0EwlX6sYJz0/Rd42fd6INBtQwjsywVBd2FvY gJ7lB0/bSbp9IOsH/eo2wSzb/TWWb9ElFTd3OPnByxDbKqdqb2i8rGNZVE96lvTGE6u3 U9VNuW8FfpoxO6j+XyxSLw0aFkxUILJCcUk5H4TjPIYuoH6c1xrLofXXCYAovJCnNobu 8aYOHBLKbhexOyFLdbwo80V+KCgsIWcry61EYxFaKcs1cO68QFGKrhuFpKgbqBES5Zb8 UtLg== X-Gm-Message-State: AKGB3mJfBXvdn0CBTXSiFoqp4lsCVb5HhEsq4ch9i/LzVwQTDxgJYSMF CkrCSPtOZ6DBHPxguznBdVk= X-Received: by 10.98.66.67 with SMTP id p64mr33944592pfa.227.1516258347515; Wed, 17 Jan 2018 22:52:27 -0800 (PST) Received: from pi.iht.com.au ([203.87.124.230]) by smtp.gmail.com with ESMTPSA id t80sm9576200pgb.88.2018.01.17.22.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jan 2018 22:52:25 -0800 (PST) X-Google-Original-Sender: Received: from johan by pi with local (Exim 4.89) (envelope-from ) id 1ec3zQ-0008OJ-8v; Thu, 18 Jan 2018 17:47:56 +1100 Date: Thu, 18 Jan 2018 17:47:36 +1100 From: Johan Hovold To: Andreas Kemnade Cc: Johan Hovold , Mark Rutland , devicetree@vger.kernel.org, Discussions about the Letux Kernel , Jonathan Cameron , Arnd Bergmann , Tony Lindgren , "H. Nikolaus Schaller" , kernel@pyra-handheld.com, Russell King , linux-kernel@vger.kernel.org, Thierry Reding , Rob Herring , Kevin Hilman , =?iso-8859-1?Q?Beno=EEt?= Cousson , Greg Kroah-Hartman , linux-omap@vger.kernel.org, Andreas =?iso-8859-1?Q?F=E4rber?= , linux-arm-kernel@lists.infradead.org Subject: Re: [Letux-kernel] [PATCH v5 3/5] misc serdev: Add w2sg0004 (gps receiver) power control driver Message-ID: <20180118064736.GH3286@localhost> References: <5494ad34b39a6c62601e3747440268dfb3be7d5a.1512114576.git.hns@goldelico.com> <20171222124427.GI3374@localhost> <20180109184347.28ba0a6e@aktux> <20180112144647.GA5992@localhost> <20180112194022.7da1e726@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180112194022.7da1e726@kemnade.info> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 12, 2018 at 07:40:35PM +0100, Andreas Kemnade wrote: > On Fri, 12 Jan 2018 15:46:47 +0100 > Johan Hovold wrote: > > > On Tue, Jan 09, 2018 at 06:43:47PM +0100, Andreas Kemnade wrote: > > > On Fri, 22 Dec 2017 13:44:27 +0100 > > > Johan Hovold wrote: > > > > > > [...] > > > > I'd suggest reiterating the problem you're trying to solve and > > > > enumerating the previously discussed potential solutions in order to > > > > find a proper abstraction level for this (before getting lost in > > > > implementation details). > > > > > > > The main point here is in short words: Having a device powered on or off > > > when the uart it is attached to, is used or not used anymore, > > > so the already available userspace applications do not need to be changed. > > > > So we'd end up with something in-between a kernel driver and a > > user-space solution. What about devices that need to be (partially) > > powered also when the port isn't open? A pure user-space solution would > > be able to handle all variants. > > > Well partly powered devices are at many places, And they hide that problem > from userspace, just get the open()/get() and close()/put() from there and power the > device accordingly. > > So the question still remains why should the kernel hide some things and some > it should not. > If it all is in userspace, then there is still something needed in the devicetree > (if I understand correctly, every information about hardware which cannot be > auto-probed belongs into device tree) so that the userspace knows what kind of > device is at that port. So there can be a daemon powering on and off devices. > But that would break existing applications which just expect that they just need > to open/close the device. > > Or you need to have some inotify handler in userspace and attach it there to > react on close() and open() of that device. > But this thing needs to have two kind of information: > > 1. the type of chip available to do the right powerup sequence. > > 2. how the chip is wired up to the cpu. > > So to avoid having hardware information spread all over the table at least > these information would need to be in devicetree. But that also all feels > like a hack and hard to maintain. Having the device described in the device tree is certainly desirable, not least for chip identification. And with a GPS framework in the kernel with a well-defined interface, implementing power management would be straight forward. I'm just not convinced that the proposed tty interface is the right interface for this. User space would still rely on gpsd for the GPS protocols, and would also ultimately be managing power by killing gpsd or whatever daemon that would otherwise be holding the port open. Something like the generic power sequences that has been discussed elsewhere might be a better fit for this if all you want to do is power on and off on port open and close (and on suspend/resume). There really isn't anything GPS-specific in the current proposal (besides the suggested tty-device name). But sure, that wouldn't be sufficient to deal with the unknown-power-state problem with the device in question. Johan