Patch "phy: rockchip-typec: fix tcphy_get_mode error case" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    phy: rockchip-typec: fix tcphy_get_mode error case

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     phy-rockchip-typec-fix-tcphy_get_mode-error-case.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 42f522343960577ec19fbb9fa1f427523f9cac10
Author: Neill Kapron <nkapron@xxxxxxxxxx>
Date:   Thu Jan 26 00:10:12 2023 +0000

    phy: rockchip-typec: fix tcphy_get_mode error case
    
    [ Upstream commit 4ca651df07183e29cdad7272255e23aec0169a1b ]
    
    The existing logic in tcphy_get_mode() can cause the phy to be
    incorrectly configured to USB UFP or DisplayPort mode when
    extcon_get_state returns an error code.
    
    extcon_get_state() can return 0, 1, or a negative error code.
    
    It is possible to get into the failing state with an extcon driver
    which does not support the extcon connector id specified as the
    second argument to extcon_get_state().
    
    tcphy_get_mode()
    ->extcon_get_state()
    -->find_cable_index_by_id()
    --->return -EINVAL;
    
    Fixes: e96be45cb84e ("phy: Add USB Type-C PHY driver for rk3399")
    Signed-off-by: Neill Kapron <nkapron@xxxxxxxxxx>
    Reviewed-by: Lee Jones <lee@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230126001013.3707873-1-nkapron@xxxxxxxxxx
    Signed-off-by: Vinod Koul <vkoul@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index d2bbdc96a1672..5b9a254c45524 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -821,10 +821,10 @@ static int tcphy_get_mode(struct rockchip_typec_phy *tcphy)
 	mode = MODE_DFP_USB;
 	id = EXTCON_USB_HOST;
 
-	if (ufp) {
+	if (ufp > 0) {
 		mode = MODE_UFP_USB;
 		id = EXTCON_USB;
-	} else if (dp) {
+	} else if (dp > 0) {
 		mode = MODE_DFP_DP;
 		id = EXTCON_DISP_DP;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux