Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1959987ybb; Sat, 11 Apr 2020 16:33:27 -0700 (PDT) X-Google-Smtp-Source: APiQypIEOxOsvPMvCJ3ShUidh4TETS7V+Utcb9Q26Y6otTlQMbGRaRjSWDc1G0liI3QsisrqJ4vk X-Received: by 2002:a05:620a:891:: with SMTP id b17mr10496452qka.114.1586648007247; Sat, 11 Apr 2020 16:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586648007; cv=none; d=google.com; s=arc-20160816; b=VgDLVmvBDqyYUCeTKyIOy/quJddt7v2wuR+I6teb58i/qQsjZsxwmCWTOjBECb9UKP BaVzPxcEVGUM5JNwLtxwct3ZqKUJK5l6i70cWwJPq0av+/BAwCMaaFkTfYd7ZJLxQbam xuxBobWaeH5cyq3MMdK9I2pRXoE5SStts74f8xyRCjMq/myVZxbAZiD0D9Ns6UB5g3rl pzn0lmrke84odddMRa83IcQ/MfQVLIwbJfjrnsFbsqYTTJY4+LHd8lqeNbnyayppXXoc HNOMambJUgruSF1Csfjr1ynHwGoUDk4vNNBJfZR4glum4IRExsRCr8izy+PiquhJA0h1 lUjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=EQLCmt3QDbM/HO31ryGMcmizyORhm18obupYJYd9oC0=; b=IkSojZcFB2Z9XoZqptmt3+7yrxu4CADZXN++1dDRJ7LHwTrZdYQ5s76BDok6fZvsXo Tq0CmKQfeFX8VMQBb5ShAixw2Xgi9NAnL6tXAOwCy80uD5dNqT3Fq4iiKsHRrS66OAbk xYoZJezUrdlhbzp+QIOytp8RD5Eon41qJYYGElXTXi9Oxn71U82awm/wLt7GFCLSh131 EsULryUDjblt28dWgaZP1pzUvAJkNftZ4QwbR2j+bu1CPmmGtR/d1MizqfPaOYEXsBJ9 JCzFmaEMxwkpcdZ/xzv/FauVCx4IuhqiI6KkF9vJIBm4UnMdYsWovs81G5wOJ1Z86C7B 4yCA== ARC-Authentication-Results: i=1; mx.google.com; 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 o67si975985qke.270.2020.04.11.16.33.13; Sat, 11 Apr 2020 16:33:27 -0700 (PDT) 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; 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 S1729764AbgDKXby (ORCPT + 99 others); Sat, 11 Apr 2020 19:31:54 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60361 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728753AbgDKXbs (ORCPT ); Sat, 11 Apr 2020 19:31:48 -0400 X-Originating-IP: 86.202.105.35 Received: from localhost (lfbn-lyo-1-9-35.w86-202.abo.wanadoo.fr [86.202.105.35]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C998520004; Sat, 11 Apr 2020 23:31:45 +0000 (UTC) Date: Sun, 12 Apr 2020 01:31:45 +0200 From: Alexandre Belloni To: William Breathitt Gray Cc: Kamel Bouhara , Dmitry Torokhov , Rob Herring , Mark Rutland , Nicolas Ferre , Ludovic Desroches , linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH 0/3] Introduce a counter inkernel API Message-ID: <20200411233145.GC3628@piout.net> References: <20200406155806.1295169-1-kamel.bouhara@bootlin.com> <20200411172259.GB95806@icarus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200411172259.GB95806@icarus> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/04/2020 13:22:59-0400, William Breathitt Gray wrote: > I'm not inherently opposed to adding an in-kernel API for the Counter > subsystem, but I'm not sure yet if it's necessary for this particular > situation. > > Is the purpose of this driver to allow users to poll on the rotary > encoder position value? If so, perhaps instead of an in-kernel API, the > polling functionality should be added as part of the Counter subsystem; > I can see this being a useful feature for many counter devices, and > it'll keep the code contained to a single subsystem. > > By the way, I'm going to be submitting a major update to the Counter > subsystem code in the next couple weeks that isolates the sysfs code > from the rest of the subsystem -- it'll likely affect the interface and > code here -- so I'll probably wait to decide for certain until that > patch lands; I anticipate it making things easier for you here after > it's merged. > > For now, I want to get a better high-level understanding about how users > would interact with this driver to use the device (input_setup_polling > is a new call for me). That should help me understand whether an > in-kernel API is the best choice here. > Well, the goal is not really polling the counters but mainly exposing the correct userspace interface for the rotary encoders that are connected to quadrature decoders. The input driver is using polling because this reduces the complexity of the patches but the ultimate goal is to also have interrupts working. I'm pretty sure the in-kernel interface can also have other usages like for example iio triggers. I could envision having to read an ADC after x turns of a motor to check for the torque. I also think that having the sysfs code separate would help as it could be considered as one of the in-kernel interface user. BTW, do you have plans to add a character device interface? -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com