From patchwork Thu May 24 08:18:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 10423085 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD0D96019D for ; Thu, 24 May 2018 08:19:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF608292EE for ; Thu, 24 May 2018 08:19:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C273029302; Thu, 24 May 2018 08:19:28 +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=unavailable 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 4EEBF292EE for ; Thu, 24 May 2018 08:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965230AbeEXISg (ORCPT ); Thu, 24 May 2018 04:18:36 -0400 Received: from mga17.intel.com ([192.55.52.151]:65272 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964867AbeEXISc (ORCPT ); Thu, 24 May 2018 04:18:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2018 01:18:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,436,1520924400"; d="scan'208";a="58073597" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 24 May 2018 01:18:30 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman , Hans de Goede Cc: Andy Shevchenko , Guenter Roeck , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH v3 1/4] usb: roles: intel_xhci: Always allow user control Date: Thu, 24 May 2018 11:18:24 +0300 Message-Id: <20180524081827.37861-2-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524081827.37861-1-heikki.krogerus@linux.intel.com> References: <20180524081827.37861-1-heikki.krogerus@linux.intel.com> 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 Trying to determine the USB port type with this mux is very difficult. To simplify the situation, always allow user control, even if the port is USB Type-C port. Reviewed-by: Hans de Goede Signed-off-by: Heikki Krogerus --- .../usb/roles/intel-xhci-usb-role-switch.c | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/drivers/usb/roles/intel-xhci-usb-role-switch.c b/drivers/usb/roles/intel-xhci-usb-role-switch.c index 28102127b9d5..6e922b50b674 100644 --- a/drivers/usb/roles/intel-xhci-usb-role-switch.c +++ b/drivers/usb/roles/intel-xhci-usb-role-switch.c @@ -38,20 +38,6 @@ struct intel_xhci_usb_data { void __iomem *base; }; -struct intel_xhci_acpi_match { - const char *hid; - int hrv; -}; - -/* - * ACPI IDs for PMICs which do not support separate data and power role - * detection (USB ACA detection for micro USB OTG), we allow userspace to - * change the role manually on these. - */ -static const struct intel_xhci_acpi_match allow_userspace_ctrl_ids[] = { - { "INT33F4", 3 }, /* X-Powers AXP288 PMIC */ -}; - static int intel_xhci_usb_set_role(struct device *dev, enum usb_role role) { struct intel_xhci_usb_data *data = dev_get_drvdata(dev); @@ -127,9 +113,10 @@ static enum usb_role intel_xhci_usb_get_role(struct device *dev) return role; } -static struct usb_role_switch_desc sw_desc = { +static const struct usb_role_switch_desc sw_desc = { .set = intel_xhci_usb_set_role, .get = intel_xhci_usb_get_role, + .allow_userspace_control = true, }; static int intel_xhci_usb_probe(struct platform_device *pdev) @@ -137,7 +124,6 @@ static int intel_xhci_usb_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct intel_xhci_usb_data *data; struct resource *res; - int i; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); if (!data) @@ -150,11 +136,6 @@ static int intel_xhci_usb_probe(struct platform_device *pdev) if (!data->base) return -ENOMEM; - for (i = 0; i < ARRAY_SIZE(allow_userspace_ctrl_ids); i++) - if (acpi_dev_present(allow_userspace_ctrl_ids[i].hid, "1", - allow_userspace_ctrl_ids[i].hrv)) - sw_desc.allow_userspace_control = true; - platform_set_drvdata(pdev, data); data->role_sw = usb_role_switch_register(dev, &sw_desc);