mbox series

[v9,00/15] TCPM support for FRS and AutoDischarge Disconnect

Message ID 20200929024004.244992-1-badhri@google.com
Headers show
Series TCPM support for FRS and AutoDischarge Disconnect | expand

Message

Badhri Jagan Sridharan Sept. 29, 2020, 2:39 a.m. UTC
Hi,

Addressed three comments from v8:
1. Fixed the make dt_binding_check that Rob Herring pointed out in
   "dt-bindings: usb: Maxim type-c controller device tree binding
   document"
   https://lkml.org/lkml/2020/9/22/720

2. Moved to string based enums for new-source-frs-typec-current to
   address comments from Rob herring for:
   "dt-bindings: connector: Add property to set initial current cap
   for FRS". As a result, introduced another patch:
   "usb: typec: tcpm: Parse frs type-c current from device tree"
   to refactor tcpm code to read new-source-frs-typec-current from
   device tree. Previously this is was a uint32.
   https://lkml.org/lkml/2020/9/22/729

3. To address Heikki's comment on Auto discharge disconnect threshold
   https://lkml.org/lkml/2020/9/21/1857
   a. Removed the call to tcpm_set_auto_vbus_discharge_threshold
      from source attach path.
   b. Moved logic of setting TCPC_VBUS_SINK_DISCONNECT_THRESH_MAX to
      tcpci.c as the tcpci_maxim was actually setting the default
      values. Removed the get_auto_vbus_discharge_threshold callback
      from tcpci_data for now. Can be added later if needed.

4. Added additional patches to address an isssue where vbus was being
   left post disconnect after Fast Role Swap operation is executed.
   a. usb: typec: tcpm: frs sourcing vbus callback
   b. usb: typec: tcpci: frs sourcing vbus callback
   c. usb: typec: tcpci_max77759: Fix vbus stuck on upon diconnecting sink

Thanks,
Badhri.

Badhri Jagan Sridharan (15):
  usb: typec: tcpci: Add a getter method to retrieve tcpm_port reference
  usb: typec: tcpci: Add set_vbus tcpci callback
  dt-bindings: usb: Maxim type-c controller device tree binding document
  usb: typec: tcpci_maxim: Chip level TCPC driver
  dt-bindings: connector: Add property to set initial current cap for
    FRS
  usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)
  usb: typec: tcpci: Implement callbacks for FRS
  usb: typec: tcpci_maxim: Add support for Sink FRS
  usb: typec: tcpm: frs sourcing vbus callback
  usb: typec: tcpci: frs sourcing vbus callback
  usb: typec: tcpci_max77759: Fix vbus stuck on upon diconnecting sink
  usb: typec: tcpm: Parse frs type-c current from device tree
  usb: typec: tcpm: Implement enabling Auto Discharge disconnect support
  usb: typec: tcpci: Implement Auto discharge disconnect callbacks
  usb: typec: tcpci_maxim: Enable auto discharge disconnect

 .../bindings/connector/usb-connector.yaml     |  26 +
 .../devicetree/bindings/usb/maxim,tcpci.yaml  |  68 +++
 drivers/usb/typec/tcpm/Kconfig                |   6 +
 drivers/usb/typec/tcpm/Makefile               |  15 +-
 drivers/usb/typec/tcpm/tcpci.c                | 102 +++-
 drivers/usb/typec/tcpm/tcpci.h                |  30 +-
 drivers/usb/typec/tcpm/tcpci_maxim.c          | 504 ++++++++++++++++++
 drivers/usb/typec/tcpm/tcpm.c                 | 299 ++++++++++-
 include/dt-bindings/usb/pd.h                  |  10 +
 include/linux/usb/pd.h                        |  19 +-
 include/linux/usb/tcpm.h                      |  27 +-
 include/linux/usb/typec.h                     |  12 +
 12 files changed, 1093 insertions(+), 25 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/maxim,tcpci.yaml
 create mode 100644 drivers/usb/typec/tcpm/tcpci_maxim.c

Comments

Greg KH Oct. 2, 2020, 1:39 p.m. UTC | #1
On Mon, Sep 28, 2020 at 07:39:51PM -0700, Badhri Jagan Sridharan wrote:
> set_vbus callback allows TCPC which are TCPCI based, however,
> does not support turning on sink and source mode through
> Command.SinkVbus and Command.SourceVbusDefaultVoltage.
> 
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

This patch breaks the build, are you sure you tested it?

Can you respin it against my latest tree so that I can take the patches
that have been reviewed?

thanks,

greg k-h
Greg KH Oct. 2, 2020, 1:40 p.m. UTC | #2
On Fri, Oct 02, 2020 at 03:39:52PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Sep 28, 2020 at 07:39:51PM -0700, Badhri Jagan Sridharan wrote:
> > set_vbus callback allows TCPC which are TCPCI based, however,
> > does not support turning on sink and source mode through
> > Command.SinkVbus and Command.SourceVbusDefaultVoltage.
> > 
> > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> This patch breaks the build, are you sure you tested it?

Sorry, not this patch, patch 4:

drivers/usb/typec/tcpm/tcpci.c: In function ‘tcpci_register_port’:
drivers/usb/typec/tcpm/tcpci.c:630:13: error: ‘struct tcpc_dev’ has no member named ‘enable_frs’
  630 |  tcpci->tcpc.enable_frs = tcpci_enable_frs;
      |             ^


thanks,

greg k-h
Badhri Jagan Sridharan Oct. 2, 2020, 4:08 p.m. UTC | #3
Hi Greg,

Yes I tested it on usb-next before sending it out.

  630 |  tcpci->tcpc.enable_frs = tcpci_enable_frs;

In https://patchwork.kernel.org/project/linux-usb/list/?series=356837
i.e v9 version of this series,
Patch 7 i.e. https://patchwork.kernel.org/patch/11804847/ is where the
above line is added.

I restested in combinations [1]  [2] [3] [4]. All of them were clear
cherry-picks. I didnt any merge conflicts.

Maybe you are applying patches in a different order ?
If so can you post the git log for me to apply in the same order and test ?

Or Do you want me to rebase on top of usb-testing ?
I didnt see any merge conflicts though.

Thanks,
Badhri


[1] usb-testing all patches in series
https://patchwork.kernel.org/project/linux-usb/list/?series=356837
07684bb88ed4 (HEAD -> usb-testing) usb: typec: tcpci_maxim: Enable
auto discharge disconnect
1c97f5e32ba6 usb: typec: tcpci: Implement Auto discharge disconnect callbacks
1b829a062e6e usb: typec: tcpm: Implement enabling Auto Discharge
disconnect support
7ba4edfd9155 usb: typec: tcpm: Parse frs type-c current from device tree
01d47f2e98ba usb: typec: tcpci_max77759: Fix vbus stuck on upon
diconnecting sink
9e8ed3d8809c usb: typec: tcpci: frs sourcing vbus callback
8804a3f75563 usb: typec: tcpm: frs sourcing vbus callback
69fe6c1c7648 usb: typec: tcpci_maxim: Add support for Sink FRS
0a22d446c026 usb: typec: tcpci: Implement callbacks for FRS
93c622006aa6 usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)
14672081f2fd dt-bindings: connector: Add property to set initial
current cap for FRS
58372bd1d8e8 usb: typec: tcpci_maxim: Chip level TCPC driver
c16b09eaf60f dt-bindings: usb: Maxim type-c controller device tree
binding document
32d66c0449e1 usb: typec: tcpci: Add set_vbus tcpci callback
85e90e5054d6 usb: typec: tcpci: Add a getter method to retrieve
tcpm_port reference
97b65223c18f (origin/usb-testing) USB: core: remove polling for
/sys/kernel/debug/usb/devices
da0cb6310094 usb: typec: add support for STUSB160x Type-C controller family

[2] usb-testing: till patch4 in series
https://patchwork.kernel.org/project/linux-usb/list/?series=356837
58372bd1d8e8 (HEAD -> usb-testing) usb: typec: tcpci_maxim: Chip level
TCPC driver
c16b09eaf60f dt-bindings: usb: Maxim type-c controller device tree
binding document
32d66c0449e1 usb: typec: tcpci: Add set_vbus tcpci callback
85e90e5054d6 usb: typec: tcpci: Add a getter method to retrieve
tcpm_port reference
97b65223c18f (origin/usb-testing) USB: core: remove polling for
/sys/kernel/debug/usb/devices
da0cb6310094 usb: typec: add support for STUSB160x Type-C controller family

[3] usb-next all patches in series
https://patchwork.kernel.org/project/linux-usb/list/?series=356837
62b5171538da (HEAD -> usb-next) usb: typec: tcpci_maxim: Enable auto
discharge disconnect
ea8987805ba6 usb: typec: tcpci: Implement Auto discharge disconnect callbacks
af9a12b19352 usb: typec: tcpm: Implement enabling Auto Discharge
disconnect support
33aec604a529 usb: typec: tcpm: Parse frs type-c current from device tree
31df45f3df20 usb: typec: tcpci_max77759: Fix vbus stuck on upon
diconnecting sink
0945795f170d usb: typec: tcpci: frs sourcing vbus callback
c49080982064 usb: typec: tcpm: frs sourcing vbus callback
67a3ff254cc1 usb: typec: tcpci_maxim: Add support for Sink FRS
299582bbf78f usb: typec: tcpci: Implement callbacks for FRS
bb4eb3fb65df usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)
5aad64e80460 dt-bindings: connector: Add property to set initial
current cap for FRS
6c59a16ddee2 usb: typec: tcpci_maxim: Chip level TCPC driver
172274d3e327 dt-bindings: usb: Maxim type-c controller device tree
binding document
bdba308a7164 usb: typec: tcpci: Add set_vbus tcpci callback
66b7b0d83399 usb: typec: tcpci: Add a getter method to retrieve
tcpm_port reference
59ee364bafb2 (origin/usb-next) Merge tag 'thunderbolt-for-v5.10-rc1'
of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt
into usb-next
bf1c67449833 USB: cdc-acm: clean up no-union-descriptor handling

[4] usb-next till patch4 in series
https://patchwork.kernel.org/project/linux-usb/list/?series=356837
6c59a16ddee2 (HEAD -> usb-next) usb: typec: tcpci_maxim: Chip level TCPC driver
172274d3e327 dt-bindings: usb: Maxim type-c controller device tree
binding document
bdba308a7164 usb: typec: tcpci: Add set_vbus tcpci callback
66b7b0d83399 usb: typec: tcpci: Add a getter method to retrieve
tcpm_port reference
59ee364bafb2 (origin/usb-next) Merge tag 'thunderbolt-for-v5.10-rc1'
of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt
into usb-next
bf1c67449833 USB: cdc-acm: clean up no-union-descriptor handling


On Fri, Oct 2, 2020 at 6:40 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Fri, Oct 02, 2020 at 03:39:52PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Sep 28, 2020 at 07:39:51PM -0700, Badhri Jagan Sridharan wrote:
> > > set_vbus callback allows TCPC which are TCPCI based, however,
> > > does not support turning on sink and source mode through
> > > Command.SinkVbus and Command.SourceVbusDefaultVoltage.
> > >
> > > Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> > > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >
> > This patch breaks the build, are you sure you tested it?
>
> Sorry, not this patch, patch 4:
>
> drivers/usb/typec/tcpm/tcpci.c: In function ‘tcpci_register_port’:
> drivers/usb/typec/tcpm/tcpci.c:630:13: error: ‘struct tcpc_dev’ has no member named ‘enable_frs’
>   630 |  tcpci->tcpc.enable_frs = tcpci_enable_frs;
>       |             ^
>
>
> thanks,
>
> greg k-h
Greg KH Oct. 3, 2020, 3:57 p.m. UTC | #4
On Fri, Oct 02, 2020 at 09:08:00AM -0700, Badhri Jagan Sridharan wrote:
> Hi Greg,
> 
> Yes I tested it on usb-next before sending it out.
> 
>   630 |  tcpci->tcpc.enable_frs = tcpci_enable_frs;
> 
> In https://patchwork.kernel.org/project/linux-usb/list/?series=356837
> i.e v9 version of this series,
> Patch 7 i.e. https://patchwork.kernel.org/patch/11804847/ is where the
> above line is added.
> 
> I restested in combinations [1]  [2] [3] [4]. All of them were clear
> cherry-picks. I didnt any merge conflicts.
> 
> Maybe you are applying patches in a different order ?

I didn't think so.  Can you try applying the patches, in order, and
building after each one to see if you get the same error or not?

My usb-next branch is up to date with all of the recent patches.

thanks,

greg k-h
Badhri Jagan Sridharan Oct. 8, 2020, 6:32 a.m. UTC | #5
On Sat, Oct 3, 2020 at 8:56 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Fri, Oct 02, 2020 at 09:08:00AM -0700, Badhri Jagan Sridharan wrote:
> > Hi Greg,
> >
> > Yes I tested it on usb-next before sending it out.
> >
> >   630 |  tcpci->tcpc.enable_frs = tcpci_enable_frs;
> >
> > In https://patchwork.kernel.org/project/linux-usb/list/?series=356837
> > i.e v9 version of this series,
> > Patch 7 i.e. https://patchwork.kernel.org/patch/11804847/ is where the
> > above line is added.
> >
> > I restested in combinations [1]  [2] [3] [4]. All of them were clear
> > cherry-picks. I didnt any merge conflicts.
> >
> > Maybe you are applying patches in a different order ?
>
> I didn't think so.  Can you try applying the patches, in order, and
> building after each one to see if you get the same error or not?

Tried this as well. Not sure what I am doing differently.
Also was manually looking for "tcpci_enable_frs" in the series
and it's first occurrence is in:
"[PATCH v9 07/15] usb: typec: tcpci: Implement callbacks for FRS".

Just sent out the v10 after addressing a couple of comments from
Rob Herring.

Thanks,
Badhri


>
> My usb-next branch is up to date with all of the recent patches.
>
> thanks,
>
> greg k-h