xref: /OK3568_Linux_fs/kernel/Documentation/ABI/testing/sysfs-class-extcon (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunWhat:		/sys/class/extcon/.../
2*4882a593SmuzhiyunDate:		February 2012
3*4882a593SmuzhiyunContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
4*4882a593SmuzhiyunDescription:
5*4882a593Smuzhiyun		Provide a place in sysfs for the extcon objects.
6*4882a593Smuzhiyun		This allows accessing extcon specific variables.
7*4882a593Smuzhiyun		The name of extcon object denoted as ... is the name given
8*4882a593Smuzhiyun		with extcon_dev_register.
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun		One extcon device denotes a single external connector
11*4882a593Smuzhiyun		port. An external connector may have multiple cables
12*4882a593Smuzhiyun		attached simultaneously. Many of docks, cradles, and
13*4882a593Smuzhiyun		accessory cables have such capability. For example,
14*4882a593Smuzhiyun		the 30-pin port of Nuri board (/arch/arm/mach-exynos)
15*4882a593Smuzhiyun		may have both HDMI and Charger attached, or analog audio,
16*4882a593Smuzhiyun		video, and USB cables attached simultaneously.
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun		If there are cables mutually exclusive with each other,
19*4882a593Smuzhiyun		such binary relations may be expressed with extcon_dev's
20*4882a593Smuzhiyun		mutually_exclusive array.
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunWhat:		/sys/class/extcon/.../name
23*4882a593SmuzhiyunDate:		February 2012
24*4882a593SmuzhiyunContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
25*4882a593SmuzhiyunDescription:
26*4882a593Smuzhiyun		The /sys/class/extcon/.../name shows the name of the extcon
27*4882a593Smuzhiyun		object. If the extcon object has an optional callback
28*4882a593Smuzhiyun		"show_name" defined, the callback will provide the name with
29*4882a593Smuzhiyun		this sysfs node.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunWhat:		/sys/class/extcon/.../state
32*4882a593SmuzhiyunDate:		February 2012
33*4882a593SmuzhiyunContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
34*4882a593SmuzhiyunDescription:
35*4882a593Smuzhiyun		The /sys/class/extcon/.../state shows and stores the cable
36*4882a593Smuzhiyun		attach/detach information of the corresponding extcon object.
37*4882a593Smuzhiyun		If the extcon object has an optional callback "show_state"
38*4882a593Smuzhiyun		defined, the showing function is overridden with the optional
39*4882a593Smuzhiyun		callback.
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun		If the default callback for showing function is used, the
42*4882a593Smuzhiyun		format is like this::
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun		    # cat state
45*4882a593Smuzhiyun		    USB_OTG=1
46*4882a593Smuzhiyun		    HDMI=0
47*4882a593Smuzhiyun		    TA=1
48*4882a593Smuzhiyun		    EAR_JACK=0
49*4882a593Smuzhiyun		    #
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun		In this example, the extcon device has USB_OTG and TA
52*4882a593Smuzhiyun		cables attached and HDMI and EAR_JACK cables detached.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun		In order to update the state of an extcon device, enter a hex
55*4882a593Smuzhiyun		state number starting with 0x::
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun		    # echo 0xHEX > state
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun		This updates the whole state of the extcon device.
60*4882a593Smuzhiyun		Inputs of all the methods are required to meet the
61*4882a593Smuzhiyun		mutually_exclusive conditions if they exist.
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun		It is recommended to use this "global" state interface if
64*4882a593Smuzhiyun		you need to set the value atomically. The later state
65*4882a593Smuzhiyun		interface associated with each cable cannot update
66*4882a593Smuzhiyun		multiple cable states of an extcon device simultaneously.
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunWhat:		/sys/class/extcon/.../cable.x/name
69*4882a593SmuzhiyunDate:		February 2012
70*4882a593SmuzhiyunContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
71*4882a593SmuzhiyunDescription:
72*4882a593Smuzhiyun		The /sys/class/extcon/.../cable.x/name shows the name of cable
73*4882a593Smuzhiyun		"x" (integer between 0 and 31) of an extcon device.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunWhat:		/sys/class/extcon/.../cable.x/state
76*4882a593SmuzhiyunDate:		February 2012
77*4882a593SmuzhiyunContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
78*4882a593SmuzhiyunDescription:
79*4882a593Smuzhiyun		The /sys/class/extcon/.../cable.x/state shows and stores the
80*4882a593Smuzhiyun		state of cable "x" (integer between 0 and 31) of an extcon
81*4882a593Smuzhiyun		device. The state value is either 0 (detached) or 1
82*4882a593Smuzhiyun		(attached).
83*4882a593Smuzhiyun
84*4882a593SmuzhiyunWhat:		/sys/class/extcon/.../mutually_exclusive/...
85*4882a593SmuzhiyunDate:		December 2011
86*4882a593SmuzhiyunContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
87*4882a593SmuzhiyunDescription:
88*4882a593Smuzhiyun		Shows the relations of mutually exclusiveness. For example,
89*4882a593Smuzhiyun		if the mutually_exclusive array of extcon device is
90*4882a593Smuzhiyun		{0x3, 0x5, 0xC, 0x0}, then the output is::
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun		    # ls mutually_exclusive/
93*4882a593Smuzhiyun		    0x3
94*4882a593Smuzhiyun		    0x5
95*4882a593Smuzhiyun		    0xc
96*4882a593Smuzhiyun		    #
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun		Note that mutually_exclusive is a sub-directory of the extcon
99*4882a593Smuzhiyun		device and the file names under the mutually_exclusive
100*4882a593Smuzhiyun		directory show the mutually-exclusive sets, not the contents
101*4882a593Smuzhiyun		of the files.
102