Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796090542; b=mvCEPU2+7LBlO6VjjP3UiqyaioENq2hlj1KCDcYqM7fQicTZFzdCIOdOIfznSFc0jSJS GrOnyj17gjJjAnXIHCuP25zSaBeWcvgMoEda2oBaxIe1C6DlwFNS2pWWIHCCRkZGVCqdp VwvCFR2R0CArho1KmZHjWSYTiLtzUyFK5iUvQ1RN3yC5XcAPxU7g68J/820uv7LO2PSxW J9JCCSnDs2n1GlDsNahz4LOXJCqA1bj9HIbzjjO3RNxONncC3+Mk3izBb5wFwkCOhn6dR DsGF+R78N+NEW1rd+uHZTPjvOcLsKpzT7SVeAYpjDBHUz3D7UdUVsXrrnfNVDXN41iw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796090542; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=7DvoWTJLigE5z2SsC1ecPMTH/8Te3U+dAmRltG3uMbY=; b=T2Rv9bsCY1pdmUjhx6v4Xuioen6oHhurzsYfqdpv1AZxJMfgRg+mjF4v6wdVHXkI+uD+ K2xAYLbm/zH4OYp19f1Q2KaqtvKVvAL4QfHQULe4Y0wYmH6fvbrU+D9AvTE9xMgTpoK4q iNG55ZzUz4vOi4vv4H1/ztYo14oJtfCWpEAr8AaHM0oTNL2ET1BsB+exK945IyK/T5t9q ZtD75CEr2PC7s5mBAKZ5+kkHehm0Vu1fOJg1vKBxWeTES+aGV7IZnNuIVTqv7A89zkLdS O72xt0NW2VSPKpAQfuf5zRLWvMled/mcEaqBPv4bIr9yf4SGYc5O4KDNksF5HHln8GQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=d1MgqtzP; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DDBD606A31A for ; Tue, 1 Dec 2026 02:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=d1MgqtzP Received: by smtp.kernel.org (Postfix) with ESMTPSA id B20E41F00926; Tue, 1 Dec 2026 02:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796090542; bh=7DvoWTJLigE5z2SsC1ecPMTH/8Te3U+dAmRltG3uMbY=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=d1MgqtzPPHw1gquFvjw5foflfPRD7QKJKOGkSxwCeGiwsKiRxexRKSO+3STcI3NNU xmAefcCINBhJVKKVdD7SDVwjAD7vIQsbAvjpvIBCh481bRAY4yortsRj5LeB1aQcT0 BFvWt7AjYV39uXo/PARQkr4pkDuUXoCFFR3azUQonhnfAv/9mZ9ZqdoFzM84cZBRRA KKLzJEdMNPzp/q/kc3tgBUE9ZptHGemnU2w4nwgsRgrJqov03j/EIkXPyiA2CE+6Qu 4iFXRN4MV04/SkUcNm2/gzNPPI5MceWOJOdGkLzDDti84WutPfBC6+IO8QTbuCvMr+ kfOVahrN8gLYQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 2/2] phy: cix: add Sky1 USB/DP combo PHY driver Reply-To: sashiko-reviews@lists.linux.dev To: "Gary Yang" Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org, vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com In-Reply-To: <20261201014059.3811728-3-gary.yang@cixtech.com> References: <20261201014059.3811728-1-gary.yang@cixtech.com> <20261201014059.3811728-3-gary.yang@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Dec 2026 02:02:21 +0000 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] phy: cix: stale dp_lanes, bus_width, and cur_mode on deferred DP reinit - [Medium] phy: cix: udphy_dp_phy_power_on() drops DP power state in USB-only mode -- commit 4655d6dad04c97aef72f0068945521b5e297a7ae Author: Gary Yang phy: cix: add Sky1 USB/DP combo PHY driver This commit adds a generic PHY driver for the CIX Sky1 USB3/DisplayPort combo PHY, with Type-C orientation switch and mode mux integration. > diff --git a/drivers/phy/cix/phy-cix-usbdp.c b/drivers/phy/cix/phy-cix-us= bdp.c > new file mode 100644 > index 0000000000000..046ded908adc4 > --- /dev/null > +++ b/drivers/phy/cix/phy-cix-usbdp.c > @@ -0,0 +1,1570 @@ [ ... ] > +static int usbdp_typec_mux_set(struct typec_mux_dev *mux, > + struct typec_mux_state *state) > +{ > + struct cix_udphy *udphy =3D typec_mux_get_drvdata(mux); > + u8 mode; > + int ret; > + > + /* Ignore mux events not involving USB or DisplayPort */ > + if (!usbdp_typec_is_supported_mode(state)) { > + dev_dbg(udphy->dev, "ignore mux event with mode=3D%lu\n", > + state->mode); > + return 0; > + } > + > + if (state->mode < TYPEC_STATE_MODAL) { > + /* > + * The DP altmode driver signals the safe and USB states > + * around a mode switch. The USB and the USB+DP modes share > + * one register table, so keep the DP lanes available for > + * those notifications. > + */ > + if (state->alt && state->alt->svid =3D=3D USB_TYPEC_DP_SID) > + mode =3D UDPHY_MODE_DP_USB; > + else > + mode =3D UDPHY_MODE_USB; > + } else { [ ... ] > +static int udphy_dp_phy_power_on(struct phy *phy) > +{ > + struct cix_udphy *udphy =3D phy_get_drvdata(phy); > + int ret; > + > + guard(mutex)(&udphy->mutex); > + > + if (!(udphy->next_mode & UDPHY_MODE_DP)) > + return 0; [Severity: Medium] Can udphy_dp_phy_power_on() leave DisplayPort unpowered for the session if it runs while udphy->next_mode is UDPHY_MODE_USB? Port-level typec_set_mode() calls for TYPEC_STATE_SAFE or TYPEC_STATE_USB pass state->alt =3D=3D NULL, which sets udphy->next_mode to UDPHY_MODE_USB = in usbdp_typec_mux_set(). If the DP controller calls phy_power_on() before the modal DP mux notification arrives, udphy_dp_phy_power_on() returns 0 without setting UDPHY_MODE_DP in udphy->cur_mode or recording that the DP consumer requested power, while the PHY core increments dp_phy->power_count to 1. When the mux later switches to UDPHY_MODE_DP or UDPHY_MODE_DP_USB, UDPHY_MODE_DP is still never set in udphy->cur_mode, so every udphy_dp_phy_configure() call sees !(udphy->cur_mode & UDPHY_MODE_DP) and silently drops link training writes. > + udphy->dp_lanes =3D udphy_dplane_get(udphy); > + > + ret =3D cix_usbdp_phy_power_on(udphy); > + if (ret) > + return ret; > + > + /* > + * With 4-lane DisplayPort the DP PHY owns the PMA lanes, so the USB3 > + * function cannot be active anymore even if its consumer still holds > + * phy_init(). Drop the USB bit here so that the combo PHY can really > + * be powered off once the DP PHY releases the lanes. > + */ > + if (udphy->next_mode =3D=3D UDPHY_MODE_DP) > + udphy->cur_mode &=3D ~UDPHY_MODE_USB; > + > + phy_set_bus_width(phy, udphy->dp_lanes); > + udphy->cur_mode |=3D UDPHY_MODE_DP; > + > + /* > + * In the USB+DP modes the USB3 controller keeps using its lanes, so > + * keep the USB mode accounted for while its consumer is initialized. > + */ > + if ((udphy->next_mode & UDPHY_MODE_USB) && udphy->u3_initialized) > + udphy->cur_mode |=3D UDPHY_MODE_USB; > + > + return 0; > +} [ ... ] > +static int udphy_dp_phy_configure(struct phy *phy, > + union phy_configure_opts *opts) > +{ [ ... ] > + if (dp->set_rate && udphy->needs_reinit) { > + ret =3D udphy->cfg->udphy_reinit(udphy); > + if (ret) { > + dev_err(udphy->dev, "failed to reconfigure udphy\n"); > + return ret; > + } > + > + udphy->needs_reinit =3D false; > + > + if (udphy->next_mode =3D=3D UDPHY_MODE_DP) > + udphy->cur_mode &=3D ~UDPHY_MODE_USB; > + } > + > + /* All of the options are valid, so they can be applied now. */ > + if (dp->set_lanes) > + udphy->dp_lanes =3D dp->lanes; > + > + if (dp->set_rate) { > + ret =3D udphy_dp_phy_set_rate(udphy, dp); > + if (ret) { > + dev_err(udphy->dev, "failed to set DP link rate\n"); > + return ret; > + } > + } [Severity: Medium] When a deferred udphy_reinit() runs here after a mux mode change, does it leave udphy->dp_lanes, the PHY bus_width, and udphy->cur_mode out of sync with udphy->next_mode? Unlike udphy_dp_phy_power_on(), this path does not update udphy->dp_lanes from udphy_dplane_get(udphy) when dp->set_lanes is not set in the same call, nor does it call phy_set_bus_width(phy, udphy_dplane_get(udphy)). If a DP controller configures link rate before lane count in separate phy_configure() calls, udphy_dp_phy_set_rate() iterates over the previous mode's udphy->dp_lanes, either leaving XCVR_DIAG_HSCLK_DIV unprogrammed on lanes 2 and 3 after a 2-to-4 lane switch or overwriting the 2 active USB3 PMA lanes after a 4-to-2 lane switch. In addition, this path does not check that udphy->next_mode still includes UDPHY_MODE_DP, and does not restore UDPHY_MODE_USB in udphy->cur_mode when switching from UDPHY_MODE_DP back to UDPHY_MODE_DP_USB while udphy->u3_initialized is true. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201014059.3811= 728-2-gary.yang@cixtech.com?part=3D2