Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2229313imu; Sat, 10 Nov 2018 10:11:50 -0800 (PST) X-Google-Smtp-Source: AJdET5cCx1E2nZ1GdrOeJezPOhX/1FDB5TvW66Idq3B3FebufdVZ0uMn71hn3dlGV1E2zvuKlGpl X-Received: by 2002:a17:902:7595:: with SMTP id j21-v6mr11994907pll.191.1541873510560; Sat, 10 Nov 2018 10:11:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541873510; cv=none; d=google.com; s=arc-20160816; b=dA20FuCE/fRjyeQ4XBnmjn4lu/97AB80ISeLjZZZmI5LSJ4W0qxTdpjin7PO14izp0 UBQAXCAXJj2bSXPe2VWou47SwP9LZJPsYj4HWVObjGhgWreRdzJKLSXaGe2D8AtVjxjc F4VHb8MRZSOsyTuzzxhwBbLAjhHEF7RqStBvwANDwy8f22NTTjo+zNj5b3RqpN0gpqA6 uFCdCx/Rkk/e1pHnUNccM2v7Szp/wsa+LNa/TCl9a3O0akiKs4HgO/upnA99qyq7Evbe m/ny9+qD1HNguyIwXWtoiVM+l4tgN8cNi/asIl1vf3ureRIGpXAA0yxOdN7MNGXH9T/c 7hUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1nPBxsEdjLXzM5I81csTPQpn/61bSb/r/4fXZRmXCnQ=; b=oeCg+wRBeqo0T0Iwjr2UW/jxhNKpXFXawAy/xXL3szxRdTghu5XmmPKEpxZkoWWbLE /3upJcXPBi/Bz4KFRTaHgrHeO0xX38gUj6MISgA7z53I+7T5Y6ViSmCnn1VEG6clCKjE wpg4Y3j1vW0cwhVdOGbPt+X1ojcrXYxd2vMatZ6cWz9wDRYRpHYRhyGzqNrH21EvQfpB 5uLIHLnBikW2DHtgdeDOShj9JolKUhVm+6hmAkWHtvBMjKPRmOraQMisJPJsX34Tqwch goA/kHujg8++9OY3D0ca5FPe/gBQrVzQAXRVFtwNEaLmj9H4W3BpX4yXL9v2ye72g3k5 jhkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91-v6si4225566ply.335.2018.11.10.10.11.34; Sat, 10 Nov 2018 10:11:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbeKKD5C (ORCPT + 99 others); Sat, 10 Nov 2018 22:57:02 -0500 Received: from mga02.intel.com ([134.134.136.20]:37029 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727068AbeKKD5B (ORCPT ); Sat, 10 Nov 2018 22:57:01 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Nov 2018 10:11:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,488,1534834800"; d="scan'208";a="107537164" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 10 Nov 2018 10:11:03 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 117037C6; Sat, 10 Nov 2018 20:11:03 +0200 (EET) From: Andy Shevchenko To: MyungJoo Ham , Chanwoo Choi , linux-usb@vger.kernel.org, Felipe Balbi , Guenter Roeck , Heikki Krogerus , Roger Quadros , linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Sebastian Reichel , linux-omap@vger.kernel.org, Darren Hart , platform-driver-x86@vger.kernel.org, Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Chen-Yu Tsai , Hans de Goede Cc: Andy Shevchenko Subject: [PATCH v1 5/5] usb: dwc3: drd: Add support for DR detection through extcon Date: Sat, 10 Nov 2018 20:11:01 +0200 Message-Id: <20181110181101.24557-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181110181101.24557-1-andriy.shevchenko@linux.intel.com> References: <20181110181101.24557-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow extcon device, found by name, to provide DR status for USB. This is needed, for example, in case of Intel Merrifield platform, where the Intel Basin Cove PMIC provides an extcon device to communicate the detected role. Note, that the "linux,extcon-name" property name is only for kernel internal use by X86/ACPI platform code and as such is not documented in the device tree bindings. Signed-off-by: Andy Shevchenko --- drivers/usb/dwc3/drd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c index 5dc4cddd5b68..d6b47829fdca 100644 --- a/drivers/usb/dwc3/drd.c +++ b/drivers/usb/dwc3/drd.c @@ -485,10 +485,20 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc) struct device *dev = dwc->dev; struct device_node *np_phy, *np_conn; struct extcon_dev *edev; + const char *name; if (device_property_read_bool(dev, "extcon")) return extcon_get_edev_by_phandle(dev, 0); + /* + * Device tree platforms should get extcon via phandle. + * On ACPI platforms, we get the name from a device property. + * This device property is for kernel internal use only and + * is expected to be set by the glue code. + */ + if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) + return extcon_get_extcon_dev(name); + np_phy = of_parse_phandle(dev->of_node, "phys", 0); np_conn = of_graph_get_remote_node(np_phy, -1, -1); -- 2.19.1