Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2337995pxu; Fri, 9 Oct 2020 14:15:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJMtm11HeMnJxcrgmBoMssN50dVE45c0G2utIHUHc9F2zx3Qb74EIS9G+pb9gc04s9nR43 X-Received: by 2002:aa7:d488:: with SMTP id b8mr1211632edr.21.1602278134673; Fri, 09 Oct 2020 14:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602278134; cv=none; d=google.com; s=arc-20160816; b=FLFJ36fvwIEPL2xn3JB8enTKKidqsk5LaKWAdoRU0W1JB3eKJtcy632D8j0pFX9yO4 Kclzyqj1KpyluzbtqO6I0vLarl4wAKIx6GbLCpx6GoAuuDZ9DQKSoA83Wrq5ZF12dRPK uR24Lb5j1M5ZXY4kdcOV4h/xAgWt0IIWIJngIpCD3jXEkbFvan/JYwbhhcLQxU+gnOwj /qdtn5BF33UMV0wMoC0DgSQ8YV8HGYSj/dAUz7YFC76B2VnJa81hTQ/k6I6sXgEvamLS M8bGW+6pW+xAaTIdeH7URiza459X1z1hPOolUxj79kGa1TNmRoQGo+V3XXZf86L3JCFf aD9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BxdWRQZZAQXbACMcVIYykRy6YUP7TBKb65N0Og/TMfk=; b=oHTG4TXu5kdxGbstessdh4t3KhlLyLjJ4IWyvLbtHWEWINiE83NL5VzrADcg+5vWZr vuF1CigXx+ZDjud+bLtxuwqo5PiZk+NCOyadROfuNKJnsGsZkSqCiRFR4RWKNqfV/bEa 1krhd+mGJ3UUerM3wPCOzDdH85iHRd9X8Rw1za0znCg7iI0eGfF10D+Ue06JT3kPsMsy IPd7TmECG3hQlOAey+Azbe/pveQYp3DqtxWJwUiQBTZyEFjTV4DC9NMWLAm1gSOsM7S6 8kcCiDZwN48bzH+O3CnPs53ff/NimrRcpLtjVbe0natKtJVMMjnW+nP7+fr14pwyJFzY /HXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o24si2299767edr.567.2020.10.09.14.14.34; Fri, 09 Oct 2020 14:15:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388947AbgJIOlG (ORCPT + 99 others); Fri, 9 Oct 2020 10:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388691AbgJIOlE (ORCPT ); Fri, 9 Oct 2020 10:41:04 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A068C0613D2; Fri, 9 Oct 2020 07:41:04 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kQtZr-002KHD-Q5; Fri, 09 Oct 2020 16:41:00 +0200 From: Benjamin Berg To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Guenter Roeck , linux-kernel@vger.kernel.org, Benjamin Berg , Hans de Goede , Heikki Krogerus Subject: [PATCH 0/2] UCSI race condition resulting in wrong port state Date: Fri, 9 Oct 2020 16:40:45 +0200 Message-Id: <20201009144047.505957-1-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Berg Hi all, so, I kept running in an issue where the UCSI port information was saying that power was being delivered (online: 1), while no cable was attached. The core of the problem is that there are scenarios where UCSI change notifications are lost. This happens because querying the changes that happened is done using the GET_CONNECTOR_STATUS command while clearing the bitfield happens from the separate ACK command. Any change in between will be lost. Note that the problem may be almost invisible in the UI as e.g. GNOME will still show the battery as discharging. But some policies like automatic suspend may be applied incorrectly. Cc: Hans de Goede Cc: Heikki Krogerus Benjamin Berg (2): usb: typec: ucsi: acpi: Always decode connector change information usb: typec: ucsi: Work around PPM losing change information drivers/usb/typec/ucsi/ucsi.c | 125 ++++++++++++++++++++++++----- drivers/usb/typec/ucsi/ucsi.h | 2 + drivers/usb/typec/ucsi/ucsi_acpi.c | 5 +- 3 files changed, 110 insertions(+), 22 deletions(-) -- 2.26.2