mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johann Neuhauser <jneuhauser@dh-electronics.com>
To: Mark Brown <broonie@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: RE: [PATCH 0/3] regulator: userspace-consumer: Add regulator event uevents
Date: Mon, 7 Apr 2025 14:17:10 +0000	[thread overview]
Message-ID: <a18c4ad3b9f647c08d71b4550b5f1cf9@dh-electronics.com> (raw)
In-Reply-To: <b5fa7d1a-16bf-4031-8990-f559cf589b67@sirena.org.uk>

From: Mark Brown <broonie@kernel.org>
Sent: Friday, April 4, 2025 7:03 PM
>
>On Fri, Apr 04, 2025 at 03:40:06PM +0200, Johann Neuhauser wrote:
>> This series adds support for regulator event reporting via uevents to the
>> userspace-consumer regulator driver. The goal is to provide userspace with
>> a straightforward mechanism to monitor and respond to important regulator
>> events such as overcurrent conditions, voltage changes, and enable/disable
>> transitions.
>
>This sounds like you're trying to use userspace-consumer in production
>rather than as a test bodge...   what's the actual use case here?

Hi Mark,

Thank you for your feedback and question.

We have a hardware setup where the USB-A port is directly connected (D+/D-
lines) to the SoC, while its VBUS line is driven by an external I²C-based PMIC.
If a connected USB device attempts to draw more than approximately 800mA,
the PMIC detects an overcurrent condition, automatically disables the output,
and communicates an overcurrent event via the regulator framework.

Currently, the generic USB HCD drivers lack a built-in mechanism for handling
or recovering from such regulator-related events, particularly for reporting or
re-enabling regulator outputs after an OC condition occurs. The DA8xx OHCI
driver is one exception, as it indeed provides such functionality, but
integrating similar support into the generic USB HCD drivers seemed unlikely to
be accepted upstream.

I came across the userspace-consumer driver and believed it could help manage
this specific scenario. With this driver, I was able to manually toggle the
regulator off and back on, successfully clearing the error state. However, the
driver lacked proper event reporting, making it difficult to identify when the
regulator had entered an error state. Therefore, I proposed adding regulator
event reporting to enable userspace to detect these regulator events via udev
rules and subsequently restore regular USB power operation.

While I was aware that using the userspace-consumer driver might be seen as
somewhat of a workaround for special cases, I did not fully consider that it
was intended primarily as a temporary testing solution and perhaps not suitable
for this kind of production usage. I'd be grateful for any suggestions or advice you
might have on the appropriate approach or alternative solutions you could
recommend for upstream integration.

Thanks for again your input and guidance!

Best regards,
Johann


  reply	other threads:[~2025-04-07 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-04 13:40 Johann Neuhauser
2025-04-04 13:40 ` [PATCH 1/3] regulator: userspace-consumer: Add uevent reporting for regulator events Johann Neuhauser
2025-04-04 13:40 ` [PATCH 2/3] ABI: sysfs-platform: Document uevent ABI for reg-userspace-consumer Johann Neuhauser
2025-04-04 13:40 ` [PATCH 3/3] docs: regulator: userspace-consumer: Add uevent-based regulator event reporting Johann Neuhauser
2025-04-04 17:02 ` [PATCH 0/3] regulator: userspace-consumer: Add regulator event uevents Mark Brown
2025-04-07 14:17   ` Johann Neuhauser [this message]
2025-04-07 15: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=a18c4ad3b9f647c08d71b4550b5f1cf9@dh-electronics.com \
    --to=jneuhauser@dh-electronics.com \
    --cc=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=lgirdwood@gmail.com \
    --cc=linux-doc@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

all inboxes | Powered by JetHome®