Re: [PATCH/RFT 07/12] USB: ohci-da8xx: Request gpios and handle interrupt in the driver

From: David Lechner
Date: Wed Oct 12 2016 - 20:49:06 EST


On 10/12/2016 10:01 AM, Axel Haslam wrote:
I agree that we should use a regulator for the vbus power.
i will make that change. However, im not so sure about using the
regulator for the overcurrent handling. There seems to be no other
driver doing this, and as you mention, we would need to change the regulator
framework, which might not be justifiable. I think there is not another way
to handle the over current notification other than powering the port off.

The regulator framework has REGULATOR_EVENT_OVER_CURRENT already. Perhaps this could be of some use? For example you could extend the existing gpio-regulator driver with an optional overcurrent gpio pin.



how about using regulator for vbus, but keeping gpio for overcurrent
notifications?

See the suggestion above about extending the gpio-regulator driver.


For the usersapce handling you describe above, maybe we should be able to
listen for an usb overcurrent uevent in userspace? it seems this
question was asked
a couple of years back[1], but im not sure what the conclusion was. In any case,
we could have DT and non-DT based ohci-da8xx working,
And could work on a uevent notification for the scenario you describe
above which
i think is not specific to the ohci-da8xx.

[1]http://linux-usb.vger.kernel.narkive.com/SjcUB5hk/how-best-to-get-over-current-notification-to-user-application

Thanks for the link. Too bad it seems nothing ever became of this. I guess it will be up to me to bring up the discussion again if I really want it.