From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 ED82620E6; Wed, 30 Jul 2025 09:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753868387; cv=none; b=fbI9RqmQI4PQ2Cb7hxTvXTpjNwfJdb3/nueatg3vs6nRM97pFn3/Rb2n1N0uMcUtmR6javlf8aMZSJ5yozzNBSF8TQbkxuZHx76u24Onw7paAIpUF25/MQertmmcQMlPAWClKw1Wh0HVg/t0NEyhiYtNbTlaa3wxy8HtUwFJo/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753868387; c=relaxed/simple; bh=7FGmBXUgcnVH5lj28wajGeyaKa7OEE1124Xl87OJEy0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iy4oKCiWiGvg+vJnVXpLrjwv3il7RoXF1b1G3pNqSWFNkXwHQEacZRlWgI7Qe7EHGZ4Ev6H0CH9s84cqJkzZy0QbBepz+rD2/vNEo1iXt4Tb+tnRgi37pT+e35qmG0s1bxVeUFinAkIByWcJGFIVpmoAspAqGy5CpAWqC3lr4sA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KIXxIO6y; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KIXxIO6y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1913C4CEE7; Wed, 30 Jul 2025 09:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753868386; bh=7FGmBXUgcnVH5lj28wajGeyaKa7OEE1124Xl87OJEy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KIXxIO6yIqhmIdGf03ET/gkU8NzkQZBWy6R3n/c5aaP57qxwvgjsP2LolQcuv0Br2 vY8KIgZCGjFjVIG8oXYa46r2LedwMVd6xk8lEGZzlrkUnSlB53hTeVuuhWzhL3/psT UbWUJHDTUnFsnpzcpTH0WdJhq7oZf3LTsLR6j2FU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Grzeschik , Heikki Krogerus , Sasha Levin Subject: [PATCH 6.6 49/76] usb: typec: tcpm: allow to use sink in accessory mode Date: Wed, 30 Jul 2025 11:35:42 +0200 Message-ID: <20250730093228.749935834@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250730093226.854413920@linuxfoundation.org> References: <20250730093226.854413920@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Grzeschik commit 64843d0ba96d3eae297025562111d57585273366 upstream. Since the function tcpm_acc_attach is not setting the data and role for for the sink case we extend it to check for it first. Signed-off-by: Michael Grzeschik Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20250404-ml-topic-tcpm-v1-1-b99f44badce8@pengutronix.de Stable-dep-of: bec15191d523 ("usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3802,12 +3802,17 @@ static void tcpm_snk_detach(struct tcpm_ static int tcpm_acc_attach(struct tcpm_port *port) { int ret; + enum typec_role role; + enum typec_data_role data; if (port->attached) return 0; - ret = tcpm_set_roles(port, true, TYPEC_SOURCE, - tcpm_data_role_for_source(port)); + role = tcpm_port_is_sink(port) ? TYPEC_SINK : TYPEC_SOURCE; + data = tcpm_port_is_sink(port) ? tcpm_data_role_for_sink(port) + : tcpm_data_role_for_source(port); + + ret = tcpm_set_roles(port, true, role, data); if (ret < 0) return ret;