lkml.org 
[lkml]   [2020]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 09/19] usb: dwc3: qcom: Override VBUS when using gpio_usb_connector
Date
Using the gpio_usb_connector driver also means that we are not supplying
VBUS via the SoC but by an external PMIC directly.

This patch searches for a gpio_usb_connector as a child node of the core
DWC3 block and if found switches on the VBUS over-ride, leaving it up to
the role-switching code in gpio-usb-connector to switch off and on VBUS.

Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/usb/dwc3/dwc3-qcom.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 261af9e38ddd..73f9f3bcec59 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -550,6 +550,16 @@ static const struct dwc3_acpi_pdata sdm845_acpi_pdata = {
.ss_phy_irq_index = 2
};

+static bool dwc3_qcom_find_gpio_usb_connector(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+
+ if (of_get_child_by_name(np, "gpio_usb_connector"))
+ return true;
+
+ return false;
+}
+
static int dwc3_qcom_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -557,7 +567,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
struct dwc3_qcom *qcom;
struct resource *res, *parent_res = NULL;
int ret, i;
- bool ignore_pipe_clk;
+ bool ignore_pipe_clk, gpio_usb_conn;

qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL);
if (!qcom)
@@ -649,9 +659,10 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
}

qcom->mode = usb_get_dr_mode(&qcom->dwc3->dev);
+ gpio_usb_conn = dwc3_qcom_find_gpio_usb_connector(qcom->dwc3);

- /* enable vbus override for device mode */
- if (qcom->mode == USB_DR_MODE_PERIPHERAL)
+ /* enable vbus override for device mode or GPIO USB connector mode */
+ if (qcom->mode == USB_DR_MODE_PERIPHERAL || gpio_usb_conn)
dwc3_qcom_vbus_overrride_enable(qcom, true);

/* register extcon to override sw_vbus on Vbus change later */
--
2.25.0
\
 
 \ /
  Last update: 2020-01-22 19:56    [W:0.158 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site