aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2021-08-21 10:54:34 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2021-08-21 19:07:07 +0200
commit8299d1f057439f94c6a4412e2e5c5082b82a30c9 (patch)
tree1bf678d61f11f7394493be464c7876e496f7faed /target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch
parent33b6885975ce376ff075362b7f0890326043111b (diff)
downloadupstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.tar.gz
upstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.tar.bz2
upstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.zip
bcm27xx: add kernel 5.10 support
Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted patches, wireless patches and defconfig patches. bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 4B v1.1 4G bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch b/target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch
new file mode 100644
index 0000000000..f4dc7b6289
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.10/950-0061-Fixes-a-problem-when-module-probes-before-i2c-module.patch
@@ -0,0 +1,46 @@
+From 4be98b29d123fc7615ea8404fbda450ec8acb084 Mon Sep 17 00:00:00 2001
+From: Joerg Schambacher <joerg@i2audio.com>
+Date: Fri, 16 Oct 2020 15:17:07 +0200
+Subject: [PATCH] Fixes a problem when module probes before i2c module
+ is available
+
+The driver crashed while a NULL pointer returned by i2c_get_adapter()
+has been used to access the i2c bus functions.
+The headphone probing function hb_hp_probe() now returns -EPROBE_DEFER
+in case the i2c module has not been loaded yet.
+
+Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
+---
+ sound/soc/bcm/hifiberry_dacplus.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/sound/soc/bcm/hifiberry_dacplus.c
++++ b/sound/soc/bcm/hifiberry_dacplus.c
+@@ -315,12 +315,14 @@ static int hb_hp_detect(void)
+ {
+ struct i2c_adapter *adap = i2c_get_adapter(1);
+ int ret;
+-
+ struct i2c_client tpa_i2c_client = {
+ .addr = 0x60,
+ .adapter = adap,
+ };
+
++ if (!adap)
++ return -EPROBE_DEFER; /* I2C module not yet available */
++
+ ret = i2c_smbus_read_byte(&tpa_i2c_client) >= 0;
+ i2c_put_adapter(adap);
+ return ret;
+@@ -342,7 +344,10 @@ static int snd_rpi_hifiberry_dacplus_pro
+ struct of_changeset ocs;
+
+ /* probe for head phone amp */
+- if (hb_hp_detect()) {
++ ret = hb_hp_detect();
++ if (ret < 0)
++ return ret;
++ if (ret) {
+ card->aux_dev = hifiberry_dacplus_aux_devs;
+ card->num_aux_devs =
+ ARRAY_SIZE(hifiberry_dacplus_aux_devs);