diff mbox

[v3,1/5] extcon: Add Type-C and DP support

Message ID 1466686264-6744-2-git-send-email-zyw@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Zhong June 23, 2016, 12:51 p.m. UTC
Add EXTCON_DISP_DP and EXTCON_DISP_DP_ALT for the Display external
connector. The EXTCON_DISP_DP is for DisplayPort, and the
EXTCON_DISP_DP_ALT is the DisplayPort as an Alternate Mode for
the USB Type-C connector (VESA DisplayPort Alt Mode on USB Type-C
Standard).

And for the Type-C USB, there is some information need to be supplied
by PowerDelivery or other mode detecter: port orientation and pin
assignments, so add these 2 virtual cable: EXTCON_TYPEC_POLARITY
and EXTCON_TYPEC_PIN_ASSIGN. If EXTCON_TYPEC_POLARITY is attached,
the Type-C get flip orientation. IF EXTCON_TYPEC_PIN_ASSIGN is
attached, Type-C get Pin_Assignment_C(for DP only mode) or
Pin_Assignment_D(for DP alt mode), the default Assignment is A or B.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
---

Changes in v3: None
Changes in v2: None
Changes in v1: None

 drivers/extcon/extcon.c | 6 ++++++
 include/linux/extcon.h  | 6 ++++++
 2 files changed, 12 insertions(+)

Comments

Chanwoo Choi June 28, 2016, 12:26 p.m. UTC | #1
Hi Chris,

I agree to add the new EXTCON_DISP_DP connector.
But, other new definition should be discussed.
- EXTCON_DISP_DP_ALT
- EXTCON_TYPEC_POLARITY
- EXTCON_TYPEC_PIN_ASSIGN

I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate
as the new external connector definition. These are the property or attribute of
USB connector with C-type.

Also, EXTCON_DISP_DP_ALT is not a new type of connector.
It is just one of the mode for DP connector.

As I knew, DP alternative mode use the USB connector with C-type.
So, DP alternative mode can be expressed on following:
 = EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type

Thanks,
Chanwoo Choi

2016-06-23 21:51 GMT+09:00 Chris Zhong <zyw@rock-chips.com>:
> Add EXTCON_DISP_DP and EXTCON_DISP_DP_ALT for the Display external
> connector. The EXTCON_DISP_DP is for DisplayPort, and the
> EXTCON_DISP_DP_ALT is the DisplayPort as an Alternate Mode for
> the USB Type-C connector (VESA DisplayPort Alt Mode on USB Type-C
> Standard).
>
> And for the Type-C USB, there is some information need to be supplied
> by PowerDelivery or other mode detecter: port orientation and pin
> assignments, so add these 2 virtual cable: EXTCON_TYPEC_POLARITY
> and EXTCON_TYPEC_PIN_ASSIGN. If EXTCON_TYPEC_POLARITY is attached,
> the Type-C get flip orientation. IF EXTCON_TYPEC_PIN_ASSIGN is
> attached, Type-C get Pin_Assignment_C(for DP only mode) or
> Pin_Assignment_D(for DP alt mode), the default Assignment is A or B.
>
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
> Changes in v1: None
>
>  drivers/extcon/extcon.c | 6 ++++++
>  include/linux/extcon.h  | 6 ++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index 21a123c..0522b4d 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -53,6 +53,10 @@ static const char *extcon_name[] =  {
>         [EXTCON_CHG_USB_FAST]           = "FAST-CHARGER",
>         [EXTCON_CHG_USB_SLOW]           = "SLOW-CHARGER",
>
> +       /* Type-c connector */
> +       [EXTCON_TYPEC_POLARITY]         = "TYPE-C-POLARITY",
> +       [EXTCON_TYPEC_PIN_ASSIGN]       = "TYPE-C-PIN-ASSIGN",
> +
>         /* Jack external connector */
>         [EXTCON_JACK_MICROPHONE]        = "MICROPHONE",
>         [EXTCON_JACK_HEADPHONE]         = "HEADPHONE",
> @@ -68,6 +72,8 @@ static const char *extcon_name[] =  {
>         [EXTCON_DISP_MHL]               = "MHL",
>         [EXTCON_DISP_DVI]               = "DVI",
>         [EXTCON_DISP_VGA]               = "VGA",
> +       [EXTCON_DISP_DP]                = "DP",
> +       [EXTCON_DISP_DP_ALT]            = "DP-ALT",
>
>         /* Miscellaneous external connector */
>         [EXTCON_DOCK]                   = "DOCK",
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
> index 7abf674..98039ad 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -45,6 +45,10 @@
>  #define EXTCON_CHG_USB_FAST    9
>  #define EXTCON_CHG_USB_SLOW    10
>
> +/* Type-c connector */
> +#define EXTCON_TYPEC_POLARITY  11      /* Typec-C plug orientation */
> +#define EXTCON_TYPEC_PIN_ASSIGN        12      /* Typec-C pin Assignment */
> +
>  /* Jack external connector */
>  #define EXTCON_JACK_MICROPHONE 20
>  #define EXTCON_JACK_HEADPHONE  21
> @@ -60,6 +64,8 @@
>  #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 */
> +#define EXTCON_DISP_DP_ALT     45      /* Display Port Type-C Alternate Mode */
>
>  /* Miscellaneous external connector */
>  #define EXTCON_DOCK            60
> --
> 2.6.3
>
Guenter Roeck June 28, 2016, 4:33 p.m. UTC | #2
On Tue, Jun 28, 2016 at 5:26 AM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
> Hi Chris,
>
> I agree to add the new EXTCON_DISP_DP connector.
> But, other new definition should be discussed.
> - EXTCON_DISP_DP_ALT
> - EXTCON_TYPEC_POLARITY
> - EXTCON_TYPEC_PIN_ASSIGN
>
> I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate
> as the new external connector definition. These are the property or attribute of
> USB connector with C-type.
>
> Also, EXTCON_DISP_DP_ALT is not a new type of connector.
> It is just one of the mode for DP connector.
>
> As I knew, DP alternative mode use the USB connector with C-type.
> So, DP alternative mode can be expressed on following:
>  = EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type
>

Problem is that extcon doesn't support exchanging cable properties
between cable providers (extcon drivers) and consumers, other than
cable states. In order to exchange properties such as polarity and pin
assignments, we would need a separate infrastructure. But then the
question would be why to use extcon in the first place.

If you have a solution for that puzzle, please let us know.

Thanks,
Guenter

> Thanks,
> Chanwoo Choi
>
> 2016-06-23 21:51 GMT+09:00 Chris Zhong <zyw@rock-chips.com>:
>> Add EXTCON_DISP_DP and EXTCON_DISP_DP_ALT for the Display external
>> connector. The EXTCON_DISP_DP is for DisplayPort, and the
>> EXTCON_DISP_DP_ALT is the DisplayPort as an Alternate Mode for
>> the USB Type-C connector (VESA DisplayPort Alt Mode on USB Type-C
>> Standard).
>>
>> And for the Type-C USB, there is some information need to be supplied
>> by PowerDelivery or other mode detecter: port orientation and pin
>> assignments, so add these 2 virtual cable: EXTCON_TYPEC_POLARITY
>> and EXTCON_TYPEC_PIN_ASSIGN. If EXTCON_TYPEC_POLARITY is attached,
>> the Type-C get flip orientation. IF EXTCON_TYPEC_PIN_ASSIGN is
>> attached, Type-C get Pin_Assignment_C(for DP only mode) or
>> Pin_Assignment_D(for DP alt mode), the default Assignment is A or B.
>>
>> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>> ---
>>
>> Changes in v3: None
>> Changes in v2: None
>> Changes in v1: None
>>
>>  drivers/extcon/extcon.c | 6 ++++++
>>  include/linux/extcon.h  | 6 ++++++
>>  2 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
>> index 21a123c..0522b4d 100644
>> --- a/drivers/extcon/extcon.c
>> +++ b/drivers/extcon/extcon.c
>> @@ -53,6 +53,10 @@ static const char *extcon_name[] =  {
>>         [EXTCON_CHG_USB_FAST]           = "FAST-CHARGER",
>>         [EXTCON_CHG_USB_SLOW]           = "SLOW-CHARGER",
>>
>> +       /* Type-c connector */
>> +       [EXTCON_TYPEC_POLARITY]         = "TYPE-C-POLARITY",
>> +       [EXTCON_TYPEC_PIN_ASSIGN]       = "TYPE-C-PIN-ASSIGN",
>> +
>>         /* Jack external connector */
>>         [EXTCON_JACK_MICROPHONE]        = "MICROPHONE",
>>         [EXTCON_JACK_HEADPHONE]         = "HEADPHONE",
>> @@ -68,6 +72,8 @@ static const char *extcon_name[] =  {
>>         [EXTCON_DISP_MHL]               = "MHL",
>>         [EXTCON_DISP_DVI]               = "DVI",
>>         [EXTCON_DISP_VGA]               = "VGA",
>> +       [EXTCON_DISP_DP]                = "DP",
>> +       [EXTCON_DISP_DP_ALT]            = "DP-ALT",
>>
>>         /* Miscellaneous external connector */
>>         [EXTCON_DOCK]                   = "DOCK",
>> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
>> index 7abf674..98039ad 100644
>> --- a/include/linux/extcon.h
>> +++ b/include/linux/extcon.h
>> @@ -45,6 +45,10 @@
>>  #define EXTCON_CHG_USB_FAST    9
>>  #define EXTCON_CHG_USB_SLOW    10
>>
>> +/* Type-c connector */
>> +#define EXTCON_TYPEC_POLARITY  11      /* Typec-C plug orientation */
>> +#define EXTCON_TYPEC_PIN_ASSIGN        12      /* Typec-C pin Assignment */
>> +
>>  /* Jack external connector */
>>  #define EXTCON_JACK_MICROPHONE 20
>>  #define EXTCON_JACK_HEADPHONE  21
>> @@ -60,6 +64,8 @@
>>  #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 */
>> +#define EXTCON_DISP_DP_ALT     45      /* Display Port Type-C Alternate Mode */
>>
>>  /* Miscellaneous external connector */
>>  #define EXTCON_DOCK            60
>> --
>> 2.6.3
>>
Guenter Roeck June 29, 2016, 2:08 a.m. UTC | #3
On Tue, Jun 28, 2016 at 6:40 PM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
> Hi Guenter,
>
> 2016년 6월 29일 수요일, Guenter Roeck<groeck@google.com>님이 작성한 메시지:
>>
>> On Tue, Jun 28, 2016 at 5:26 AM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
>> > Hi Chris,
>> >
>> > I agree to add the new EXTCON_DISP_DP connector.
>> > But, other new definition should be discussed.
>> > - EXTCON_DISP_DP_ALT
>> > - EXTCON_TYPEC_POLARITY
>> > - EXTCON_TYPEC_PIN_ASSIGN
>> >
>> > I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate
>> > as the new external connector definition. These are the property or
>> > attribute of
>> > USB connector with C-type.
>> >
>> > Also, EXTCON_DISP_DP_ALT is not a new type of connector.
>> > It is just one of the mode for DP connector.
>> >
>> > As I knew, DP alternative mode use the USB connector with C-type.
>> > So, DP alternative mode can be expressed on following:
>> >  = EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type
>> >
>>
>> Problem is that extcon doesn't support exchanging cable properties
>> between cable providers (extcon drivers) and consumers, other than
>> cable states. In order to exchange properties such as polarity and pin
>> assignments, we would need a separate infrastructure. But then the
>> question would be why to use extcon in the first place.
>>
>> If you have a solution for that puzzle, please let us know.
>>
>
> You're right.
> Current extcon don't support the cable properties.
> The requirement about cables properties occur such as USB ID and VBUS pin.
> So, I'll support the cable properties in extcon framework and send the
> patches within this week.
>
> Maybe, the function definitions are following:
> (But, these may be changed on real patches)
> - extcon_set_cable_property(struct extcon_dev *edev, unsigned int id, enum
> extcon_property prop, unsigned in prop_val)
> - extcon_get_cable_property(struct extcon_dev *edev, unsigned int id, enum
> extcon_property prop)
>

Excellent idea. Couple of thoughts:

- We might need notifiers for property events. Not sure if the state
notifiers are sufficient (properties might change independently of
state). Or maybe state events could be used if a cable property (but
not the state) changes ?

- It might possibly make sense to make the prop argument opaque (such
as u32). Properties would still be defined in extcon (such as
EXTCON_PROP_TYPEC_POLARITY), but this would leave more room for cable
type specific properties. After all, the properties would be cable
type specific.

Thanks,
Guenter
Guenter Roeck July 6, 2016, 8:22 p.m. UTC | #4
Hi,

On Tue, Jun 28, 2016 at 6:40 PM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
> Hi Guenter,
>
> 2016년 6월 29일 수요일, Guenter Roeck<groeck@google.com>님이 작성한 메시지:
>>
>> On Tue, Jun 28, 2016 at 5:26 AM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
>> > Hi Chris,
>> >
>> > I agree to add the new EXTCON_DISP_DP connector.
>> > But, other new definition should be discussed.
>> > - EXTCON_DISP_DP_ALT
>> > - EXTCON_TYPEC_POLARITY
>> > - EXTCON_TYPEC_PIN_ASSIGN
>> >
>> > I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate
>> > as the new external connector definition. These are the property or
>> > attribute of
>> > USB connector with C-type.
>> >
>> > Also, EXTCON_DISP_DP_ALT is not a new type of connector.
>> > It is just one of the mode for DP connector.
>> >
>> > As I knew, DP alternative mode use the USB connector with C-type.
>> > So, DP alternative mode can be expressed on following:
>> >  = EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type
>> >
>>
>> Problem is that extcon doesn't support exchanging cable properties
>> between cable providers (extcon drivers) and consumers, other than
>> cable states. In order to exchange properties such as polarity and pin
>> assignments, we would need a separate infrastructure. But then the
>> question would be why to use extcon in the first place.
>>
>> If you have a solution for that puzzle, please let us know.
>>
>
> You're right.
> Current extcon don't support the cable properties.
> The requirement about cables properties occur such as USB ID and VBUS pin.
> So, I'll support the cable properties in extcon framework and send the
> patches within this week.
>

Did you have time to look into this ? Any idea if/when you will send
the patches ?

Thanks,
Guenter
Chanwoo Choi July 11, 2016, 2:30 p.m. UTC | #5
Hi Guenter,

2016-07-07 5:22 GMT+09:00 Guenter Roeck <groeck@google.com>:
> Hi,
>
> On Tue, Jun 28, 2016 at 6:40 PM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
>> Hi Guenter,
>>
>> 2016년 6월 29일 수요일, Guenter Roeck<groeck@google.com>님이 작성한 메시지:
>>>
>>> On Tue, Jun 28, 2016 at 5:26 AM, Chanwoo Choi <cwchoi00@gmail.com> wrote:
>>> > Hi Chris,
>>> >
>>> > I agree to add the new EXTCON_DISP_DP connector.
>>> > But, other new definition should be discussed.
>>> > - EXTCON_DISP_DP_ALT
>>> > - EXTCON_TYPEC_POLARITY
>>> > - EXTCON_TYPEC_PIN_ASSIGN
>>> >
>>> > I think that TYPEC_POLARITY and TYPEC_PIN_ASSING are not appropriate
>>> > as the new external connector definition. These are the property or
>>> > attribute of
>>> > USB connector with C-type.
>>> >
>>> > Also, EXTCON_DISP_DP_ALT is not a new type of connector.
>>> > It is just one of the mode for DP connector.
>>> >
>>> > As I knew, DP alternative mode use the USB connector with C-type.
>>> > So, DP alternative mode can be expressed on following:
>>> >  = EXTCON_DISP_DP + EXTCON_USB + some property of USB c-type
>>> >
>>>
>>> Problem is that extcon doesn't support exchanging cable properties
>>> between cable providers (extcon drivers) and consumers, other than
>>> cable states. In order to exchange properties such as polarity and pin
>>> assignments, we would need a separate infrastructure. But then the
>>> question would be why to use extcon in the first place.
>>>
>>> If you have a solution for that puzzle, please let us know.
>>>
>>
>> You're right.
>> Current extcon don't support the cable properties.
>> The requirement about cables properties occur such as USB ID and VBUS pin.
>> So, I'll support the cable properties in extcon framework and send the
>> patches within this week.
>>
>
> Did you have time to look into this ? Any idea if/when you will send
> the patches ?

Firstly, I'm sorry for late reply.

I'm developing the suggested idea on extcon-test branch[1]. But, I
have not yet completed.
There are issues about compatibility of existing notifier of extcon.

It[1] is not final version. I need more time to make the well design
for extcon property.

[1] https://git.kernel.org/cgit/linux/kernel/git/chanwoo/extcon.git/log/?h=extcon-test
- usb: dwc3: omap: Support the changed method to get the state of connector
- usb: chipdata: Support the changed method to get the state of connector
- extcon: Add the support for extcon property according to type of connector
- extcon: Add the extcon_type to group each connector into five category

Thanks,
Chanwoo Choi
diff mbox

Patch

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 21a123c..0522b4d 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -53,6 +53,10 @@  static const char *extcon_name[] =  {
 	[EXTCON_CHG_USB_FAST]		= "FAST-CHARGER",
 	[EXTCON_CHG_USB_SLOW]		= "SLOW-CHARGER",
 
+	/* Type-c connector */
+	[EXTCON_TYPEC_POLARITY]		= "TYPE-C-POLARITY",
+	[EXTCON_TYPEC_PIN_ASSIGN]	= "TYPE-C-PIN-ASSIGN",
+
 	/* Jack external connector */
 	[EXTCON_JACK_MICROPHONE]	= "MICROPHONE",
 	[EXTCON_JACK_HEADPHONE]		= "HEADPHONE",
@@ -68,6 +72,8 @@  static const char *extcon_name[] =  {
 	[EXTCON_DISP_MHL]		= "MHL",
 	[EXTCON_DISP_DVI]		= "DVI",
 	[EXTCON_DISP_VGA]		= "VGA",
+	[EXTCON_DISP_DP]		= "DP",
+	[EXTCON_DISP_DP_ALT]		= "DP-ALT",
 
 	/* Miscellaneous external connector */
 	[EXTCON_DOCK]			= "DOCK",
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 7abf674..98039ad 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -45,6 +45,10 @@ 
 #define EXTCON_CHG_USB_FAST	9
 #define EXTCON_CHG_USB_SLOW	10
 
+/* Type-c connector */
+#define EXTCON_TYPEC_POLARITY	11	/* Typec-C plug orientation */
+#define EXTCON_TYPEC_PIN_ASSIGN	12	/* Typec-C pin Assignment */
+
 /* Jack external connector */
 #define EXTCON_JACK_MICROPHONE	20
 #define EXTCON_JACK_HEADPHONE	21
@@ -60,6 +64,8 @@ 
 #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 */
+#define EXTCON_DISP_DP_ALT	45	/* Display Port Type-C Alternate Mode */
 
 /* Miscellaneous external connector */
 #define EXTCON_DOCK		60