From patchwork Fri Feb 1 10:47:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 10792487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6751313B4 for ; Fri, 1 Feb 2019 10:48:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D86E31AB9 for ; Fri, 1 Feb 2019 10:48:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F03831BD0; Fri, 1 Feb 2019 10:48:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3AAA31AB9 for ; Fri, 1 Feb 2019 10:48:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729734AbfBAKsB (ORCPT ); Fri, 1 Feb 2019 05:48:01 -0500 Received: from mga06.intel.com ([134.134.136.31]:14407 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbfBAKsB (ORCPT ); Fri, 1 Feb 2019 05:48:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Feb 2019 02:48:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,548,1539673200"; d="scan'208";a="143354913" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 01 Feb 2019 02:47:58 -0800 From: Heikki Krogerus To: Greg Kroah-Hartman , Ajay Gupta , Michael Hsu Cc: linux-usb@vger.kernel.org Subject: [PATCH 0/5] usb: typec: ucsi: Support for DP alt mode Date: Fri, 1 Feb 2019 13:47:53 +0300 Message-Id: <20190201104758.1483-1-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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