From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751232AbdJCSR1 (ORCPT ); Tue, 3 Oct 2017 14:17:27 -0400 Received: from 20.mo5.mail-out.ovh.net ([91.121.55.239]:59562 "EHLO 20.mo5.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbdJCSR0 (ORCPT ); Tue, 3 Oct 2017 14:17:26 -0400 X-Greylist: delayed 3602 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Oct 2017 14:17:25 EDT To: linux-input@vger.kernel.org From: =?UTF-8?Q?=c5=81ukasz_Majewski?= Subject: [Regulator] Request for clarification - GPIO controlled regulator, USB VBUS, Cc: "linux-kernel@vger.kernel.org" , Liam Girdwood , Mark Brown Message-ID: Date: Tue, 3 Oct 2017 18:58:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13951025746289345253 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrkeejgdejkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear All, Maybe somebody could shed some light to following issue: On my setup I do have USB connected touchscreen powered from VBUS. The VBUS power is controlled by a GPIO pin, which in turn is governed by regulator API: reg_usbh1_vbus: usb-h1-vbus { compatible = "regulator-fixed"; gpio = <&gpio3 31 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usbh1_vbus>; regulator-name = "usb_h1_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; regulator-settling-time-us = <100000>; }; This regulator is then passed to USB controller: &usbh1 { vbus-supply = <®_usbh1_vbus>; } The regulator API starts VBUS -> USB host get info about the VBUS present and starts enumeration of the USB device. I would like to ask if there is any recommended way to remove VBUS power and have a way to force from user space the touchscreen (re-)enumeration? As fair as I know the Regulator API is RO on purpose, so I cannot toggle vbus from there. I could use hacks presented here (the userspace-regulator API): https://patchwork.ozlabs.org/patch/374912/ https://lkml.org/lkml/2014/7/30/357 but for some reason they did not find the way to the upstream. Also it seems like such approach is for testing, not for production system. I could write a "dummy" regulator driver, which would export control API to /dev/sys/proc. Something like: http://elixir.free-electrons.com/linux/latest/source/drivers/usb/phy/phy-fsl-usb.c (but with opposite way). or ./drivers/input/misc/regulator-haptic.c I've also tried the "usb" power control tricks; echo "0" > /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms echo "auto" > /sys/bus/usb/devices/usb1/power/control But without any effect (probably because of above dependencies). Have I overlooked something? Maybe there is any other mainline code, which I could reuse? My goal is to reuse as much as possible from ML and avoid developing any new code :-) Thanks in advance, -- Best regards. Ɓukasz Majewski