xref: /linux/Documentation/ABI/testing/sysfs-class-extcon (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1de55d871SMyungJoo HamWhat:		/sys/class/extcon/.../
2806d9dd7SMyungJoo HamDate:		February 2012
3de55d871SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
4de55d871SMyungJoo HamDescription:
5de55d871SMyungJoo Ham		Provide a place in sysfs for the extcon objects.
6de55d871SMyungJoo Ham		This allows accessing extcon specific variables.
7de55d871SMyungJoo Ham		The name of extcon object denoted as ... is the name given
8de55d871SMyungJoo Ham		with extcon_dev_register.
9de55d871SMyungJoo Ham
10806d9dd7SMyungJoo Ham		One extcon device denotes a single external connector
11806d9dd7SMyungJoo Ham		port. An external connector may have multiple cables
12806d9dd7SMyungJoo Ham		attached simultaneously. Many of docks, cradles, and
13806d9dd7SMyungJoo Ham		accessory cables have such capability. For example,
14806d9dd7SMyungJoo Ham		the 30-pin port of Nuri board (/arch/arm/mach-exynos)
15806d9dd7SMyungJoo Ham		may have both HDMI and Charger attached, or analog audio,
16f28d5a01SPeter Meerwald		video, and USB cables attached simultaneously.
17806d9dd7SMyungJoo Ham
18bde68e60SMyungJoo Ham		If there are cables mutually exclusive with each other,
19bde68e60SMyungJoo Ham		such binary relations may be expressed with extcon_dev's
20bde68e60SMyungJoo Ham		mutually_exclusive array.
21bde68e60SMyungJoo Ham
22de55d871SMyungJoo HamWhat:		/sys/class/extcon/.../name
23806d9dd7SMyungJoo HamDate:		February 2012
24de55d871SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
25de55d871SMyungJoo HamDescription:
26de55d871SMyungJoo Ham		The /sys/class/extcon/.../name shows the name of the extcon
27de55d871SMyungJoo Ham		object. If the extcon object has an optional callback
28de55d871SMyungJoo Ham		"show_name" defined, the callback will provide the name with
29de55d871SMyungJoo Ham		this sysfs node.
30de55d871SMyungJoo Ham
31de55d871SMyungJoo HamWhat:		/sys/class/extcon/.../state
32806d9dd7SMyungJoo HamDate:		February 2012
33de55d871SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
34de55d871SMyungJoo HamDescription:
35806d9dd7SMyungJoo Ham		The /sys/class/extcon/.../state shows and stores the cable
36806d9dd7SMyungJoo Ham		attach/detach information of the corresponding extcon object.
37806d9dd7SMyungJoo Ham		If the extcon object has an optional callback "show_state"
38f28d5a01SPeter Meerwald		defined, the showing function is overridden with the optional
39806d9dd7SMyungJoo Ham		callback.
40806d9dd7SMyungJoo Ham
41806d9dd7SMyungJoo Ham		If the default callback for showing function is used, the
4254a19b4dSMauro Carvalho Chehab		format is like this::
4354a19b4dSMauro Carvalho Chehab
44806d9dd7SMyungJoo Ham		    # cat state
45806d9dd7SMyungJoo Ham		    USB_OTG=1
46806d9dd7SMyungJoo Ham		    HDMI=0
47806d9dd7SMyungJoo Ham		    TA=1
48806d9dd7SMyungJoo Ham		    EAR_JACK=0
49806d9dd7SMyungJoo Ham		    #
5054a19b4dSMauro Carvalho Chehab
51f28d5a01SPeter Meerwald		In this example, the extcon device has USB_OTG and TA
52806d9dd7SMyungJoo Ham		cables attached and HDMI and EAR_JACK cables detached.
53806d9dd7SMyungJoo Ham
54806d9dd7SMyungJoo Ham		In order to update the state of an extcon device, enter a hex
5554a19b4dSMauro Carvalho Chehab		state number starting with 0x::
5654a19b4dSMauro Carvalho Chehab
57f28d5a01SPeter Meerwald		    # echo 0xHEX > state
58806d9dd7SMyungJoo Ham
59f28d5a01SPeter Meerwald		This updates the whole state of the extcon device.
60806d9dd7SMyungJoo Ham		Inputs of all the methods are required to meet the
61f28d5a01SPeter Meerwald		mutually_exclusive conditions if they exist.
62806d9dd7SMyungJoo Ham
63806d9dd7SMyungJoo Ham		It is recommended to use this "global" state interface if
64f28d5a01SPeter Meerwald		you need to set the value atomically. The later state
65806d9dd7SMyungJoo Ham		interface associated with each cable cannot update
66806d9dd7SMyungJoo Ham		multiple cable states of an extcon device simultaneously.
67806d9dd7SMyungJoo Ham
68*4aa5216cSMauro Carvalho ChehabWhat:		/sys/class/extcon/.../cable.X/name
69806d9dd7SMyungJoo HamDate:		February 2012
70806d9dd7SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
71806d9dd7SMyungJoo HamDescription:
72*4aa5216cSMauro Carvalho Chehab		The /sys/class/extcon/.../cable.X/name shows the name of cable
73*4aa5216cSMauro Carvalho Chehab		"X" (integer between 0 and 31) of an extcon device.
74806d9dd7SMyungJoo Ham
75*4aa5216cSMauro Carvalho ChehabWhat:		/sys/class/extcon/.../cable.X/state
76806d9dd7SMyungJoo HamDate:		February 2012
77806d9dd7SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
78806d9dd7SMyungJoo HamDescription:
79*4aa5216cSMauro Carvalho Chehab		The /sys/class/extcon/.../cable.X/state shows and stores the
80*4aa5216cSMauro Carvalho Chehab		state of cable "X" (integer between 0 and 31) of an extcon
81806d9dd7SMyungJoo Ham		device. The state value is either 0 (detached) or 1
82806d9dd7SMyungJoo Ham		(attached).
83bde68e60SMyungJoo Ham
84bde68e60SMyungJoo HamWhat:		/sys/class/extcon/.../mutually_exclusive/...
85bde68e60SMyungJoo HamDate:		December 2011
86bde68e60SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
87bde68e60SMyungJoo HamDescription:
88bde68e60SMyungJoo Ham		Shows the relations of mutually exclusiveness. For example,
89f28d5a01SPeter Meerwald		if the mutually_exclusive array of extcon device is
9054a19b4dSMauro Carvalho Chehab		{0x3, 0x5, 0xC, 0x0}, then the output is::
9154a19b4dSMauro Carvalho Chehab
92bde68e60SMyungJoo Ham		    # ls mutually_exclusive/
93bde68e60SMyungJoo Ham		    0x3
94bde68e60SMyungJoo Ham		    0x5
95bde68e60SMyungJoo Ham		    0xc
96bde68e60SMyungJoo Ham		    #
97bde68e60SMyungJoo Ham
98bde68e60SMyungJoo Ham		Note that mutually_exclusive is a sub-directory of the extcon
99bde68e60SMyungJoo Ham		device and the file names under the mutually_exclusive
100bde68e60SMyungJoo Ham		directory show the mutually-exclusive sets, not the contents
101bde68e60SMyungJoo Ham		of the files.
102