Message ID | 20231216034335.242168-2-badhri@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-2033-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp19305dyi; Fri, 15 Dec 2023 19:44:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFdqzWinv+7SVCKNdTXD/T6Z6it2zBmR/sTFp8moT89hP8AFJBzjmpudXq8QQVjXaB/scm X-Received: by 2002:a05:620a:40ca:b0:77f:b027:8aaf with SMTP id g10-20020a05620a40ca00b0077fb0278aafmr2733346qko.97.1702698259306; Fri, 15 Dec 2023 19:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702698259; cv=none; d=google.com; s=arc-20160816; b=VaJAyXjNPMrZgHXl/znDpPID/4P43WjyVDOKYHWqVb/XnyKxN3b9k9A0jsHxHXWrdy 52Y18cbbhkpMGxY31lGX2vQRxRBIH3v1goyfkakTzbxDj/T1+L+TsKYr1pRZbareL5wm zP0uvBWEbzbVeTg9J22wlvpEhwuOX/ZGcQYh1GBuAw6uXpt/yoALHaN7V1rkewFaxQ26 5+Qmrj/uRC/ralO4mAA/Z8FjtgrGXZCfwuvpK4eKe8Os763lGSyo1LSeLjT0lex63Q8E aZudlKqB8SQlNkeE97saEb8Szc7AXbeG4EOL4Cv3gysu1hbcxH+3VeiONcH4IkGOagUZ MqDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=ejamfelkmThXdmiMH7xDujYdMZ8xHKUQpSO5wh3pdx0=; fh=Cvtd4F/XzjLnQIT7tSgEEZzX8aMBtsloIRz7/SeSFVk=; b=ii3kq6yK0jYEFR3xZsfkIsGamfKlpyy3l9FQuxIeBq3vmMoQ1S5X3aD5tOBX5N6y6a oN9nxqnNBBp6Ekj5lv22zbTyIZad9iJBWo1o6o9akxrs+dv29t6gkzx8ZQLX4Ky2zsgE s/ECNZtztgvo64wKsHx0ttS4eU8SwNlE67ArKOo2GY5Qht8/3g/nsFMdN7pViJrni1nK py0r+ameM6PZhEnMdJw2hiusL7F2G+j3sDgM54xKXKqCgSGi9JVK80sJQzpYlAPn+tEM 7cW0NMJP5M6u4JvBmd8LvKofXK+ZYN7PjKe6XlaQJuXibFrUaU1B3sreDz/6SoatnJtN BZYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Eceb7rIs; spf=pass (google.com: domain of linux-kernel+bounces-2033-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2033-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y11-20020a05620a44cb00b0077da5e2ff28si20798166qkp.289.2023.12.15.19.44.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 19:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2033-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Eceb7rIs; spf=pass (google.com: domain of linux-kernel+bounces-2033-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2033-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 191261C24AA1 for <ouuuleilei@gmail.com>; Sat, 16 Dec 2023 03:44:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 190E01118B; Sat, 16 Dec 2023 03:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Eceb7rIs" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37242883E for <linux-kernel@vger.kernel.org>; Sat, 16 Dec 2023 03:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--badhri.bounces.google.com Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-5ca4ee5b97aso699924a12.1 for <linux-kernel@vger.kernel.org>; Fri, 15 Dec 2023 19:43:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702698222; x=1703303022; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ejamfelkmThXdmiMH7xDujYdMZ8xHKUQpSO5wh3pdx0=; b=Eceb7rIs8bM69TfukcjBZoKCRWgojJkHk2deH7sbI/fLDd6VdOVB0R3oTceh1flGK/ jgLqX5cXX58F1nZzb5BSg0YbtJjIpG4y3sg56fzFjqBGGPN+/uEQkQSvCIp4peFvqV53 ih4mR3X9Tq51oVOdHQIU2XIvHI2m7wHVApqKR1SgnWtqJKOGp6W4U8H89Y2Y0qHPxtXM 0EZpTnDlVeDFnVff1QpawbslBDVXrqjDPXrdfYlbd2iRntQiad71Ni06xMSpTBNFix6o 1lXj3bd7PLLDuIjELtk/tMz/si98zwkIwpR0tzAHz76jYLORJz9WSjSP6YZ9pHJPJNL9 L6ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702698222; x=1703303022; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ejamfelkmThXdmiMH7xDujYdMZ8xHKUQpSO5wh3pdx0=; b=hFdce/Vj/dFyGTab+wDfWBgAIb6kx0r+5F3VC9b2890vtqcd4cpkUqYGAzGgS8XAUf U+99+nykjEgDqATjOe8epAMua0HL1pBSTH5rmMgX3NWWt2lSlFBghgTBzU1G06Vx3knc bCK80Ejje3eoR49gM5o5WSA49Udx/EGrNrl4J1ZJem79syN4qO2hoq1SVK9TvFacuCPn oRRCTsvvmHZ2ofHh1ucI7Hd1vc6AxY2gDV1u/bN7/xmKFBs+/EFYgJXvWtUgymWzl0Gs ZNDLruzEb7wOJIO8f25VQ9fELwyhh5Tvo2XsLKRxvjQLgcXBOvQ9kgwjdf4ddCZ2EqHi 8Cxg== X-Gm-Message-State: AOJu0YzBSHYT0WpsgYa3Ar/qNI/ADXZBBM0xCHSGwD8XnKhoJpY8m8EL B/MAogUjYiW4RenPmRhj0HrXUNDSIjQ= X-Received: from badhri.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:6442]) (user=badhri job=sendgmr) by 2002:a63:5c07:0:b0:5ca:4440:234c with SMTP id q7-20020a635c07000000b005ca4440234cmr738217pgb.12.1702698222327; Fri, 15 Dec 2023 19:43:42 -0800 (PST) Date: Sat, 16 Dec 2023 03:43:35 +0000 In-Reply-To: <20231216034335.242168-1-badhri@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20231216034335.242168-1-badhri@google.com> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231216034335.242168-2-badhri@google.com> Subject: [PATCH v1 2/2] usb: gadget: Retry populating usb-psy when null From: Badhri Jagan Sridharan <badhri@google.com> To: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org, raychi@google.com, royluo@google.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan <badhri@google.com>, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785408529980695762 X-GMAIL-MSGID: 1785408529980695762 |
Series |
[v1,1/2] usb: dwc3: Refactor usb-psy init
|
|
Commit Message
Badhri Jagan Sridharan
Dec. 16, 2023, 3:43 a.m. UTC
This patch allows populating usb-psy where usb-psy comes up
after dwc3 is probed. Retry populating usb-psy when dwc->usb_psy
is null while dwc3_gadget_vbus_draw() is executed.
Cc: stable@vger.kernel.org
Fixes: 99288de36020 ("usb: dwc3: add an alternate path in vbus_draw callback")
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
drivers/usb/dwc3/gadget.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 858fe4c299b7..b3470a5e5e26 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -3049,8 +3049,11 @@ static int dwc3_gadget_vbus_draw(struct usb_gadget *g, unsigned int mA) if (dwc->usb2_phy) return usb_phy_set_power(dwc->usb2_phy, mA); - if (!dwc->usb_psy) - return -EOPNOTSUPP; + if (!dwc->usb_psy) { + dwc3_populate_usb_psy(dwc); + if (!dwc->usb_psy) + return -EOPNOTSUPP; + } val.intval = 1000 * mA; ret = power_supply_set_property(dwc->usb_psy, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &val);