RE: [PATCH v3 10/12] staging: typec: tcpci: keep the not connecting cc line open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
> -----Original Message-----
> From: shufan_lee(李?帆) [mailto:shufan_lee@xxxxxxxxxxx]
> Sent: 2018年3月15日 15:45
> To: Jun Li <jun.li@xxxxxxx>; robh+dt@xxxxxxxxxx; mark.rutland@xxxxxxx;
> gregkh@xxxxxxxxxxxxxxxxxxx; heikki.krogerus@xxxxxxxxxxxxxxx
> Cc: a.hajda@xxxxxxxxxxx; linux@xxxxxxxxxxxx; yueyao@xxxxxxxxxx;
> o_leveque@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; dl-linux-imx
> <linux-imx@xxxxxxx>
> Subject: RE: [PATCH v3 10/12] staging: typec: tcpci: keep the not connecting
> cc line open
> 
> Hi Jun,
> 
> -----Original Message-----
> From: Jun Li [mailto:jun.li@xxxxxxx]
> Sent: Thursday, March 15, 2018 3:00 PM
> To: shufan_lee(李?帆); robh+dt@xxxxxxxxxx; mark.rutland@xxxxxxx;
> gregkh@xxxxxxxxxxxxxxxxxxx; heikki.krogerus@xxxxxxxxxxxxxxx
> Cc: a.hajda@xxxxxxxxxxx; linux@xxxxxxxxxxxx; yueyao@xxxxxxxxxx;
> o_leveque@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; dl-linux-imx
> Subject: RE: [PATCH v3 10/12] staging: typec: tcpci: keep the not connecting
> cc line open
> 
> 
> 
> > -----Original Message-----
> > From: shufan_lee(李?帆) [mailto:shufan_lee@xxxxxxxxxxx]
> > Sent: 2018年3月14日 16:59
> > To: Jun Li <jun.li@xxxxxxx>; robh+dt@xxxxxxxxxx; mark.rutland@xxxxxxx;
> > gregkh@xxxxxxxxxxxxxxxxxxx; heikki.krogerus@xxxxxxxxxxxxxxx
> > Cc: a.hajda@xxxxxxxxxxx; linux@xxxxxxxxxxxx; yueyao@xxxxxxxxxx;
> > o_leveque@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; dl-linux-imx
> > <linux-imx@xxxxxxx>
> > Subject: RE: [PATCH v3 10/12] staging: typec: tcpci: keep the not
> > connecting cc line open
> >
> > Hi Jun,
> >
> > -----Original Message-----
> > From: Li Jun [mailto:jun.li@xxxxxxx]
> > Sent: Tuesday, March 13, 2018 5:35 PM
> > To: robh+dt@xxxxxxxxxx; mark.rutland@xxxxxxx;
> > gregkh@xxxxxxxxxxxxxxxxxxx; heikki.krogerus@xxxxxxxxxxxxxxx
> > Cc: a.hajda@xxxxxxxxxxx; jun.li@xxxxxxx; linux@xxxxxxxxxxxx;
> > yueyao@xxxxxxxxxx; shufan_lee(李?帆); o_leveque@xxxxxxxxx;
> > linux-usb@xxxxxxxxxxxxxxx; linux-imx@xxxxxxx
> > Subject: [PATCH v3 10/12] staging: typec: tcpci: keep the not
> > connecting cc line open
> >
> > While set polarity, we should keep the not connecting cc line to be
> > open when attached.
> >
> > Signed-off-by: Li Jun <jun.li@xxxxxxx>
> > ---
> >  drivers/staging/typec/tcpci.c | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/typec/tcpci.c
> > b/drivers/staging/typec/tcpci.c index
> > 9a230c6..6fdb179 100644
> > --- a/drivers/staging/typec/tcpci.c
> > +++ b/drivers/staging/typec/tcpci.c
> > @@ -185,6 +185,7 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,
> >        enum typec_cc_polarity polarity)  {  struct tcpci *tcpci =
> > tcpc_to_tcpci(tcpc);
> > +unsigned int reg;
> >  int ret;
> >
> >  ret = regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, @@ -193,7 +194,17
> > @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc,  if (ret < 0)
> > return ret;
> >
> > -return 0;
> > +/* Set the not connected cc line open */ ret =
> > +regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, &reg); if (ret < 0) return
> > +ret; if (polarity == TYPEC_POLARITY_CC2) ret =
> > +TCPC_ROLE_CTRL_CC1_SHIFT; else ret = TCPC_ROLE_CTRL_CC2_SHIFT; reg
> |=
> > +TCPC_ROLE_CTRL_CC_OPEN << ret; reg &= ~TCPC_ROLE_CTRL_DRP; return
> > +regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg);
> >  }
> >
> >  static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
> > --
> > 2.7.4
> >
> >   I applied all of your patches and tested with RT1711H.
> >   I met a case as following:
> >   1. The state machine starts toggling with RC.CCx = Rp/Rp
> >   2. Connect to adapter with an A2C cable
> >   3. open/open is received after setting RC.DRP to 0. Because RC.CCx
> > is Rp/Rp while setting RC.DRP to 0 and the connected A2C cable is a cable
> with Rp.
> >
> 
> What's the RC.CCx value before setting RC.DRP in your case?
> It is Rp/Rp, i.e. reg0x1A = 0x4A
> 
> I suppose the RC.CCx should be updated accordingly by TCPC (and its firmware),
> RT1711H still keep the starting value after detected a Rp?
> Yes, according to TCPCI's spec, upon connection, the TCPC shall resolve to
> either an Rp or Rd and report the CC1/CC2 State in the CC_STATUS register.
> It seems like we only need to present correct role and report to CC_STATUS
> register but not necessary to report the role to RC.CCx.
> So, RT1711H's firmware only present Rd and report it to reg0x1D(CC_STATUS)
> but not change the value of reg0x1A (RC.CCx).
> 

Know your situation, seems we need set cc after attach only for drp toggling case.
I will update this patch, thanks.

Jun

> >   According to TCPCI's specification, Figure 4-20. DRP Initialization
> > and Connection Detection, we need to set RC.CCx before setting RC.DRP to 0.
> >
> >   ConnectionDetermine CC & VCONN
> >     - Set RC.CC1 & RC.CC2 per decision
> >     - Set RC.DRP=0
> >     - Set TCPC_CONTROl.PlugOrientation
> >     - Set PC.AutoDischargeDisconnect=1 & PC.EnableVconn
> >
> >   If I understand correctly, we'll need to do the following step
> > before setting DRP to 0.
> 
> The read out value has the correct RC.CCx in my HW, so another question is:
> without my patch of this and below change, how does your chip can work in
> this case before?
> If we don't write RC.DRP to 0 after attached, RC.CCx will not take effect.
> RT1711H will present the correct role that detected by toggling, i.e. the role
> shows in reg0x1D(CC_STATUS).
> 
> RC.DRP == 1 and RC.CCx is Rp/Rp but actually your typec chip is presenting Rd?
> (show me the RC value when set polarity without my patch) Yes, value of
> Reg0x1A(Role Control) is 0x4A.
> 
> Jun Li
> >
> > @@ -1900,6 +1901,8 @@ static int tcpm_src_attach(struct tcpm_port
> *port)
> >         if (port->attached)
> >                 return 0;
> >
> > +       tcpm_set_cc(port, tcpm_rp_cc(port));
> > +
> >         ret = tcpm_set_polarity(port, polarity);
> >         if (ret < 0)
> >                 return ret;
> > @@ -2014,6 +2017,8 @@ static int tcpm_snk_attach(struct tcpm_port
> *port)
> >         if (port->attached)
> >                 return 0;
> >
> > +       tcpm_set_cc(port, TYPEC_CC_RD);
> > +
> >         ret = tcpm_set_polarity(port, port->cc2 != TYPEC_CC_OPEN ?
> >                                 TYPEC_POLARITY_CC2 :
> > TYPEC_POLARITY_CC1);
> >         if (ret < 0)
> >
> > ************* Email Confidentiality Notice ********************
> >
> > The information contained in this e-mail message (including any
> > attachments) may be confidential, proprietary, privileged, or
> > otherwise exempt from disclosure under applicable laws. It is intended
> > to be conveyed only to the designated recipient(s). Any use,
> > dissemination, distribution, printing, retaining or copying of this
> > e-mail (including its attachments) by unintended recipient(s) is
> > strictly prohibited and may be unlawful. If you are not an intended
> > recipient of this e-mail, or believe that you have received this
> > e-mail in error, please notify the sender immediately (by replying to
> > this e-mail), delete any and all copies of this e-mail (including any
> attachments) from your system, and do not disclose the content of this e-mail
> to any other person. Thank you!
> ************* Email Confidentiality Notice ********************
> 
> The information contained in this e-mail message (including any attachments)
> may be confidential, proprietary, privileged, or otherwise exempt from
> disclosure under applicable laws. It is intended to be conveyed only to the
> designated recipient(s). Any use, dissemination, distribution, printing, retaining
> or copying of this e-mail (including its attachments) by unintended recipient(s)
> is strictly prohibited and may be unlawful. If you are not an intended recipient
> of this e-mail, or believe that you have received this e-mail in error, please
> notify the sender immediately (by replying to this e-mail), delete any and all
> copies of this e-mail (including any attachments) from your system, and do not
> disclose the content of this e-mail to any other person. Thank you!
?韬{.n?????%??檩??w?{.n???{炳???骅w*jg????????G??⒏⒎?:+v????????????"??????



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux