From patchwork Wed Mar 13 03:54:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 780849 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F154D52B for ; Wed, 13 Mar 2024 03:54:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302066; cv=none; b=U4QmCqkwwDLu1uo4Py4Kqrw6Ly1WSUvkOKJdq4fabM20ugFcZxPJ/o72lhVvbmqZO8F+bfEL0xrHeIv3LWCaMZqvu859O9qnEIPVEueufxh+pDYpXSPDK7pIBKknF1WqF2FvPgxH82PKG280y5IIDSyGTIeZe0JD6l9fCJpRF68= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302066; c=relaxed/simple; bh=5qUUCTMFfwh0GWLizFk8xctUPdAHmp89Ki8123ktN38=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k0vcAiY7dB/sLVJNKGR0lP3+qaW0soMpO+NHN3Y7MLxropIvdLiMTIpDVpbkkr1qhXRHMO4ffKEWdeeyhwJIsvvj6vQrs+oPwaGPH0gm0O9X++H4ZV/pPjlShYcCRN1TgVWaa+C1wFxWB0Uap/njx3yNcQ4T4iE/JTySaKWd4ec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Vq4sTN5r; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Vq4sTN5r" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2d228a132acso80456081fa.0 for ; Tue, 12 Mar 2024 20:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710302062; x=1710906862; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RLTPq66GU+FLbpH3nyuA9I8IqdpbGC/dXUxjJTbbTFU=; b=Vq4sTN5resfoKl2ZP0jIXXTxe6kN5nrkl2+af6Nd9sXill94EtJYPjSO7fsRitsmiV f6CvorYT9NujrGwI/6V4vJBc4jRpDHyYWGaw5fUgS9ITYobFPQ8BXMlhLQ6iP09cTUMV NTg88+KUuYj45Qm2ldzBJK9lvWFJ8WLfgOgERsrc3R83nNSygF5h1gXY1pX5KhDx6Auz XUCrzteGKc5oZoH81wGcbXyd3MpC62YrKWWJ6bz3SrNEntu3uKa11D8AepEAXzYYUf5P 1H6a+fVGfQIIV6GbqRtuNMxOwIVUYd3jd9ik0STnHB4jTUtxKxN4vdYk6YrVrsnLCWJ+ iiQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710302062; x=1710906862; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RLTPq66GU+FLbpH3nyuA9I8IqdpbGC/dXUxjJTbbTFU=; b=gmherTwT2UeXoZ1uBmEJxG826La+u4it+JE+AHJACdV0LsffDX1EVMTEl+68i9ynQo kxk7FsowTP7DP9+SKT7Vtv1Gs/EsYhvRcWhclt5XsaUMKrG+h70OCCVA24NYfqqZv0qC CLQgsjvFmSBGyV+IE/4DygTnwCdO8bFf49lWnjGpdp0boihdDHGe++oR+ARRZYqgVsoI 1UvmfYCKk5QnK7hSCRaQ8KOm5oQorPocLr9NiNXrpk1DLTGuCj8aOaRncp8WhblGSAbQ l3RQlTJ80oaLbzvJRNt0ooOof5Xp14JA6GbjMuCsWUYUCSfu3F6PN79XmnpccYmWxUDr cPcQ== X-Forwarded-Encrypted: i=1; AJvYcCWPRHtufS7qKfUml101Stbqb3gS3rTxNg2KaJg0ehQ0JRXHXBqBd/oYjaAsh/Sf9p2IV2hurfxAYousmYJhsEHE6W6RoiuGHOym X-Gm-Message-State: AOJu0YzKXPbCMrXZ5n6H4s+hXPkNos/MYnVOyxzVljOZPy5WoGoFqDvf 2FcfXTDrqAgxLJNcTaP6Dw+J+8qd92gDN2aUWrXcM90xn5A/UeqE+3IZjh+gNvw= X-Google-Smtp-Source: AGHT+IF2gIO8l89DhMPUZnzCGqhK82MhP/4ZMa2FOkGWNOMjWcfpe6eVq0PlHpm1K5Fom8nIThZywQ== X-Received: by 2002:a2e:7812:0:b0:2d4:142:488a with SMTP id t18-20020a2e7812000000b002d40142488amr7666840ljc.8.1710302062209; Tue, 12 Mar 2024 20:54:22 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f25-20020a05651c02d900b002d0acb57c89sm1854319ljo.64.2024.03.12.20.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 20:54:20 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 13 Mar 2024 05:54:11 +0200 Subject: [PATCH 1/7] usb: typec: ucsi: fix race condition in connection change ACK'ing Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240313-qcom-ucsi-fixes-v1-1-74d90cb48a00@linaro.org> References: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> In-Reply-To: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck , Bjorn Andersson , Neil Armstrong , Konrad Dybcio Cc: Johan Hovold , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2257; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=5qUUCTMFfwh0GWLizFk8xctUPdAHmp89Ki8123ktN38=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl8SNqd16wpFUFHQFpmCrx+aM4x5e+9Cbg/SwXy EdVo+IYGxKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZfEjagAKCRCLPIo+Aiko 1UjFB/4vxPjvb5YNIJgzQJVuz/WdW4MrD6GzN/1jhebh/IPO9C/nP43s77XTsN73+OTlfVNgKj7 KRzqBz1ESGVxQQxhe/2KfA1S5ijpxK+egNcbul3gw/oqD+nGfIZhPoHp7k6GhiX8akiKxqn27LC iJm920Vq03Of8/X5T8XaKKqmaZ26hpUvv9x0bkBWszW0edyW/Nbyj4Ad4nUiQaFlmVS/e7RpQcK Z7HDoO+hI6Oj3xqrjlFHLVrxkw2ozF+vWnWoYPI9QENjgV58QiyN1B+zRyyTNVaIXyrZkuhqa2l FS4ARb4RRh7dauequb0u/GYKVmA1E3ZUQZmDS9/GMRhM9S1M X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The code to handle connection change events contains a race: there is an open window for notifications to arrive between clearing EVENT_PENDING bit and sending the ACK_CC_CI command to acknowledge the connection change. This is mostly not an issue, but on Qualcomm platforms when the PPM receives ACK_CC_CI with the ConnectorChange bit set if there is no pending reported Connector Change, it responds with the CommandCompleted + NotSupported notifications, completely breaking UCSI state machine. Fix this by reading out CCI after ACK_CC_CI and scheduling the work if there is a connector change reported. Fixes: bdc62f2bae8f ("usb: typec: ucsi: Simplified registration and I/O API") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus --- drivers/usb/typec/ucsi/ucsi.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index cf52cb34d285..4abb752c6806 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -61,12 +61,28 @@ static int ucsi_acknowledge_command(struct ucsi *ucsi) static int ucsi_acknowledge_connector_change(struct ucsi *ucsi) { + unsigned int con_num; u64 ctrl; + u32 cci; + int ret; ctrl = UCSI_ACK_CC_CI; ctrl |= UCSI_ACK_CONNECTOR_CHANGE; - return ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl)); + ret = ucsi->ops->sync_write(ucsi, UCSI_CONTROL, &ctrl, sizeof(ctrl)); + if (ret) + return ret; + + clear_bit(EVENT_PENDING, &ucsi->flags); + ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); + if (ret) + return ret; + + con_num = UCSI_CCI_CONNECTOR(cci); + if (con_num) + ucsi_connector_change(ucsi, con_num); + + return 0; } static int ucsi_exec_command(struct ucsi *ucsi, u64 command); @@ -1215,8 +1231,6 @@ static void ucsi_handle_connector_change(struct work_struct *work) if (con->status.change & UCSI_CONSTAT_CAM_CHANGE) ucsi_partner_task(con, ucsi_check_altmodes, 1, 0); - clear_bit(EVENT_PENDING, &con->ucsi->flags); - mutex_lock(&ucsi->ppm_lock); ret = ucsi_acknowledge_connector_change(ucsi); mutex_unlock(&ucsi->ppm_lock); From patchwork Wed Mar 13 03:54:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 780848 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E7B410A2A for ; Wed, 13 Mar 2024 03:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302068; cv=none; b=QJhP8DM/XUuXNQMS9DUllePoBIEROc/i7kUPgL5HdRF0a6wCDwcyq/EIeV+0yAptOwe8OXojkcF0e5UfhjWiZs7+grQKEeueGwYHLTixzfxM8u5K+uwjfa5pTxAimTgq0Vv4OizG5fXE3fLYcI76JYCXjnrCFs/mugMIUjYMG0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302068; c=relaxed/simple; bh=b4TOdcAfpKP7c8TtSew/74QZD84OuH+/13I9UVvWj6I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EEnyhp1rTn9jK8rvbXNkTrYb4chiL9g5JQGlSRxdBe306TLDZ4p/67+wNNSdbzwhJeOZ2Cbnmdri5DG1GmPCtvYg8nbuWEVBCLq3JSLOVu2bW9I+hzZK1KN1yo7GAp7mbRBDC7y+Z1/GjoB864CD1hnWZC9y7neqkrnFhdFxKYM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=N//dqGSF; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="N//dqGSF" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d09cf00214so71636561fa.0 for ; Tue, 12 Mar 2024 20:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710302063; x=1710906863; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gFntvUmfQrQoD9JhHP4a9IiBrKarY81qZUG6+LdJaJU=; b=N//dqGSFTGZvAunpZjEUrPCDR0QAy+0xIvChTBMKfVysAt17fMBVWca1U/DE6hmJFo AZE7RnQOrdAiy1nfH43OuJBJ3loRlKATQS+f3JoY9Ct07oJQ6ACDV54vwx2Ql66uoNHM 27t3+kD7wxgrwF4lL8emztXUM+CY8mnXeHuA3sWunwWVeNp5nR998/WaXMN7IHjPWd/b ACbQOG2tQVVLeBabOfoDjpLyb2du6+7d//2Ltzpw+/5ZPJcQZX3I+DaBfbBZBWm8i9mG iCsGjea1ADQWIO7ehcjkQ06irnS7aw3iQcw1mWKVKbinon62i2gXiyQNrhM7wJVoGfFd Ujrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710302063; x=1710906863; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFntvUmfQrQoD9JhHP4a9IiBrKarY81qZUG6+LdJaJU=; b=abRxnT38MGjqKyzEpK5Wc36z3/g5KhxFfB0J0gUAQmpe0M6cqU7blanMWac6O26sQn OKelp1sBbR12+Hq/Efl2NtmfjADfnbJDVDN5UPSEH6aCN7t+QP742jIn5y4AwLIXx5OC Q6k2PLdrrROnEJdVBkNlzB/jhv4z0+nYTW/aINtZ0N/aN/7DKLGb8rhEbAZ434obg3sz 9yk63HM1PXnwzc4ylpx+15ET2BB4lUnX52eXyLrfdRMzHBZ1xuSP437G5FMuUIjuI7V2 kdO6frI8Cq9KlnSnb4+Qx+PObxQwda+aeyXy7PIezZs2H+LwdTT8x6WGtgiY1sQ3t3i0 e/fw== X-Forwarded-Encrypted: i=1; AJvYcCVW4U0hV0QBPi2CqCjsEzOJg+FCgBU01ZyjohV/SwT7km+NfmDIx+yiodLsbU5QXPVuwcNQdZzIGGMVAVJEkHSteTQSCQ53rGF2 X-Gm-Message-State: AOJu0YwUAh/6DE+TqdR0eFe2qgKikEyH9KouPuRuQJj2KOBgQ4+4QmBY PDFMg1MdhH3xi8cbAQVuuuYdzwBTijJUR0Nali3r7Y2Ex3Hy9cqF9NV7I0DrMjc= X-Google-Smtp-Source: AGHT+IF7ZptzPxSTf58/lAJjw4Oo4QhbXQNkZBdrDCZziYkkXuk84yKwMDenXbJyp736hIssvaOTAQ== X-Received: by 2002:a2e:8e3c:0:b0:2d3:fca:dae8 with SMTP id r28-20020a2e8e3c000000b002d30fcadae8mr1200502ljk.16.1710302063642; Tue, 12 Mar 2024 20:54:23 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f25-20020a05651c02d900b002d0acb57c89sm1854319ljo.64.2024.03.12.20.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 20:54:22 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 13 Mar 2024 05:54:12 +0200 Subject: [PATCH 2/7] usb: typec: ucsi: acknowledge the UCSI_CCI_NOT_SUPPORTED Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240313-qcom-ucsi-fixes-v1-2-74d90cb48a00@linaro.org> References: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> In-Reply-To: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck , Bjorn Andersson , Neil Armstrong , Konrad Dybcio Cc: Johan Hovold , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1127; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=b4TOdcAfpKP7c8TtSew/74QZD84OuH+/13I9UVvWj6I=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl8SNqeJcoJB/Iq7ScN3gQPd6nqFh0TtyF56Qo1 NIzkt2f3CaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZfEjagAKCRCLPIo+Aiko 1a3NCACwe1UaBtfp8zYIFp97vnTMJ/Rftih1EHQpFoHrXfy+q8GjM7W55FJWQ0tAJYAHneww/11 rW0r6zoOWO0hGH6L9wScIb2k5fsy8RgV7e5FOj/Yu8QMY/f0FYoQl15l8AUfhF8BWYhgWll8tf/ ipldJqj9i7EgaY0Qr2FdwICG5H2Y2LePyZRb5HljYaW4ABjjn6ojloi0+4f9nExQG7K9bdOkYMb q3EwJ6XFQlbJCSnMjN2nAp+f5lYuWmFria6qyf/FXgkYqO0NJSZ+cETuzQ9B4MG7uYbNwehvcII vndULkoE+/G27inrpaRG3Q2Nyyn9uNwE75AcIJ4co7trqJew X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A When the PPM reports UCSI_CCI_NOT_SUPPORTED for the command, the flag remains set and no further commands are allowed to be processed until OPM acknowledges failed command completion using ACK_CC_CI. Add missing call to ucsi_acknowledge_command(). Fixes: bdc62f2bae8f ("usb: typec: ucsi: Simplified registration and I/O API") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus --- drivers/usb/typec/ucsi/ucsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 4abb752c6806..bde4f03b9aa2 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -167,8 +167,10 @@ static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd) if (!(cci & UCSI_CCI_COMMAND_COMPLETE)) return -EIO; - if (cci & UCSI_CCI_NOT_SUPPORTED) - return -EOPNOTSUPP; + if (cci & UCSI_CCI_NOT_SUPPORTED) { + ret = ucsi_acknowledge_command(ucsi); + return ret ? ret : -EOPNOTSUPP; + } if (cci & UCSI_CCI_ERROR) { if (cmd == UCSI_GET_ERROR_STATUS) From patchwork Wed Mar 13 03:54:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 780847 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8A510A35 for ; Wed, 13 Mar 2024 03:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302069; cv=none; b=bCAXufkGJZccIZFFoRlSnConSlkdrn3NXKpBixhZaeoHCyc6WCZAdBwkk+uJyiDGqH1TNGon+vVapTzsAPKihh9Zp4xDb8eN7lJL5LKiAC084Np2IUUsQQcu3/b154SUmS38RCFB/Y8aZ2It/GPrSSdGXK6oH6b/8DZR2Opu+uU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302069; c=relaxed/simple; bh=pwqh+7qUWx0XkGuOfq8GXVfKJVkT8SLDNZBKjtfBxbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QYbuwKWWmbp6yQ69OT/MSNHBGcz6LNJGTAEmbZdHaa6afNCtAVc4xXieuGIwIBC19pY1LvitUzrRoqaYTTUIguOupsF5Y9qWUcLHKxiGTUYggUCfBO//fqix69e50DMDkbtz8cWqoCzHxCy5PjsfpGPgvGWlK5bCzW6JaCuSApQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=IUaXGz0r; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IUaXGz0r" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2d309a23d76so3551531fa.1 for ; Tue, 12 Mar 2024 20:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710302066; x=1710906866; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=uhTvdctsG3UAMNuU+ThWL3PpPImv7wP9zybhV8Y4zOc=; b=IUaXGz0rxDtAD6Cld+luz1aqvemAl0UDawDcjU++IpWlYfvGzG72/Kez6VQDQCIByH ZdBRlw9KC0TIw+OaGGv6MNi+tlEk5alA2DMVVPVU0fhl+VQVV0h3HA2gsql2hNIFSvFF oBcLZEvksHh6n572UgLmKAcCTE/jjHf42gutb2anI8imgDytdXBxs83HfeDHuwO4Ypmf fiJjnj6e1xcFJG7rsaSoB1Jyb+hvO2cdnAiLgsQPXwJ0pEaQjR5H0b3cb8wW47Kc62F1 2W2NdIPaA9uLiTWGIGbPN20KcViSMpaskbOaTsFmbOrsPthND/If5ZhET3VeLPAZsSYM 7Ayw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710302066; x=1710906866; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uhTvdctsG3UAMNuU+ThWL3PpPImv7wP9zybhV8Y4zOc=; b=WcbxZyTnH3yxtXlp9turv+XOWzovWQ/H8KIL1q6ReZUQzVjwSmg7p54df021QTRS+W 0gKlVz37+Ma6hQnCdoD1PG8bNvnUp5nKzVdESvd0m/MvNVzlNOOh0qZBTjJl8nPtkS7y Pg2QrPBmwXssie2r4xrtnpb6NL4DUdP+fP19FUR+adeaCpK5TW1lOvaGp+oiX53WhaHb LnonWMDSlEMD8XFWAtFRRzUnDGYDgSJrs3dpoWr1Y98sd3pY/+Oh77r8a13qqYYavQwK j/Aot/RhB9RfPedOv3bsw4m0gbWz5Zx8JbiuNDDer3vIVA2Aqjrx2gvvEX9QT6g6xLxR vB/A== X-Forwarded-Encrypted: i=1; AJvYcCUD2+LQwt//f7BakCcDoToRariFzRQ+ahBsmd1KtCY6/gfvllh+WQ3FF4Ylay8H/r6KEHp7QE7zudMWssjQiWePXNOq/S3nUACc X-Gm-Message-State: AOJu0Yyq4WUf3cMWHEDpP2amyU1ant7UltP7xY52XrF16piAva6Tyu7L kRngcapzmbtO0xO4XU7c64R+54MMMypwVbVwBujTIhjno5ENPyLdvwxxtpd2Ez4= X-Google-Smtp-Source: AGHT+IGUXuKt1xsCYGLcIpNaTG6doYJa88I3f0jTK6Qe7QNycBlM9CkIMQ3hzYDXjsxiQ5roHW7rYQ== X-Received: by 2002:a2e:984e:0:b0:2d4:6c19:67d5 with SMTP id e14-20020a2e984e000000b002d46c1967d5mr203100ljj.18.1710302066638; Tue, 12 Mar 2024 20:54:26 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f25-20020a05651c02d900b002d0acb57c89sm1854319ljo.64.2024.03.12.20.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 20:54:25 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 13 Mar 2024 05:54:15 +0200 Subject: [PATCH 5/7] usb: typec: ucsi: limit the UCSI_NO_PARTNER_PDOS even further Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240313-qcom-ucsi-fixes-v1-5-74d90cb48a00@linaro.org> References: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> In-Reply-To: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck , Bjorn Andersson , Neil Armstrong , Konrad Dybcio Cc: Johan Hovold , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=936; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=pwqh+7qUWx0XkGuOfq8GXVfKJVkT8SLDNZBKjtfBxbs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl8SNr5RlhRizT3CYUWt8TNerNgnS1//e4G+r31 b4pQpB5/6GJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZfEjawAKCRCLPIo+Aiko 1SKzB/9zGp/G8bISVxeCGIhS8uvT6pZELUF3hCqGctUuFrbIpV65Gdq/ez91l1PgETjn6GMCGSW sAKmTpVlfnYDypMn8wZuwVz1yetFoXqRg7XEik/i8PmzxnXJVzzaUoakH/cp4hqBA1kTWgozjnz QRLPZRDHLyOZiQyefK2xfU9z7uZtVOEBUt9Io625dadNsoqHfFgZYsWU7Y7fNlDVusSxtlcr7Mu u21RyF7QSCKpFQtY5OUuNK3HYU/CQWi4Xj0sKJcf2KkWRDPOP06dIVlz7HdPmtf8DxqLTK7qE0H q4ab2aeZAZIYxyMuW8ijEU8rFWVNG2MVGglhuwxHo/9usGyR X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Reading Partner Source PDOs for the consumer Connectors appears to be working. Permit getting PDOs in this case in order to populate capabilities of the connected power supply in the sysfs. Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus --- drivers/usb/typec/ucsi/ucsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index 011d52bf34f6..72d368433b1f 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -642,7 +642,9 @@ static int ucsi_read_pdos(struct ucsi_connector *con, int ret; if (is_partner && - ucsi->quirks & UCSI_NO_PARTNER_PDOS) + ucsi->quirks & UCSI_NO_PARTNER_PDOS && + ((con->status.flags & UCSI_CONSTAT_PWR_DIR) || + !is_source(role))) return 0; command = UCSI_COMMAND(UCSI_GET_PDOS) | UCSI_CONNECTOR_NUMBER(con->num); From patchwork Wed Mar 13 03:54:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 780846 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71E2214ABC for ; Wed, 13 Mar 2024 03:54:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302072; cv=none; b=PORiDk0H5iYgH3Siu1rgYf6xjqtm39u+bHw5mzgYoJVHq4qCJJU9+upeAVArldUCwMU844rrW2nQw/m3x8KkvG+7QN1twWWTA0OktqVaaASBiJOtFHjanEAKyMyCNIm5Kr08n4GIYvfOyFrsbCPM56EDp6aj8TpkS2On9T5D7Qw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710302072; c=relaxed/simple; bh=S06LW4XbXp4mNZRbX50ghuv/ngjWIPDbWauLWS0Z+FU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KKfPibMzfLJaV3fpMkS0FLdYLmaEB0QG2QP6CB4xDaK2KWaqXu8shavdzBsCZrENj9uhN5KaY+jLtKVnxr3Nr2E5b+A5u4sZKoqubtoFakAeQwX6CwRMubYOZqdekQm0/jv8EnAV1TP9CJf/r7RK/iLpMgDuzzAUdXmvO/G9h44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Pnov1oIs; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Pnov1oIs" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2d27fef509eso101134971fa.3 for ; Tue, 12 Mar 2024 20:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710302068; x=1710906868; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Z632Vl9mGcaUD+E7Cpwdhyjpjxo2r7hLci9lVvPzHlg=; b=Pnov1oIssLpiTJqrAjLlU8ThYua0NravpFbBeOIHDnL1NiU9ugNF89QXqytmXt5rBu nw065NatFw/6ijseQV7HO0JtB3heAaTFJZZ/X4jNvPDvXNr2JIm3wHM5p8hJikLAuv27 IfyvK91T82fWeJCT/myTLmLuJ1erJdDaXeMqZWeB+h4ShQUPGo7cDSh3M8YUkJfd6XMW 9PTMXHT/oaYjCyFBQkCBXAa8C64xdbWJAyqRT7fnTlP0EQwP7EgXyhdoptJFlDCtdbkx 8nxCzSH7uOwfyzkciHoM2W1AVIyulcb4EXXZV1BvTJpVmV5As6E788j1SQmEGVUpimhx YkQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710302068; x=1710906868; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z632Vl9mGcaUD+E7Cpwdhyjpjxo2r7hLci9lVvPzHlg=; b=Hg/x2UK/z0niAi2XZHIUhfs7ikkM3/cMldqpKYUSgly9W4RmAuyJ8bGseanD7uGlbu lNnHfjJQuRcii+KDr36hj2V9N/Xl9RZrJpziubtsjthu+ItRPfh6a0iBFSrojVwahZsq MWcb9aDBEc+gmQFWBM1dEockv0isoEePqxGNyRrjrWEWgEvKLBUDC1BtIXB8aNWG4Rhx cicEL5Os+Xw0EU/qWq2a2E28xK0ypvO/X4/TZABxY9LNCS2lwBJiQxK32f8/Zm3a0KKW 0azNDtk4oXG6rpQg5CfVquG0jOZ1dwbM0CLAPO/NlMZyDe3IpVbDnSLHP4HvLfzOvNHo 3Ifw== X-Forwarded-Encrypted: i=1; AJvYcCXR3A8FKIe+mhrMOgIMBVbobpQWCurXKPpV2URQdhGA65NzsXNB5e7yFfpilpfXVKYLa9G9TT7Sq7fSRly67Gq0s7KkfgWrhhWr X-Gm-Message-State: AOJu0Yw383Dh2/In6LQ0JIOFCQF/Pt0D+GS0vP31HyTKbWoEzLyfNTQk XyX9eCfcDdmR9XfSiwd7JeXon4tHvgLYtZ9kMAz37j7eD56fnF0AD5PM8bnZk8w= X-Google-Smtp-Source: AGHT+IGT21uwfmDhENLTqEjyobLcyK/klC8iwxAr7x91U3iV4MBVqo6A+D5u/a3myRTNeji9AGY8rA== X-Received: by 2002:a2e:b0f1:0:b0:2d4:4a0d:d48 with SMTP id h17-20020a2eb0f1000000b002d44a0d0d48mr3239650ljl.47.1710302068739; Tue, 12 Mar 2024 20:54:28 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f25-20020a05651c02d900b002d0acb57c89sm1854319ljo.64.2024.03.12.20.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 20:54:27 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 13 Mar 2024 05:54:17 +0200 Subject: [PATCH 7/7] soc: qcom: pmic_glink: reenable UCSI on sc8280xp Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240313-qcom-ucsi-fixes-v1-7-74d90cb48a00@linaro.org> References: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> In-Reply-To: <20240313-qcom-ucsi-fixes-v1-0-74d90cb48a00@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman , Guenter Roeck , Bjorn Andersson , Neil Armstrong , Konrad Dybcio Cc: Johan Hovold , linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=885; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=S06LW4XbXp4mNZRbX50ghuv/ngjWIPDbWauLWS0Z+FU=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ+pH5exzHOlrKmav+l5ZE3/7pk7Bumje/gT92sakcnOr+ z475i/pZDRmYWDkYpAVU2TxKWiZGrMpOezDjqn1MINYmUCmMHBxCsBEIt6x/9PjOXv3CoPxwnZL /882hZlvIuWPab36PneV8eaX2dtFfV+qacU01FUwytl8t16Z9L3D1vwPa9jl+PWhlYe7+u/Y5hv +Ycz3lnr2I5TNUkfrn9dvwwDe1bJJ+xPebTpwp6k7SS+gM/CiuT73lxj9hCm3JzClFD089Lvg+N 0W68NhrZvCJmf7VAp/8quvXCIqvu2hvEpA49O5wVF57Bbhmre+B4haaAXY2PfoHVomurTcYfVUr zV7PkluCHvymIvZoKJg32P+9bNqjD22OSUWGvd4Gese5Z0jpXjitvapDe8dtu3icbT8s5rzzCen DNvZE77wHinmjjmesnAK7x7RfX9vBd3a8G2KkvccGY31AA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Now as all UCSI issues have been fixed, reenable UCSI subdevice on the Qualcomm SC8280XP platform. Signed-off-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus --- drivers/soc/qcom/pmic_glink.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c index f913e9bd57ed..e5a591733a0f 100644 --- a/drivers/soc/qcom/pmic_glink.c +++ b/drivers/soc/qcom/pmic_glink.c @@ -343,7 +343,6 @@ static const unsigned long pmic_glink_sm8450_client_mask = BIT(PMIC_GLINK_CLIENT static const struct of_device_id pmic_glink_of_match[] = { { .compatible = "qcom,sc8180x-pmic-glink", .data = &pmic_glink_sc8180x_client_mask }, - { .compatible = "qcom,sc8280xp-pmic-glink", .data = &pmic_glink_sc8180x_client_mask }, { .compatible = "qcom,pmic-glink", .data = &pmic_glink_sm8450_client_mask }, {} };