Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751761AbcL1NBd (ORCPT ); Wed, 28 Dec 2016 08:01:33 -0500 Received: from mail-qt0-f173.google.com ([209.85.216.173]:36491 "EHLO mail-qt0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbcL1NBb (ORCPT ); Wed, 28 Dec 2016 08:01:31 -0500 MIME-Version: 1.0 In-Reply-To: References: <1480432969-20913-1-git-send-email-bgolaszewski@baylibre.com> <44cce3d5-f65e-1a35-20a4-5eb9fda42312@metafoo.de> From: Linus Walleij Date: Wed, 28 Dec 2016 14:00:58 +0100 Message-ID: Subject: Re: [PATCH] iio: misc: add a generic regulator driver To: Bartosz Golaszewski Cc: Lars-Peter Clausen , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , "linux-iio@vger.kernel.org" , linux-devicetree , LKML , Kevin Hilman , Patrick Titiano , Neil Armstrong , Liam Girdwood , Mark Brown Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1266 Lines: 32 On Tue, Dec 13, 2016 at 3:28 PM, Bartosz Golaszewski wrote: > + Linus > > While the new GPIO interface would be very convenient - in our case we > could simply name the lines appropriately in the device tree - I'm not > sure this would be the correct approach. > > From this year's ELCE in Berlin I remember Linus suggested during his > talk that it's always better to write a kernel driver. Also: this way > the relevant GPIO lines would not be reserved for exclusive use by > power switches. > > Linus - do you have any thoughts/suggestions on that subject? If the probe you are power cycling has its own DT node and is described as a device per se in the system, then it should have a device driver grabbing and toggling its own GPIO line. If the probe is only really known in userspace, and driven from userspace, it's GPIO reset line should also be driven from userspace, using the chardev ABI as you describe. Whether something should have a userspace or kernelspace driver is a gray area, admittedly. There are cases for both. The general consideration would be reuse and deployment. If you expect all users of this probe to always use libiio and some other userspace, I guess userspace-only makes sense? Yours, Linus Walleij