Skip to content

Commit 5c9eb46

Browse files
retro98boyigorpecovnik
authored andcommitted
Improve Type-C Virtual PD extcon driver
1 parent de7519c commit 5c9eb46

5 files changed

Lines changed: 32 additions & 544 deletions

File tree

patch/kernel/archive/rockchip64-6.12/general-add-miniDP-virtual-extcon.patch

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
1+
From f0d2b53fcfd0151999f8f7041c3f4a19ac77b191 Mon Sep 17 00:00:00 2001
22
From: Tony <tonymckahan@gmail.com>
33
Date: Wed, 3 Mar 2021 07:59:25 +0100
4-
Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676)
4+
Subject: [PATCH] RK3399 Typec DP (#2676)
55

66
> X-Git-Archeology: > recovered message: > * RK3399 NanoPC-T4 Add Type-C alt mode DP
77
> X-Git-Archeology: > recovered message: > * rk3399 rockpi 4C add mini-DP (WIP)
@@ -55,14 +55,15 @@ Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676)
5555
---
5656
drivers/extcon/Kconfig | 10 +
5757
drivers/extcon/Makefile | 1 +
58-
drivers/extcon/extcon-usbc-virtual-pd.c | 285 ++++++++++
58+
drivers/extcon/extcon-usbc-virtual-pd.c | 285 ++++++++++++++++++++++++
5959
3 files changed, 296 insertions(+)
60+
create mode 100644 drivers/extcon/extcon-usbc-virtual-pd.c
6061

6162
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
62-
index 111111111111..222222222222 100644
63+
index aec46bf03..dd755b952 100644
6364
--- a/drivers/extcon/Kconfig
6465
+++ b/drivers/extcon/Kconfig
65-
@@ -214,4 +214,14 @@ config EXTCON_RTK_TYPE_C
66+
@@ -227,4 +227,14 @@ config EXTCON_RTK_TYPE_C
6667
The DHC (Digital Home Hub) RTD series SoC contains a type c module.
6768
This driver will detect the status of the type-c port.
6869

@@ -78,17 +79,17 @@ index 111111111111..222222222222 100644
7879
+
7980
endif
8081
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
81-
index 111111111111..222222222222 100644
82+
index 6482f2bfd..979770183 100644
8283
--- a/drivers/extcon/Makefile
8384
+++ b/drivers/extcon/Makefile
84-
@@ -27,3 +27,4 @@ obj-$(CONFIG_EXTCON_USB_GPIO) += extcon-usb-gpio.o
85+
@@ -28,3 +28,4 @@ obj-$(CONFIG_EXTCON_USB_GPIO) += extcon-usb-gpio.o
8586
obj-$(CONFIG_EXTCON_USBC_CROS_EC) += extcon-usbc-cros-ec.o
8687
obj-$(CONFIG_EXTCON_USBC_TUSB320) += extcon-usbc-tusb320.o
8788
obj-$(CONFIG_EXTCON_RTK_TYPE_C) += extcon-rtk-type-c.o
8889
+obj-$(CONFIG_EXTCON_USBC_VIRTUAL_PD) += extcon-usbc-virtual-pd.o
8990
diff --git a/drivers/extcon/extcon-usbc-virtual-pd.c b/drivers/extcon/extcon-usbc-virtual-pd.c
9091
new file mode 100644
91-
index 000000000000..111111111111
92+
index 000000000..1040c98db
9293
--- /dev/null
9394
+++ b/drivers/extcon/extcon-usbc-virtual-pd.c
9495
@@ -0,0 +1,285 @@
@@ -158,7 +159,7 @@ index 000000000000..111111111111
158159
+ union extcon_property_value property;
159160
+ int det;
160161
+
161-
+ det = vpd->det_gpio ? gpiod_get_raw_value(vpd->det_gpio) : 0;
162+
+ det = vpd->det_gpio ? gpiod_get_value(vpd->det_gpio) : 0;
162163
+ if (det) {
163164
+ device_connected = (vpd->data_role == DR_DEVICE) ? true : false;
164165
+ host_connected = (vpd->data_role == DR_HOST) ? true : false;
@@ -240,7 +241,7 @@ index 000000000000..111111111111
240241
+
241242
+ vpd->data_role = vpd_extcon_data_role(vpd);
242243
+
243-
+ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_ASIS);
244+
+ vpd->det_gpio = devm_gpiod_get(dev, "det", GPIOD_IN);
244245
+ if (IS_ERR(vpd->det_gpio)) {
245246
+ ret = PTR_ERR(vpd->det_gpio);
246247
+ dev_warn(dev, "failed to get det gpio: %d\n", ret);
@@ -378,5 +379,5 @@ index 000000000000..111111111111
378379
+MODULE_DESCRIPTION("Type-C Virtual PD extcon driver");
379380
+MODULE_LICENSE("GPL v2");
380381
--
381-
Armbian
382+
2.54.0
382383

patch/kernel/archive/rockchip64-6.18/general-add-miniDP-virtual-extcon.patch

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
1+
From f0d2b53fcfd0151999f8f7041c3f4a19ac77b191 Mon Sep 17 00:00:00 2001
22
From: Tony <tonymckahan@gmail.com>
33
Date: Wed, 3 Mar 2021 07:59:25 +0100
4-
Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676)
4+
Subject: [PATCH] RK3399 Typec DP (#2676)
55

66
> X-Git-Archeology: > recovered message: > * RK3399 NanoPC-T4 Add Type-C alt mode DP
77
> X-Git-Archeology: > recovered message: > * rk3399 rockpi 4C add mini-DP (WIP)
@@ -55,11 +55,12 @@ Subject: [ARCHEOLOGY] RK3399 Typec DP (#2676)
5555
---
5656
drivers/extcon/Kconfig | 10 +
5757
drivers/extcon/Makefile | 1 +
58-
drivers/extcon/extcon-usbc-virtual-pd.c | 285 ++++++++++
58+
drivers/extcon/extcon-usbc-virtual-pd.c | 285 ++++++++++++++++++++++++
5959
3 files changed, 296 insertions(+)
60+
create mode 100644 drivers/extcon/extcon-usbc-virtual-pd.c
6061

6162
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
62-
index 111111111111..222222222222 100644
63+
index aec46bf03..dd755b952 100644
6364
--- a/drivers/extcon/Kconfig
6465
+++ b/drivers/extcon/Kconfig
6566
@@ -227,4 +227,14 @@ config EXTCON_RTK_TYPE_C
@@ -78,7 +79,7 @@ index 111111111111..222222222222 100644
7879
+
7980
endif
8081
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
81-
index 111111111111..222222222222 100644
82+
index 6482f2bfd..979770183 100644
8283
--- a/drivers/extcon/Makefile
8384
+++ b/drivers/extcon/Makefile
8485
@@ -28,3 +28,4 @@ obj-$(CONFIG_EXTCON_USB_GPIO) += extcon-usb-gpio.o
@@ -88,7 +89,7 @@ index 111111111111..222222222222 100644
8889
+obj-$(CONFIG_EXTCON_USBC_VIRTUAL_PD) += extcon-usbc-virtual-pd.o
8990
diff --git a/drivers/extcon/extcon-usbc-virtual-pd.c b/drivers/extcon/extcon-usbc-virtual-pd.c
9091
new file mode 100644
91-
index 000000000000..111111111111
92+
index 000000000..1040c98db
9293
--- /dev/null
9394
+++ b/drivers/extcon/extcon-usbc-virtual-pd.c
9495
@@ -0,0 +1,285 @@
@@ -158,7 +159,7 @@ index 000000000000..111111111111
158159
+ union extcon_property_value property;
159160
+ int det;
160161
+
161-
+ det = vpd->det_gpio ? gpiod_get_raw_value(vpd->det_gpio) : 0;
162+
+ det = vpd->det_gpio ? gpiod_get_value(vpd->det_gpio) : 0;
162163
+ if (det) {
163164
+ device_connected = (vpd->data_role == DR_DEVICE) ? true : false;
164165
+ host_connected = (vpd->data_role == DR_HOST) ? true : false;
@@ -240,7 +241,7 @@ index 000000000000..111111111111
240241
+
241242
+ vpd->data_role = vpd_extcon_data_role(vpd);
242243
+
243-
+ vpd->det_gpio = devm_gpiod_get_optional(dev, "det", GPIOD_ASIS);
244+
+ vpd->det_gpio = devm_gpiod_get(dev, "det", GPIOD_IN);
244245
+ if (IS_ERR(vpd->det_gpio)) {
245246
+ ret = PTR_ERR(vpd->det_gpio);
246247
+ dev_warn(dev, "failed to get det gpio: %d\n", ret);
@@ -378,5 +379,5 @@ index 000000000000..111111111111
378379
+MODULE_DESCRIPTION("Type-C Virtual PD extcon driver");
379380
+MODULE_LICENSE("GPL v2");
380381
--
381-
Armbian
382+
2.54.0
382383

patch/kernel/archive/rockchip64-6.6/general-add-miniDP-dt-doc.patch

Lines changed: 0 additions & 133 deletions
This file was deleted.

0 commit comments

Comments
 (0)