Update to 5.16.1 and use patches from manjaro

This commit is contained in:
Juan José Gutiérrez de Quevedo Pérez 2022-01-19 21:20:02 +01:00
parent 1ca87f0e12
commit 7298a2e142
4 changed files with 158 additions and 136 deletions

View file

@ -0,0 +1,46 @@
From 942e794211fc05943db36212d41c4e8a68b3c922 Mon Sep 17 00:00:00 2001
From: Dan Johansen <strit@manjaro.org>
Date: Mon, 17 Aug 2020 21:32:16 +0200
Subject: [PATCH] Bluetooth-Add-new-quirk-for-broken-local-ext-features
---
include/net/bluetooth/hci.h | 7 +++++++
net/bluetooth/hci_event.c | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index c8e67042a3b1..53f7a8518372 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -228,6 +228,13 @@ enum {
*/
HCI_QUIRK_VALID_LE_STATES,
+ /* When this quirk is set, max_page for local extended features
+ * is set to 1, even if controller reports higher number. Some
+ * controllers (e.g. RTL8723CS) report more pages, but they
+ * don't actually support features declared there.
+ */
+ HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
+
/* When this quirk is set, then erroneous data reporting
* is ignored. This is mainly due to the fact that the HCI
* Read Default Erroneous Data Reporting command is advertised,
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4b7fc430793c..9b165c8f16de 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -700,7 +700,9 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
if (rp->status)
return;
- if (hdev->max_page < rp->max_page)
+ if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
+ &hdev->quirks) &&
+ hdev->max_page < rp->max_page)
hdev->max_page = rp->max_page;
if (rp->page < HCI_MAX_PAGES)
--
2.28.0

View file

@ -1,30 +1,20 @@
diff -abBur linux-5.15/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts linux-5.15-bluetooth-pinebook/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
--- linux-5.15/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 2021-10-31 20:53:10.000000000 +0000
+++ linux-5.15-bluetooth-pinebook/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 2021-11-03 11:01:16.392103274 +0000
@@ -405,6 +405,19 @@
status = "okay";
};
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+ uart-has-rtscts;
+ status = "okay";
+
+ bluetooth {
+ compatible = "realtek,rtl8723cs-bt";
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
+ host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
+ };
+};
+
&usb_otg {
dr_mode = "host";
};
diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/drivers/bluetooth/btrtl.c
--- linux-5.15/drivers/bluetooth/btrtl.c 2021-10-31 20:53:10.000000000 +0000
+++ linux-5.15-bluetooth-pinebook/drivers/bluetooth/btrtl.c 2021-11-03 10:23:12.451249029 +0000
@@ -17,7 +17,11 @@
From 98780d7a20789dd671c5858546bcc7f9320fb335 Mon Sep 17 00:00:00 2001
From: Dan Johansen <strit@manjaro.org>
Date: Wed, 17 Nov 2021 00:10:47 +0100
Subject: [PATCH] Bluetooth: btrtl: add support for the RTL8723CS
Signed-off-by: Dan Johansen <strit@manjaro.org>
---
drivers/bluetooth/btrtl.c | 124 +++++++++++++++++++++++++++++++++++--
drivers/bluetooth/btrtl.h | 5 ++
drivers/bluetooth/hci_h5.c | 2 +
3 files changed, 127 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index c2bdd1e6060e..e64b6d1ead95 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -17,7 +17,12 @@
#define VERSION "0.1"
@ -32,11 +22,12 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
+#define RTL_CHIP_8723CS_VF 4
+#define RTL_CHIP_8723CS_XX 5
#define RTL_EPATCH_SIGNATURE "Realtech"
+#define RTL_ROM_LMP_3499 0x3499
+#define RTL_ROM_LMP_8703B 0x8703
#define RTL_ROM_LMP_8723A 0x1200
#define RTL_ROM_LMP_8723B 0x8723
#define RTL_ROM_LMP_8821A 0x8821
@@ -30,6 +34,7 @@
@@ -30,6 +35,7 @@
#define IC_MATCH_FL_HCIREV (1 << 1)
#define IC_MATCH_FL_HCIVER (1 << 2)
#define IC_MATCH_FL_HCIBUS (1 << 3)
@ -44,51 +35,18 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
#define IC_INFO(lmps, hcir, hciv, bus) \
.match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \
IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \
@@ -57,6 +62,7 @@
@@ -57,6 +63,7 @@ struct id_table {
__u16 hci_rev;
__u8 hci_ver;
__u8 hci_bus;
+ __u8 chip_type;
bool config_needed;
bool has_rom_version;
char *fw_name;
@@ -96,6 +102,72 @@
bool has_msft_ext;
@@ -97,6 +104,39 @@ static const struct id_table ic_id_table[] = {
.fw_name = "rtl_bt/rtl8723b_fw.bin",
.cfg_name = "rtl_bt/rtl8723b_config" },
+ /* 8723CS-CG */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8723CS_CG,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_cg_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_cg_config" },
+
+ /* 8723CS-VF */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8723CS_VF,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_vf_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_vf_config" },
+
+ /* 8723CS-XX */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8723CS_XX,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_xx_config" },
+
+ /* 8723CS-CG */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
@ -125,7 +83,7 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
/* 8723D */
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
.config_needed = true,
@@ -175,7 +247,8 @@
@@ -182,7 +222,8 @@ static const struct id_table ic_id_table[] = {
};
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
@ -135,20 +93,17 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
{
int i;
@@ -192,6 +265,12 @@
@@ -199,6 +240,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) &&
(ic_id_table[i].hci_bus != hci_bus))
continue;
+ if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) &&
+ (ic_id_table[i].chip_type != chip_type))
+ continue;
+ if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) &&
+ (ic_id_table[i].chip_type != chip_type))
+ continue;
break;
}
@@ -274,6 +353,7 @@
@@ -281,6 +325,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
{ RTL_ROM_LMP_8723B, 1 },
{ RTL_ROM_LMP_8821A, 2 },
{ RTL_ROM_LMP_8761A, 3 },
@ -156,7 +111,7 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
{ RTL_ROM_LMP_8822B, 8 },
{ RTL_ROM_LMP_8723B, 9 }, /* 8723D */
{ RTL_ROM_LMP_8821A, 10 }, /* 8821C */
@@ -552,6 +632,48 @@
@@ -559,6 +604,48 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
return ret;
}
@ -205,7 +160,7 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
void btrtl_free(struct btrtl_device_info *btrtl_dev)
{
kvfree(btrtl_dev->fw_data);
@@ -568,7 +690,7 @@
@@ -575,7 +662,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
struct hci_rp_read_local_version *resp;
char cfg_name[40];
u16 hci_rev, lmp_subver;
@ -214,10 +169,13 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
int ret;
u16 opcode;
u8 cmd[2];
@@ -638,8 +760,14 @@
out_free:
kfree_skb(skb);
@@ -601,8 +688,17 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
hci_rev = le16_to_cpu(resp->hci_rev);
lmp_subver = le16_to_cpu(resp->lmp_subver);
+ /*
+ * We assume drop_fw is not needed for devices that have chip_type.
+ */
+ if (rtl_has_chip_type(lmp_subver)) {
+ ret = rtl_read_chip_type(hdev, &chip_type);
+ if (ret)
@ -228,9 +186,18 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
- hdev->bus);
+ hdev->bus, chip_type);
if (!btrtl_dev->ic_info) {
rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
@@ -722,6 +850,7 @@
if (!btrtl_dev->ic_info)
btrtl_dev->drop_fw = true;
@@ -645,7 +741,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
lmp_subver = le16_to_cpu(resp->lmp_subver);
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
- hdev->bus);
+ hdev->bus, chip_type);
}
out_free:
kfree_skb(skb);
@@ -727,6 +823,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,
case RTL_ROM_LMP_8761A:
case RTL_ROM_LMP_8822B:
case RTL_ROM_LMP_8852A:
@ -238,10 +205,11 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
return btrtl_setup_rtl8723b(hdev, btrtl_dev);
default:
rtl_dev_info(hdev, "assuming no firmware upload needed");
@@ -752,6 +881,18 @@
@@ -758,6 +855,19 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
rtl_dev_dbg(hdev, "WBS supported not enabled.");
break;
}
+
+ switch (btrtl_dev->ic_info->lmp_subver) {
+ case RTL_ROM_LMP_8703B:
+ /* 8723CS reports two pages for local ext features,
@ -257,7 +225,7 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
}
EXPORT_SYMBOL_GPL(btrtl_set_quirks);
@@ -910,6 +1051,12 @@
@@ -916,6 +1026,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin");
@ -270,10 +238,10 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.c linux-5.15-bluetooth-pinebook/d
MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin");
Only in linux-5.15-bluetooth-pinebook/drivers/bluetooth: btrtl.c.orig
diff -abBur linux-5.15/drivers/bluetooth/btrtl.h linux-5.15-bluetooth-pinebook/drivers/bluetooth/btrtl.h
--- linux-5.15/drivers/bluetooth/btrtl.h 2021-10-31 20:53:10.000000000 +0000
+++ linux-5.15-bluetooth-pinebook/drivers/bluetooth/btrtl.h 2021-11-03 10:23:12.455249023 +0000
diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h
index 2c441bda390a..1c6282241d2d 100644
--- a/drivers/bluetooth/btrtl.h
+++ b/drivers/bluetooth/btrtl.h
@@ -14,6 +14,11 @@
struct btrtl_device_info;
@ -286,55 +254,19 @@ diff -abBur linux-5.15/drivers/bluetooth/btrtl.h linux-5.15-bluetooth-pinebook/d
struct rtl_download_cmd {
__u8 index;
__u8 data[RTL_FRAG_LEN];
diff -abBur linux-5.15/drivers/bluetooth/hci_h5.c linux-5.15-bluetooth-pinebook/drivers/bluetooth/hci_h5.c
--- linux-5.15/drivers/bluetooth/hci_h5.c 2021-10-31 20:53:10.000000000 +0000
+++ linux-5.15-bluetooth-pinebook/drivers/bluetooth/hci_h5.c 2021-11-03 10:25:17.971078312 +0000
@@ -938,6 +938,8 @@
err = btrtl_download_firmware(h5->hu->hdev, btrtl_dev);
/* Give the device some time before the hci-core sends it a reset */
usleep_range(10000, 20000);
+ if (err)
+ goto out_free;
btrtl_set_quirks(h5->hu->hdev, btrtl_dev);
@@ -1096,6 +1098,8 @@
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 34286ffe0568..f963473d6b3f 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -1095,6 +1095,8 @@ static const struct of_device_id rtl_bluetooth_of_match[] = {
.data = (const void *)&h5_data_rtl8723bs },
{ .compatible = "realtek,rtl8723ds-bt",
.data = (const void *)&h5_data_rtl8723bs },
+ { .compatible = "realtek,rtl8723cs-bt",
+ .data = (const void *)&rtl_vnd },
+ { .compatible = "realtek,rtl8723cs-bt",
+ .data = (const void *)&h5_data_rtl8723bs },
#endif
{ },
};
diff -abBur linux-5.15/include/net/bluetooth/hci.h linux-5.15-bluetooth-pinebook/include/net/bluetooth/hci.h
--- linux-5.15/include/net/bluetooth/hci.h 2021-10-31 20:53:10.000000000 +0000
+++ linux-5.15-bluetooth-pinebook/include/net/bluetooth/hci.h 2021-11-03 10:23:12.467249007 +0000
@@ -246,6 +246,13 @@
* HCI after resume.
*/
HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+ /* When this quirk is set, max_page for local extended features
+ * is set to 1, even if controller reports higher number. Some
+ * controllers (e.g. RTL8723CS) report more pages, but they
+ * don't actually support features declared there.
+ */
+ HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
};
/* HCI device flags */
diff -abBur linux-5.15/net/bluetooth/hci_event.c linux-5.15-bluetooth-pinebook/net/bluetooth/hci_event.c
--- linux-5.15/net/bluetooth/hci_event.c 2021-10-31 20:53:10.000000000 +0000
+++ linux-5.15-bluetooth-pinebook/net/bluetooth/hci_event.c 2021-11-03 10:23:12.475248996 +0000
@@ -725,7 +725,9 @@
if (rp->status)
return;
- if (hdev->max_page < rp->max_page)
+ if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
+ &hdev->quirks) &&
+ hdev->max_page < rp->max_page)
hdev->max_page = rp->max_page;
if (rp->page < HCI_MAX_PAGES)
--
2.33.0

View file

@ -0,0 +1,40 @@
From 3704655d8113ccaae2fb52287fcca5d2900e941b Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Wed, 31 Oct 2018 20:43:26 -0700
Subject: [PATCH] arm64: allwinner: a64: enable Bluetooth On Pinebook
Pinebook has an RTL8723CS WiFi + BT chip, BT is connected to UART1
and uses PL5 as device wake GPIO, PL6 as host wake GPIO the I2C
controlling signals are connected to R_I2C bus.
Enable it in the device tree.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
.../arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index 64b1c54f87c0a..e63ff271be4e6 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -408,6 +408,18 @@
status = "okay";
};
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+ status = "okay";
+
+ bluetooth {
+ compatible = "realtek,rtl8723cs-bt";
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
+ host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
+ };
+};
+
&usb_otg {
dr_mode = "host";
};

View file

@ -2,10 +2,10 @@
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
pkgbase=linux-pinebook
_srcname=linux-5.15
_srcname=linux-5.16
_kernelname=${pkgbase#linux}
_desc="pinebook kernel"
pkgver=5.15.2
pkgver=5.16.1
pkgrel=1
arch=('aarch64')
url="http://www.kernel.org/"
@ -14,15 +14,19 @@ makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' '
options=('!strip')
source=("http://www.kernel.org/pub/linux/kernel/v5.x/${_srcname}.tar.xz"
"http://www.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz"
'0001-pinebook-bluetooth.patch'
"0001-Bluetooth-Add-new-quirk-for-broken-local-ext-features.patch"
"0002-Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch"
"0003-arm64-allwinner-a64-enable-Bluetooth-On-Pinebook.patch"
'config'
'linux.preset'
'60-linux.hook'
'90-linux.hook')
md5sums=('071d49ff4e020d58c04f9f3f76d3b594'
'568b7d7588d99eb5c3a56d5631f3d2f8'
'38f4336d3267dc8b1acf9526065c1f7a'
md5sums=('e6680ce7c989a3efe58b51e3f3f0bf93'
'd571392436365678b420e4dece216514'
'cf64831f27bb47da29e708b7243bb340'
'a100d32aa6c345290061d2a773bf1232'
'9510821113c122f91f47b9d0f7ca7264'
'72a67c336d52430aa63e527f5a8dfbce'
'41cb5fef62715ead2dd109dbea8413d6'
'ce6c81ad1ad1f8b333fd6077d47abdaf'