From d19444bf8a252aa5c2e1a8b5dd029da82d812092 Mon Sep 17 00:00:00 2001 From: retro98boy Date: Sat, 22 Feb 2025 10:58:32 +0800 Subject: [PATCH] rockchip64: fix wrong GPIO direction in DP virtual extcon driver The extcon-usbc-virtual-pd driver requests the detection GPIO with the flag GPIOD_OUT_LOW, which leads to a failure in gpiod_to_irq and consequently causes the driver loading to fail. This issue can be fixed by changing GPIOD_OUT_LOW to either GPIOD_IN or GPIOD_ASIS. This patch opts to change GPIOD_OUT_LOW to GPIOD_ASIS, as this is a less invasive approach. For devices intending to use this driver, it's also necessary to set the pinctrl property of the detection GPIO to input mode in the dts file. --- .../rockchip64-6.12/general-add-miniDP-virtual-extcon.patch | 2 +- .../rockchip64-6.13/general-add-miniDP-virtual-extcon.patch | 2 +- .../rockchip64-6.6/general-add-miniDP-virtual-extcon.patch | 2 +- .../rockchip64-6.9/general-add-miniDP-virtual-extcon.patch | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/patch/kernel/archive/rockchip64-6.12/general-add-miniDP-virtual-extcon.patch b/patch/kernel/archive/rockchip64-6.12/general-add-miniDP-virtual-extcon.patch index ce8dae5e32..6fb6ea1e9c 100644 --- a/patch/kernel/archive/rockchip64-6.12/general-add-miniDP-virtual-extcon.patch +++ b/patch/kernel/archive/rockchip64-6.12/general-add-miniDP-virtual-extcon.patch @@ -240,7 +240,7 @@ index 000000000000..111111111111 + + vpd->data_role = vpd_extcon_data_role(vpd); + -+ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_OUT_LOW); ++ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_ASIS); + if (IS_ERR(vpd->det_gpio)) { + ret = PTR_ERR(vpd->det_gpio); + dev_warn(dev, "failed to get det gpio: %d\n", ret); diff --git a/patch/kernel/archive/rockchip64-6.13/general-add-miniDP-virtual-extcon.patch b/patch/kernel/archive/rockchip64-6.13/general-add-miniDP-virtual-extcon.patch index ce8dae5e32..6fb6ea1e9c 100644 --- a/patch/kernel/archive/rockchip64-6.13/general-add-miniDP-virtual-extcon.patch +++ b/patch/kernel/archive/rockchip64-6.13/general-add-miniDP-virtual-extcon.patch @@ -240,7 +240,7 @@ index 000000000000..111111111111 + + vpd->data_role = vpd_extcon_data_role(vpd); + -+ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_OUT_LOW); ++ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_ASIS); + if (IS_ERR(vpd->det_gpio)) { + ret = PTR_ERR(vpd->det_gpio); + dev_warn(dev, "failed to get det gpio: %d\n", ret); diff --git a/patch/kernel/archive/rockchip64-6.6/general-add-miniDP-virtual-extcon.patch b/patch/kernel/archive/rockchip64-6.6/general-add-miniDP-virtual-extcon.patch index 467a3655d0..a52a680591 100644 --- a/patch/kernel/archive/rockchip64-6.6/general-add-miniDP-virtual-extcon.patch +++ b/patch/kernel/archive/rockchip64-6.6/general-add-miniDP-virtual-extcon.patch @@ -240,7 +240,7 @@ index 000000000000..e0713670e33d + + vpd->data_role = vpd_extcon_data_role(vpd); + -+ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_OUT_LOW); ++ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_ASIS); + if (IS_ERR(vpd->det_gpio)) { + ret = PTR_ERR(vpd->det_gpio); + dev_warn(dev, "failed to get det gpio: %d\n", ret); diff --git a/patch/kernel/archive/rockchip64-6.9/general-add-miniDP-virtual-extcon.patch b/patch/kernel/archive/rockchip64-6.9/general-add-miniDP-virtual-extcon.patch index 00551e8b31..31d96f5be4 100644 --- a/patch/kernel/archive/rockchip64-6.9/general-add-miniDP-virtual-extcon.patch +++ b/patch/kernel/archive/rockchip64-6.9/general-add-miniDP-virtual-extcon.patch @@ -240,7 +240,7 @@ index 000000000000..e0713670e33d + + vpd->data_role = vpd_extcon_data_role(vpd); + -+ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_OUT_LOW); ++ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_ASIS); + if (IS_ERR(vpd->det_gpio)) { + ret = PTR_ERR(vpd->det_gpio); + dev_warn(dev, "failed to get det gpio: %d\n", ret);