Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1456833 > unrolled thread

[PATCH v4 0/6] extcon: Add the support for extcon type and property

Started byChanwoo Choi <cw00.choi@samsung.com>
First post2016-08-05 02:50 +0200
Last post2016-08-05 02:50 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v4 0/6] extcon: Add the support for extcon type and property Chanwoo Choi <cw00.choi@samsung.com> - 2016-08-05 02:50 +0200
    [PATCH v4 6/6] extcon: Add EXTCON_DISP_DP and the property for USB  Type-C Chanwoo Choi <cw00.choi@samsung.com> - 2016-08-05 02:50 +0200

#1456833 — [PATCH v4 0/6] extcon: Add the support for extcon type and property

FromChanwoo Choi <cw00.choi@samsung.com>
Date2016-08-05 02:50 +0200
Subject[PATCH v4 0/6] extcon: Add the support for extcon type and property
Message-ID<s2BuN-mO-7@gated-at.bofh.it>
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 v3:
- Remove the redundant EXTCON_PROP_USB_ID.
- Fix the bug of struct __extcon_info for EXTCON_USB_HOST.
- Remove the wrong comment in extcon_set_property_capability().

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_VBUS and EXTCON_PROP_USB_TYPEC_POLARITY

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, 0);
	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, 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 | 729 ++++++++++++++++++++++++++++++++++++++++--------
 include/linux/extcon.h  | 171 +++++++++++-
 2 files changed, 780 insertions(+), 120 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1456834 — [PATCH v4 6/6] extcon: Add EXTCON_DISP_DP and the property for USB Type-C

FromChanwoo Choi <cw00.choi@samsung.com>
Date2016-08-05 02:50 +0200
Subject[PATCH v4 6/6] extcon: Add EXTCON_DISP_DP and the property for USB Type-C
Message-ID<s2BuO-mO-29@gated-at.bofh.it>
In reply to#1456833
From: Chris Zhong <zyw@rock-chips.com>

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>
---
 drivers/extcon/extcon.c | 5 +++++
 include/linux/extcon.h  | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 8fde4befaa51..a0a1eea18727 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -157,6 +157,11 @@ struct __extcon_info {
 		.id = EXTCON_DISP_VGA,
 		.name = "VGA",
 	},
+	[EXTCON_DISP_DP] = {
+		.type = EXTCON_TYPE_DISP | EXTCON_TYPE_USB,
+		.id = EXTCON_DISP_DP,
+		.name = "DP",
+	},
 
 	/* Miscellaneous external connector */
 	[EXTCON_DOCK] = {
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 162c46a42bac..ad7a1606a7f3 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -69,6 +69,7 @@
 #define EXTCON_DISP_MHL		41	/* Mobile High-Definition Link */
 #define EXTCON_DISP_DVI		42	/* Digital Visual Interface */
 #define EXTCON_DISP_VGA		43	/* Video Graphics Array */
+#define EXTCON_DISP_DP		44	/* Display Port */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK		60
@@ -102,11 +103,16 @@
  * @type:	integer (intval)
  * @value:	0 (low) or 1 (high)
  * @default:	0 (low)
+ * - EXTCON_PROP_USB_TYPEC_POLARITY
+ * @type:	integer (intval)
+ * @value:	0 (normal) or 1 (flip)
+ * @default:	0 (normal)
  */
 #define EXTCON_PROP_USB_VBUS		0
+#define EXTCON_PROP_USB_TYPEC_POLARITY	1
 
 #define EXTCON_PROP_USB_MIN		0
-#define EXTCON_PROP_USB_MAX		0
+#define EXTCON_PROP_USB_MAX		1
 #define EXTCON_PROP_USB_CNT	(EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
 
 /* Properties of EXTCON_TYPE_CHG. */
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web