From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 6991D322768 for ; Fri, 6 Mar 2026 14:47:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772808447; cv=none; b=Usw0orfh8IFeaWtqx7CVnhR9JiqGCFEjS4WiUy/bVw3nh2q0aVdTGXY9nS7WBAa+YyFKndhMfJ/f4Y59c9TbCBC244kahjwSwjb7Liro7PR0IM/6bcW30ZyERfoMvtaXoiMKGRHDGyFVsZxd8msyTI8R4YYN7HyMfWL8n2UsRI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772808447; c=relaxed/simple; bh=lHU4p6O5PhOBjkv8UhxZJvcTBnLTNQoJwXygxMD73Bs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tNhQZ/cYKRPbER5sMW4ilmkXzWAl5oyfqOuTK8lEnzVicN4VDnI2WEaVgYKqFKGhE0HKAxmJPq84ZDww4ycHKGuFworTTZCaAaYC50T/KF2TnIIEL9KGWTTimnQgMiUreJ87qpVmInXZIhQQFzkPMxfSqS+paq9tk1zm25UPFSY= 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=w/Pi37k+; arc=none smtp.client-ip=209.85.128.46 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="w/Pi37k+" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-48529c325f0so2464045e9.0 for ; Fri, 06 Mar 2026 06:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772808445; x=1773413245; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:reply-to:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=u3XCaVwMs6jiaEA7h2Q92YjViLmR/AitujSLMg3tv7Y=; b=w/Pi37k+lQ8Oe/kaerGniUKykC0AL1Uj+im10rsbJelKzKAjFRojhq6qGRKexFNuyd CWW9oI20jvVc6v90ON4aZCofOhVNo6RroyjUMfTlyL4sfRJinTov/ztVYSQvyyrn/zp1 Kp2b2Gey2UJP2a0lGHMzLyLQhfo34ty08ldAEMwfWXaMu7fJrObnZp/ga9/ZyZuBjhmM DdRmDN/KCDICQkSQv1QD9Xu6VEuepHiPxKd25RkapZ49qFiYevhrLWewIFEJbDem3DAo d0KuqSC81VOB8O9Gi1hOyfkZYc18DzY13Mg14Ws/a7b2SPSOAEsBpxJa4FYBl3qdsh+J R2hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772808445; x=1773413245; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:reply-to:user-agent :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u3XCaVwMs6jiaEA7h2Q92YjViLmR/AitujSLMg3tv7Y=; b=CzwEEvtJnKFiIlcj0jHwaa4NPYoq7q6zzb62Cwfxcoi3zP91rI4/zdmujBplIJjhyZ Z4wXuBRatmFbTW53NK12V39ufPRJa+OxXC0dnEB8HIWNNVy1OXBlgcDGcaofYzs3vjTl fg2GXKLRPGyl9/gq+GVXPb4Vl26ClrMbeH7QdzCAHEE4alU3lfA8nVoyn8d24srY5/Zi IOBGuDBt5/sAiEKP5kMyFh8xBCtgdpiYMWpr1z3/WsBhz0D/UG8GH/bjFOAWX86E9PYR Fzk5XbT6vmIW/FnnmN94eltHZFsblFtKAM+iZf2Qkqxeiw8hm+ev2Ud0nN7jCr3M5wJk AKuA== X-Forwarded-Encrypted: i=1; AJvYcCUQJ6AeOUaS075JnVhkXG8v1v4JIgY01feAabvVih1y+vhSY9UJQL/n3MXnE4sUKzFRhj5g/+Aa1unL9SI=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv20uqy1eRUiUeHhLR0fStnt20rDBr1N9Byx1JnU+k9a1IfAA0 iMkD0dY2Gvuru6+lHrt8PiP0BH+GzE4yOstPOseMLCLp/0dPKON0LOilBi5IOQMGHqI= X-Gm-Gg: ATEYQzxF2NVjxL06N4NOOCDIx0zr3aIB0+Fql8ausW6V1u5bnZ2tMt1q/lFZbSZJYod f8ai1DK6ylH2uiGpLdKAhfHM9hafArmbYkBXq3oC3q/F/JQhKFLLL7JJsd2NdKuMFL4DllmElBf rpe7IdTOX2VjRK+7o9oUw/N7kEYWKKPk5mvsNyedvwrO2Ur7bTWlwdb4++NTK7sr0DeDckcV7eo 7ElCYiz7GLpf6QD43V/V8vS4gjcdOvRcjuEg/bQkDmCIS3Oa5calZH/gk++Dfo7N0sF6yPw3hqG q51HZjviEFwvgvKRl5UtHRWO6SxGetu0za+dYkgximIop6qGKRNDG0029moHX2ULbzjdQDS1FcL xk8cTZYeTV9UDoiKCxwcFpPed/Ef9ANp+xWlpgmpWYm6yX8xeaX9hMGsc7LbS7zPEPQursiAhbu orKjwMx3DB/KrmJ4oQLLySxssHongYxLaIEZIp73f0CBnTcKQl7g6JcBF40rYQl3tNE8lmqONtX 2dS X-Received: by 2002:a05:600c:3acf:b0:483:b505:9db4 with SMTP id 5b1f17b1804b1-48526978d8fmr37553345e9.31.1772808444635; Fri, 06 Mar 2026 06:47:24 -0800 (PST) Received: from ?IPV6:2a01:e0a:106d:1080:cbfe:649:7f17:8b95? ([2a01:e0a:106d:1080:cbfe:649:7f17:8b95]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fb27a13sm116190505e9.11.2026.03.06.06.47.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Mar 2026 06:47:24 -0800 (PST) Message-ID: <7fcbf142-f2c6-4b9e-bb63-befa553aceff@linaro.org> Date: Fri, 6 Mar 2026 15:47:23 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: Neil Armstrong Subject: Re: [PATCH] soc: qcom: pmic_glink_altmode: Fix SVID=DP && unconnected edge case To: Konrad Dybcio , Bjorn Andersson , Jack Pham Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Abel Vesa References: <20260306-topic-pgaltmode_fixup-v1-1-ec154b2d8e89@oss.qualcomm.com> From: Neil Armstrong Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85/3NU3oti3nrIHmHABEB AAHNKk5laWwgQXJtc3Ryb25nIDxuZWlsLmFybXN0cm9uZ0BsaW5hcm8ub3JnPsLAkQQTAQoA O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4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: <20260306-topic-pgaltmode_fixup-v1-1-ec154b2d8e89@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/6/26 12:20, Konrad Dybcio wrote: > From: Konrad Dybcio > > The commit referenced in Fixes started evaluating the value of > alt_port->mux_ctrl before checking the active SVID. This led to > drm_aux_hpd_bridge_notify() no longer being called for the 'DP unplug' > case. > > Perhaps somewhat interestingly, the firmware sends a notification with > SVID=DP, mux_ctrl=MUX_CTRL_STATE_NO_CONN and pin_assignment=0 on > unplug. 'pin_assignment' was previously interpreted as a bitfield > excerpt from the second byte of the DP pg_altmode payload (and stored > as an u8). > > That value is used in pmic_glink_altmode_sc8280xp_notify(), decremented > by 1 (DPAM_HPD_A). Previously, this would result in an u8 underflow > that would rollover to 0xff (which prior to the Fixes patch would have > caused a pmic_glink_altmode_safe() and 'disconnected' bridge > notification). That check was removed, without a replacement. > > Resolve this issue by making sure the SID=DP && mux_ctrl=NO_CONN combo > once again results in a HPD bridge notification. > > Fixes: 0539c5a6fdef ("soc: qcom: pmic_glink_altmode: Consume TBT3/USB4 mode notifications") > Reported-by: Abel Vesa > Tested-by: Abel Vesa > Signed-off-by: Konrad Dybcio > --- > drivers/soc/qcom/pmic_glink_altmode.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c > index d0afdcb96ee1..b496b88842a2 100644 > --- a/drivers/soc/qcom/pmic_glink_altmode.c > +++ b/drivers/soc/qcom/pmic_glink_altmode.c > @@ -350,15 +350,17 @@ static void pmic_glink_altmode_worker(struct work_struct *work) > > typec_switch_set(alt_port->typec_switch, alt_port->orientation); > > - if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) { > - pmic_glink_altmode_safe(altmode, alt_port); > - } else if (alt_port->svid == USB_TYPEC_TBT_SID) { > + if (alt_port->svid == USB_TYPEC_TBT_SID) { > pmic_glink_altmode_enable_tbt(altmode, alt_port); > } else if (alt_port->svid == USB_TYPEC_DP_SID) { > - pmic_glink_altmode_enable_dp(altmode, alt_port, > - alt_port->mode, > - alt_port->hpd_state, > - alt_port->hpd_irq); > + if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) { > + pmic_glink_altmode_safe(altmode, alt_port); > + } else { > + pmic_glink_altmode_enable_dp(altmode, alt_port, > + alt_port->mode, > + alt_port->hpd_state, > + alt_port->hpd_irq); > + } > > if (alt_port->hpd_state) > conn_status = connector_status_connected; > @@ -368,6 +370,8 @@ static void pmic_glink_altmode_worker(struct work_struct *work) > drm_aux_hpd_bridge_notify(&alt_port->bridge->dev, conn_status); > } else if (alt_port->mux_ctrl == MUX_CTRL_STATE_TUNNELING) { > pmic_glink_altmode_enable_usb4(altmode, alt_port); > + } else if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) { > + pmic_glink_altmode_safe(altmode, alt_port); > } else { > pmic_glink_altmode_enable_usb(altmode, alt_port); > } This looks fishy, because you had: if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) pmic_glink_altmode_safe() else (blah) ... else (alt_port->svid == USB_TYPEC_DP_SID) pmic_glink_altmode_enable_dp else (blah) ... else (blah) ... So what's the difference with : if (blah) ... else (alt_port->svid == USB_TYPEC_DP_SID) { if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) pmic_glink_altmode_safe() else pmic_glink_altmode_enable_dp } else (blah) ... else (blah) ... else (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) pmic_glink_altmode_safe() Before, if mux_ctrl was MUX_CTRL_STATE_NO_CONN, it would set to safe mode whatever the svid, now it's either in the DP case or at the end. I don't see the difference here, except if your desire is to ignore the MUX_CTRL_STATE_NO_CONN for USB_TYPEC_TBT_SID and MUX_CTRL_STATE_TUNNELING. But it doesn't match the commit message at all. Neil > > --- > base-commit: fc7b1a72c6cd5cbbd989c6c32a6486e3e4e3594d > change-id: 20260306-topic-pgaltmode_fixup-6b488960e355 > > Best regards,