mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Cristian.Birsan@microchip.com
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Using TCPM for ports without Power Delivery support
Date: Tue, 16 Feb 2021 11:12:25 +0200	[thread overview]
Message-ID: <YCuMeW6lbaSq8CIM@kuha.fi.intel.com> (raw)
In-Reply-To: <6cf411e1-8234-d1ca-541d-067665620945@microchip.com>

Hi Cristian,

On Mon, Feb 15, 2021 at 05:25:29PM +0000, Cristian.Birsan@microchip.com wrote:
> My name is Cristian and I'm working on bringing up a USB Type-C Port Controller
> (TCPC) without Power Delivery support which is intended to work with USB 2.0
> Host/Device.
> 
> The IP is integrated into one of Microchip's SoCs, it is memory-mapped and it
> was designed based on USB Type-C Cable and Connector specification revision 1.2.
> 
> In brief, it has support for detecting the threshold voltages on CC1, CC2 lines,
> control of the current source (Ip), and pull-down resistors (Rd). The management
> of the controller is to be implemented in software (it is not autonomous).
> 
> Having in mind that the controller uses proprietary registers, I chose to
> implement it using TCPM directly and skip the TCPC Interface.
> 
> For the beginning, I would like to enable simple use cases like the ones
> described in Connection State Diagram: Source and Connection State Diagram: Sink
> from USB Type-C Cable and Connector Specification.
> 
> Some of the problems that I encountered until now are:
> 
> 1. tcpm_register_port() fails if set_pd_rx(), pd_transmit() or set_vconn()
> functions are missing.
> 
> 2. the port capabilities are specified in the connector DT bindings only through
> PDOs, even though PDOs are specific to PD mode.
> 
> 3. once I was able to start the TCPM state machine, it called pd_transmit() in
> the process to negotiate the capabilities. For my case I used a dummy function
> just to be able to register the port.
> 
> Please let me know what you think and if you have any advice. Am I going in the
> right direction or is there a better way to implement this?

Don't bother with tcpm if you don't have PD support. Just register
your port(s) and the partners directly with the connector class:
https://www.kernel.org/doc/html/latest/driver-api/usb/typec.html

You can use the driver for the TI HD3SS3220 controller as an example
how to do that (drivers/usb/typec/hd3ss3220.c). That thing is also
just USB Type-C PHY without PD support just like your port controller.


Br,

-- 
heikki

  reply	other threads:[~2021-02-16  9:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 17:25 Cristian.Birsan
2021-02-16  9:12 ` Heikki Krogerus [this message]
2021-02-17 15:28   ` Cristian.Birsan
2021-02-17 16:59     ` Guenter Roeck

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=YCuMeW6lbaSq8CIM@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=Cristian.Birsan@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®