18c2ecf20Sopenharmony_ciWhat: /sys/class/extcon/.../ 28c2ecf20Sopenharmony_ciDate: February 2012 38c2ecf20Sopenharmony_ciContact: MyungJoo Ham <myungjoo.ham@samsung.com> 48c2ecf20Sopenharmony_ciDescription: 58c2ecf20Sopenharmony_ci Provide a place in sysfs for the extcon objects. 68c2ecf20Sopenharmony_ci This allows accessing extcon specific variables. 78c2ecf20Sopenharmony_ci The name of extcon object denoted as ... is the name given 88c2ecf20Sopenharmony_ci with extcon_dev_register. 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci One extcon device denotes a single external connector 118c2ecf20Sopenharmony_ci port. An external connector may have multiple cables 128c2ecf20Sopenharmony_ci attached simultaneously. Many of docks, cradles, and 138c2ecf20Sopenharmony_ci accessory cables have such capability. For example, 148c2ecf20Sopenharmony_ci the 30-pin port of Nuri board (/arch/arm/mach-exynos) 158c2ecf20Sopenharmony_ci may have both HDMI and Charger attached, or analog audio, 168c2ecf20Sopenharmony_ci video, and USB cables attached simultaneously. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci If there are cables mutually exclusive with each other, 198c2ecf20Sopenharmony_ci such binary relations may be expressed with extcon_dev's 208c2ecf20Sopenharmony_ci mutually_exclusive array. 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciWhat: /sys/class/extcon/.../name 238c2ecf20Sopenharmony_ciDate: February 2012 248c2ecf20Sopenharmony_ciContact: MyungJoo Ham <myungjoo.ham@samsung.com> 258c2ecf20Sopenharmony_ciDescription: 268c2ecf20Sopenharmony_ci The /sys/class/extcon/.../name shows the name of the extcon 278c2ecf20Sopenharmony_ci object. If the extcon object has an optional callback 288c2ecf20Sopenharmony_ci "show_name" defined, the callback will provide the name with 298c2ecf20Sopenharmony_ci this sysfs node. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciWhat: /sys/class/extcon/.../state 328c2ecf20Sopenharmony_ciDate: February 2012 338c2ecf20Sopenharmony_ciContact: MyungJoo Ham <myungjoo.ham@samsung.com> 348c2ecf20Sopenharmony_ciDescription: 358c2ecf20Sopenharmony_ci The /sys/class/extcon/.../state shows and stores the cable 368c2ecf20Sopenharmony_ci attach/detach information of the corresponding extcon object. 378c2ecf20Sopenharmony_ci If the extcon object has an optional callback "show_state" 388c2ecf20Sopenharmony_ci defined, the showing function is overridden with the optional 398c2ecf20Sopenharmony_ci callback. 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci If the default callback for showing function is used, the 428c2ecf20Sopenharmony_ci format is like this:: 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci # cat state 458c2ecf20Sopenharmony_ci USB_OTG=1 468c2ecf20Sopenharmony_ci HDMI=0 478c2ecf20Sopenharmony_ci TA=1 488c2ecf20Sopenharmony_ci EAR_JACK=0 498c2ecf20Sopenharmony_ci # 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci In this example, the extcon device has USB_OTG and TA 528c2ecf20Sopenharmony_ci cables attached and HDMI and EAR_JACK cables detached. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci In order to update the state of an extcon device, enter a hex 558c2ecf20Sopenharmony_ci state number starting with 0x:: 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci # echo 0xHEX > state 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci This updates the whole state of the extcon device. 608c2ecf20Sopenharmony_ci Inputs of all the methods are required to meet the 618c2ecf20Sopenharmony_ci mutually_exclusive conditions if they exist. 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci It is recommended to use this "global" state interface if 648c2ecf20Sopenharmony_ci you need to set the value atomically. The later state 658c2ecf20Sopenharmony_ci interface associated with each cable cannot update 668c2ecf20Sopenharmony_ci multiple cable states of an extcon device simultaneously. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciWhat: /sys/class/extcon/.../cable.x/name 698c2ecf20Sopenharmony_ciDate: February 2012 708c2ecf20Sopenharmony_ciContact: MyungJoo Ham <myungjoo.ham@samsung.com> 718c2ecf20Sopenharmony_ciDescription: 728c2ecf20Sopenharmony_ci The /sys/class/extcon/.../cable.x/name shows the name of cable 738c2ecf20Sopenharmony_ci "x" (integer between 0 and 31) of an extcon device. 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ciWhat: /sys/class/extcon/.../cable.x/state 768c2ecf20Sopenharmony_ciDate: February 2012 778c2ecf20Sopenharmony_ciContact: MyungJoo Ham <myungjoo.ham@samsung.com> 788c2ecf20Sopenharmony_ciDescription: 798c2ecf20Sopenharmony_ci The /sys/class/extcon/.../cable.x/state shows and stores the 808c2ecf20Sopenharmony_ci state of cable "x" (integer between 0 and 31) of an extcon 818c2ecf20Sopenharmony_ci device. The state value is either 0 (detached) or 1 828c2ecf20Sopenharmony_ci (attached). 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ciWhat: /sys/class/extcon/.../mutually_exclusive/... 858c2ecf20Sopenharmony_ciDate: December 2011 868c2ecf20Sopenharmony_ciContact: MyungJoo Ham <myungjoo.ham@samsung.com> 878c2ecf20Sopenharmony_ciDescription: 888c2ecf20Sopenharmony_ci Shows the relations of mutually exclusiveness. For example, 898c2ecf20Sopenharmony_ci if the mutually_exclusive array of extcon device is 908c2ecf20Sopenharmony_ci {0x3, 0x5, 0xC, 0x0}, then the output is:: 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci # ls mutually_exclusive/ 938c2ecf20Sopenharmony_ci 0x3 948c2ecf20Sopenharmony_ci 0x5 958c2ecf20Sopenharmony_ci 0xc 968c2ecf20Sopenharmony_ci # 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci Note that mutually_exclusive is a sub-directory of the extcon 998c2ecf20Sopenharmony_ci device and the file names under the mutually_exclusive 1008c2ecf20Sopenharmony_ci directory show the mutually-exclusive sets, not the contents 1018c2ecf20Sopenharmony_ci of the files. 102