From patchwork Tue Jan 23 22:51:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 765580 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2053.outbound.protection.outlook.com [40.107.8.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91BDF537E4; Tue, 23 Jan 2024 22:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.8.53 ARC-Seal: i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706050306; cv=fail; b=naHNZ8MRnP4lWpE2wkS9+GsBt/5YJgQJrTfNN8dDhZgw85jyegOkB3aEmiRMMiulmR6xBCFe7CHUrM1Nm3VkMIZ0JICDL1rb2hyUkzXbryGDAktAGSMJKmRINyuruPV79CsOZK8f246AjYLeyZrqwMlvjYTEaCw9pfUjP5ut5lA= ARC-Message-Signature: i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706050306; c=relaxed/simple; bh=BL+wCyu069pdREzTeNtCL3sbaTqIbGofOlCKB74fXJU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=WqfOUUCoL20j052cpwK4OYPPjObwHqGShELuGl0lBFB2bSOAoaEp9jl/xv3kTp6b/7xWhwBeZIwMVSmOmjsjm/qYO2QLjg7Y33ffznTNVSdKRMAFxXGrnT/hjY1ruSe3eoD5sNJ7wlvZUQxG326t9tycNBL2byf5rBkXRaJct98= ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=seco.com; spf=pass smtp.mailfrom=seco.com; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b=ousD+g98; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b=ousD+g98; arc=fail smtp.client-ip=40.107.8.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=seco.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seco.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b="ousD+g98"; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b="ousD+g98" ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Q0zLBxnPwkDeg9Qk4jlfBFNCuoVmGJr7nqtu/0vu2qijMIyue6vCvWUz8OGV7lFE0y1CD8yqEmpUefDhX0q82bduFNXePOwtD/xJMJIclfjqAWF6L7M3TdHzshkMsjvBAsu/H7h0k7b5ez4q0b9fRcMn9wAPr9UFmeIcZZa80/JfzWuif9c0ZwNg5QkqkFisQH+hwy/yARjYWQv+mGXlC7wjSl5Zsa1X6/T0zewMWs30fxnkC2RJsrjNfMLFWt4tVeXS7k4c2l+Q+R0WmM6SV9yZA3YXFF5C+CmaeYkJFbhW019s9uZn6Z6Ydk1jfs968N7BDftAwOjPABwHZXoLDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Xn3bdx/1ViQbIcXUPw4qs/B3XhdCQuZ0mCdbfnFzMa8=; b=bIhX8gJLz+fFCNhzDOiUH3rJKKg5LmhE3nt4DWZQQRpEjCg7eGEvP+sycRg6FWwpVQ70LrM/qXDfW2Fdbqmz/P4u5WN9oseDqzSn+N8RjRnsBtX3yP9GyTNgWCXjOJv9IbOWogAgxmAdI7sw2vGBhO0bk2Gra487eymu1GOd0DKlvm6aSsAf1pASu7keG3N8Biy/oeb5qSdnGwEh1rezQ0Eeq+7VdQedv/neyVB4RCIVeRWFWQS2gDu8iIpuPpekkUjDu4sPA03XnpQb4awKcdG5i0B1WEGs46i9/rVU1wOATQDj0FWKjxd3SgkMazoA6LxYlIiyLn+633DFWK8yMQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 20.160.56.84) smtp.rcpttodomain=free.fr smtp.mailfrom=seco.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=seco.com; dkim=pass (signature was verified) header.d=seco.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=seco.com] dkim=[1,1,header.d=seco.com] dmarc=[1,1,header.from=seco.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xn3bdx/1ViQbIcXUPw4qs/B3XhdCQuZ0mCdbfnFzMa8=; b=ousD+g98gJ4zU67AXppLHY68jtALzY6b8fogFBJaRaB79YL8y9If4SI7DK/uGLSEiypYqJ1D7y1j1x5H0HchSDwyCheizBPcm2/IqWgLgl7MD1QbN14Sb+GLluKk8xm5bGAxJfLnGblIC8IjUNIsdhMheNzXqDau3ZfVUjXEeTrPBhgSrpbvzK3oS8UYP50AGjDdyJEglrHLFuLwrfaz1gi9JOSz9dfcAmGWXpgROuGuBPRSf6kN+MEkrL9h89yh2lKv5N0sbjuiW6joL5FO4s6Ly7b9ZD4q8ABhZ0Hi+NpiyEXE37OE+FGZnLca2hlst5aS4qGrOgkvhWxcXwWznQ== Received: from FR3P281CA0174.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::17) by AM9PR03MB6900.eurprd03.prod.outlook.com (2603:10a6:20b:2de::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 22:51:40 +0000 Received: from VI1EUR05FT062.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:a0:cafe::93) by FR3P281CA0174.outlook.office365.com (2603:10a6:d10:a0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22 via Frontend Transport; Tue, 23 Jan 2024 22:51:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.84) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.84 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.84; helo=repost-eu.tmcas.trendmicro.com; pr=C Received: from repost-eu.tmcas.trendmicro.com (20.160.56.84) by VI1EUR05FT062.mail.protection.outlook.com (10.233.243.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.21 via Frontend Transport; Tue, 23 Jan 2024 22:51:40 +0000 Received: from outmta (unknown [192.168.82.135]) by repost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id E731A20083980; Tue, 23 Jan 2024 22:51:39 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (unknown [104.47.17.168]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 246332008006E; Tue, 23 Jan 2024 22:51:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nrkiRKitTE/4uPkUeaqQ5Z/Xs63SCgETD4MxAHI+POqlPtw4qyu0mEKUFX6uvJDD2HeJ8dnGLTowg6Db9RmK1q7MgG6TIvcuayzA78pJllCsjFRqWp9FowMWuphZH2Ae48vwcs3R2xS263Gj7dk6aI/An9qDGHK6JiI2bbrcA1ODwpdw6/w45bDwSaV68tGu2oliIudsUNrA107O6HGtoOZh78I3cu7DRXtUUF69jSkeouyFCLeCjTDVc+kQtgq/vvHxowoCeddtC7VexbBtw2CVc4AGFz5qRM5TS8Fl9AiwRQ3UC5pmPfytvMUyc0qewW3p+emtHb7gtjZ069DuEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Xn3bdx/1ViQbIcXUPw4qs/B3XhdCQuZ0mCdbfnFzMa8=; b=WJ+3zL99k5ueLaYtWeCd8714xbCnGhdn3YEEaIy8Q/gJTmgSUDkoW84iqRBZhOzUgHJf4lVi7FwNzQxxDtts3Upm7oqE2bpcRFTTZHgOv9iiRpC1CWZRCg05IOMaidyUgrnoVXu+dAMPWk0Jbu9RrFMo6of/Qjuupzm5A95UaELEiDktmXg2nJmKbDewQFFp9ecYxLZf/XOeoGV2jtOIkbW6WFjUI0Psphs+CyA/FBVE9tvxAGiI7XjOuCHYRFQx6D7dLk+O4Fk8FZxSlAWK7oLhZJOhoZVZhvT6Hir4Df4WL4VigK3WR5dlL3HcjiOYnDpwEIZ82EsOjwiNiHO+wQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Xn3bdx/1ViQbIcXUPw4qs/B3XhdCQuZ0mCdbfnFzMa8=; b=ousD+g98gJ4zU67AXppLHY68jtALzY6b8fogFBJaRaB79YL8y9If4SI7DK/uGLSEiypYqJ1D7y1j1x5H0HchSDwyCheizBPcm2/IqWgLgl7MD1QbN14Sb+GLluKk8xm5bGAxJfLnGblIC8IjUNIsdhMheNzXqDau3ZfVUjXEeTrPBhgSrpbvzK3oS8UYP50AGjDdyJEglrHLFuLwrfaz1gi9JOSz9dfcAmGWXpgROuGuBPRSf6kN+MEkrL9h89yh2lKv5N0sbjuiW6joL5FO4s6Ly7b9ZD4q8ABhZ0Hi+NpiyEXE37OE+FGZnLca2hlst5aS4qGrOgkvhWxcXwWznQ== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by AS2PR03MB9792.eurprd03.prod.outlook.com (2603:10a6:20b:608::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 22:51:36 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::ec0a:c3a4:c8f9:9f84]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::ec0a:c3a4:c8f9:9f84%7]) with mapi id 15.20.7202.031; Tue, 23 Jan 2024 22:51:36 +0000 From: Sean Anderson To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Robert Jarzmik , Felipe Balbi , Linus Walleij , Jonathan Hunter , Mike Looijmans , Jules Maselbas , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 2/4] usb: phy: generic: Get the vbus supply Date: Tue, 23 Jan 2024 17:51:09 -0500 Message-Id: <20240123225111.1629405-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20240123225111.1629405-1-sean.anderson@seco.com> References: <20240123225111.1629405-1-sean.anderson@seco.com> X-ClientProxiedBy: BL0PR0102CA0069.prod.exchangelabs.com (2603:10b6:208:25::46) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AS2PR03MB9792:EE_|VI1EUR05FT062:EE_|AM9PR03MB6900:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a4e561d-98ae-40b6-75bc-08dc1c65dcfc X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: oIMly5ZVM5Fr7yoeGgh0prds10X6eInq7SUCALcIyAwhPm586Y5NTIkgbv2S/W+/NzPe0mkJKwEODpx+tjHG86WMcrB0+bWe2J0ZAveQ95xeMtF6AvRrKODcRnj4ovJujf+UjSkI8fcmseGLD/D0+9fKk6RSIusvjJ5VDZb1ZXAAB7Jf8OY01czHYn1IOV3JI7yjd97XDB2d4A1ehvHPKNGG+2UY2W5nO79X6L4jzX9uI6vKMI8GD9dVuOY792QNt1gQ2qjxib6BQ3o4hLwB3G8fQQYWkwxDg+X85G7GdAljziaLFZ/U/JSbTQYRl5fyA4J+Ra2Q0Qf4SGin6ogBO/EkZ2FeK8XuTDZynp9zkELxSyVKV4bPHZWDo0pUW96H6mb2BqEgU8JoqKPwtTkZnWn0vOoHBlWieDi/UnNWSM5ewWQfWLUGC4dpHarzz60T9hhU6RMs33tlkSeSb5zTiaStIY9RmWR/mv8opFtaRjZisV9o6Ho6NwFeS36HBM77PAc4n7htLoGILhGUPjeAUbct/Y+6Pz2yvAQTsYMjKLvtLCC8WRhLeyZ5BVZf2H73bqb45Kw94eaWKtoiF8k4lagX4296R/e45GVyHD2N0cNPHQB/OL8hNaeFnqxuZ9D/poQyMzVqzv/uMgMBYdpTqmRd4Xn2FFDVic2Lk2OT28vMdY0HMbrgKrmxJrryBZnxJFtaqtxi889Ci06b5yYucQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39850400004)(366004)(376002)(136003)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(6666004)(38350700005)(66556008)(86362001)(66476007)(54906003)(107886003)(316002)(36756003)(2616005)(41300700001)(66946007)(6512007)(52116002)(4326008)(8936002)(38100700002)(1076003)(26005)(8676002)(2906002)(5660300002)(6506007)(44832011)(478600001)(6486002)(41533002)(15583001)(41080700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR03MB9792 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT062.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 2b6e90c8-9138-452a-2de3-08dc1c65daae X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yoLJc14pZ69zF/jtejjospyPPo+gdPCLrGuRM1HgPReZ3H4PlZNHCEsS8+yqUb+etufxElAsG2wFc9x6R7LErXGGB2D1d/92xt5mJ8yOpPGSeaEIXzpvDiLBJrKmmbezls49ve9K0Ozq1azQoq74mUFtlwPJAFWtWv1HXOP8hr1c4n8pIj90rOnefvo6vi1jM4BKIIav8R2YVgFYBX2haQnTQKeQcnBrAylOnyJcfgO/agZ/b2lFLFKiQ6D+zJPH1zG7EePFsrnCW9cOm0vUiin4hSWWO952RYe9eF6xBHO7OFgzOOxY1seVauWUtyMqaB5s3oJoUuQA3KoDLkOFnnwHoboGxx+cvLW80fguFZLFgbpY5fintsxGHCoDokY2c+m+NF+f3/xOng/X65gKxpDfdyLcFaV0qk+83qXOpUASJiyU0R3A4oKT52770IxNXOVeMiDoJxNZpSBWWv9VLPP4xAMctlullNJiPo2IVYtqcqFLW5IoN6mcz9fVWlm5AE/w1ocibMLDRvNay65aHR7laVXOfLP8LdISL7c4Je2MxjwYxqyfFW2va7u9831DeiiMjX9zOZRCdA0EcUd4w/mHk5W9H1bGjRUr0qcLSvSQXdIUPdsronRiV6iVToX40ff50dJ6cdYswOKRKhbeAqqanfsi2lkIqxXSnL/mbcmPoPY5VCICbAlR0fzwbGBJpGPpmACAd+ggEeKR+HeYkYEGMgZFwCTPpKIp2PkZ2Rqali7koO2HRcivCHjTU9NWY5rZujFOExhS2D6LVSHcaL/Cj+kTOB4jBfgMtIb4i4eN7WwEvheB4vj/ycmtGhJFDJPddeoTBwYE4ZHgPQZ5ciN0PkQXGArz7jjUBz17XH8= X-Forefront-Antispam-Report: CIP:20.160.56.84; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:repost-eu.tmcas.trendmicro.com; PTR:repost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230031)(376002)(136003)(346002)(39850400004)(396003)(230922051799003)(82310400011)(451199024)(186009)(1800799012)(64100799003)(36840700001)(40470700004)(46966006)(40460700003)(47076005)(40480700001)(1076003)(26005)(82740400003)(8936002)(4326008)(44832011)(8676002)(5660300002)(54906003)(70586007)(356005)(316002)(70206006)(86362001)(478600001)(6486002)(7596003)(2906002)(7636003)(107886003)(336012)(6512007)(34070700002)(36860700001)(2616005)(6506007)(36756003)(6666004)(41300700001)(41533002)(15583001)(41080700001); DIR:OUT; SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 22:51:40.3793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4e561d-98ae-40b6-75bc-08dc1c65dcfc X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.84]; Helo=[repost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT062.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB6900 While support for working with a vbus was added, the regulator was never actually gotten (despite what was documented). Fix this by actually getting the supply from the device tree. Fixes: 7acc9973e3c4 ("usb: phy: generic: add vbus support") Signed-off-by: Sean Anderson --- (no changes since v1) drivers/usb/phy/phy-generic.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 9ab50f26db60..16494030209e 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -274,6 +274,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), "could not get vbus regulator\n"); + nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); + if (PTR_ERR(nop->vbus_draw) == -ENODEV) + nop->vbus_draw = NULL; + if (IS_ERR(nop->vbus_draw)) + return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), + "could not get vbus regulator\n"); + nop->dev = dev; nop->phy.dev = nop->dev; nop->phy.label = "nop-xceiv"; From patchwork Tue Jan 23 22:51:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 765579 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2069.outbound.protection.outlook.com [40.107.22.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3A05537E4; Tue, 23 Jan 2024 22:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.69 ARC-Seal: i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706050314; cv=fail; b=b0F3nY7zNCWK0om+U0h7ctszp23iZNZWIpD6UJpwvDRGUC4GgeKC6AHZAhiVHEP1SS/r9giC6aYeX+FP6bnjqw2kcsHfY4J44PoOBsAaCvpGDrsZzzVTx7cEWABS0lfineGNRTpZ5hZpxPFPvKqfds/lp4U2Jc9Wx7M0xl8UXoY= ARC-Message-Signature: i=3; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706050314; c=relaxed/simple; bh=KOjlN/VRD+j9F7LEY27DLPI5jA0bLrRW/apJlN6qXZ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aEGC0ht2SbStJLMXVOwg1l8CEMz7RMoCQBJKuMfwzwK+ev9i4fDghbhYfnN3xxCbBeoD7hxzb32GQJ2i+jwbNOpiDDg2mGywscWKM9SgCs91t9ozzOnM3UH1kiJuu/neOhi99U7ifI0IwuxbM9nZz6wgsLljcaE+LQTqIGtTI8g= ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=seco.com; spf=pass smtp.mailfrom=seco.com; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b=owGlNnnV; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b=owGlNnnV; arc=fail smtp.client-ip=40.107.22.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=seco.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seco.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b="owGlNnnV"; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b="owGlNnnV" ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=D+nFyWRB+yj7xaV9EtcsMCRguhkrL1+gYInbbYKqCyA6hHCDmF7ln08RwMbKdhu2KisOwupG+ivdOmrTu+ad1wsJcrPPInjCtOBapFgz0621myoUWeD8C7ep5VUsXoXDqGm+WtFVskxuBat8IQO/pKnMsrgla13M75ln1a0jgenveRQCUMwjZqpaqjeTJeiyqjVq38NmllUiuICy/Bc/2+zFjySauaxddJnS59KzUKD5A3ZFEu80SUU0hjFo1hYiWsMLJXy9TvTLD+dfzPsdeWk/iSzpUfn/FcxO3GkRlH/0jrgkKIRpvFfDmyuhdv5FaTN/zmAm4NQ7tep/XXRtNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yQwdF3zdAmdqqJrogk/goljRhoD8cVgWt282GWXQhGc=; b=jasmJMVEuPk4fr5pk+Ndjb+N0+2yOFnFj9bTwIEHOFNemAN6oxnaXVr6vhuOP3haIN2/3CnQTsl4Rv8/lehzkFdzt+cama1A6IbqFKwf66o/pUJleXkO2cTkF9s7bQns9TLNvxuqt56YfyS+xtYSf5VS3og0RfB8a6mXUaNdvOx4/CNZv4p3QGGr+9VAWWuBOZhshfWvEQw9KLwZuFEhgdaHC5uwj3g6f0Suv9mG1V3lDjbPsZAQ08/ulkPPh7kS98xPigRwdG5Mai+J7qjKujI/Zks1/pwxdZ44w+bXX9Tz+d3tcoiptyS2IJYJAeE0qItsZYDx+hDMhfQaygAaYw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 20.160.56.82) smtp.rcpttodomain=free.fr smtp.mailfrom=seco.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=seco.com; dkim=pass (signature was verified) header.d=seco.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=seco.com] dkim=[1,1,header.d=seco.com] dmarc=[1,1,header.from=seco.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yQwdF3zdAmdqqJrogk/goljRhoD8cVgWt282GWXQhGc=; b=owGlNnnVPSzpgrvsTiSbBToolvozKrFjY22IDKbsu8vCkP5nOv9ZRCCcIhL+ZSmyWSxWP1EIlsC0kzyxSfuTeX/X4PLTnKHC4He0ZY6SrsChZFw2pKuqKREjePUKysP2tgT0f++OFgCs0PbTOai1nDNf9UxNNt08htFqlMiHLcrT+OON2zIVj6ZgW26dyBCozceODf3+nvFMG7Sk8BByS1s5D+mv8ZgPWG3AtBcZjqhcEXsqILFQJahzK+RmC2FRlv/H+UMNwwr6qygNkpQ+cBV0uKLu8fczB8+VmgDCpwZqBtD1p2TvxmtoxePheIl1+owVZoDwXnL8mGIoxuySfg== Received: from AM6P194CA0051.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::28) by AS2PR03MB9443.eurprd03.prod.outlook.com (2603:10a6:20b:59c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 22:51:48 +0000 Received: from AM6EUR05FT044.eop-eur05.prod.protection.outlook.com (2603:10a6:209:84:cafe::f5) by AM6P194CA0051.outlook.office365.com (2603:10a6:209:84::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22 via Frontend Transport; Tue, 23 Jan 2024 22:51:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.82) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.82 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.82; helo=repost-eu.tmcas.trendmicro.com; pr=C Received: from repost-eu.tmcas.trendmicro.com (20.160.56.82) by AM6EUR05FT044.mail.protection.outlook.com (10.233.241.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22 via Frontend Transport; Tue, 23 Jan 2024 22:51:48 +0000 Received: from outmta (unknown [192.168.82.140]) by repost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 04F482009538D; Tue, 23 Jan 2024 22:51:48 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (unknown [104.47.17.168]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id CF5CA2008006F; Tue, 23 Jan 2024 22:51:39 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KGLxx2Cz6gU2fIpTGcnAyNEO9890J3Cypb+j8ylC6qLWTcRBPlS6D9mpkJ0QsyAwiRqL6gcPj01huBNJGiPiu7CeDzlVpKKj0uTGW0YmjlZ+P0VviTA+RCKz7CAIqiy6pFPcFptq23Gk+YprjJ/STK9yviO/hhcBAw9U4mfuAruhwOySlMyaeK/XCsOZ1G1UVTKXXlleOnR+91ZDUrEDnayVbry/941/npP0oqXnGIbhgGt8xPqXT5f59zWbHZ7ptM4wgt835koZytvK5gS+uqw/9Ho5GMUJ3feVQgDyGS/dWWflezhThXQrcLcex7SrQrEJZMPcMqx3qttGdVmidg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yQwdF3zdAmdqqJrogk/goljRhoD8cVgWt282GWXQhGc=; b=OAJCcMxXI6oSlf32/XBM96Xj/Pm1XidX+eCTHkol6vzrsrRS7apErOPc9mLLQrLD8ni23d2NJGa89gYeVn4jR6E1/KSBVsijeLFY7TahPCskB6sh4mgcJiklqgfeHGxRWaINzxBH/PAG9nFxsP5L2G5J4YOYxALlP6NvFhrsU63fmI8PnJDqx8adfIbF9my5ke0Lh2SX2mPTSFMOqYFD/hoMg2QemvVL8YKuMB/hHTiVkVxM5XMwDgOZh1ZCtuiMYrxdaLwsG+myd115Xx3yxx3dmSqlDmuY1LQJKqm9OkGGFrTQg0ykKNmUmR72D5wndEa2Ckc2nVUgeqowHsajTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yQwdF3zdAmdqqJrogk/goljRhoD8cVgWt282GWXQhGc=; b=owGlNnnVPSzpgrvsTiSbBToolvozKrFjY22IDKbsu8vCkP5nOv9ZRCCcIhL+ZSmyWSxWP1EIlsC0kzyxSfuTeX/X4PLTnKHC4He0ZY6SrsChZFw2pKuqKREjePUKysP2tgT0f++OFgCs0PbTOai1nDNf9UxNNt08htFqlMiHLcrT+OON2zIVj6ZgW26dyBCozceODf3+nvFMG7Sk8BByS1s5D+mv8ZgPWG3AtBcZjqhcEXsqILFQJahzK+RmC2FRlv/H+UMNwwr6qygNkpQ+cBV0uKLu8fczB8+VmgDCpwZqBtD1p2TvxmtoxePheIl1+owVZoDwXnL8mGIoxuySfg== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by AS2PR03MB9792.eurprd03.prod.outlook.com (2603:10a6:20b:608::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 22:51:38 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::ec0a:c3a4:c8f9:9f84]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::ec0a:c3a4:c8f9:9f84%7]) with mapi id 15.20.7202.031; Tue, 23 Jan 2024 22:51:38 +0000 From: Sean Anderson To: Greg Kroah-Hartman , linux-usb@vger.kernel.org Cc: Robert Jarzmik , Felipe Balbi , Linus Walleij , Jonathan Hunter , Mike Looijmans , Jules Maselbas , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 3/4] usb: phy: generic: Implement otg->set_vbus Date: Tue, 23 Jan 2024 17:51:10 -0500 Message-Id: <20240123225111.1629405-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20240123225111.1629405-1-sean.anderson@seco.com> References: <20240123225111.1629405-1-sean.anderson@seco.com> X-ClientProxiedBy: BL0PR0102CA0069.prod.exchangelabs.com (2603:10b6:208:25::46) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AS2PR03MB9792:EE_|AM6EUR05FT044:EE_|AS2PR03MB9443:EE_ X-MS-Office365-Filtering-Correlation-Id: 35b9a4e5-d2dc-42fb-416d-08dc1c65e1db X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dbKl2GSIEU30j42pVyuHNhqMEB33Y6B3qjRH/G1c2CkKPzlClcPQw1/ZIPlVbXG0YVlr183M+bfGxH7fR0W8YABobr7NdIv7SRH6XA/xFWh/SjpntOykhVU8sOme15PhvPQk9nDGCWW43i8WTlHDSJ8Ijhqt8JBAyrw0sj6iReYnzDDGaqrw0Dc+Zs21cc0pMFe/nH3NzgnGiaRjm+e/P7KpA/ZycieEETKg+xFQz+ig4Lf4NNmPKTW9evHlaxTaDqBmqeGnVUEGubiy6iwGlL7zdEnk+rLxXeXr+BO8/bSYafVQoVtaUcpiZiNQizy4q/BJhaKl/HW3j4TPc+pg5oTgdS+1ue/7wDEx1Z6uWyRC08BXCKoZaANFuMDAbScyXGAYhr/6kD/8YZcBFYDYmHSFSigj0Wd+N/eO7MTPQp17ndzC5SmU4PZF1hdCnEsUwXl2nbU9IK8DwW7euueRxXz+BgTSB4jzPfBro3J9GRNAJp8zNNA9JUfv+sDM71HBFeQeqNGXAbTx2rna9RMx0phKZUZFl1wLvxdP4vNWsQaJo242sgylqkvYv16RfYSmmfTo2Rs1PEeV8SzZWg+WFYWWysRrzcjNHQD6kC2w2ihwKP4VOU6PUgdtFBSt/asteUqf+MFf5tqjC1h3vMMbDc64E7kk1O4u0wIXkDjbZqY= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(39850400004)(366004)(376002)(136003)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(6666004)(38350700005)(66556008)(86362001)(66476007)(54906003)(107886003)(316002)(36756003)(2616005)(41300700001)(66946007)(6512007)(52116002)(4326008)(8936002)(38100700002)(1076003)(83380400001)(26005)(8676002)(2906002)(5660300002)(6506007)(44832011)(478600001)(6486002)(41533002)(41080700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR03MB9792 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM6EUR05FT044.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 37430a67-1934-4ee7-4a13-08dc1c65db8f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9cOx/PpJv9OvHS36WoUZvPrpkIMW7sRZE+hLkVUu2vJIwEPQoMzVyO/sEDvkvD/9HCGWgH7LhoWHk0uoZ7GrTVpB/uFEBnmRTaItrJfAWNfHK46PMRQJSkKyDIHC8Wn/1BMGNWT4bL8BfwT6hy9qAd4ugpF6SS26IMbXJXzS8QS69DM35Re3pBcvNgQCMGry1FC7C7ev2KU66wEOD69dn3e3U/DI60HyZsToce0aS2U32oKwg+/SVUy1ZXgIwQF53nhsdoALASNtOXbBua9nWubtCeJHk/sCAhUJsEnXTNZag2JjWcbPgEF2M5snS2LbxNfjQjA0Ykz8ISJp3sCsu1Eij+YTTx+xQ+HVlbZ+TA8MZWY7PTOnhFF9hN2HA1r3nmZQ0fajMP8pEqOBWdCyKiWvT5wQMja8Ju/oezT0uJtrHsLoA0D7JI3RT3xS2zome9Sdk61NxalnsS/UaVEqeDKkM0pZXCIP/vzBUy40lMTK2g135EP/FlGCj9f9s7syEdgCrmtrTJET97OcJqaxlBASbSEipKF9JRd1WNBBe4DLILr5y/rTBM2RISTqme1i5KansY8WSpJt5W+hkDAg7mNiZuI0I2hfp7SitcAmxu9jAQ5e4Emvd7LZheSfv2aXvm8bX4bB2YnFa5ZjNI/88BwKSTDrY76s14YeVoe30S/2wXdqFWWXTVZjJVbtV/P/n1Q67Iq5c07MUdtMwWKRRZ3uvNpE+miOfrP4ibQdOG8K2DUlJJLLsgSrmzfETVtI4Ki0IDdQcYfmg9Bat04UTSycgrdzkQUJEniWz5saLw9iDvBk7GCk4IWXkWQHitc+NYu4aNs+fytJ6T1KrL1fdA== X-Forefront-Antispam-Report: CIP:20.160.56.82; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:repost-eu.tmcas.trendmicro.com; PTR:repost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230031)(39850400004)(136003)(396003)(376002)(346002)(230922051799003)(64100799003)(82310400011)(186009)(1800799012)(451199024)(46966006)(40470700004)(36840700001)(6512007)(54906003)(70206006)(70586007)(2616005)(1076003)(107886003)(316002)(40480700001)(40460700003)(5660300002)(336012)(6506007)(478600001)(26005)(6486002)(6666004)(83380400001)(44832011)(2906002)(36756003)(41300700001)(34070700002)(86362001)(7596003)(7636003)(356005)(47076005)(36860700001)(8676002)(8936002)(4326008)(82740400003)(41533002)(41080700001); DIR:OUT; SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 22:51:48.5816 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35b9a4e5-d2dc-42fb-416d-08dc1c65e1db X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.82]; Helo=[repost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT044.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR03MB9443 Some USB controller drivers call otg_set_vbus when entering host or device mode. Implement this callback so that VBUS can be turned on and off automatically. This is especially useful when there is no property for a VBUS supply in the controller's binding. This results in a change in semantics of the vbus_draw regulator. Whereas before it represented the VBUS supplied by an A-Device when we acted as a B-Device, now it represents an internal VBUS source. Accordingly, we no longer set the current limit or enable/disable the bus from nop_gpio_vbus_thread. Because this supply was never initialized before the previous commit, there should be no change in behavior. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/usb/phy/phy-generic.c | 45 +++++++++++++---------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 16494030209e..f7db24b5ed5c 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -74,33 +74,26 @@ static void nop_reset(struct usb_phy_generic *nop) } /* interface to regulator framework */ -static void nop_set_vbus_draw(struct usb_phy_generic *nop, unsigned mA) +static int nop_set_vbus(struct usb_otg *otg, bool enable) { - struct regulator *vbus_draw = nop->vbus_draw; - int enabled; - int ret; + int ret = 0; + struct usb_phy_generic *nop = dev_get_drvdata(otg->usb_phy->dev); - if (!vbus_draw) - return; + if (!nop->vbus_draw) + return 0; - enabled = nop->vbus_draw_enabled; - if (mA) { - regulator_set_current_limit(vbus_draw, 0, 1000 * mA); - if (!enabled) { - ret = regulator_enable(vbus_draw); - if (ret < 0) - return; - nop->vbus_draw_enabled = 1; - } - } else { - if (enabled) { - ret = regulator_disable(vbus_draw); - if (ret < 0) - return; - nop->vbus_draw_enabled = 0; - } + if (enable && !nop->vbus_draw_enabled) { + ret = regulator_enable(nop->vbus_draw); + if (ret) + nop->vbus_draw_enabled = false; + else + nop->vbus_draw_enabled = true; + + } else if (!enable && nop->vbus_draw_enabled) { + ret = regulator_disable(nop->vbus_draw); + nop->vbus_draw_enabled = false; } - nop->mA = mA; + return ret; } @@ -120,14 +113,9 @@ static irqreturn_t nop_gpio_vbus_thread(int irq, void *data) otg->state = OTG_STATE_B_PERIPHERAL; nop->phy.last_event = status; - /* drawing a "unit load" is *always* OK, except for OTG */ - nop_set_vbus_draw(nop, 100); - atomic_notifier_call_chain(&nop->phy.notifier, status, otg->gadget); } else { - nop_set_vbus_draw(nop, 0); - status = USB_EVENT_NONE; otg->state = OTG_STATE_B_IDLE; nop->phy.last_event = status; @@ -291,6 +279,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) nop->phy.otg->usb_phy = &nop->phy; nop->phy.otg->set_host = nop_set_host; nop->phy.otg->set_peripheral = nop_set_peripheral; + nop->phy.otg->set_vbus = nop_set_vbus; return 0; }