History log of /linux-master/include/linux/extcon.h
Revision Date Author Comments
# 52e4e287 20-Jul-2023 YueHaibing <yuehaibing@huawei.com>

extcon: Remove unused inline functions

commit 830ae442202e ("extcon: Remove the deprecated extcon functions")
left behind this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 3a06ed80 08-Jul-2022 Michael Wu <michael@allwinnertech.com>

extcon: Add EXTCON_DISP_CVBS and EXTCON_DISP_EDP

Add EXTCON_DISP_CVBS for Composite Video Broadcast Signal.
Add EXTCON_DISP_EDP for Embedded Display Port

[1] https://en.wikipedia.org/wiki/Composite_video
[2] https://en.wikipedia.org/wiki/DisplayPort#eDP

Signed-off-by: Michael Wu <michael@allwinnertech.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 58e4a2d2 16-Dec-2021 Dan Carpenter <dan.carpenter@oracle.com>

extcon: Fix extcon_get_extcon_dev() error handling

The extcon_get_extcon_dev() function returns error pointers on error,
NULL when it's a -EPROBE_DEFER defer situation, and ERR_PTR(-ENODEV)
when the CONFIG_EXTCON option is disabled. This is very complicated for
the callers to handle and a number of them had bugs that would lead to
an Oops.

In real life, there are two things which prevented crashes. First,
error pointers would only be returned if there was bug in the caller
where they passed a NULL "extcon_name" and none of them do that.
Second, only two out of the eight drivers will build when CONFIG_EXTCON
is disabled.

The normal way to write this would be to return -EPROBE_DEFER directly
when appropriate and return NULL when CONFIG_EXTCON is disabled. Then
the error handling is simple and just looks like:

dev->edev = extcon_get_extcon_dev(acpi_dev_name(adev));
if (IS_ERR(dev->edev))
return PTR_ERR(dev->edev);

For the two drivers which can build with CONFIG_EXTCON disabled, then
extcon_get_extcon_dev() will now return NULL which is not treated as an
error and the probe will continue successfully. Those two drivers are
"typec_fusb302" and "max8997-battery". In the original code, the
typec_fusb302 driver had an 800ms hang in tcpm_get_current_limit() but
now that function is a no-op. For the max8997-battery driver everything
should continue working as is.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# c9570d4a 31-Dec-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: Add stubs for extcon_register_notifier_all() functions

Add stubs for extcon_register_notifier_all() function for !CONFIG_EXTCON
case. This is useful for compile testing and for drivers which use
EXTCON but do not require it (therefore do not depend on CONFIG_EXTCON).

Fixes: 815429b39d94 ("extcon: Add new extcon_register_notifier_all() to monitor all external connectors")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 995bb109 16-Mar-2020 Mayank Rana <mrana@codeaurora.org>

extcon: Mark extcon_get_edev_name() function as exported symbol

extcon_get_edev_name() function provides client driver to request
extcon dev's name. If extcon driver and client driver are compiled
as loadable modules, extcon_get_edev_name() function symbol is not
visible to client driver. Hence mark extcon_find_edev_name() function
as exported symbol.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# b7365587 12-Jan-2020 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove unneeded extern keyword from extcon.h

'extern' keyword is unneeded in extcon.h because public header file
of extcon defines the function prototype.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 9c92ab61 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282

Based on 1 normalized pattern(s):

this software is licensed under the terms of the gnu general public
license version 2 as published by the free software foundation and
may be copied distributed and modified under those terms this
program is distributed in the hope that it will be useful but
without any warranty without even the implied warranty of
merchantability or fitness for a particular purpose see the gnu
general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 285 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 370ed7a9 27-Feb-2018 Andrzej Hajda <a.hajda@samsung.com>

extcon: add possibility to get extcon device by OF node

Since extcon property is not allowed in DT, extcon subsystem requires
another way to get extcon device. Lets try the simplest approach - get
edev by of_node.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 176aa360 20-Sep-2017 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Split out extcon header file for consumer and provider device

The extcon has two type of extcon devices as following.
- 'extcon provider deivce' adds new extcon device and detect the
state/properties of external connector. Also, it notifies the
state/properties to the extcon consumer device.
- 'extcon consumer device' gets the change state/properties
from extcon provider device.
Prior to that, include/linux/extcon.h contains all exported API for
both provider and consumer device driver. To clarify the meaning of
header file and to remove the wrong use-case on consumer device,
this patch separates into extcon.h and extcon-provider.h.

[Description for include/linux/{extcon.h|extcon-provider.h}]
- extcon.h includes the extcon API and data structure for extcon consumer
device driver. This header file contains the following APIs:
: Register/unregister the notifier to catch the change of extcon device
: Get the extcon device instance
: Get the extcon device name
: Get the state of each external connector
: Get the property value of each external connector
: Get the property capability of each external connector

- extcon-provider.h includes the extcon API and data structure for extcon
provider device driver. This header file contains the following APIs:
: Include 'include/linux/extcon.h'
: Allocate the memory for extcon device instance
: Register/unregister extcon device
: Set the state of each external connector
: Set the property value of each external connector
: Set the property capability of each external connector

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>


# ab8a8fbe 13-Jul-2017 Chanwoo Choi <cwchoi00@gmail.com>

extcon: Use tab instead of space for indentation

The extcon header file defines the functions which used the mismatched
indentation and used the space on some case. So, this patch clean-up
the indentation in order to improve the readbility.

And this patch changes the return value of extcon_get_extcon_dev()
because of maintaing the same value with extcon_get_edev_by_phandle().

Signed-off-by: Chanwoo Choi <cwchoi00@gmail.com>


# 6ab6094f 03-Apr-2017 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Correct description to improve the readability

The extcon files explains the detailed operation for functions and
what is meaning of extcon structure. There are different explanation
even if the same argument.

So, it modifies the description for both functions and structures
in order to improve the readability and guide the role of functions
more well.

Also, this patch fixes the mismatching license info as a GPL v2
and removes the inactive author information.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 808ae8f3 22-Mar-2017 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove deprecated extcon_set/get_cable_state_()

The commit 575c2b867ee0 ("extcon: Rename the extcon_set/get_state()
to maintain the function naming pattern") renames the extcon function as
following: But, the extcon just keeps the old API to prevent the build error.
This patch removes the deprecatd extcon API.

- extcon_get_cable_state_() -> extcon_get_state()
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 815429b3 29-Mar-2017 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add new extcon_register_notifier_all() to monitor all external connectors

The extcon core already provides the extcon_register_notifier() function
in order to register the notifier block which is used to monitor
the state change for the specific external connector such as EXTCON_USB,
EXTCON_USB_HOST and so on. The extcon consumer uses the this function.

The extcon consumer might need to monitor the all supported external
connectors from the extcon device. In this case, The extcon consumer
should have each notifier_block structure for each external connector.

This patch adds the new extcon_register_notifier_all() function
that extcon consumer is able to monitor the state change of all
supported external connectors by using only one notifier_block structure.

- List of new added functions:
int extcon_register_notifier_all(struct extcon_dev *edev,
struct notifier_block *nb);
int extcon_unregister_notifier_all(struct extcon_dev *edev,
struct notifier_block *nb);
int devm_extcon_register_notifier_all(struct device *dev,
struct extcon_dev *edev, struct notifier_block *nb);
void devm_extcon_unregister_notifier_all(struct device *dev,
struct extcon_dev *edev, struct notifier_block *nb);

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>


# 3c5f0e07 01-Jan-2017 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add new EXTCON_CHG_USB_PD type for USB Power Delivery

This patch adds the new EXTCON_CHG_USB_PD for USB PD (Power Delivery)[1].
The USB Power Delivery specification specifies that USB cable provides
the increased power more than 7.5W to device with larger power demand.
The EXTCON_CHG_USB_PD has the EXTCON_TYPE_CHG and EXTCON_TYPE_USB type.

[1] https://en.wikipedia.org/wiki/USB#PD

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 62a37443 02-Jan-2017 Baolin Wang <baolin.wang@linaro.org>

extcon: Add documentation for EXTCON_CHG_USB_SLOW/FAST

Currently there are no documentation for EXTCON_CHG_USB_SLOW/FAST
charger connector. These names don't mean much and no guide to tell
users how to use it, thus try to add documentation to make them clear.

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
[cw00.choi: Use the 'connector' expression instead of 'cable']
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# e6cf0465 26-Dec-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Move defintion of struct extcon_dev to driver/extcon directory

This patch moves the 'struct extcon_dev' of extcon subsystem
to driver/extcon/extcon.h header file because the struct extcon_dev have to
be handled by extcon API to guarantee the consistency of strcut extcon_dev.
If external drivers are able to touch the struct extcon_dev directly, it might
cause the critical and unknown problem.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# db622861 20-Dec-2016 Baolin Wang <baolin.wang@linaro.org>

extcon: Add documentation for EXTCON_CHG_USB_* and EXTCON_USB_*

Current there is both "EXTCON_USB" and "EXTCON_CHG_USB_SDP" which
both seem to suggest a standard downstream port. But there is no
documentation describing how these relate.

Thus add documentation to describe EXTCON_CHG_USB_SDP should always
appear together with EXTCON_USB, and EXTCON_CHG_USB_ACA would normally
appear with EXTCON_USB_HOST.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# eeb7df27 15-Sep-2016 Kishon Vijay Abraham I <kishon@ti.com>

include: extcon: Fix compilation error caused because of incomplete merge

Fix the following compilation error caused due to incomplete merge. This is
observed if CONFIG_EXTCON is not set.

In file included from ./include/linux/mfd/palmas.h:23:0,
from drivers/input/misc/palmas-pwrbutton.c:22:
./include/linux/extcon.h: In function ‘extcon_sync’:
./include/linux/extcon.h:361:1: error: expected declaration specifiers before ‘<<’ token
./include/linux/extcon.h:370:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
./include/linux/extcon.h:376:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘>>’ token
./include/linux/extcon.h:381:1: error: expected declaration specifiers before ‘<<’ token
./include/linux/extcon.h:390:1: error: expected declaration specifiers or ‘...’ before ‘==’ token
./include/linux/extcon.h:476:11: warning: ‘struct extcon_specific_cable_nb’ declared inside parameter list [enabled by default]
./include/linux/extcon.h:476:11: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
./include/linux/extcon.h:474:19: error: storage class specified for parameter ‘extcon_register_interest’
./include/linux/extcon.h:474:19: warning: parameter ‘extcon_register_interest’ declared ‘inline’ [enabled by default]
./include/linux/extcon.h:477:1: warning: ‘always_inline’ attribute ignored [-Wattributes]
./include/linux/extcon.h:474:19: error: ‘no_instrument_function’ attribute applies only to functions
./include/linux/extcon.h:477:1: error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c7914e8d 09-Sep-2016 Chris Zhong <zyw@rock-chips.com>

extcon: Introduce EXTCON_PROP_DISP_HPD property

EXTCON_PROP_DISP_HPD is need by display port, if the system has no hpd
interrupt, this property can be used.
- HPD (Hot Plug Detect) send the signal whether display device is on or off
to source device.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
[cw00.choi: Add the description of HPD and full name of HPD]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 8df0cfe6 15-Aug-2016 Guenter Roeck <groeck@chromium.org>

extcon: Introduce EXTCON_PROP_USB_SS property for SuperSpeed mode

EXTCON_PROP_USB_SS (SuperSpeed)[1] is necessary to distinguish
between USB/USB2 and USB3 connections on USB Type-C cables.

[1] https://en.wikipedia.org/wiki/USB#Overview

Cc: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# af9b9285 05-Aug-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add new EXTCON_CHG_WPT for Wireless Power Transfer device

This patchs add the new EXTCON_CHG_WPT for Wireless Power Transfer[1].
The Wireless Power Transfer is the transmission of electronical energy
from a power source. The EXTCON_CHG_WPT has the EXTCON_TYPE_CHG.

[1] https://en.wikipedia.org/wiki/Wireless_power_transfer

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 736d25b1 05-Aug-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add new EXTCON_DISP_HMD for Head-mounted Display device

This patch adds the new EXTCON_DISP_HMD id for Head-mounted Display[1] device.
The HMD device is usually for USB connector type So, the HMD connector
has the two extcon types of both EXTCON_TYPE_DISP and EXTCON_TYPE_USB.

[1] https://en.wikipedia.org/wiki/Head-mounted_display

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 2f251406 21-Jul-2016 Chris Zhong <zyw@rock-chips.com>

extcon: Add EXTCON_DISP_DP and the property for USB Type-C

Add EXTCON_DISP_DP for the Display external connector. For Type-C
connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
Alt Mode on USB Type-C Standard). The Type-C support both normal
and flipped orientation, so add a property to extcon.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# a580982f 21-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the synchronization extcon APIs to support the notification

This patch adds the synchronization extcon APIs to support the notifications
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.

The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().

The list of new extcon APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between extcon provider driver
and extcon client driver.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);

case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS 1);
extcon_sync(edev, EXTCON_USB);

case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_sync(edev, EXTCON_USB);

case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 35872fdc 21-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# ceaa98f4 25-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the support for the capability of each property

This patch adds the support of the property capability setting. This function
decides the supported properties of each external connector on extcon provider
driver.

Ths list of new extcon APIs to get/set the capability of property as following:
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 067c1652 11-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the support for extcon property according to extcon type

This patch support the extcon property for the external connector
because each external connector might have the property according to
the H/W design and the specific characteristics.

- EXTCON_PROP_USB_[property name]
- EXTCON_PROP_CHG_[property name]
- EXTCON_PROP_JACK_[property name]
- EXTCON_PROP_DISP_[property name]

Add the new extcon APIs to get/set the property value as following:
- int extcon_get_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value *prop_val)
- int extcon_set_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val)

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 505cf01f 11-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the extcon_type to gather each connector into five category

This patch adds the new extcon type to group the each connecotr
into following five category. This type would be used to handle
the connectors as a group unit instead of a connector unit.
- EXTCON_TYPE_USB : USB connector
- EXTCON_TYPE_CHG : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

Also, each external connector is possible to belong to one more extcon type.
In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 84c48dc5 30-Jun-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Block the bit masking operation for cable state except for extcon core

This patch restrict the usage of extcon_update_state() in the extcon
core because the extcon_update_state() use the bit masking to change
the state of external connector. When this function is used in device drivers,
it may occur the probelm with the handling mistake of bit masking.

Also, this patch removes the extcon_get/set_state() functions because these
functions use the bit masking which is reluctant way. Instead, extcon
provides the extcon_set/get_cable_state_() functions.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 8457a1b4 15-Aug-2016 Guenter Roeck <groeck@chromium.org>

extcon: Introduce EXTCON_PROP_USB_SS property for SuperSpeed mode

EXTCON_PROP_USB_SS (SuperSpeed)[1] is necessary to distinguish
between USB/USB2 and USB3 connections on USB Type-C cables.

[1] https://en.wikipedia.org/wiki/USB#Overview

Cc: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 7fe95fb8 05-Aug-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add new EXTCON_CHG_WPT for Wireless Power Transfer device

This patchs add the new EXTCON_CHG_WPT for Wireless Power Transfer[1].
The Wireless Power Transfer is the transmission of electronical energy
from a power source. The EXTCON_CHG_WPT has the EXTCON_TYPE_CHG.

[1] https://en.wikipedia.org/wiki/Wireless_power_transfer

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 9c0595d6 05-Aug-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add new EXTCON_DISP_HMD for Head-mounted Display device

This patch adds the new EXTCON_DISP_HMD id for Head-mounted Display[1] device.
The HMD device is usually for USB connector type So, the HMD connector
has the two extcon types of both EXTCON_TYPE_DISP and EXTCON_TYPE_USB.

[1] https://en.wikipedia.org/wiki/Head-mounted_display

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 2164188d 21-Jul-2016 Chris Zhong <zyw@rock-chips.com>

extcon: Add EXTCON_DISP_DP and the property for USB Type-C

Add EXTCON_DISP_DP for the Display external connector. For Type-C
connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
Alt Mode on USB Type-C Standard). The Type-C support both normal
and flipped orientation, so add a property to extcon.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# ab11af04 21-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the synchronization extcon APIs to support the notification

This patch adds the synchronization extcon APIs to support the notifications
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.

The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().

The list of new extcon APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between extcon provider driver
and extcon client driver.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);

case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS 1);
extcon_sync(edev, EXTCON_USB);

case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_sync(edev, EXTCON_USB);

case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 575c2b86 21-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 7f2a0a16 25-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the support for the capability of each property

This patch adds the support of the property capability setting. This function
decides the supported properties of each external connector on extcon provider
driver.

Ths list of new extcon APIs to get/set the capability of property as following:
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 792e7e9e 11-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the support for extcon property according to extcon type

This patch support the extcon property for the external connector
because each external connector might have the property according to
the H/W design and the specific characteristics.

- EXTCON_PROP_USB_[property name]
- EXTCON_PROP_CHG_[property name]
- EXTCON_PROP_JACK_[property name]
- EXTCON_PROP_DISP_[property name]

Add the new extcon APIs to get/set the property value as following:
- int extcon_get_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value *prop_val)
- int extcon_set_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val)

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 55e4e2f1 11-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add the extcon_type to gather each connector into five category

This patch adds the new extcon type to group the each connecotr
into following five category. This type would be used to handle
the connectors as a group unit instead of a connector unit.
- EXTCON_TYPE_USB : USB connector
- EXTCON_TYPE_CHG : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

Also, each external connector is possible to belong to one more extcon type.
In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>


# 912465bc 30-Jun-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Block the bit masking operation for cable state except for extcon core

This patch restrict the usage of extcon_update_state() in the extcon
core because the extcon_update_state() use the bit masking to change
the state of external connector. When this function is used in device drivers,
it may occur the probelm with the handling mistake of bit masking.

Also, this patch removes the extcon_get/set_state() functions because these
functions use the bit masking which is reluctant way. Instead, extcon
provides the extcon_set/get_cable_state_() functions.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# bc921260 27-Jun-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Fix the wrong description about extcon_set/get_cable_state_()

This patch fixes the wrong description about extcon_set/get_cable_state_()
because they use the unique id of external connector instead of legacy name.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 58f38656 27-Jun-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add resource-managed functions to register extcon notifier

This patch adds the resource-managed functions for register/unregister
the extcon notifier with the id of each external connector. This function
will make it easy to handle the extcon notifier.

- int devm_extcon_register_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
- void devm_extcon_unregister_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 20f7b53d 27-Jun-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Move struct extcon_cable from header file to core

This patch moves the struct extcon_cable because that should
be only handled by extcon core. There are no reason to publish
the internal structure.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 830ae442 31-May-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove the deprecated extcon functions

This patch removes the deprecated extcon functions using string type
to identify the type of external connector. The Commit 2a9de9c0f08d61
("extcon: Use the unique id for external connector instead of string)
uses the unique id to separate the type of external connector instead of
string name.
- extcon_register_interest()
- extcon_unregister_interest()
- extcon_set_cable_state()
- extcon_get_cable_state()

And, extcon_register_interest() finds the first extcon device to include the
requested external connector from extcon client device and then register the
notifier if extcon device argument is NULL. Instead, extcon_register_notifier()
supports this feature.

But, this patch remains the deprecatd function definition to prevent
the build break.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 11eecf91 02-Oct-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Modify the id and name of external connector

This patch modifies the id and name of external connector with the
additional prefix to clarify both attribute and meaning of external
connector as following:
- EXTCON_CHG_* mean the charger connector.
- EXTCON_JACK_* mean the jack connector.
- EXTCON_DISP_* mean the display port connector.

Following table show the new name of external connector with old name:
--------------------------------------------------
Old extcon name | New extcon name |
--------------------------------------------------
EXTCON_TA | EXTCON_CHG_USB_DCP |
EXTCON_CHARGE_DOWNSTREAM| EXTCON_CHG_USB_CDP |
EXTCON_FAST_CHARGER | EXTCON_CHG_USB_FAST |
EXTCON_SLOW_CHARGER | EXTCON_CHG_USB_SLOW |
--------------------------------------------------
EXTCON_MICROPHONE | EXTCON_JACK_MICROPHONE |
EXTCON_HEADPHONE | EXTCON_JACK_HEADPHONE |
EXTCON_LINE_IN | EXTCON_JACK_LINE_IN |
EXTCON_LINE_OUT | EXTCON_JACK_LINE_OUT |
EXTCON_VIDEO_IN | EXTCON_JACK_VIDEO_IN |
EXTCON_VIDEO_OUT | EXTCON_JACK_VIDEO_OUT |
EXTCON_SPDIF_IN | EXTCON_JACK_SPDIF_IN |
EXTCON_SPDIF_OUT | EXTCON_JACK_SPDIF_OUT |
--------------------------------------------------
EXTCON_HMDI | EXTCON_DISP_HDMI |
EXTCON_MHL | EXTCON_DISP_MHL |
EXTCON_DVI | EXTCON_DISP_DVI |
EXTCON_VGA | EXTCON_DISP_VGA |
--------------------------------------------------

And, when altering the name of USB charger connector, EXTCON refers to the
"Battery Charging v1.2 Spec and Adopters Agreement"[1] to use the standard
name of USB charging port as following. Following name of USB charging port
are already used in power_supply subsystem. We chan check it on patch[2].
- EXTCON_CHG_USB_SDP /* Standard Downstream Port */
- EXTCON_CHG_USB_DCP /* Dedicated Charging Port */
- EXTCON_CHG_USB_CDP /* Charging Downstream Port */
- EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */

[1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip
[2] commit 85efc8a18ced ("power_supply: Add types for USB chargers")

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[ckeepax: For the Arizona changes]
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>


# 2519b765 11-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove optional print_state() function pointer of struct extcon_dev

This patch removes the optional print_state() function pointer which included
in 'struct extcon_dev' because the extcon must maintain the consistent name
of extcon device on sysfs instead of inconsistent state of external connectors.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 85a77ff0 10-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove duplicate header file in extcon.h

This patch removes the duplicate header file in extcon.h.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 73b6ecdb 11-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Redefine the unique id of supported external connectors without 'enum extcon' type

This patch just redefine the unique id of supported external connectors without
'enum extcon' type. Because unique id would be used on devictree file(*.dts) to
indicate the specific external connectors like key number of input framework.
So, I have the plan to move this definitions to following header file which
includes the unique id of supported external connectors.
- include/dt-bindings/extcon/extcon.h

Fixes: 2a9de9c0f08d ("extcon: Use the unique id for external connector instead of string")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f8df8808 27-May-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove optional print_name() function pointer of extcon_dev

This patch removes the optional print_name() function pointer included in
'struct extcon_dev' because the extcon must maintain the consistent name of
extcon device on sysfs instead of inconsistent name. After merged patch[1],
extcon can maintain the consistent name of extcon device without any hard-coded
device name.
[1] https://lkml.org/lkml/2015/4/27/258

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 046050f6 19-May-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Update the prototype of extcon_register_notifier() with enum extcon

Previously, extcon consumer driver used the extcon_register_interest()
to register the notifier chain and then to receive the notifier event
when external connector's state is changed. When registering the notifier chain
for specific external connector with extcon_register_interest(), it used the
the string name of external connector directly. There are potential problem
because of unclear, non-standard and inconsequent cable name. Namely,
it is not appropriate method to identify each external connector.

So, this patch modify the prototype of extcon_register_notifier() by using
the 'enum extcon' which are the unique id for each external connector
instead of unclear string method.

- Previously, the extcon consumer driver used the extcon_register_interest()
with 'cable_name' to point out the specific external connector. Also. it used
the un-needed structure (struct extcon_specific_cable_nb).
: int extcon_register_interest(struct extcon_specific_cable_nb *obj,
const char *extcon_name, const char *cable_name,
struct notifier_block *nb)

- Newly, the updated extcon_register_notifier() would definitely support
the same feature to detech the changed state of external connector without
any specific structure (struct extcon_specific_cable_nb).
: int extcon_register_notifier(struct extcon_dev *edev, enum extcon id,
struct notifier_block *nb)

This patch support the both extcon_register_interest() and new extcon_register_
notifier(). But the extcon_{register|unregister}_interest() will be deprecated
because extcon core would support the notifier event for extcon consumer driver
with only updated extcon_register_notifier() and 'extcon_specific_cable_nb'
will be removed if there are no extcon consumer driver with legacy
extcon_{register|unregister}_interest().

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>


# 2a9de9c0 24-Apr-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Use the unique id for external connector instead of string

This patch uses the unique id to identify the type of external connector instead
of string name. The string name have the many potential issues. So, this patch
defines the 'extcon' enumeration which includes all supported external connector
on EXTCON subsystem. If new external connector is necessary, the unique id of
new connector have to be added in 'extcon' enumeration. There are current
supported external connector in 'enum extcon' as following:

enum extcon {
EXTCON_NONE = 0x0,

/* USB external connector */
EXTCON_USB = 0x1,
EXTCON_USB_HOST = 0x2,

/* Charger external connector */
EXTCON_TA = 0x10,
EXTCON_FAST_CHARGER = 0x11,
EXTCON_SLOW_CHARGER = 0x12,
EXTCON_CHARGE_DOWNSTREAM = 0x13,

/* Audio and video external connector */
EXTCON_LINE_IN = 0x20,
EXTCON_LINE_OUT = 0x21,
EXTCON_MICROPHONE = 0x22,
EXTCON_HEADPHONE = 0x23,

EXTCON_HDMI = 0x30,
EXTCON_MHL = 0x31,
EXTCON_DVI = 0x32,
EXTCON_VGA = 0x33,
EXTCON_SPDIF_IN = 0x34,
EXTCON_SPDIF_OUT = 0x35,
EXTCON_VIDEO_IN = 0x36,
EXTCON_VIDEO_OUT = 0x37,

/* Miscellaneous external connector */
EXTCON_DOCK = 0x50,
EXTCON_JIG = 0x51,
EXTCON_MECHANICAL = 0x52,

EXTCON_END,
};

For example in extcon-arizona.c:
To use unique id removes the potential issue about handling
the inconsistent name of external connector with string.
- Previously, use the string to register the type of arizona jack connector
static const char *arizona_cable[] = {
"Mechanical",
"Microphone",
"Headphone",
"Line-out",
};
- Newly, use the unique id to register the type of arizona jack connector
static const enum extcon arizona_cable[] = {
EXTCON_MECHANICAL,
EXTCON_MICROPHONE,
EXTCON_HEADPHONE,
EXTCON_LINE_OUT,

EXTCON_NONE,
};

And this patch modify the prototype of extcon_{get|set}_cable_state_() which
uses the 'enum extcon id' instead of 'cable_index'. Because although one more
extcon drivers support USB cable, each extcon driver might has the differnt
'cable_index' for USB cable. All extcon drivers can use the unique id number
for same external connector with modified extcon_{get|set}_cable_state_().

- Previously, use 'cable_index' on these functions:
extcon_get_cable_state_(struct extcon_dev*, int cable_index)
extcon_set_cable_state_(struct extcon_dev*, int cable_index, bool state)

-Newly, use 'enum extcon id' on these functions:
extcon_get_cable_state_(struct extcon_dev*, enum extcon id)
extcon_set_cable_state_(struct extcon_dev*, enum extcon id, bool state)

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[arnd: Report the build break about drivers/usb/phy/phy-tahvo.c after using the
unique id for external connector insteadf of string]
Reported-by: Arnd Bergmann <arnd@arndb.de>
[dan.carpenter: Report the build warning of extcon_{set|get}_cable_state_()]
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>


# b9ec23c0 23-Apr-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Fix the checkpatch warning and minor coding style issue

This patch clean up the extcon core driver by fixing the checkpatch warning
and minor coding style issue.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 707d7550 14-Apr-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add extcon_get_edev_name() API to get the extcon device name

This patch adds the extcon_get_edev_name() API to get the name of extcon device
because all information inclued in the structure extcon_dev should be accessed
by extcon core API instead of directly accessing the data.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 739ba1bf 24-Apr-2014 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add devm_extcon_dev_allocate/free to manage the resource of extcon device

This patch add device managed devm_extcon_dev_{allocate,free} to automatically
free the memory of extcon_dev structure without handling free operation.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>


# a9af6522 24-Apr-2014 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add extcon_dev_allocate/free() to control the memory of extcon device

This patch add APIs to control the extcon device on extcon provider driver.
The extcon_dev_allocate() allocates the memory of extcon device and initializes
supported cables. And then extcon_dev_free() decrement the reference of the
device of extcon device and free the memory of the extcon device. This APIs
must need to implement devm_extcon_dev_allocate()/free() APIs.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>


# 1111244f 21-Apr-2014 Sangjung Woo <sangjung.woo@samsung.com>

extcon: Add resource-managed extcon register function

Add resource-managed extcon device register function for convenience.
For example, if a extcon device is attached with new
devm_extcon_dev_register(), that extcon device is automatically
unregistered on driver detach.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
[Fix bug about devm_extcon_dev_match/release() and code clean by Chanwoo Choi]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 1ad94ffe 18-Mar-2014 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Move OF helper function to extcon core and change function name

This patch move simply OF helper function to extcon core and change function
name as following:
- of_extcon_get_extcon_dev() -> extcon_get_edev_by_phandle()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Felipe Balbi <balbi@ti.com>


# 42d7d753 26-Sep-2013 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Simplify extcon_dev_register() prototype by removing unnecessary parameter

This patch remove extcon_dev_register()'s second parameter which means
the pointer of parent device to simplify prototype of this function.
So, if extcon device has the parent device, it should set the pointer of
parent device to edev.dev.parent in extcon device driver instead of in
extcon_dev_register().

Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# dae61651 26-Sep-2013 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Change field type of 'dev' in extcon_dev structure

The extcon device must always need 'struct device' so this patch change
field type of 'dev' instead of allocating memory for 'struct device' on
extcon_dev_register() function.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <cw00.choi@samsung.com>


# a75e1c73 30-Aug-2013 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Fix indentation coding style to improve readability

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# df072eb9 20-Nov-2012 MyungJoo Ham <myungjoo.ham@samsung.com>

extcon: kernel_doc style fix

Corrected kernel_doc entries.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>


# d851718f 08-Nov-2012 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Add missing header file to extcon.h

This patch add missing header file(sysfs.h/device.h) to extcon.h
because 'struct extcon_dev' define attribute field(attr_g_muex/
attrs_muex/d_attrs_mues) and device_type field(extcon_dev_type).

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# 0cf6ad8a 29-Aug-2012 anish kumar <anish198519851985@gmail.com>

extcon: standard cable names definition and declaration changed

With this change now individual drivers can use standard cable
names as below:
static const char *arizona_cable[] = {
extcon_cable_name[EXTCON_USB],
extcon_cable_name[EXTCON_USB_HOST],
"CUSTOM_CABLE"
NULL,
}

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>


# c338bb03 22-Aug-2012 Peter Meerwald <pmeerw@pmeerw.net>

extcon: fixing typos

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0e1507c8 02-May-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

extcon: Add EXTCON_MECHANICAL cable type for physical presence

Some accessory detection mechanisms are able to detect that something is
physically present in the socket separately to identifying what is present
in the socket. This information can be useful to applications, for example
allowing them to indicate that a potentially broken accessory is present,
so provide a standard way to report it to userspace.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bde68e60 19-Apr-2012 MyungJoo Ham <myungjoo.ham@samsung.com>

Extcon: support mutually exclusive relation between cables.

There could be cables that t recannot be attaches simulatenously. Extcon
device drivers may express such information via mutually_exclusive in
struct extcon_dev.

For example, for an extcon device with 16 cables (bits 0 to 15 are
available), if mutually_exclusive = { 0x7, 0xC0, 0x81, 0 }, then, the
following attachments are prohibitted.
{0, 1}
{0, 2}
{1, 2}
{6, 7}
{0, 7}
and every attachment set that are superset of one of the above.
For the detail, please refer to linux/include/linux/extcon.h.

The concept is suggested by NeilBrown <neilb@suse.de>

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

--
Changes from V5:
- Updated sysfs format
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 806d9dd7 19-Apr-2012 MyungJoo Ham <myungjoo.ham@samsung.com>

Extcon: support multiple states at a device.

One switch device (e.g., MUIC(MAX8997, MAX77686, ...), and some 30-pin
devices) may have multiple cables attached. For example, one
30-pin port may inhabit a USB cable, an HDMI cable, and a mic.
Thus, one switch device requires multiple state bits each representing
a type of cable.

For such purpose, we use the 32bit state variable; thus, up to 32
different type of cables may be defined for a switch device. The list of
possible cables is defined by the array of cable names in the switch_dev
struct given to the class.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

--
Changes from V7
- Bugfixed in _call_per_cable() (incorrect nb) (Chanwoo Choi)
- Compiler error in header for !CONFIG_EXTCON (Chanwoo Choi)

Changes from V5
- Sysfs style reformed: subdirectory per cable.
- Updated standard cable names
- Removed unnecessary printf
- Bugfixes after testing

Changes from V4
- Bugfixes after more testing at Exynos4412 boards with userspace
processses.

Changes from V3
- Bugfixes after more testing at Exynos4412 boards.

Changes from V2
- State can be stored by user
- Documentation updated

Changes from RFC
- Switch is renamed to extcon
- Added kerneldoc comments
- Added APIs to support "standard" cable names
- Added helper APIs to support notifier block registration with cable
name.
- Regrouped function list in the header file.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 74c5d09b 19-Apr-2012 Donggeun Kim <dg77.kim@samsung.com>

Extcon: support notification based on the state changes.

State changes of extcon devices have been notified via kobjet_uevent.
This patch adds notifier interfaces in order to allow device drivers to
get notified easily. Along with notifier interface,
extcon_get_extcon_dev() function is added so that device drivers may
discover a extcon_dev easily.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

--
Changes from RFC
- Renamed switch to extcon
- Bugfix: extcon_dev_unregister()
- Bugfix: "edev->dev" is "internal" data.
- Added kerneldoc comments.
- Reworded comments.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# de55d871 19-Apr-2012 MyungJoo Ham <myungjoo.ham@samsung.com>

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: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mark 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>