Re: [RFC PATCH 0/3] introduce: Multistate Switch Class

From: Linus Walleij
Date: Mon Nov 28 2011 - 08:04:09 EST


On Mon, Nov 28, 2011 at 8:27 AM, Greg KH <gregkh@xxxxxxx> wrote:
> On Mon, Nov 28, 2011 at 12:31:14PM +1100, NeilBrown wrote:
>>
>>  My own thought is that this deserves a new device class which allows easy
>>  hook-up of in-kernel signalling using notifications and which can be
>>  exported as input devices in much the same way the 'gpio' devices can be
>>  exported via gpio_keys.  The switch could also optionally be exported through
>>  sysfs much like gpio can be exported through sysfs.
>
> That might also work, but again, odds are the HID spec already defines
> this type of "switch", so why recreate it as a different type of device?

I think both yes and no, but I will stand corrected.

When you plug it into a host, I guess your device will
negotiate power withdrawal from the host as anything else,
no matter what device or interface classes it presents.

However in the other case I am under the impression that
devices supporting EPS
http://en.wikipedia.org/wiki/Common_External_Power_Supply
Or the "battery charging specification"
http://www.usb.org/developers/devclass_docs/batt_charging_1_1.zip
do so in their Phy transceiver drivers, say e.g.
drivers/usb/otg/ab8500-usb.c in our case. This is sometime
called a "chinese charger" or "dedicated charger". It's just
appearing on the micro-USB port, it doesn't enumerate and
the OS driver does not talk to it. I think it notifies the transceiver
by short-circuiting D+ and D- and the transceiver/phy
driver may in many cases notify charging circuitry and
userspace that it's been plugged in (switch uevent,
cable insertion input event or whatever we come up with).

So no, I don't think HID defines this, it's defined in a
physical layer spec, and the interfaces to OS:es are
transciever/phy-custom.

I've CC:ed Morten who was part of writing the charging
spec so he can correct me if I'm saying the wrong thing.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/