From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796386148; b=NbVk0C3LkHJqpI+TgtbSEHLiOf0CM4x/7x3ws/7LBSmn19+iYGMkY0j31xMzx+MOWF9k 6fQpzWNtoUeVpMo2L/HorrZAjjXABnNa/2vTVvUHl9HF5Zk8Z6gVduAk95nsJ1T0YEMYA MEw9WL8zaaxIVkSH4RCEhp2A9n6NxBkyt+FTVgaGOQoyYllvbkYTIpy5uMvvT+DVc7003 RRC5aU00L1WrEl7L9l9LQK4aOX6H0qX+meg1xo+7q7CfL0tEI4iR5q8H28Y/APwpPxuWy 7vGrulmpzjjdEUpfNvGb1SjGiJkPF24Ad5s97b2Lbg207EkmPa6P1ATC2yg1gNVI9Yw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386148; 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=5OeDhiEDZQSsAxry1UGlbTsbt8f56qL0tsP1aN7Cb1o=; b=X7fXludg5kloLQhIBVTfmMlSbzF0q80YuuNjttlkxiP+iX1NAKmkqso3E8Tb6XR0VkaJ fnvc48RDDeeQjLU8/I49+o+IsILgumXiihMtJZq9w5ioyYOwj0yptkd1qa2A1RS6yLHps 1aCWfcK3eA3YqvEJ9ITjV5huA1N0IH3fCLn8oXsGTLVS32PcXHTr8Z/gdfOPSXUskQOxo jU1WFCNVcrgaeYmPDe1w7/8jHK6iMZEhQ7nb/zrePCejmKmRRR+KUzz27UP1FnD2dAtJT mat3WUCoBzOtU7fGxicHKWDpPgZeMGkmTQWSAAMTb39Nkl+HSpmYQIh3v9wklL+Raog== 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=LDrsXTYM; arc=none smtp.remote-ip=198.175.65.15 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (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 EE8D0606A32C; Fri, 4 Dec 2026 12:09:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EE8D0606A32C 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=LDrsXTYM DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796386147; x=1827922147; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=5OeDhiEDZQSsAxry1UGlbTsbt8f56qL0tsP1aN7Cb1o=; b=LDrsXTYM8k9F/mNNvbkg+dK2xnwagoZXE+oLBNS+45uADMPa7PBxCSgT aEQqac1kbIe1tkgrzuPp3Ma6vMbkQeNWZdf0tXpkvjipZYSD8CdIzA39Y tTtgx34VzFTfwbe+6otiJ+dWULLkfjhztyuBIImlM0DN9nglRGeQIkiyL 88PNbd7TuWGZfH/wWt9rl0J3RNTnuVvMcZRSnXudx0TPZcnbma/uQ+ZqA I+mn3Qy1yPii0ZrZ4A8LN6jT8Pa6wl4P5LDaOMh0IezRJMLnv+KYTBTKc aMqu8MyaVr4tfUPK8LmtYZ9P9t46J/xuLuskbibHp9LlZxC6zY49f95xG g==; X-CSE-ConnectionGUID: XuGZDgIHS9ycWEUvr5H96g== X-CSE-MsgGUID: JoMjjBMUShO//Qg6rUB/bg== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5366712" X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="5366712" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 04:09:07 -0800 X-CSE-ConnectionGUID: tjDvusOfQU6mnsffEjzTlw== X-CSE-MsgGUID: o24XsEI6TH++ZablxIQ9KQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,78,1794902400"; d="scan'208";a="14354922" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa007.fm.intel.com with ESMTP; 04 Dec 2026 04:09:03 -0800 Received: by black.igk.intel.com (Postfix, from userid 1008) id 7AC2A98; Fri, 04 Dec 2026 13:09:02 +0100 (CET) Date: Fri, 4 Dec 2026 13:09:02 +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, stable@vger.kernel.org Subject: Re: [PATCH v3 4/4] usb: typec: tcpm/tcpci_maxim: only complain about vbus when sourcing Message-ID: References: <20261130-max77759-wait-v3-0-1ee9034dd228@linaro.org> <20261130-max77759-wait-v3-4-1ee9034dd228@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: <20261130-max77759-wait-v3-4-1ee9034dd228@linaro.org> On Mon, Nov 30, 2026 at 04:04:02PM +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") > Cc: stable@vger.kernel.org > Signed-off-by: André Draszik Reviewed-by: Heikki Krogerus > --- > 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.839.g22a8290db9-goog > -- heikki