From patchwork Sun Jun 16 10:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13699520 X-Patchwork-Delegate: geert@linux-m68k.org Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F70049635; Sun, 16 Jun 2024 10:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718535276; cv=none; b=fscxPgA87y54EQVZtlCTPuJ4AJJuKYX5+OlbrPhpWn/RbKAUrWlcZ/GXTB38ZvXmbDztcifb6Y9U/NQ7PfJyZ+5Xkry4I6tc6CkzIIV+iIMmvw2rqJveHjfAVdKghpYHAZjhanz0d/OglJCXijrlyZdHxUFM1O1qiz9A61VJITM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718535276; c=relaxed/simple; bh=hf9q0SiOotKRMOi18VwE0gegjxek1tj+D+9rTylpQ5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDp9/o0AVxdLXvJlDgwE9GXgdGoMXRTD64eJc7aqxxosorDdBkI+5PmI+IdeSLLhbhpVQZz3bqNc6MkVMEos75jav/Y8LY9Mclt4BUHKE3RGnezArt61BJFjQp+KcyfRlZSX7ENkV/gbBxfEt2yw0axkFJ77YteVYv/yq+IySEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.08,242,1712588400"; d="scan'208";a="212062414" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 16 Jun 2024 19:54:34 +0900 Received: from localhost.localdomain (unknown [10.226.92.60]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 425DD41FEF55; Sun, 16 Jun 2024 19:54:28 +0900 (JST) From: Biju Das To: Yoshihiro Shimoda Cc: Biju Das , Philipp Zabel , Rob Herring , Krzysztof Kozlowski , Liam Girdwood , Mark Brown , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Geert Uytterhoeven , Magnus Damm , devicetree@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v4 5/6] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Date: Sun, 16 Jun 2024 11:53:57 +0100 Message-ID: <20240616105402.45211-6-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240616105402.45211-1-biju.das.jz@bp.renesas.com> References: <20240616105402.45211-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use regulator_hardware_enable() for controlling VBUS enable for RZ/G2L alike SoCs in interrupt context. Signed-off-by: Biju Das Acked-by: Vinod Koul --- v3->v4: * Updated commit description with regulator_hardware_enable() * Used devm_regulator_get_exclusive() to get regulator handle. v2->v3: * Replaced regulator's regmap API with newly introduced regulator_set_hardware_enable_register to enable/disable regulator in interrupt context. * Dropped using "usb_vbus-supply" v1->v2: * Used regulator driver's regmap to handle VBUS. --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index fbab6ac0f0d1..7594f64eb737 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -188,6 +188,9 @@ static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus) dev_vdbg(ch->dev, "%s: %08x, %d\n", __func__, val, vbus); if (ch->soc_no_adp_ctrl) { + if (ch->vbus) + regulator_hardware_enable(ch->vbus, vbus); + vbus_ctrl_reg = USB2_VBCTRL; vbus_ctrl_val = USB2_VBCTRL_VBOUT; } @@ -718,7 +721,10 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) phy_set_drvdata(channel->rphys[i].phy, &channel->rphys[i]); } - channel->vbus = devm_regulator_get_optional(dev, "vbus"); + if (channel->soc_no_adp_ctrl && channel->is_otg_channel) + channel->vbus = devm_regulator_get_exclusive(dev, "vbus"); + else + channel->vbus = devm_regulator_get_optional(dev, "vbus"); if (IS_ERR(channel->vbus)) { if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) { ret = PTR_ERR(channel->vbus);