Re: [PATCH v5 3/5] Extcon: support multiple states at a device.

From: Arnd Bergmann
Date: Wed Feb 22 2012 - 05:07:17 EST


On Friday 10 February 2012, MyungJoo Ham wrote:
> Date: December 2011
> Contact: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>
> Description:
> - The /sys/class/extcon/.../state shows the cable attach/detach
> - information of the corresponding extcon object. If the extcon
> - objecct has an optional callback "show_state" defined, the
> - callback will provide the name with this sysfs node.
> + The /sys/class/extcon/.../state shows and stores the cable
> + attach/detach information of the corresponding extcon object.
> + If the extcon objecct has an optional callback "show_state"
> + defined, the showing function is overriden with the optional
> + callback.
> +
> + If the default callback for showing function is used, the
> + format is like this:
> + # cat state
> + USB_OTG=1
> + HDMI=0
> + TA=1
> + EAR_JACK=0
> + #
> + In this example, the extcon device have USB_OTG and TA
> + cables attached and HDMI and EAR_JACK cables detached.
> +
> + There are two methods to update state of extcon.
> + Method 1.
> + echo CABLE_NAME [0|1] > state
> + Method 2.
> + echo 0xHEX > state
> +
> + Method 1 updates the state (0 or 1) of the
> + corresponding cable (either the name or index of the cable).
> + Method 2 updates the whole state of the extcon dev.

I think having two ways to do the same thing is rather confusing, it would
be nice to provide only one way and make sure that it works for everyone.

Maybe the entire thing can be turned around into one attribute group
per cable and unified with the mutually-exclusive part, like

extcon/.../usb-otg/state # 0 or 1 for disable or enable
/mutually-exclusive # list of exclusive ports
/hdmi/...
/ta/...

Arnd
--
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/