All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Zhong <zyw@rock-chips.com>
To: Guenter Roeck <groeck@google.com>
Cc: "Douglas Anderson" <dianders@chromium.org>,
	"Tomasz Figa" <tfiga@chromium.org>,
	"Heiko Stübner" <heiko@sntech.de>, 姚智情 <yzq@rock-chips.com>,
	"Guenter Roeck" <groeck@chromium.org>,
	myungjoo.ham@samsung.com, cw00.choi@samsung.com,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"Kever Yang" <kever.yang@rock-chips.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399
Date: Fri, 24 Jun 2016 10:48:23 +0800	[thread overview]
Message-ID: <576C9F77.6000702@rock-chips.com> (raw)
In-Reply-To: <CABXOdTdH-jNVx1b3R+=Z712Zcs8c6q3Hq1iwt_i7foe3K3SAVw@mail.gmail.com>

Hi Guenter

On 06/24/2016 10:10 AM, Guenter Roeck wrote:
> Hi Chris,
>
> On Thu, Jun 23, 2016 at 5:34 PM, Chris Zhong <zyw@rock-chips.com> wrote:
>> Hi Guenter
>>
>>
>> On 06/24/2016 05:47 AM, Guenter Roeck wrote:
>>> Hi Chris,
>>>
>>> On Thu, Jun 23, 2016 at 5:51 AM, Chris Zhong <zyw@rock-chips.com> wrote:
>>>> Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
>>>> Type-C PHY is designed to support the USB3 and DP applications. The
>>>> PHY basically has two main components: USB3 and DisplyPort. USB3
>>>> operates in SuperSpeed mode and the DP can operate at RBR, HBR and
>>>> HBR2 data rates.
>>>>
>>>> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>>>>
>>> [ ... ]
>>>
>>>> +
>>>> +static void tcphy_get_state(struct rockchip_typec_phy *tcphy,
>>>> +                           struct extcon_dev *edev)
>>>> +{
>>>> +       int mode;
>>>> +       bool plugged, flip, pin_assign, dfp, ufp, dp;
>>>> +
>>>> +       ufp = extcon_get_cable_state_(edev, EXTCON_USB);
>>>> +       dfp = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
>>>> +       dp = extcon_get_cable_state_(edev, EXTCON_DISP_DP);
>>>> +       flip = extcon_get_cable_state_(edev, EXTCON_TYPEC_POLARITY);
>>>> +       pin_assign = extcon_get_cable_state_(edev,
>>>> EXTCON_TYPEC_PIN_ASSIGN);
>>>> +
>>>> +       plugged = ufp | dfp | dp;
>>>> +       tcphy->flip = flip;
>>>> +
>>>> +       if (plugged) {
>>>> +               if (ufp) {
>>>> +                       mode = MODE_UFP_USB;
>>>> +               } else if (dfp && !dp) {
>>>> +                       mode = MODE_DFP_USB;
>>>> +               } else if (dfp && dp) {
>>>> +                       mode = MODE_DFP_USB | MODE_DFP_DP;
>>>> +                       tcphy->pin_assign = pin_assign ? PIN_MAP_D :
>>>> PIN_MAP_B;
>>>> +               } else {
>>>> +                       mode = MODE_DFP_DP;
>>>> +                       tcphy->pin_assign = pin_assign ? PIN_MAP_C :
>>>> PIN_MAP_A;
>>> I am having trouble extracting pin_assign from our code. What
>>> determines if map A or C should be selected ?
>>>
>>> Thanks,
>>> Guenter
>> Oh, forgot rename the macro:
>>
>> PIN_MAP_ should be PIN_ASSIGN_
>>
>>
>>   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),
>>    if detached, it get the default Assignment: A(for DP only mode) or B(for
>> DP alt mode),.
>>
> So we are really talking about DP only vs. DP Alt mode ? If so, do we
> even need PIN_ASSIGN ? Why not just use EXTCON_DISP_DP_ALT directly ?
>
> Also, I'll have to get a better understanding what "DP only mode" and
> "DP Alt mode" actually means. DisplayPort is already a Type-C
> alternate mode, so the terminology is a bit confusing. Do you happen
> to have a description somewhere, by any chance ?
>
> Thanks,
> Guenter
The Pin Assignments is come from:
VESA DisplayPort Alt Mode on USB Type-C Standard

There are 2 mode for DP: DP only mode, and DP+USB3 mode(EXTCON_DISP_DP_ALT )
At DP only mode, DP has 4 lanes of Type-C;
At DP+USB3 mode, DP has 2 lanes, and USB3 has the other 2 lanes.

For DP only mode, there are 3 kind of pin assignments: A, C, E.
For DP + USB3 mode, there are 3 kind of pin assignments: B, D, F.

Pin Assignments C and D use the same assignments as Pin Assignments E and F.
Thence, we just need to distinguish A and C for DP only mode.
and distinguish B and D for DP + USB3 mode.
That why the phy need a PIN_ASSIGN cable.


The name of "DP Alt mode", it is DP+USB3 mode, actually.
I think if the name makes anyone confused, it can be changed to DP_USB3 mode:
The cable list could be:
EXTCON_DISP_DP
EXTCON_DISP_DP_USB3


>
>> I am going to add a comment for describe which PIN_ASSIGN_ should be
>> selected
>> in next version, if no one disagrees the usage of cable
>>
>>
>>>
>>
>
>

WARNING: multiple messages have this Message-ID (diff)
From: zyw@rock-chips.com (Chris Zhong)
To: linux-arm-kernel@lists.infradead.org
Subject: [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399
Date: Fri, 24 Jun 2016 10:48:23 +0800	[thread overview]
Message-ID: <576C9F77.6000702@rock-chips.com> (raw)
In-Reply-To: <CABXOdTdH-jNVx1b3R+=Z712Zcs8c6q3Hq1iwt_i7foe3K3SAVw@mail.gmail.com>

Hi Guenter

On 06/24/2016 10:10 AM, Guenter Roeck wrote:
> Hi Chris,
>
> On Thu, Jun 23, 2016 at 5:34 PM, Chris Zhong <zyw@rock-chips.com> wrote:
>> Hi Guenter
>>
>>
>> On 06/24/2016 05:47 AM, Guenter Roeck wrote:
>>> Hi Chris,
>>>
>>> On Thu, Jun 23, 2016 at 5:51 AM, Chris Zhong <zyw@rock-chips.com> wrote:
>>>> Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
>>>> Type-C PHY is designed to support the USB3 and DP applications. The
>>>> PHY basically has two main components: USB3 and DisplyPort. USB3
>>>> operates in SuperSpeed mode and the DP can operate at RBR, HBR and
>>>> HBR2 data rates.
>>>>
>>>> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>>>>
>>> [ ... ]
>>>
>>>> +
>>>> +static void tcphy_get_state(struct rockchip_typec_phy *tcphy,
>>>> +                           struct extcon_dev *edev)
>>>> +{
>>>> +       int mode;
>>>> +       bool plugged, flip, pin_assign, dfp, ufp, dp;
>>>> +
>>>> +       ufp = extcon_get_cable_state_(edev, EXTCON_USB);
>>>> +       dfp = extcon_get_cable_state_(edev, EXTCON_USB_HOST);
>>>> +       dp = extcon_get_cable_state_(edev, EXTCON_DISP_DP);
>>>> +       flip = extcon_get_cable_state_(edev, EXTCON_TYPEC_POLARITY);
>>>> +       pin_assign = extcon_get_cable_state_(edev,
>>>> EXTCON_TYPEC_PIN_ASSIGN);
>>>> +
>>>> +       plugged = ufp | dfp | dp;
>>>> +       tcphy->flip = flip;
>>>> +
>>>> +       if (plugged) {
>>>> +               if (ufp) {
>>>> +                       mode = MODE_UFP_USB;
>>>> +               } else if (dfp && !dp) {
>>>> +                       mode = MODE_DFP_USB;
>>>> +               } else if (dfp && dp) {
>>>> +                       mode = MODE_DFP_USB | MODE_DFP_DP;
>>>> +                       tcphy->pin_assign = pin_assign ? PIN_MAP_D :
>>>> PIN_MAP_B;
>>>> +               } else {
>>>> +                       mode = MODE_DFP_DP;
>>>> +                       tcphy->pin_assign = pin_assign ? PIN_MAP_C :
>>>> PIN_MAP_A;
>>> I am having trouble extracting pin_assign from our code. What
>>> determines if map A or C should be selected ?
>>>
>>> Thanks,
>>> Guenter
>> Oh, forgot rename the macro:
>>
>> PIN_MAP_ should be PIN_ASSIGN_
>>
>>
>>   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),
>>    if detached, it get the default Assignment: A(for DP only mode) or B(for
>> DP alt mode),.
>>
> So we are really talking about DP only vs. DP Alt mode ? If so, do we
> even need PIN_ASSIGN ? Why not just use EXTCON_DISP_DP_ALT directly ?
>
> Also, I'll have to get a better understanding what "DP only mode" and
> "DP Alt mode" actually means. DisplayPort is already a Type-C
> alternate mode, so the terminology is a bit confusing. Do you happen
> to have a description somewhere, by any chance ?
>
> Thanks,
> Guenter
The Pin Assignments is come from:
VESA DisplayPort Alt Mode on USB Type-C Standard

There are 2 mode for DP: DP only mode, and DP+USB3 mode(EXTCON_DISP_DP_ALT )
At DP only mode, DP has 4 lanes of Type-C;
At DP+USB3 mode, DP has 2 lanes, and USB3 has the other 2 lanes.

For DP only mode, there are 3 kind of pin assignments: A, C, E.
For DP + USB3 mode, there are 3 kind of pin assignments: B, D, F.

Pin Assignments C and D use the same assignments as Pin Assignments E and F.
Thence, we just need to distinguish A and C for DP only mode.
and distinguish B and D for DP + USB3 mode.
That why the phy need a PIN_ASSIGN cable.


The name of "DP Alt mode", it is DP+USB3 mode, actually.
I think if the name makes anyone confused, it can be changed to DP_USB3 mode:
The cable list could be:
EXTCON_DISP_DP
EXTCON_DISP_DP_USB3


>
>> I am going to add a comment for describe which PIN_ASSIGN_ should be
>> selected
>> in next version, if no one disagrees the usage of cable
>>
>>
>>>
>>
>
>

  reply	other threads:[~2016-06-24  2:48 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 12:50 [v3 PATCH 0/5] Rockchip Type-C and DispplayPort driver Chris Zhong
2016-06-23 12:50 ` Chris Zhong
2016-06-23 12:50 ` Chris Zhong
2016-06-23 12:51 ` [v3 PATCH 1/5] extcon: Add Type-C and DP support Chris Zhong
2016-06-28 12:26   ` Chanwoo Choi
2016-06-28 16:33     ` Guenter Roeck
     [not found]       ` <CAGTfZH1ciu33btOAkwwA+8pUV=5-XDus-Q_wNiv_hwRoLK5dPw@mail.gmail.com>
     [not found]         ` <CAGTfZH1ciu33btOAkwwA+8pUV=5-XDus-Q_wNiv_hwRoLK5dPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-06-29  2:08           ` Guenter Roeck
2016-06-29  2:08             ` Guenter Roeck
2016-07-06 20:22           ` Guenter Roeck
2016-07-06 20:22             ` Guenter Roeck
2016-07-11 14:30             ` Chanwoo Choi
2016-06-23 12:51 ` [v3 PATCH 2/5] Documentation: bindings: add dt doc for Rockchip USB Type-C PHY Chris Zhong
2016-06-23 12:51   ` Chris Zhong
     [not found]   ` <1466686264-6744-3-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-06-24 19:19     ` Rob Herring
2016-06-24 19:19       ` Rob Herring
2016-06-24 19:19       ` Rob Herring
2016-06-23 12:51 ` [v3 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399 Chris Zhong
2016-06-23 12:51   ` Chris Zhong
     [not found]   ` <1466686264-6744-4-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-06-23 12:57     ` Kishon Vijay Abraham I
2016-06-23 12:57       ` Kishon Vijay Abraham I
2016-06-23 12:57       ` Kishon Vijay Abraham I
2016-06-24 19:39       ` Heiko Stuebner
2016-06-24 19:39         ` Heiko Stuebner
2016-06-27  2:19         ` Chris Zhong
2016-06-27  2:19           ` Chris Zhong
2016-06-27  4:01           ` Guenter Roeck
2016-06-27  4:01             ` Guenter Roeck
2016-06-27  4:39             ` Chris Zhong
2016-06-27  4:39               ` Chris Zhong
2016-06-23 17:23   ` Guenter Roeck
2016-06-23 17:23     ` Guenter Roeck
2016-06-23 21:47   ` Guenter Roeck
2016-06-23 21:47     ` Guenter Roeck
2016-06-24  0:34     ` Chris Zhong
2016-06-24  0:34       ` Chris Zhong
2016-06-24  2:10       ` Guenter Roeck
2016-06-24  2:10         ` Guenter Roeck
2016-06-24  2:48         ` Chris Zhong [this message]
2016-06-24  2:48           ` Chris Zhong
2016-06-23 12:51 ` [v3 PATCH 4/5] Documentation: bindings: add dt documentation for cdn DP controller Chris Zhong
2016-06-23 12:51   ` Chris Zhong
2016-06-23 12:51   ` Chris Zhong
2016-06-24 19:20   ` Rob Herring
2016-06-24 19:20     ` Rob Herring
2016-06-24 19:20     ` Rob Herring
2016-06-23 12:51 ` [v3 PATCH 5/5] drm/rockchip: cdn-dp: add cdn DP support for rk3399 Chris Zhong
2016-06-23 12:51   ` Chris Zhong
2016-06-23 12:51   ` Chris Zhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576C9F77.6000702@rock-chips.com \
    --to=zyw@rock-chips.com \
    --cc=cw00.choi@samsung.com \
    --cc=dianders@chromium.org \
    --cc=groeck@chromium.org \
    --cc=groeck@google.com \
    --cc=heiko@sntech.de \
    --cc=kever.yang@rock-chips.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=tfiga@chromium.org \
    --cc=yzq@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.