[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200207015907.242991-10-bryan.odonoghue@linaro.org>
Date: Fri, 7 Feb 2020 01:58:58 +0000
From: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
To: linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org,
gregkh@...uxfoundation.org, jackp@...eaurora.org, balbi@...nel.org,
bjorn.andersson@...aro.org
Cc: linux-kernel@...r.kernel.org,
Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Andy Gross <agross@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Philipp Zabel <p.zabel@...gutronix.de>
Subject: [PATCH v4 09/18] usb: dwc3: qcom: Override VBUS when using gpio_usb_connector
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@...nel.org>
Cc: Bjorn Andersson <bjorn.andersson@...aro.org>
Cc: Lee Jones <lee.jones@...aro.org>
Cc: Felipe Balbi <balbi@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Philipp Zabel <p.zabel@...gutronix.de>
Cc: linux-arm-msm@...r.kernel.org
Cc: linux-usb@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Acked-by: Felipe Balbi <balbi@...nel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
---
drivers/usb/dwc3/dwc3-qcom.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 261af9e38ddd..b2d20b474029 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -550,6 +550,21 @@ 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;
+ bool retval = false;
+
+ np = of_get_child_by_name(pdev->dev.of_node, "connector");
+ if (np) {
+ if (of_device_is_compatible(np, "gpio-usb-b-connector"))
+ retval = true;
+ }
+ of_node_put(np);
+
+ return retval;
+}
+
static int dwc3_qcom_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
@@ -557,7 +572,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 +664,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
Powered by blists - more mailing lists