From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796021077; b=HJ1jmQq7srobAVgE64NdH2gymtqcJyfqSUKJelhfWa0lhaw1kyU/xJMtTmyj3Ph00h1D ONx7OqDGkbLlg7zfTh36X7//yBiX65oXlvZLMPMFdEPjnYGiPN9rBoudUIQbCboYiysYn 3qYFeCoHReFaBc2/kIdsG3n3OHuvx6d/37tl4ch55DfkTjQR3TDPlzlNKUCoJcakd75Ek JcKWXGxnmly/Y65vs/1FuUBMOG94RSRVMQams82a+l38Nilln3aldCO3e37ocriMoM6Z/ sjQ8XZNOELqWzmlXMFflnvr7CE5pevCpejKqM9zlfLgLI6p54YwwVnSIRYwLGgw0bCQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796021077; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=tGQNn+KBjuePhyDja0zN0CezrWSUCloPB/J3pzOqeo4=; b=IfeDgAeRX//e8OU9FPpG5mt9UKYdrY5KbYrQn5p966URtw9/FHu76oN7U+ACxGEGi9oY XQffwgt4co4Hvfqrkr/MNeNXXnCwNMsyMOzfEir3FN5ZtcVvLFwY/1Et2KS5n6KYF9Mzm K+t48pjeHrabaZxIHmG/J2L1uAgkSM7ym3p4elmXChIru2hqA5iAga2meNeSgVVWGD5j1 R2ZsAJ+nmyJS7r8Ra8k/3rE62LoBKpFWqVwnXxm9ZKjbezr6hz76VrU4KOVI/+iysurRQ NImC/nJru2ues7xHW1SoBsGknsU7tFkPkeTLHz0D/oFYhSjM+TUkH4WP0m47qmhJo0g== 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="YSHBlTQ/"; 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) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C28606A31C for ; Mon, 30 Nov 2026 06:44:37 +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=YSHBlTQ/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3D751F000C1; Mon, 30 Nov 2026 06:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796021076; bh=tGQNn+KBjuePhyDja0zN0CezrWSUCloPB/J3pzOqeo4=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=YSHBlTQ/KK9ekwQjdyYHtEah4VkjEOWaLfYh/mvw4fSRFi35kyXR9qHIziJfNIsqZ r7Gha5zEYCv46wkaN5ixrWjOV08VWhH/CByIriAk1KQ39md/WiujAKHBYKSHd19GWt Fmm9wVdVI83qfKKT9kSzrKzKsNuJnJ+a81q4NlqytA7yf9QG+E250GsY8/q2ShJIAa hxISb2RR3X/ikFxaSYOkLt2t14ErvYo5ex+M0TRAyRRe5zuXcXBd3nw4TzOdxzq0Vz yZIsTBPRGVo6aml/WPACEzwTBpwBUYk7IDRo7kQ1nGi9g6jSlsyarVv3aR7AGvs2AA 10BRb1QCEsh8g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 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: <20261130062028.3366748-3-gary.yang@cixtech.com> References: <20261130062028.3366748-1-gary.yang@cixtech.com> <20261130062028.3366748-3-gary.yang@cixtech.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 06:44:35 +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: - [High] phy: cix: stale cur_mode and deferred reinit in cix_usbdp_phy_power_on() - [High] phy: cix: usbdp_typec_mux_set() drops UDPHY_MODE_DP in default branch -- commit 65650ff2bab980862db4f825d7173df1ccff3e28 Author: Gary Yang phy: cix: add Sky1 USB/DP combo PHY driver This commit adds a driver for the CIX Sky1 USB/DP combo PHY, exposing USB3 and DisplayPort PHYs and registering a Type-C orientation switch and mode mux. > 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..9a2c8b827ff8c > --- /dev/null > +++ b/drivers/phy/cix/phy-cix-usbdp.c [ ... ] > +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; > + > + /* 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; > + } > + > + switch (state->mode) { > + case TYPEC_DP_STATE_C: > + fallthrough; > + case TYPEC_DP_STATE_E: > + mode =3D UDPHY_MODE_DP; > + break; > + case TYPEC_DP_STATE_D: > + fallthrough; > + case TYPEC_DP_STATE_F: > + mode =3D UDPHY_MODE_DP_USB; > + break; > + default: > + /* usb only handle as usb+dp mode */ > + mode =3D UDPHY_MODE_USB; > + break; > + } [Severity: High] Should the default case set mode to UDPHY_MODE_DP_USB instead of UDPHY_MODE_USB, matching the comment and udphy_set_default_mode()? When dp_altmode_configure_vdm() places the mux in TYPEC_STATE_SAFE before sending DP_CMD_CONFIGURE, setting udphy->next_mode to UDPHY_MODE_USB drops UDPHY_MODE_DP. If HPD then triggers phy_power_on(udphy->dp_phy) before the DisplayPort alt mode state notification arrives (as in dp_altmode_configured()), udphy_dp_phy_power_on() sees !(udphy->next_mode & UDPHY_MODE_DP) and returns 0 without powering on the PHY or setting UDPHY_MODE_DP in udphy->cur_mode, causing udphy_dp_phy_configure() to silently drop all subsequent link training writes. [ ... ] > +static int cix_usbdp_phy_power_on(struct cix_udphy *udphy) > +{ > + int ret; > + > + if (udphy->cur_mode =3D=3D udphy->next_mode && !udphy->needs_reinit) > + return 0; > + > + if (udphy->cur_mode =3D=3D UDPHY_MODE_NONE) > + ret =3D udphy->cfg->udphy_init(udphy); > + else if (udphy->needs_reinit) > + ret =3D udphy->cfg->udphy_reinit(udphy); > + else > + return 0; > + > + if (ret) { > + dev_err(udphy->dev, "failed to bring up udphy\n"); > + return ret; > + } > + > + udphy->needs_reinit =3D false; > + > + return 0; > +} > + > +static int cix_usbdp_phy_power_off(struct cix_udphy *udphy) > +{ > + int ret; > + > + ret =3D udphy->cfg->udphy_exit(udphy); > + if (ret) { > + dev_err(udphy->dev, "failed to exit udphy\n"); > + return ret; > + } > + > + udphy->cur_mode =3D UDPHY_MODE_NONE; > + > + return 0; > +} > + > +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; > + > + udphy->dp_lanes =3D udphy_dplane_get(udphy); > + > + ret =3D cix_usbdp_phy_power_on(udphy); > + if (ret) > + return ret; > + > + phy_set_bus_width(phy, udphy->dp_lanes); > + udphy->cur_mode |=3D UDPHY_MODE_DP; > + > + return 0; > +} > + > +static int udphy_dp_phy_power_off(struct phy *phy) > +{ > + struct cix_udphy *udphy =3D phy_get_drvdata(phy); > + > + guard(mutex)(&udphy->mutex); > + > + if (!(udphy->cur_mode & UDPHY_MODE_DP)) > + return 0; > + > + udphy->cur_mode &=3D ~UDPHY_MODE_DP; > + phy_set_bus_width(phy, 0); > + > + if (udphy->cur_mode =3D=3D UDPHY_MODE_NONE) > + return cix_usbdp_phy_power_off(udphy); > + > + return 0; > +} [ ... ] > +static int cix_u3phy_init(struct phy *phy) > +{ > + struct cix_udphy *udphy =3D phy_get_drvdata(phy); > + int ret; > + > + guard(mutex)(&udphy->mutex); > + > + if (!(udphy->next_mode & UDPHY_MODE_USB)) > + return 0; > + > + ret =3D cix_usbdp_phy_power_on(udphy); > + if (ret) > + return ret; > + > + udphy->cur_mode |=3D UDPHY_MODE_USB; > + > + return 0; > +} [Severity: High] Does transitioning into 4-lane DisplayPort mode (UDPHY_MODE_DP) while u3_phy is already initialized leave UDPHY_MODE_USB stuck in udphy->cur_mode? When u3_phy is initialized at probe or on initial Type-C attach, cix_u3phy_init() sets UDPHY_MODE_USB in udphy->cur_mode. Entering 4-lane DP alt mode sets udphy->next_mode =3D UDPHY_MODE_DP and udphy->needs_reinit= =3D true without tearing down u3_phy (and even if cix_u3phy_set_mode() runs, cix_u3phy_init() returns 0 early when !(udphy->next_mode & UDPHY_MODE_USB) without clearing UDPHY_MODE_USB). udphy_dp_phy_power_on() then calls sky1_udphy_reinit() to reprogram the whole PHY into 4-lane DP-only mode and ORs UDPHY_MODE_DP into udphy->cur_mode. When udphy_dp_phy_power_off() later clears UDPHY_MODE_DP, udphy->cur_mode is still UDPHY_MODE_USB rather than UDPHY_MODE_NONE, so cix_usbdp_phy_power_off() is skipped and the PHY and apb_clk stay enabled. Also, because udphy_orien_sw_set() and usbdp_typec_mux_set() only set udphy->needs_reinit =3D true and defer sky1_udphy_reinit() to the next cix_usbdp_phy_power_on(), any orientation change or exit from 4-lane DP back to USB while u3_phy is already active will never trigger sky1_udphy_reinit(), leaving the hardware programmed with the stale orientation or 4-lane DP-only register table. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130062028.3366= 748-1-gary.yang@cixtech.com?part=3D2