extcon: Add the synchronization extcon APIs to support the notification
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 22 Jul 2016 04:16:34 +0000 (13:16 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 8 Aug 2016 02:17:22 +0000 (11:17 +0900)
commitab11af049f88f059a73f679fb050bd7abb98d24b
tree5260565a306c3723ba00b4cc35d76f7a74282f76
parent575c2b867ee0c2affdd309f375c032c0c7dc219c
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>
drivers/extcon/extcon.c
include/linux/extcon.h
This page took 0.028061 seconds and 5 git commands to generate.