From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932138AbcHBB6u (ORCPT ); Mon, 1 Aug 2016 21:58:50 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:41587 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755704AbcHBB6a (ORCPT ); Mon, 1 Aug 2016 21:58:30 -0400 X-AuditID: cbfee68d-f79286d000007a9a-31-579ffe435fee From: Chanwoo Choi To: linux-kernel@vger.kernel.org Cc: cw00.choi@samsung.com, myungjoo.ham@samsung.com, zyw@rock-chips.com, groeck@chromium.org, rogerq@ti.com, chanwoo@kernel.org Subject: [PATCH v3 0/6] extcon: Add the support for extcon type and property Date: Tue, 02 Aug 2016 10:58:19 +0900 Message-id: <1470103105-5992-1-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsWyRsSkQNf53/xwg6fnLSwm3rjCYnH9y3NW i1OvljFbXN41h83iduMKNoueR1oW8x/sYHZg95jdcJHFY9OqTjaPv7P2s3j0bVnF6HH8xnYm j8+b5ALYorhsUlJzMstSi/TtErgy1s4/zF7Qr1nRvvMoUwPjaqUuRk4OCQETiVOn9zFD2GIS F+6tZ+ti5OIQEljBKDFv4Wx2mKIPsw9BJWYxSjz+fx6sQ0jgC6PEq6c1IDabgJbE/hc32EBs EQEFic29z1hBbGaBRkaJ20sSQGxhAR+JafuuMoLYLAKqElP+fWUBsXkFXCTWz33KBLFMTuLD nkfsIMskBLrZJRoO9LFANAhIfJt8CMjmAErISmw6AHW1pMTBFTdYJjAKLmBkWMUomlqQXFCc lF5kqFecmFtcmpeul5yfu4kRGL6n/z3r3cF4+4D1IUYBDkYlHt6A3PnhQqyJZcWVuYcYTYE2 TGSWEk3OB0ZJXkm8obGZkYWpiamxkbmlmZI4r6LUz2AhgfTEktTs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rnz5ZqLFNiKc5INNRiLipOBABs6SlXpwIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch-set add the support the extcon type, extcon property and the synchronization functions. The each external connector has the common characters. So, the external connectors are able to gather in the specific type. And the each external connectors has the specific H/W desigin to support the multiple features throught h/w lines. There are the requirement to express the each h/w character of each external connector. Lastly, when the state and property are changed, the extcon notify the extcon client driver of the changed information. To support the notification on extcon provider drivers, this patches support the three sync functions. Changes from v2: - Fix minor coding style issue. - Add Tested-by tag of Guenter Roeck for all patches. - Add Reviewed-by tag of Guenter Roeck for all patches Changes from v1: - Expand the size (+1) of the property array for each extcon type. - Use the memset() to initialize the property when connector is detached. - Wrap the data of struct extcon_dev in the lock mechanism. - Don't send the notification if connector state is not changed in extcon_set_state_sync() - Fix the minor issue. - Add Tested-by tag of Chris Zhong for these patches. - Add Signed-off tag of Myungjoo Ham for patch1. - Add Reviewed-by tag of Guenter Roeck for patch6. Depends on: This patch depend on the extcon git repository[2]. (branch : extcon-next) [1] https://en.wikipedia.org/wiki/DisplayPort [2] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/ [Detailed description of these patches] 1. Add the extcon type to group the each external connector. There are five categories unitl now as following: - 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 2. Add the extcon property to support the multiple characteristic for the specific H/W design. - EXTCON_PROP_USB_[property name] - EXTCON_PROP_CHG_[property name] - EXTCON_PROP_JACK_[property name] - EXTCON_PROP_DISP_[property name] e.g., EXTCON_PROP_USB_ID and EXTCON_PROP_USB_VBUS The list of the new extcon APIs for the property 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) - 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); 3. Add the sync functions to synchronize the data of each external connector between an extcon provider driver and the extcon client drivers. The list of the new extcon sync APIs as following: - extcon_sync() : Send the notification for each external connector to synchronize the information between and extcon provider driver and the extcon client drivers. - extcon_set_state_sync() : Set the state of external connector with noti. - extcon_set_property_sync() : Set the property of external connector with noti. 4. Add the new external connector definition. The EXTCON_DISP_DP means the Display external connector[1]. The list of new external connector as following: - EXTCON_DISP_DP The list of new property of USB connector as following: - EXTCON_PROP_USB_TYPEC_POLARITY 5. Rename the renames the existing extcon_get/set_cable_state_() to maintain the function naming pattern like as extcon APIs for property. - extcon_set_cable_state_() -> extcon_set_state() - extcon_get_cable_state_() -> extcon_get_state() 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_ID, 1); extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0); 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_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1); 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); Chanwoo Choi (5): extcon: Add the extcon_type to gather each connector into five category extcon: Add the support for extcon property according to extcon type extcon: Add the support for the capability of each property extcon: Rename the extcon_set/get_state() to maintain the function naming pattern extcon: Add the synchronization extcon APIs to support the notification Chris Zhong (1): extcon: Add EXTCON_DISP_DP and the property for USB Type-C drivers/extcon/extcon.c | 730 ++++++++++++++++++++++++++++++++++++++++-------- include/linux/extcon.h | 176 +++++++++++- 2 files changed, 786 insertions(+), 120 deletions(-) -- 1.9.1