linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Łukasz Majewski" <l.majewski@majess.pl>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [Regulator] Request for clarification - GPIO controlled regulator, USB VBUS,
Date: Tue, 3 Oct 2017 12:16:41 -0700	[thread overview]
Message-ID: <CAKdAkRSB4wAx1CnaQKFq2jdvmk15NisWegYbS1iHqMOgvothKg@mail.gmail.com> (raw)
In-Reply-To: <c4ba36d3-c495-8ddf-9aa7-3e25e5b44672@majess.pl>

Hi Łukasz,

On Tue, Oct 3, 2017 at 9:58 AM, Łukasz Majewski <l.majewski@majess.pl> wrote:
> 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 = <&reg_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 :-)
>

Please start from the beginning: it is not quite clear why you want
the touchscreen to be re-enumerated.

Thanks.

-- 
Dmitry

  reply	other threads:[~2017-10-03 19:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-03 16:58 [Regulator] Request for clarification - GPIO controlled regulator, USB VBUS, Łukasz Majewski
2017-10-03 19:16 ` Dmitry Torokhov [this message]
2017-10-03 20:25   ` Łukasz Majewski
2017-10-04 10:32 ` Mark Brown
2017-10-04 10:45   ` Łukasz Majewski
2017-10-04 11:27     ` Mark Brown
2017-10-04 11:54       ` Łukasz Majewski
2017-10-04 14:57         ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKdAkRSB4wAx1CnaQKFq2jdvmk15NisWegYbS1iHqMOgvothKg@mail.gmail.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=broonie@kernel.org \
    --cc=l.majewski@majess.pl \
    --cc=lgirdwood@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).