All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
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 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
Date: Thu,  1 Mar 2018 10:24:15 +0100	[thread overview]
Message-ID: <20180301092420.1191-2-enric.balletbo@collabora.com> (raw)
In-Reply-To: <20180301092420.1191-1-enric.balletbo@collabora.com>

Right now the rockchip typec-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. That's required to detect
cable-state changes but 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 <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 7492c8978217..3741afab5cd2 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,9 @@ 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) == -EPROBE_DEFER)
+			return PTR_ERR(tcphy->extcon);
+		tcphy->extcon = NULL;
 	}
 
 	pm_runtime_enable(dev);
-- 
2.16.1

WARNING: multiple messages have this Message-ID (diff)
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: kishon@ti.com, heiko@sntech.de
Cc: gwendal@chromium.org, linux-kernel@vger.kernel.org,
	vicencb@gmail.com, linux-rockchip@lists.infradead.org,
	groeck@chromium.org, kernel@collabora.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
Date: Thu,  1 Mar 2018 10:24:15 +0100	[thread overview]
Message-ID: <20180301092420.1191-2-enric.balletbo@collabora.com> (raw)
In-Reply-To: <20180301092420.1191-1-enric.balletbo@collabora.com>

Right now the rockchip typec-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. That's required to detect
cable-state changes but 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 <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 7492c8978217..3741afab5cd2 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,9 @@ 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) == -EPROBE_DEFER)
+			return PTR_ERR(tcphy->extcon);
+		tcphy->extcon = NULL;
 	}
 
 	pm_runtime_enable(dev);
-- 
2.16.1

WARNING: multiple messages have this Message-ID (diff)
From: enric.balletbo@collabora.com (Enric Balletbo i Serra)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing.
Date: Thu,  1 Mar 2018 10:24:15 +0100	[thread overview]
Message-ID: <20180301092420.1191-2-enric.balletbo@collabora.com> (raw)
In-Reply-To: <20180301092420.1191-1-enric.balletbo@collabora.com>

Right now the rockchip typec-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. That's required to detect
cable-state changes but 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 <vicencb@gmail.com>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---

 drivers/phy/rockchip/phy-rockchip-typec.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index 7492c8978217..3741afab5cd2 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,9 @@ 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) == -EPROBE_DEFER)
+			return PTR_ERR(tcphy->extcon);
+		tcphy->extcon = NULL;
 	}
 
 	pm_runtime_enable(dev);
-- 
2.16.1

  reply	other threads:[~2018-03-01  9:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-01  9:24 [PATCH 0/6] phy: rockchip-typec: fix boards that does not report cable-state Enric Balletbo i Serra
2018-03-01  9:24 ` Enric Balletbo i Serra
2018-03-01  9:24 ` Enric Balletbo i Serra
2018-03-01  9:24 ` Enric Balletbo i Serra [this message]
2018-03-01  9:24   ` [PATCH 1/6] phy: rockchip-typec: fall back to working in host-mode if extcon is missing Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:45   ` Heiko Stübner
2018-03-01  9:45     ` Heiko Stübner
2018-03-01 12:15     ` Enric Balletbo i Serra
2018-03-01 12:15       ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 2/6] dt-bindings: phy-rockchip-typec: move extcon property to be optional Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:49   ` Heiko Stübner
2018-03-01  9:49     ` Heiko Stübner
2018-03-01  9:49     ` Heiko Stübner
2018-03-01  9:24 ` [PATCH 3/6] arm64: dts: rockchip: enable typec-phy for rk3399-sapphire Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 4/6] arm64: dts: rockchip: enable typec-phy for rk3399-firefly Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 5/6] arm64: dts: rockchip: enable typec-phy1 for rk3399-puma Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra
2018-03-01  9:24 ` [PATCH 6/6] arm64: dts: rockchip: enable typec-phy0 for rk3399-puma-haikou Enric Balletbo i Serra
2018-03-01  9:24   ` Enric Balletbo i Serra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180301092420.1191-2-enric.balletbo@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=heiko@sntech.de \
    --cc=kernel@collabora.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=vicencb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.