Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp463550lqb; Fri, 24 May 2024 04:08:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsEk8SchRRdzlORyQvVUCNsVjs+JgQAQWIUSH2TI7ihj6vyNDAQsW8bQbvlcN1bs/J0Y27HZgLTpifMDaBSvurUkkvqWKxsERCrU3p2Q== X-Google-Smtp-Source: AGHT+IHbow573JZOjpXjshmdtlGsSJunJOQwSuL9D3Zj/IgQphHcni+MLD8StlhBeTXL1ArovXyg X-Received: by 2002:a17:90a:17c5:b0:2bd:47fe:6dec with SMTP id 98e67ed59e1d1-2bddce5c42dmr6830172a91.5.1716548924106; Fri, 24 May 2024 04:08:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716548924; cv=pass; d=google.com; s=arc-20160816; b=LnMqI143dM2ti2QhOCUyqNbW4XgTGp7J0G8wmQQbOJk2SWr4j3dc2HM+3qAVOmtxAC m//0gXpZFGZGq16yvK/nYqVRU2n6XFA/8DO3M4GAKwsLtpYaH5mcMOU9hSguzGP1z85Z Ll5a/MgI9x1PloWgPoPDV/D2AnsoR/KfBpXKpjFxnDCCGHR6JPFNBPIB4GiQPgB+esSn Mi6o2EnVIK+a1zFoGC81lWsGKApqAYZWfCzC4vl02+GTQgFpVy2g3AjrVorpSnF5zYHN /PIXlQwFa4hTt3pL5VZA+/NQu4kXfNv7zDsnoS/tU/NAvfErEXNhxTYwfb2Eo5lgQXEG CG+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7o+fFn7gbAlvwKqYJrJ0dZxZZJ/KAuKR0bymU0MdKuQ=; fh=SUgjIEH8cbyiH+EijvHrfVf97RHQEdErvCpCBFX72VI=; b=PO461dlb2qbgB7gXvcz/gJ4qKfzGmoQ2mJszoEeRG8pKMUUnsL9Wre4WjYsWspoD7l KBWty7NOd9Pw2K2m7t3wJASamugWNnZ+KH9ElBeJxbLPdH+jffAAriXH67/plhkS3s96 DeNpSYq2nY88L/8FtmDWM3XlT8VWH44DnI4cGSfdeUoLkcZDP1nX3PBG9DKQhH5o5Aqy s5VWABNqeYPLRo0KQ+A1MiMoKCgNZljV6gMFJZsM51egvmW00ISRtkuf69ECF7Vj2Icq 3yxyEzRqrT+lJLZtr2NBbeLfIdMdfAjXhEQTPskN9kMT1Aoc70f+JupwcoVwO4mzCARk s0WQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tecnico.ulisboa.pt header.s=mail header.b=gOI3nfEu; arc=pass (i=1 spf=pass spfdomain=tecnico.ulisboa.pt dkim=pass dkdomain=tecnico.ulisboa.pt dmarc=pass fromdomain=tecnico.ulisboa.pt); spf=pass (google.com: domain of linux-kernel+bounces-188635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=tecnico.ulisboa.pt Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdda0587ecsi2308076a91.158.2024.05.24.04.08.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 04:08:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@tecnico.ulisboa.pt header.s=mail header.b=gOI3nfEu; arc=pass (i=1 spf=pass spfdomain=tecnico.ulisboa.pt dkim=pass dkdomain=tecnico.ulisboa.pt dmarc=pass fromdomain=tecnico.ulisboa.pt); spf=pass (google.com: domain of linux-kernel+bounces-188635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=tecnico.ulisboa.pt Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E5AF3B214E9 for ; Fri, 24 May 2024 11:08:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BCEE886622; Fri, 24 May 2024 11:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b="gOI3nfEu" Received: from smtp1.tecnico.ulisboa.pt (smtp1.tecnico.ulisboa.pt [193.136.128.21]) (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 E1FC842078; Fri, 24 May 2024 11:08:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.136.128.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716548890; cv=none; b=SEmJMzYEPXiRnli6BLCjZ+7/Azj2TPfXfL500fMG9raA2KBnNyVXh7WRnsOpCleZsvdZXa/vIuLoSJ9ZAiNhNN3ma5W9cJrxKoS8e4wNmP2MtV7oTnTjC6qvjkASXq5WHX1nkmcfPMxOn18WKlhbCjJX3U4KKYo7uf22HZeV5mY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716548890; c=relaxed/simple; bh=F+uCQdV0aunttbQzzXVZNYHFs0YrsoqwUqhoLVcnC9M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HTpTdoA+yZsg2Qxcfy4xMRHnN9j4igjZ8wcdvEOwP3bfOrySPNufESlzmuvJER8xf1Zvg98NFtLarLv4cIKFiwEpgbN9QhlYdn4zACQhvkMrjxOpCximTmtdil0un6iq3oKvCFDacim8faLTty51lvCQjpI8YmnYdqxW25QKKpA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt; spf=pass smtp.mailfrom=tecnico.ulisboa.pt; dkim=pass (1024-bit key) header.d=tecnico.ulisboa.pt header.i=@tecnico.ulisboa.pt header.b=gOI3nfEu; arc=none smtp.client-ip=193.136.128.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=tecnico.ulisboa.pt Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tecnico.ulisboa.pt Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTP id 23BC1601A40F; Fri, 24 May 2024 11:59:59 +0100 (WEST) X-Virus-Scanned: by amavis-2.13.0 (20230106) (Debian) at tecnico.ulisboa.pt Received: from smtp1.tecnico.ulisboa.pt ([127.0.0.1]) by localhost (smtp1.tecnico.ulisboa.pt [127.0.0.1]) (amavis, port 10025) with LMTP id 4SPOHJ6UAWWl; Fri, 24 May 2024 11:59:56 +0100 (WEST) Received: from mail1.tecnico.ulisboa.pt (mail1.ist.utl.pt [IPv6:2001:690:2100:1::b3dd:b9ac]) by smtp1.tecnico.ulisboa.pt (Postfix) with ESMTPS id D65FE600087F; Fri, 24 May 2024 11:59:56 +0100 (WEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tecnico.ulisboa.pt; s=mail; t=1716548396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7o+fFn7gbAlvwKqYJrJ0dZxZZJ/KAuKR0bymU0MdKuQ=; b=gOI3nfEuvAJruhD/F3G0dI4EpjmmZNiJs2ecWhlKUmNsTIRJGfk0zAb4XkLHyIJjIhcZJg 9N1U42wbTgnS3jwR40mKqf9PGRCjsxoUmamDymK/SAhfRxvAYbfW7w4nlk4t3jih1i6/8y DLNPvPEbGAXWe+LEqX90jwutZ+QZo3o= Received: from diogo-gram.. (unknown [136.226.215.14]) (Authenticated sender: ist187313) by mail1.tecnico.ulisboa.pt (Postfix) with ESMTPSA id 75E963600C8; Fri, 24 May 2024 11:59:55 +0100 (WEST) From: Diogo Ivo To: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org, dmitry.baryshkov@linaro.org, jthies@google.com, bleung@chromium.org, abhishekpandit@chromium.org, saranya.gopal@intel.com, lk@c--e.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, pmalani@chromium.org Cc: Diogo Ivo Subject: [PATCH 2/2] usb: typec: ucsi: Enable UCSI v2.0 notifications Date: Fri, 24 May 2024 11:58:21 +0100 Message-ID: <20240524105837.15342-3-diogo.ivo@tecnico.ulisboa.pt> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524105837.15342-1-diogo.ivo@tecnico.ulisboa.pt> References: <20240524105837.15342-1-diogo.ivo@tecnico.ulisboa.pt> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit UCSI version 2.0 and above define new PPM notifications. Update the logic to determine which notifications to enable taking into account these changes. Signed-off-by: Diogo Ivo --- drivers/usb/typec/ucsi/ucsi.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index cb52e7b0a2c5..0cc1c49da4a0 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1664,7 +1664,7 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con) static u64 ucsi_get_supported_notifications(struct ucsi *ucsi) { - u8 features = ucsi->cap.features; + u16 features = ucsi->cap.features; u64 ntfy = UCSI_ENABLE_NTFY_ALL; if (!(features & UCSI_CAP_ALT_MODE_DETAILS)) @@ -1680,6 +1680,23 @@ static u64 ucsi_get_supported_notifications(struct ucsi *ucsi) if (!(features & UCSI_CAP_PD_RESET)) ntfy &= ~UCSI_ENABLE_NTFY_PD_RESET_COMPLETE; + if (ucsi->version <= UCSI_VERSION_1_2) + return ntfy; + + ntfy |= UCSI_ENABLE_NTFY_SINK_PATH_STS_CHANGE; + + if (features & UCSI_CAP_GET_ATTENTION_VDO) + ntfy |= UCSI_ENABLE_NTFY_ATTENTION; + + if (features & UCSI_CAP_FW_UPDATE_REQUEST) + ntfy |= UCSI_ENABLE_NTFY_LPM_FW_UPDATE_REQ; + + if (features & UCSI_CAP_SECURITY_REQUEST) + ntfy |= UCSI_ENABLE_NTFY_SECURITY_REQ_PARTNER; + + if (features & UCSI_CAP_SET_RETIMER_MODE) + ntfy |= UCSI_ENABLE_NTFY_SET_RETIMER_MODE; + return ntfy; } -- 2.45.1