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 4C35513DBA0; Mon, 16 Sep 2024 12:02:19 +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=1726488139; cv=none; b=HfR4JLfoduhAMe50T5iDVMWXyCMa6QAjA+7+HahR9msfafkIatPWJL3zcvgrSVhWbMcblKQp/Ar368fZyAzhC0FnkoV30pPk2bWu2LSDH4u+ZqM86EdhaRW/eUw14K5JiS7Atb5tavBIw1lWGiv5iPDmqdldOgq8Wc68qp4SfUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726488139; c=relaxed/simple; bh=ydubZR61342tWmNasa7WmuQ/SB8yYGy2IYlZBVmhfic=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kdvAn1r0L1P2ScwNY/qHeOUbwci4XcWTbZuD+1k0BK2gg7zqSIUnCTDz7FAlCOaMwqT6OglPfKl0Jbip4JO09egybXicPjq8d6hb2S/kCFtnrqR1pNEM5Q5FV7z+0VD238v//Hy8Tw6HBLRqdmtHv3pKSGJPcjc5MKfv+d5d6HY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HsLFluLa; 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="HsLFluLa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7842C4CEC4; Mon, 16 Sep 2024 12:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1726488139; bh=ydubZR61342tWmNasa7WmuQ/SB8yYGy2IYlZBVmhfic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsLFluLapcseH3ESFgPMsb0lw1PIF/E54KRZ7XyhR995sRvHM9/ZcmcncBqKsNE9E afw+BpGU5mpRhdI8jJ4AzDdSZ2G+hlAKSUid2PBDgdH5BNiclyR/52cSTIEuK/uGkB mXDkDEQEvdElOWf+F/ZnmQyt7PAb7PeEvDtmDiQQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Heikki Krogerus , Benson Leung , Jameson Thies , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 6.10 001/121] usb: typec: ucsi: Always set number of alternate modes Date: Mon, 16 Sep 2024 13:42:55 +0200 Message-ID: <20240916114228.980195556@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240916114228.914815055@linuxfoundation.org> References: <20240916114228.914815055@linuxfoundation.org> User-Agent: quilt/0.67 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.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jameson Thies [ Upstream commit c313a44ac9cda60431bdc7dcdb4b135eaef31785 ] Providing the number of known alternate modes allows user space to determine when device registration has completed. Always register a number of known alternate modes for the partner and cable plug, even when the number of supported alternate modes is 0. Reviewed-by: Heikki Krogerus Reviewed-by: Benson Leung Signed-off-by: Jameson Thies Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20240510201244.2968152-5-jthies@google.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 87eb3cb4ec61 ("usb: typec: ucsi: Fix cable registration") Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 45e91d065b3b..7a127ea57b5a 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -817,10 +817,11 @@ static int ucsi_check_altmodes(struct ucsi_connector *con) /* Ignoring the errors in this case. */ if (con->partner_altmode[0]) { num_partner_am = ucsi_get_num_altmode(con->partner_altmode); - if (num_partner_am > 0) - typec_partner_set_num_altmodes(con->partner, num_partner_am); + typec_partner_set_num_altmodes(con->partner, num_partner_am); ucsi_altmode_update_active(con); return 0; + } else { + typec_partner_set_num_altmodes(con->partner, 0); } return ret; @@ -1143,7 +1144,7 @@ static int ucsi_check_connection(struct ucsi_connector *con) static int ucsi_check_cable(struct ucsi_connector *con) { u64 command; - int ret; + int ret, num_plug_am; if (con->cable) return 0; @@ -1177,6 +1178,13 @@ static int ucsi_check_cable(struct ucsi_connector *con) return ret; } + if (con->plug_altmode[0]) { + num_plug_am = ucsi_get_num_altmode(con->plug_altmode); + typec_plug_set_num_altmodes(con->plug, num_plug_am); + } else { + typec_plug_set_num_altmodes(con->plug, 0); + } + return 0; } -- 2.43.0