From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796378950; b=1sVVnH1vQI4fqAP25N/3aoTP4s6EhG8QA6vL1JUW6J9RP93ITW7NyYiuH1bCWxS6PYQ6 r1pqMkZBkmV2wJGy5WCkyvWmfMea6IodqjycO4hNmLdikui1G8eJwbN12W+3KpOe7q94B RhPvQlJro08qQ6nFBvczFYJ1Igpdq5GagFd9T1X74lgQlK68+9wvsEX+ffpBHy59o1mCz 5Tcx9YZUE2y2gmcupfWd74/iVBRvjbq3YlAUh80v5Vt2HJA0dFPydtx95ksB8vYMvGalE Th4Fye4a/LtFmoiudjWYVN6QlcFlU3rqOoA8xu8QLSte+C1bUbE+EP/aIZD9EtyaPog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796378950; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=j0DZLXa8gzXwy/KIRZu/XTXM9BMoUaCyXQ+odhDjd8U=; b=KmVlLFkATZ6K0KsWFNmlJjQTBvMgd9iRZBeS/3oG6L+zm6jxd5agyPg0dQgbKXbqOhIW GVmoBkUTaVKa7F+A/F96aLnOyAcI+g1O8lnVVGp7wwMVy+rNqfMHhL+mkrmRLfb2QSF2a K2LZYyskT8foHSefkdVb2IWfKK48GqM/9uPYYhLYgkwy0DGberL/Yv4HlearwjofQLUVV mQFM2G1dw7/AOEZI7wRXFC/LLstIluj9ryslSZaHFZVpZCLatAt84KoK84BQQP16/ZHFR /t0c0ibW91L6uZ9Q03AtsVoi5dViW9XaxuQYK+Udj4tyUS0dAftleHCsYJCQNEIj6/A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xRjVTt3W; arc=none smtp.remote-ip=74.125.82.178 Received: from mail-dy1-f178.google.com (mail-dy1-f178.google.com [74.125.82.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8AFC606A32D for ; Fri, 4 Dec 2026 10:09:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C8AFC606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=xRjVTt3W Received: by mail-dy1-f178.google.com with SMTP id 5a478bee46e88-386ab9ab619so1228192eec.1 for ; Fri, 04 Dec 2026 02:09:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796378949; x=1796983749; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=j0DZLXa8gzXwy/KIRZu/XTXM9BMoUaCyXQ+odhDjd8U=; b=xRjVTt3WKCJZS5Ky82XVGSnx6oJD0jGYTC4B2ZkErXXpS6JHBFDk3jt86bhX2TvRVS aa9NZIqG2XkPi6KLSQ5eTOUvrfaT5x66gPxuMKzCqyhBpIVezBdEYlFeb3aEEf7W9Uc+ wAk0xGZAgCGZnHWGU06YrGpTPdWK5EpJZpO5tKrO5aCXgaAULsAfyClT0wjttBHvBuLE kEnL67/qforS47VmWrxNc9wTax08VWQcMFFM2XlKPnsBTkmKK0ovkAt7iTqsW0E1p3p3 NnaLLPuDxbURnSyGEnKctDqkdEBFx+C/iaXJC5ZpuaWOk48nE2yXlzp8wpbJO1Y+Yuh1 kbuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796378949; x=1796983749; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=j0DZLXa8gzXwy/KIRZu/XTXM9BMoUaCyXQ+odhDjd8U=; b=U2G4pXFjQzem7SYX+tePE/ruoWxWspubvegedFS7+bAL/a89cXhhW5X7tWVnxyiC7f Ey6agG3DOr7IkWECZPfP1UDrYSfJfSUYSMJuFdr6M6+q7lugTxadDZB2fT5Aqgs2ezRI HwghifqhZPr5avXhonu5wfWee9uAD0kJk1LlYD1UymX9f/ayG9IiCfzZjLmLkVkta/L6 NjQOCvTSoJK2gZazGcyw167rnDWhw43ebo1MFbABpj7QcdFOoROI1ZzCfid0HSESJiTE lLNnQBmKKNt53kY/eqr6p3/BhfOswR0/dx06Dn3U4PE3YZrxykS4JwgSphT/DRk4BMir PYlw== X-Forwarded-Encrypted: i=1; AL+hErG1cDvwktebzNW9z5HP6s0SFZGXB6xatzi++pAFZYuM56nxXXBgZmmioVe14smC2F+t8Ck1Fp1Zxi46uzI=@vger.kernel.org X-Gm-Message-State: APuU4Z+Dqco80MRToNPTYYSh9aUj82sZMF3YN9xVrYKAxgZskcosGjis G088csRdRpPqMHvErFLs7SwsV+KaAdL1PQHHecAnmU8I/Jzt9U4W0Kwk X-Gm-Gg: AZFdTZewD5CtDZ2R5pf4RIrEEMRgNLKqCIQlnioUMXqJMgKTarIZ9zrR5iwDTptOd1W 0oCgS8maIzdp2VnfZ+Ausdl9evdOV3jmClGvMxrjNuV7xIBHuOGA4G6sDkgb6gBUkKL5KnYYvUI TUWH52Uozq6VnHD2IHMx3c2F5vOpTguHGAP0nxIySt5/0yL1je4cP9Hj2KJlqFjvuQbM+Tgi6e9 bAGapjAqrrGgnNgtPJ/J3XBDZ5VM08AEx5QrV+OXGXW20+VI7sExrXVz9wRG+NUgIJtu+ZGnluE azfJfGauiPSc1DElAiVPV3Lascpwo/iDRxbO4oCZxgwTCU4sNa+Bsj8T+LVZpYCwKVT0HQGaVNe AZbkjGLNxf1fs/l4fa9nMR1BsPVlVCEQ/ytOHuOgGzon7Ya71fgn4DfsaFiv7rnzCf4zWOfhhnG YZcHWV3o/P4l+5zxXBXWyFsqB2w/7Zm2VxOpMTn1zHbqMiIi6V/DblR49zrDfCI4Y8vSuasyuth ayuaYxWC16LWhAa6YnTF6xl57rc7mkB3srPvKWOo5PZ8w5oJQK3RvCZ6JIDqewQdQMLIVRxj7XD 2tdR2aJEoEQQxA7yHp62BNdfDa2QJ+Bn3CeFFnVv+IYdscxt1dPTpDTNwEb4YzWEj76FpCTRhtZ RK47Sl/ZqB9UHdmjj8hqJzsiSE0MEAvpxJhiuJjGzqqeG8q+4HLgujAtQk5DPHLUhexE4VA== X-Received: by 2002:a05:693c:881b:10b0:37b:e01b:9f15 with SMTP id 5a478bee46e88-3875211c1a9mr1731377eec.24.1796378948852; Fri, 04 Dec 2026 02:09:08 -0800 (PST) Received: from localhost.localdomain ([2804:1b2:aa42:d9ac:8d94:d81a:c8e8:49d9]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521bb842sm6358648eec.15.2026.12.04.02.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 02:09:08 -0800 (PST) From: Vinicius Pedrosa To: Heikki Krogerus , Greg Kroah-Hartman Cc: AngeloGioacchino Del Regno , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2] usb: typec: tcpci_rt1711h: unmask alerts before registering the port Date: Fri, 4 Dec 2026 07:08:47 -0300 Message-ID: <20261204100847.45323-1-vinicius.eduardo.pedrosa@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit rt1711h_probe() masks all alerts before tcpci_register_port() and only writes the real mask after devm_request_threaded_irq(). TCPM starts looking for a partner several milliseconds after the registration returns. The ET7304 (RT1715 compatible) does not latch a CC status change in TCPC_ALERT while its mask bit is clear, and setting the bit later does not bring it back. If the partner shows up before the mask is written, CC_STATUS has the Rd but no alert is pending. TCPM stays in SRC_UNATTACHED and VBUS stays off until the cable is replugged. On a Radxa Cubie A7Z (Allwinner A733) with PREEMPT_RT, a source-only port and a sink attached at boot, 6 of 12 boots ended like that. In each of them the mask write finished after TCPM started driving Rp, and in each of the other six it finished before. With this change 0 of 12 failed. Write the mask right before the registration, so the setup before it still runs masked, and drop the write after the interrupt request. The interrupt is still requested after the registration. It is level triggered, so an alert raised in between is handled once it is requested. Fixes: d6b82dafd17d ("usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality") Cc: stable@vger.kernel.org Signed-off-by: Vinicius Pedrosa Reviewed-by: Heikki Krogerus --- v2: rebase on usb-testing, as Greg asked. The context in probe() changed (cable_comm_capable); the diff is otherwise the same. v1: https://lore.kernel.org/r/20261126195059.1139494-1-vinicius.eduardo.pedrosa@gmail.com/ drivers/usb/typec/tcpm/tcpci_rt1711h.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c index 0fc583077078..a5688876a06a 100644 --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c @@ -338,6 +338,15 @@ static int rt1711h_probe(struct i2c_client *client) chip->data.set_vconn = rt1711h_set_vconn; chip->data.start_drp_toggling = rt1711h_start_drp_toggling; chip->data.cable_comm_capable = true; + + /* + * Unmask alerts before TCPM starts looking for a partner. The ET7304 + * does not latch CC changes in ALERT while its mask bit is clear. + */ + ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask); + if (ret < 0) + return ret; + chip->tcpci = tcpci_register_port(chip->dev, &chip->data); if (IS_ERR_OR_NULL(chip->tcpci)) return PTR_ERR(chip->tcpci); @@ -353,11 +362,6 @@ static int rt1711h_probe(struct i2c_client *client) if (ret < 0) return ret; - /* Enable alert interrupts */ - ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask); - if (ret < 0) - return ret; - enable_irq_wake(client->irq); return 0; -- 2.43.0