Received: by 10.223.185.116 with SMTP id b49csp7561730wrg; Thu, 1 Mar 2018 07:27:57 -0800 (PST) X-Google-Smtp-Source: AG47ELv0kQXoWGsQvKXWVGDcpWWn9UrtjoLt3fSHhR4n/lYY8j/Qzaxwzx9kAi3HIRHgvPZtVPnq X-Received: by 10.98.102.155 with SMTP id s27mr2345526pfj.198.1519918077537; Thu, 01 Mar 2018 07:27:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519918077; cv=none; d=google.com; s=arc-20160816; b=VLkztOcCcTSRWjvOLSWJWBRy3pz7dTLd+YGBG/Pwp9+/L+qWhIxsugFU3eiKLQ9kB0 qo5jsXsukBVkjM2++wEFUdHF44YSOr51E/OoSmFDK4QrjR1L9q3sxP+N0nqifwjgewwL BX7IA0fhZ+2t0aJurpfMizLXxyoYmADsPlBlQeAg8tgot4EuzhplzqZ48g8eFoxJc72D RCi0MVRL7vo+AB8XYAoS5/x7Z7dcDrr/QfdBKYpQeNKoauwxXQWumm1hJ7qGYy5ilh3A HnuxDpe2OjDiNvjuAxrd9+07KGMouVqWH8A5nyjhZMyv1kq5hqakZTQR0eXpJv7a0oDB wrGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=DlxoGW4FLd5ZAODkUX+vt3GrY0l7nMV3bBkAvIG2WWE=; b=u8zJXnwaycJmxUh11WQx7pZKJJDeBcvGZrp3lW1euWCU0DsVYd4IgDvQMP2pQyH5/n gA2kWcK6Cb/sqfyl3Xkh9KDdc4+Lvb0qqFDtPeUpfS/Y3sostYOEpY93emEtVyrYmOMv 1Q/Vw0xFFrw02f9EweoR0tpSkHxDp20ztAUx1WKrK1Ubgnvv4GHy+LnaDWLzdj/nTmzt VQOmL4Nhdo/sSpjiYk3xdOp5HpFG/EhuxYecJ/g8jBGSboN4eaZLq7UbuV3p9MfDkBET W4IHIQZyqxHQpZszdEiCT3oV+ORMOuykQLllDzYaLBW+dDKIz7LtZwblXe22hMD0BncN DmqA== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12-v6si3232265plk.508.2018.03.01.07.27.42; Thu, 01 Mar 2018 07:27:57 -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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032043AbeCAPZa (ORCPT + 99 others); Thu, 1 Mar 2018 10:25:30 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:41016 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031977AbeCAPZ0 (ORCPT ); Thu, 1 Mar 2018 10:25:26 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id B0DBB27546A From: Enric Balletbo i Serra To: kishon@ti.com, heiko@sntech.de Cc: groeck@chromium.org, gwendal@chromium.org, kernel@collabora.com, vicencb@gmail.com, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing. Date: Thu, 1 Mar 2018 16:25:10 +0100 Message-Id: <20180301152515.20940-2-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180301152515.20940-1-enric.balletbo@collabora.com> References: <20180301152515.20940-1-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Right now the rockchip type-c phy does fail probing when no extcon is detected. Some boards get the cable-state via the extcon interface and have this supported, other boards seem to use the fusb302 chip or another but the driver currently does not seem to utilize the extcon interface to report the cable-state. And, other, just connect the type-c to a standard USB-A port so use no controller at all. A missing extcon shouldn't fail to probe, instead, should just fall back to working in host-mode if it cannot get the extcon. Fixes: c301b327aea898af ("arm64: dts: rockchip: add usb3-phy otg-port support for rk3399") Reported-by: Vicente Bergas Signed-off-by: Enric Balletbo i Serra --- Changes in v2: - [1/6] Keep the error handling of extcon (Heiko Stubner) drivers/phy/rockchip/phy-rockchip-typec.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c index 7492c8978217..e260067d2c98 100644 --- a/drivers/phy/rockchip/phy-rockchip-typec.c +++ b/drivers/phy/rockchip/phy-rockchip-typec.c @@ -782,6 +782,9 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy) u8 mode; int ret; + if (!edev) + return MODE_DFP_USB; + ufp = extcon_get_state(edev, EXTCON_USB); dp = extcon_get_state(edev, EXTCON_DISP_DP); @@ -1115,9 +1118,13 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev) tcphy->extcon = extcon_get_edev_by_phandle(dev, 0); if (IS_ERR(tcphy->extcon)) { - if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER) - dev_err(dev, "Invalid or missing extcon\n"); - return PTR_ERR(tcphy->extcon); + if (PTR_ERR(tcphy->extcon) == -ENODEV) { + tcphy->extcon = NULL; + } else { + if (PTR_ERR(tcphy->extcon) != -EPROBE_DEFER) + dev_err(dev, "Invalid or missing extcon\n"); + return PTR_ERR(tcphy->extcon); + } } pm_runtime_enable(dev); -- 2.16.1