From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.9 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796042285; b=WyMp39kK0YXBevM4WZbH8nosAt3fDcQqfbWO3To4p0WmAixgzY3Vyr0BPLVJVgI+kUM5 coaoX81lR2uIk1QVIDjYdxZBfLnVWeRDVdmKD7eEvjfv1pZ0GIumRQfa8q81V0Zbl90js BJCkASNa6GZsvEiFDOWn67nmPpf7zKb3evYH2Dn93gCkgQwV7d8RfnrurbS5sW/ABPEjx DoFWJ6WwIfgBhXfelw0b1O7AUoXEMXo1SLXVzLm1zyYzuLZATEiOCjG7JK2+vkcQXgnfF M/BxIASnX/Sp2Q/i9rdLpxgozEONHoUwAtgn/oAy0xAhfW9SgwdXkdPBtxMVMFYLO/A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796042285; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Date:From:To: Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; bh=o4C6ngxK7HHDp+3CX2k745YRbgn5J1XFKlqVwtEgkTc=; b=op64WkN7xZe7+80cZLMtGjVAChMhu5B+9m8WnAeQWnN5I4n1Lrx56Iyyq37DwDrQwaJS IAzZyro99MDz/feEQNa6Kxidv1NpKm2cH/PglPPQ5QNhSVq6abvS155gmPSd7CzxggoDj +T5RnBIIFuIgTkIaHV32VohPlziQDBCYXN4JE9fI+DWhB0MfR6xSfgQrB0guS4TSWOe0w JsI4VzoGe4vlZwPZdzxqI6P/yVjvDD1lowQ/eNI445BWKxa31JqQ2m9L5Os87LZGWTFY7 nMMnaWRq+qGj3GrZCnCyMbLAN4eL6XyAQPu8i1qiyl0YsMNHZzuxoIYbVWgyQc2yEiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=fX0tj4Cy; arc=none smtp.remote-ip=198.175.65.9 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8D78606A325 for ; Mon, 30 Nov 2026 12:38:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D8D78606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=fX0tj4Cy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796042285; x=1827578285; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=o4C6ngxK7HHDp+3CX2k745YRbgn5J1XFKlqVwtEgkTc=; b=fX0tj4CyjRBalcUj7MAeACar6sMpxsmG0DlhsIC+UMpDFo7Xg7Is/t46 N2/UGsVsbvvxLzWpzd1RDrTJtjBqJ6lxQWAranBMZZJ5MkofAs94ahk2D GN3iPPrl7Gcx7VSFowpfgIY1VrQRuz25T5relnDTOG1CpkMdUaN+00dTW yKyu1EL28WaElTZtxzpK0amG1E0hG2SrnQfulT7Ws3kporfUpztpkXjMd XyFCZr4FnlWzU+YC271Nl4ySt98Q84Vz6gR/dogcEUg80k1OXvYGPufPr 5Bnq3If34RIJGDIK61Nj2U+OFaXlUky2DiVBnUzaZ5wlb1anS7UYSBHja w==; X-CSE-ConnectionGUID: IauSsTaVTZSzVu1GqnGRlQ== X-CSE-MsgGUID: CutMQBl0TrGYrCNvHGhHxw== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4777198" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4777198" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 04:38:05 -0800 X-CSE-ConnectionGUID: E91tKQLFR9aY/Cs412e4AQ== X-CSE-MsgGUID: S89gpn5kTCO3i4D/ilmTaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="12920870" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa007.jf.intel.com with ESMTP; 30 Nov 2026 04:38:01 -0800 Received: by black.igk.intel.com (Postfix, from userid 1008) id 744FE99; Mon, 30 Nov 2026 13:38:00 +0100 (CET) Date: Mon, 30 Nov 2026 13:38:00 +0100 From: Heikki Krogerus To: =?iso-8859-1?Q?Andr=E9?= Draszik Cc: Greg Kroah-Hartman , Badhri Jagan Sridharan , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Peter Griffin , Tudor Ambarus , Juan Yescas , Amit Sunil Dhamne , kernel-team@android.com, linux-usb@vger.kernel.org, linux-rt-devel@lists.linux.dev Subject: Re: [PATCH v2 4/4] usb: typec: tcpm/tcpci_maxim: only complain about vbus when sourcing Message-ID: References: <20261125-max77759-wait-v2-0-9914b985c00b@linaro.org> <20261125-max77759-wait-v2-4-9914b985c00b@linaro.org> X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261125-max77759-wait-v2-4-9914b985c00b@linaro.org> On Wed, Nov 25, 2026 at 12:16:58PM +0000, André Draszik wrote: > get_vbus_regulator_handle() logs a spurious "Failed to get vbus > regulator handle" error during probe and stores the ERR_PTR in > chip->vbus_reg even when sourcing VBUS is not requested. > > During tcpci_register_port(), tcpm_init_vbus() calls set_vbus(false, > false) before the PMIC charger providing the vbus regulator has probed > (the charger's power supply waits for the TCPM power supply), or on > sink-only boards without a vbus regulator. Sink-only operation does not > need the vbus regulator, and max_tcpci_set_vbus() already ignores > regulator lookup failures when source is false. > > Leave chip->vbus_reg untouched when regulator_get_exclusive() fails, > return the error from get_vbus_regulator_handle() silently, and log an > error in max_tcpci_set_vbus() only when sourcing is requested. > > Fixes: 0c8935642cb0 ("usb: typec: tcpm/tcpci_maxim: deprecate WAR for setting charger mode") > Signed-off-by: André Draszik Not for stable? thanks, > --- > drivers/usb/typec/tcpm/tcpci_maxim_core.c | 26 ++++++++++++++++---------- > 1 file changed, 16 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpci_maxim_core.c b/drivers/usb/typec/tcpm/tcpci_maxim_core.c > index 2e6a8906fb32..736d01694745 100644 > --- a/drivers/usb/typec/tcpm/tcpci_maxim_core.c > +++ b/drivers/usb/typec/tcpm/tcpci_maxim_core.c > @@ -208,15 +208,16 @@ static void process_rx(struct max_tcpci_chip *chip, u16 status) > > static int get_vbus_regulator_handle(struct max_tcpci_chip *chip) > { > - if (IS_ERR_OR_NULL(chip->vbus_reg)) { > - chip->vbus_reg = regulator_get_exclusive(chip->dev, "vbus"); > - if (IS_ERR_OR_NULL(chip->vbus_reg)) { > - dev_err(chip->dev, > - "Failed to get vbus regulator handle\n"); > - return -ENODEV; > - } > - } > + struct regulator *reg; > + > + if (chip->vbus_reg) > + return 0; > > + reg = regulator_get_exclusive(chip->dev, "vbus"); > + if (IS_ERR(reg)) > + return PTR_ERR(reg); > + > + chip->vbus_reg = reg; > return 0; > } > > @@ -224,7 +225,7 @@ static void max_tcpci_put_vbus_regulator(void *data) > { > struct max_tcpci_chip *chip = data; > > - if (!IS_ERR_OR_NULL(chip->vbus_reg)) > + if (chip->vbus_reg) > regulator_put(chip->vbus_reg); > } > > @@ -244,7 +245,12 @@ static int max_tcpci_set_vbus(struct tcpci *tcpci, struct tcpci_data *tdata, boo > * Regulator is not necessary for sink only applications. Return > * success in cases where sink mode is being modified. > */ > - return source ? ret : 1; > + if (!source) > + return 1; > + > + dev_err(chip->dev, "Failed to get vbus regulator: %pe\n", > + ERR_PTR(ret)); > + return ret; > } > > if (source) { > > -- > 2.56.1.831.g720f3f5937-goog -- heikki