xref: /linux/Documentation/ABI/testing/sysfs-class-extcon (revision f28d5a01562d38332987069178305e88b03d64f6)
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,
16*f28d5a01SPeter 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"
38*f28d5a01SPeter 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
42806d9dd7SMyungJoo Ham		format is like this:
43806d9dd7SMyungJoo Ham		# cat state
44806d9dd7SMyungJoo Ham		USB_OTG=1
45806d9dd7SMyungJoo Ham		HDMI=0
46806d9dd7SMyungJoo Ham		TA=1
47806d9dd7SMyungJoo Ham		EAR_JACK=0
48806d9dd7SMyungJoo Ham		#
49*f28d5a01SPeter Meerwald		In this example, the extcon device has USB_OTG and TA
50806d9dd7SMyungJoo Ham		cables attached and HDMI and EAR_JACK cables detached.
51806d9dd7SMyungJoo Ham
52806d9dd7SMyungJoo Ham		In order to update the state of an extcon device, enter a hex
53*f28d5a01SPeter Meerwald		state number starting with 0x:
54*f28d5a01SPeter Meerwald		# echo 0xHEX > state
55806d9dd7SMyungJoo Ham
56*f28d5a01SPeter Meerwald		This updates the whole state of the extcon device.
57806d9dd7SMyungJoo Ham		Inputs of all the methods are required to meet the
58*f28d5a01SPeter Meerwald		mutually_exclusive conditions if they exist.
59806d9dd7SMyungJoo Ham
60806d9dd7SMyungJoo Ham		It is recommended to use this "global" state interface if
61*f28d5a01SPeter Meerwald		you need to set the value atomically. The later state
62806d9dd7SMyungJoo Ham		interface associated with each cable cannot update
63806d9dd7SMyungJoo Ham		multiple cable states of an extcon device simultaneously.
64806d9dd7SMyungJoo Ham
65806d9dd7SMyungJoo HamWhat:		/sys/class/extcon/.../cable.x/name
66806d9dd7SMyungJoo HamDate:		February 2012
67806d9dd7SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
68806d9dd7SMyungJoo HamDescription:
69806d9dd7SMyungJoo Ham		The /sys/class/extcon/.../cable.x/name shows the name of cable
70806d9dd7SMyungJoo Ham		"x" (integer between 0 and 31) of an extcon device.
71806d9dd7SMyungJoo Ham
72806d9dd7SMyungJoo HamWhat:		/sys/class/extcon/.../cable.x/state
73806d9dd7SMyungJoo HamDate:		February 2012
74806d9dd7SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
75806d9dd7SMyungJoo HamDescription:
76*f28d5a01SPeter Meerwald		The /sys/class/extcon/.../cable.x/state shows and stores the
77806d9dd7SMyungJoo Ham		state of cable "x" (integer between 0 and 31) of an extcon
78806d9dd7SMyungJoo Ham		device. The state value is either 0 (detached) or 1
79806d9dd7SMyungJoo Ham		(attached).
80bde68e60SMyungJoo Ham
81bde68e60SMyungJoo HamWhat:		/sys/class/extcon/.../mutually_exclusive/...
82bde68e60SMyungJoo HamDate:		December 2011
83bde68e60SMyungJoo HamContact:	MyungJoo Ham <myungjoo.ham@samsung.com>
84bde68e60SMyungJoo HamDescription:
85bde68e60SMyungJoo Ham		Shows the relations of mutually exclusiveness. For example,
86*f28d5a01SPeter Meerwald		if the mutually_exclusive array of extcon device is
87*f28d5a01SPeter Meerwald		{0x3, 0x5, 0xC, 0x0}, then the output is:
88bde68e60SMyungJoo Ham		# ls mutually_exclusive/
89bde68e60SMyungJoo Ham		0x3
90bde68e60SMyungJoo Ham		0x5
91bde68e60SMyungJoo Ham		0xc
92bde68e60SMyungJoo Ham		#
93bde68e60SMyungJoo Ham
94bde68e60SMyungJoo Ham		Note that mutually_exclusive is a sub-directory of the extcon
95bde68e60SMyungJoo Ham		device and the file names under the mutually_exclusive
96bde68e60SMyungJoo Ham		directory show the mutually-exclusive sets, not the contents
97bde68e60SMyungJoo Ham		of the files.
98