Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754075AbcLKWXF (ORCPT ); Sun, 11 Dec 2016 17:23:05 -0500 Received: from mail-ua0-f171.google.com ([209.85.217.171]:35359 "EHLO mail-ua0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754058AbcLKWXC (ORCPT ); Sun, 11 Dec 2016 17:23:02 -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: Bartosz Golaszewski Date: Sun, 11 Dec 2016 23:23:00 +0100 Message-ID: Subject: Re: [PATCH] iio: misc: add a generic regulator driver To: Jonathan Cameron Cc: Lars-Peter Clausen , 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: 2525 Lines: 56 2016-12-10 19:17 GMT+01:00 Jonathan Cameron : > On 06/12/16 11:12, Bartosz Golaszewski wrote: >> >> I wrote the initial patch quickly and didn't give it much of a >> thought. Now I realized I completely missed the point and managed to >> confuse everybody - myself included. >> >> So the problem we have is not power-cycling the adc - it's >> power-cycling the device connected to a probe on which there's an adc. >> What I was trying to do was adding support for the power-switch on >> baylibre-acme[1] probes. >> >> For example: we have a USB probe on which the VBUS signal goes through >> a power load switch and than through the adc. The adc (in this case >> ina226) is always powered on, while the fixed regulator I wanted to >> enable/disable actually drives the power switch to cut/restore power >> to the connected USB device i.e. there's no real regulator - just a >> GPIO driving the power switch. >> >> A typical use case is measuring the power consumption of development >> boards[2]. Rebooting them remotely using acme probes is already done, >> but we're using the obsolete /sys/class/gpio interface. >> >> We're already using libiio to read the measured data from the power >> monitor, that's why we'd like to use the iio framework for >> power-cycling the devices as well. My question is: would bridging the >> regulator framework be the right solution? Should we look for >> something else? Bridge the GPIO framework instead? > > Definitely doesn't fit inside standard scope of IIO - though I can see > why you were thinking along these lines. > Well, it's industrial INPUT/output right? I guess we can consider power-cycling input in this case. :) In our particular use case, the main reason for using IIO is having a single interface (libiio) instead of introducing a new one just for that (in the form of random sysfs attributes for example), but I'm sure such power switches could find application elsewhere too (measuring temperature, while power-cycling some cooling mechanism is the first thing that comes to mind). > Mark Brown, any thoughts? > > Effectively we are are looking at something that (in general form) might > be the equivalent of controlling a lab bench supply... So regulators > at the edge of the known world, with no visibility of what lies beyond. > Please consider the two patches I just sent. Instead of regulators, they add DT bindings for gpio power switches and introduce a simple iio driver using the gpio consumer API. Best regards, Bartosz Golaszewski