Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de55d871 authored by MyungJoo Ham's avatar MyungJoo Ham Committed by Greg Kroah-Hartman
Browse files

Extcon (external connector): import Android's switch class and modify.



External connector class (extcon) is based on and an extension of
Android kernel's switch class located at linux/drivers/switch/.

This patch provides the before-extension switch class moved to the
location where the extcon will be located (linux/drivers/extcon/) and
updates to handle class properly.

The before-extension class, switch class of Android kernel, commits
imported are:

switch: switch class and GPIO drivers. (splitted)
Author: Mike Lockwood <lockwood@android.com>

switch: Use device_create instead of device_create_drvdata.
Author: Arve Hjønnevåg <arve@android.com>

In this patch, upon the commits of Android kernel, we have added:
- Relocated and renamed for extcon.
- Comments, module name, and author information are updated
- Code clean for successing patches
- Bugfix: enabling write access without write functions
- Class/device/sysfs create/remove handling
- Added comments about uevents
- Format changes for extcon_dev_register() to have a parent dev.

Signed-off-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>

--
Changes from v7
- Compiler error fixed when it is compiled as a module.
- Removed out-of-date Kconfig entry

Changes from v6
- Updated comment/strings
- Revised "Android-compatible" mode.
   * Automatically activated if CONFIG_ANDROID && !CONFIG_ANDROID_SWITCH
   * Creates /sys/class/switch/*, which is a copy of /sys/class/extcon/*

Changes from v5
- Split the patch
- Style fixes
- "Android-compatible" mode is enabled by Kconfig option.

Changes from v2
- Updated name_show
- Sysfs entries are handled by class itself.
- Updated the method to add/remove devices for the class
- Comments on uevent send
- Able to become a module
- Compatible with Android platform

Changes from RFC
- Renamed to extcon (external connector) from multistate switch
- Added a seperated directory (drivers/extcon)
- Added kerneldoc comments
- Removed unused variables from extcon_gpio.c
- Added ABI Documentation.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7cd9c9bb
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
What:		/sys/class/extcon/.../
Date:		December 2011
Contact:	MyungJoo Ham <myungjoo.ham@samsung.com>
Description:
		Provide a place in sysfs for the extcon objects.
		This allows accessing extcon specific variables.
		The name of extcon object denoted as ... is the name given
		with extcon_dev_register.

What:		/sys/class/extcon/.../name
Date:		December 2011
Contact:	MyungJoo Ham <myungjoo.ham@samsung.com>
Description:
		The /sys/class/extcon/.../name shows the name of the extcon
		object. If the extcon object has an optional callback
		"show_name" defined, the callback will provide the name with
		this sysfs node.

What:		/sys/class/extcon/.../state
Date:		December 2011
Contact:	MyungJoo Ham <myungjoo.ham@samsung.com>
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.
+2 −0
Original line number Diff line number Diff line
@@ -140,4 +140,6 @@ source "drivers/virt/Kconfig"

source "drivers/devfreq/Kconfig"

source "drivers/extcon/Kconfig"

endmenu
+1 −0
Original line number Diff line number Diff line
@@ -134,3 +134,4 @@ obj-$(CONFIG_VIRT_DRIVERS) += virt/
obj-$(CONFIG_HYPERV)		+= hv/

obj-$(CONFIG_PM_DEVFREQ)	+= devfreq/
obj-$(CONFIG_EXTCON)		+= extcon/

drivers/extcon/Kconfig

0 → 100644
+17 −0
Original line number Diff line number Diff line
menuconfig EXTCON
	tristate "External Connector Class (extcon) support"
	help
	  Say Y here to enable external connector class (extcon) support.
	  This allows monitoring external connectors by userspace
	  via sysfs and uevent and supports external connectors with
	  multiple states; i.e., an extcon that may have multiple
	  cables attached. For example, an external connector of a device
	  may be used to connect an HDMI cable and a AC adaptor, and to
	  host USB ports. Many of 30-pin connectors including PDMI are
	  also good examples.

if EXTCON

comment "Extcon Device Drivers"

endif # MULTISTATE_SWITCH
+5 −0
Original line number Diff line number Diff line
#
# Makefile for external connector class (extcon) devices
#

obj-$(CONFIG_EXTCON)		+= extcon_class.o
Loading