[0/5] usb: typec: ucsi: Support for DP alt mode
mbox series

Message ID 20190201104758.1483-1-heikki.krogerus@linux.intel.com
Headers show
Series
  • usb: typec: ucsi: Support for DP alt mode
Related show

Message

Heikki Krogerus Feb. 1, 2019, 10:47 a.m. UTC
Hi,

I was reluctant to add the support for alternate modes to the UCSI
driver because of problems that I'll explain below, and also because
of the fact that there is no guarantee that the firmware even allows
the operating system to know about the alternate modes (the feature is
optional in UCSI spec.), but now it seems we really have to propose
something.

In this proposal I'll introduce a DP alt mode "wrapper" code to the
UCSI driver. That code will translate the DP alt mode specific VDMs
into commands that UCSI understands. I got a lot of help from Ajay and
also Michael when implementing this. Guys! Once you are happy with
the code, please give the series your "Tested-by" tag.

As UCSI does not support VDM reading nor writing, every alternate mode
will have to be separately supported in UCSI driver. There is no
support for even the standard Attention VDM, so getting events from
the partner will not be possible. That may create difficulties with
some alt modes. Support for alternate modes in UCSI is in general very
limited.

The biggest problem comes from the fact that, as UCSI is just an
interface to a firmware, we are forced to live with the quality of the
firmware implementation. This is nothing new, but with the alternate
modes the situation is really bad. It would appear that there is no
real requirement for the feature in Microsoft Windows, and that means
the feature may not have been validated at all.

I've tested several different x86 machines that support the alt mode
feature in UCSI. Responses to some of the alt mode specific UCSI
commands may differ (UCSI spec leaves room for interpretation), and
there are clear bugs in the firmware implementation. It would also
appear the support in firmware has often been implement with a help of
only one DP adapter, making that the only adapter that the machine
appears to work with, even when in reality other adapters are working
just fine :-(.

I'm trying to work around some of those problems in these patches
(I sure hope I'm not opening a can of worms with this series).

thanks,


Heikki Krogerus (5):
  usb: typec: displayport: Move the Configuration VDO helpers to the
    header
  usb: typec: Prepare alt mode enter/exit reporting for UCSI alt mode
    support
  usb: typec: ucsi: Remove debug.h file
  usb: typec: ucsi: Preliminary support for alternate modes
  usb: typec: ucsi: Support for DisplayPort alt mode

 drivers/usb/typec/altmodes/displayport.c |   4 -
 drivers/usb/typec/class.c                |   2 +-
 drivers/usb/typec/ucsi/Makefile          |  15 +-
 drivers/usb/typec/ucsi/debug.h           |  65 ----
 drivers/usb/typec/ucsi/displayport.c     | 301 ++++++++++++++++++
 drivers/usb/typec/ucsi/trace.c           |  71 +++++
 drivers/usb/typec/ucsi/trace.h           |  33 +-
 drivers/usb/typec/ucsi/ucsi.c            | 369 +++++++++++++++++++----
 drivers/usb/typec/ucsi/ucsi.h            |  93 ++++++
 include/linux/usb/typec_dp.h             |   4 +
 10 files changed, 814 insertions(+), 143 deletions(-)
 delete mode 100644 drivers/usb/typec/ucsi/debug.h
 create mode 100644 drivers/usb/typec/ucsi/displayport.c