linux-postmarketos-rockchip: upgrade to 5.18 (MR 3170)
Dropped the usb-c patches, because it looks like usb-c charging works now out of the box on 5.18, and that was the primary reason for me to include those patches here originally. [ci:skip-build] already built successfully in CI
This commit is contained in:
parent
25b2afb40c
commit
2dd5a5ab0f
6 changed files with 819 additions and 824 deletions
|
@ -1,49 +0,0 @@
|
|||
From db4e9ffdb985752ae3c3436ff86f8f376ae8fd22 Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Schramm <t.schramm@manjaro.org>
|
||||
Date: Thu, 28 May 2020 14:25:32 +0200
|
||||
Subject: [PATCH] phy: rockchip: typec: Set extcon capabilities
|
||||
|
||||
Do not mainline, hack.
|
||||
|
||||
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
|
||||
---
|
||||
drivers/phy/rockchip/phy-rockchip-typec.c | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
|
||||
index 70a31251b202..5385bb4f0bd4 100644
|
||||
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
|
||||
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/extcon.h>
|
||||
+#include <linux/extcon-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/kernel.h>
|
||||
@@ -1160,6 +1161,22 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
|
||||
dev_err(dev, "Invalid or missing extcon\n");
|
||||
return PTR_ERR(tcphy->extcon);
|
||||
}
|
||||
+ } else {
|
||||
+ extcon_set_property_capability(tcphy->extcon, EXTCON_USB,
|
||||
+ EXTCON_PROP_USB_SS);
|
||||
+ extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST,
|
||||
+ EXTCON_PROP_USB_SS);
|
||||
+ extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP,
|
||||
+ EXTCON_PROP_USB_SS);
|
||||
+ extcon_set_property_capability(tcphy->extcon, EXTCON_USB,
|
||||
+ EXTCON_PROP_USB_TYPEC_POLARITY);
|
||||
+ extcon_set_property_capability(tcphy->extcon, EXTCON_USB_HOST,
|
||||
+ EXTCON_PROP_USB_TYPEC_POLARITY);
|
||||
+ extcon_set_property_capability(tcphy->extcon, EXTCON_DISP_DP,
|
||||
+ EXTCON_PROP_USB_TYPEC_POLARITY);
|
||||
+ extcon_sync(tcphy->extcon, EXTCON_USB);
|
||||
+ extcon_sync(tcphy->extcon, EXTCON_USB_HOST);
|
||||
+ extcon_sync(tcphy->extcon, EXTCON_DISP_DP);
|
||||
}
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
--
|
||||
GitLab
|
|
@ -1,44 +0,0 @@
|
|||
From 948d7ade0ddcf292b91d91cb8b6819a19ab3f604 Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Schramm <t.schramm@manjaro.org>
|
||||
Date: Thu, 28 May 2020 14:44:15 +0200
|
||||
Subject: [PATCH] arm64: dts: rockchip: add typec extcon hack
|
||||
|
||||
Not for mainline
|
||||
|
||||
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
|
||||
---
|
||||
arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
|
||||
index decb212e2dca..37f967a89401 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinebook-pro.dts
|
||||
@@ -401,6 +401,7 @@ opp08 {
|
||||
|
||||
&cdn_dp {
|
||||
status = "okay";
|
||||
+ extcon = <&fusb0>;
|
||||
};
|
||||
|
||||
&cpu_b0 {
|
||||
@@ -735,6 +736,9 @@ connector {
|
||||
<PDO_FIXED(5000, 1400, PDO_FIXED_USB_COMM)>;
|
||||
try-power-role = "sink";
|
||||
|
||||
+ extcon-cables = <1 2 5 6 9 10 12 44>;
|
||||
+ typec-altmodes = <0xff01 1 0x001c0000 1>;
|
||||
+
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@@ -1002,6 +1006,7 @@ spiflash: flash@0 {
|
||||
};
|
||||
|
||||
&tcphy0 {
|
||||
+ extcon = <&fusb0>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
--
|
||||
GitLab
|
|
@ -1,226 +0,0 @@
|
|||
From ed2bd8b9262b5367b0e253ffbb238ee85d82f52f Mon Sep 17 00:00:00 2001
|
||||
From: Dan Johansen <strit@manjaro.org>
|
||||
Date: Tue, 25 May 2021 22:50:01 +0200
|
||||
Subject: [PATCH] usb/typec: add extcon to tcpm
|
||||
|
||||
---
|
||||
drivers/usb/typec/tcpm/tcpm.c | 133 +++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 132 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
|
||||
index 64133e586c64..8fa1d0993b97 100644
|
||||
--- a/drivers/usb/typec/tcpm/tcpm.c
|
||||
+++ b/drivers/usb/typec/tcpm/tcpm.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <linux/completion.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/device.h>
|
||||
+#include <linux/extcon-provider.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/kernel.h>
|
||||
@@ -468,6 +469,12 @@ struct tcpm_port {
|
||||
* SNK_READY for non-pd link.
|
||||
*/
|
||||
bool slow_charger_loop;
|
||||
+
|
||||
+#ifdef CONFIG_EXTCON
|
||||
+ struct extcon_dev *extcon;
|
||||
+ unsigned int *extcon_cables;
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *dentry;
|
||||
struct mutex logbuffer_lock; /* log buffer access lock */
|
||||
@@ -824,6 +831,33 @@ static void tcpm_ams_finish(struct tcpm_port *port)
|
||||
port->ams = NONE_AMS;
|
||||
}
|
||||
|
||||
+static void tcpm_update_extcon_data(struct tcpm_port *port, bool attached) {
|
||||
+#ifdef CONFIG_EXTCON
|
||||
+ unsigned int *capability = port->extcon_cables;
|
||||
+ if (port->data_role == TYPEC_HOST) {
|
||||
+ extcon_set_state(port->extcon, EXTCON_USB, false);
|
||||
+ extcon_set_state(port->extcon, EXTCON_USB_HOST, attached);
|
||||
+ } else {
|
||||
+ extcon_set_state(port->extcon, EXTCON_USB, true);
|
||||
+ extcon_set_state(port->extcon, EXTCON_USB_HOST, attached);
|
||||
+ }
|
||||
+ while(*capability != EXTCON_NONE) {
|
||||
+ union extcon_property_value val;
|
||||
+ val.intval = true;
|
||||
+ extcon_set_property(port->extcon, *capability, EXTCON_PROP_USB_SS, val);
|
||||
+ val.intval = (port->polarity == TYPEC_POLARITY_CC2);
|
||||
+ extcon_set_property(port->extcon, *capability,
|
||||
+ EXTCON_PROP_USB_TYPEC_POLARITY, val);
|
||||
+ extcon_sync(port->extcon, *capability);
|
||||
+ capability++;
|
||||
+ }
|
||||
+ tcpm_log(port, "Extcon update (%s): %s, %s",
|
||||
+ attached ? "attached" : "detached",
|
||||
+ port->data_role == TYPEC_HOST ? "host" : "device",
|
||||
+ port->polarity == TYPEC_POLARITY_CC1 ? "normal" : "flipped");
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
static int tcpm_pd_transmit(struct tcpm_port *port,
|
||||
enum tcpm_transmit_type type,
|
||||
const struct pd_message *msg)
|
||||
@@ -1036,6 +1070,8 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached,
|
||||
typec_set_data_role(port->typec_port, data);
|
||||
typec_set_pwr_role(port->typec_port, role);
|
||||
|
||||
+ tcpm_update_extcon_data(port, attached);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1484,7 +1520,7 @@ static void svdm_consume_modes(struct tcpm_port *port, const u32 *p, int cnt)
|
||||
paltmode->mode = i;
|
||||
paltmode->vdo = p[i];
|
||||
|
||||
- tcpm_log(port, " Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x",
|
||||
+ tcpm_log(port, "Alternate mode %d: SVID 0x%04x, VDO %d: 0x%08x",
|
||||
pmdata->altmodes, paltmode->svid,
|
||||
paltmode->mode, paltmode->vdo);
|
||||
|
||||
@@ -1629,6 +1665,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
|
||||
modep->svid_index++;
|
||||
if (modep->svid_index < modep->nsvids) {
|
||||
u16 svid = modep->svids[modep->svid_index];
|
||||
+ tcpm_log(port, "More modes available, sending discover");
|
||||
response[0] = VDO(svid, 1, svdm_version, CMD_DISCOVER_MODES);
|
||||
rlen = 1;
|
||||
} else {
|
||||
@@ -3610,6 +3647,8 @@ static void tcpm_detach(struct tcpm_port *port)
|
||||
}
|
||||
|
||||
tcpm_reset_port(port);
|
||||
+
|
||||
+ tcpm_update_extcon_data(port, false);
|
||||
}
|
||||
|
||||
static void tcpm_src_detach(struct tcpm_port *port)
|
||||
@@ -5808,6 +5847,64 @@ void tcpm_tcpc_reset(struct tcpm_port *port)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcpm_tcpc_reset);
|
||||
|
||||
+static int tcpm_fw_get_caps_late(struct tcpm_port *port,
|
||||
+ struct fwnode_handle *fwnode)
|
||||
+{
|
||||
+ int ret, i;
|
||||
+ ret = fwnode_property_count_u32(fwnode, "typec-altmodes");
|
||||
+ if (ret > 0) {
|
||||
+ u32 *props;
|
||||
+ if (ret % 4) {
|
||||
+ dev_err(port->dev, "Length of typec altmode array must be divisible by 4");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ props = devm_kzalloc(port->dev, sizeof(u32) * ret, GFP_KERNEL);
|
||||
+ if (!props) {
|
||||
+ dev_err(port->dev, "Failed to allocate memory for altmode properties");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ if(fwnode_property_read_u32_array(fwnode, "typec-altmodes", props, ret) < 0) {
|
||||
+ dev_err(port->dev, "Failed to read altmodes from port");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ i = 0;
|
||||
+ while (ret > 0 && i < ARRAY_SIZE(port->port_altmode)) {
|
||||
+ struct typec_altmode *alt;
|
||||
+ struct typec_altmode_desc alt_desc = {
|
||||
+ .svid = props[i * 4],
|
||||
+ .mode = props[i * 4 + 1],
|
||||
+ .vdo = props[i * 4 + 2],
|
||||
+ .roles = props[i * 4 + 3],
|
||||
+ };
|
||||
+
|
||||
+
|
||||
+ tcpm_log(port, "Adding altmode SVID: 0x%04x, mode: %d, vdo: %u, role: %d",
|
||||
+ alt_desc.svid, alt_desc.mode, alt_desc.vdo, alt_desc.roles);
|
||||
+ alt = typec_port_register_altmode(port->typec_port,
|
||||
+ &alt_desc);
|
||||
+ if (IS_ERR(alt)) {
|
||||
+ tcpm_log(port,
|
||||
+ "%s: failed to register port alternate mode 0x%x",
|
||||
+ dev_name(port->dev), alt_desc.svid);
|
||||
+ break;
|
||||
+ }
|
||||
+ typec_altmode_set_drvdata(alt, port);
|
||||
+ alt->ops = &tcpm_altmode_ops;
|
||||
+ port->port_altmode[i] = alt;
|
||||
+ i++;
|
||||
+ ret -= 4;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+unsigned int default_supported_cables[] = {
|
||||
+ EXTCON_NONE
|
||||
+};
|
||||
+
|
||||
static int tcpm_fw_get_caps(struct tcpm_port *port,
|
||||
struct fwnode_handle *fwnode)
|
||||
{
|
||||
@@ -5827,6 +5924,23 @@ static int tcpm_fw_get_caps(struct tcpm_port *port,
|
||||
*/
|
||||
fw_devlink_purge_absent_suppliers(fwnode);
|
||||
|
||||
+#ifdef CONFIG_EXTCON
|
||||
+ ret = fwnode_property_count_u32(fwnode, "extcon-cables");
|
||||
+ if (ret > 0) {
|
||||
+ port->extcon_cables = devm_kzalloc(port->dev, sizeof(u32) * ret, GFP_KERNEL);
|
||||
+ if (!port->extcon_cables) {
|
||||
+ dev_err(port->dev, "Failed to allocate memory for extcon cable types. "\
|
||||
+ "Using default tyes");
|
||||
+ goto extcon_default;
|
||||
+ }
|
||||
+ fwnode_property_read_u32_array(fwnode, "extcon-cables", port->extcon_cables, ret);
|
||||
+ } else {
|
||||
+extcon_default:
|
||||
+ dev_info(port->dev, "No cable types defined, using default cables");
|
||||
+ port->extcon_cables = default_supported_cables;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/* USB data support is optional */
|
||||
ret = fwnode_property_read_string(fwnode, "data-role", &cap_str);
|
||||
if (ret == 0) {
|
||||
@@ -6226,6 +6340,17 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
|
||||
goto out_destroy_wq;
|
||||
|
||||
port->try_role = port->typec_caps.prefer_role;
|
||||
+#ifdef CONFIG_EXTCON
|
||||
+ port->extcon = devm_extcon_dev_allocate(dev, port->extcon_cables);
|
||||
+ if (IS_ERR(port->extcon)) {
|
||||
+ dev_err(dev, "Failed to allocate extcon device: %ld", PTR_ERR(port->extcon));
|
||||
+ goto out_destroy_wq;
|
||||
+ }
|
||||
+ if((err = devm_extcon_dev_register(dev, port->extcon))) {
|
||||
+ dev_err(dev, "Failed to register extcon device: %d", err);
|
||||
+ goto out_destroy_wq;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
port->typec_caps.fwnode = tcpc->fwnode;
|
||||
port->typec_caps.revision = 0x0120; /* Type-C spec release 1.2 */
|
||||
@@ -6259,6 +6384,12 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
|
||||
&tcpm_altmode_ops, port,
|
||||
port->port_altmode, ALTMODE_DISCOVERY_MAX);
|
||||
|
||||
+ err = tcpm_fw_get_caps_late(port, tcpc->fwnode);
|
||||
+ if (err < 0) {
|
||||
+ dev_err(dev, "Failed to get altmodes from fwnode");
|
||||
+ goto out_destroy_wq;
|
||||
+ }
|
||||
+
|
||||
mutex_lock(&port->lock);
|
||||
tcpm_init(port);
|
||||
mutex_unlock(&port->lock);
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
# boot failure
|
||||
|
||||
pkgname=linux-postmarketos-rockchip
|
||||
pkgver=5.16.8
|
||||
pkgrel=1
|
||||
pkgver=5.18
|
||||
pkgrel=0
|
||||
pkgdesc="Mainline kernel for rockchip devices"
|
||||
arch="aarch64 armv7"
|
||||
_flavor="${pkgname#linux-}"
|
||||
|
@ -54,9 +54,6 @@ esac
|
|||
|
||||
source="
|
||||
https://cdn.kernel.org/pub/linux/kernel/v${_kernver%%.*}.x/linux-$_kernver.tar.xz
|
||||
0001-phy-rockchip-typec-Set-extcon-capabilities.patch
|
||||
0003-arm64-dts-rockchip-add-typec-extcon-hack.patch
|
||||
0010-usb-typec-add-extcon-to-tcpm.patch
|
||||
0007-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch
|
||||
|
||||
config-$_flavor.aarch64
|
||||
|
@ -97,11 +94,8 @@ package() {
|
|||
|
||||
|
||||
sha512sums="
|
||||
66a0874eed7b2367fc0b69bee8c40a945b9e58d1a820c3e7e741bcb28774c811dea251826b14e2452d9e1fdd7509554ac50229f942c8ba853c308affba94a39a linux-5.16.8.tar.xz
|
||||
10949558a6e3316ea57497f377fd120d6704f3b81725317556e49d10b570a40edb06643b06738116abbe3096be485761d436f1a0d1861bd34fc18ea45068b6b0 0001-phy-rockchip-typec-Set-extcon-capabilities.patch
|
||||
b7291eecfddc7ebe9393eea864e0ee28960e8cc2f87dfc42d09426b5619f46ded97c38fb8bf26f4eea1f26bfe21396094505b3efb8676691f8751e2ffabe50ec 0003-arm64-dts-rockchip-add-typec-extcon-hack.patch
|
||||
e5cc0852506ea1e73213672f0c3f9144c08156f6d5e8af841bf3f7bffc0e89028507aac4718353eee20edd9069e3f81665caa5ca25e416f25e7e0da10451b67e 0010-usb-typec-add-extcon-to-tcpm.patch
|
||||
dbbc9d1395898a498fa4947fceda1781344fa5d360240f753810daa4fa88e519833e2186c4e582a8f1836e6413e9e85f6563c7770523b704e8702d67622f98b5 linux-5.18.tar.xz
|
||||
265b05bc542edb290ec15cd5f50132698a32e80d30ce28ce3ad7e990b7c07df92c4556122505b07a6aa582a919459872d1d874f4ed422d2aff2cdfb51889e720 0007-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch
|
||||
5dc0ed5b947ca8153e3b3874cf380208b0736a0e5db25fbeddf4c9cbb8d121d20de130462c99f9f398f4d28a229eac8cf384d9170fff5d56a48e5aec1c1eea9e config-postmarketos-rockchip.aarch64
|
||||
381064728710b2e74fbf623e7ce2ab84251ec656030e8c96c5f7630afd9e6786f725791ef5b4493eb6c821a0b87126e391a94b0ffc6999c4580f870b9cdfa1c8 config-postmarketos-rockchip.armv7
|
||||
db5b9b59d9a880d11c2d7f1c0283c4acfd741dacb9d07f8a850a4b38a40af7371531d71805c5b028fab7a3a659e824f4ee47d6b64f12a9fbd6a723220452c3f3 config-postmarketos-rockchip.aarch64
|
||||
c3144d302ae68ee9d6ef3cc77951808c61ff59ce0fcaef1a4829f11ccdb680e5a78b32697918700e9b6e1c25ccdd19002b096aed3b649197d31eed7cd2239ac4 config-postmarketos-rockchip.armv7
|
||||
"
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue