From: Sasha Levin Date: Thu, 27 Jun 2024 14:07:00 +0000 (-0400) Subject: Fixes for 6.9 X-Git-Tag: v4.19.317~151 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6623e30948d8d58212e6d88424318c74bb5ae258;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.9 Signed-off-by: Sasha Levin --- diff --git a/queue-6.9/input-ili210x-fix-ili251x_read_touch_data-return-val.patch b/queue-6.9/input-ili210x-fix-ili251x_read_touch_data-return-val.patch new file mode 100644 index 00000000000..b062063d503 --- /dev/null +++ b/queue-6.9/input-ili210x-fix-ili251x_read_touch_data-return-val.patch @@ -0,0 +1,41 @@ +From 5cc1fa810617c2d833a2361bc7e00843bb3e4e93 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 May 2024 09:56:24 +0100 +Subject: Input: ili210x - fix ili251x_read_touch_data() return value + +From: John Keeping + +[ Upstream commit 9f0fad0382124e7e23b3c730fa78818c22c89c0a ] + +The caller of this function treats all non-zero values as an error, so +the return value of i2c_master_recv() cannot be returned directly. + +This fixes touch reporting when there are more than 6 active touches. + +Fixes: ef536abd3afd1 ("Input: ili210x - define and use chip operations structure") +Signed-off-by: John Keeping +Link: https://lore.kernel.org/r/20240523085624.2295988-1-jkeeping@inmusicbrands.com +Signed-off-by: Dmitry Torokhov +Signed-off-by: Sasha Levin +--- + drivers/input/touchscreen/ili210x.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c +index 31ffdc2a93f35..79bdb2b109496 100644 +--- a/drivers/input/touchscreen/ili210x.c ++++ b/drivers/input/touchscreen/ili210x.c +@@ -261,8 +261,8 @@ static int ili251x_read_touch_data(struct i2c_client *client, u8 *data) + if (!error && data[0] == 2) { + error = i2c_master_recv(client, data + ILI251X_DATA_SIZE1, + ILI251X_DATA_SIZE2); +- if (error >= 0 && error != ILI251X_DATA_SIZE2) +- error = -EIO; ++ if (error >= 0) ++ error = error == ILI251X_DATA_SIZE2 ? 0 : -EIO; + } + + return error; +-- +2.43.0 + diff --git a/queue-6.9/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch b/queue-6.9/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch new file mode 100644 index 00000000000..5beb75aff26 --- /dev/null +++ b/queue-6.9/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch @@ -0,0 +1,48 @@ +From dc15dd2b7560af34437298db99d017e91377d1b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Jun 2024 08:58:38 +0000 +Subject: pinctrl: fix deadlock in create_pinctrl() when handling -EPROBE_DEFER + +From: Hagar Hemdan + +[ Upstream commit adec57ff8e66aee632f3dd1f93787c13d112b7a1 ] + +In create_pinctrl(), pinctrl_maps_mutex is acquired before calling +add_setting(). If add_setting() returns -EPROBE_DEFER, create_pinctrl() +calls pinctrl_free(). However, pinctrl_free() attempts to acquire +pinctrl_maps_mutex, which is already held by create_pinctrl(), leading to +a potential deadlock. + +This patch resolves the issue by releasing pinctrl_maps_mutex before +calling pinctrl_free(), preventing the deadlock. + +This bug was discovered and resolved using Coverity Static Analysis +Security Testing (SAST) by Synopsys, Inc. + +Fixes: 42fed7ba44e4 ("pinctrl: move subsystem mutex to pinctrl_dev struct") +Suggested-by: Maximilian Heyne +Signed-off-by: Hagar Hemdan +Link: https://lore.kernel.org/r/20240604085838.3344-1-hagarhem@amazon.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c +index cffeb869130dd..f424a57f00136 100644 +--- a/drivers/pinctrl/core.c ++++ b/drivers/pinctrl/core.c +@@ -1106,8 +1106,8 @@ static struct pinctrl *create_pinctrl(struct device *dev, + * an -EPROBE_DEFER later, as that is the worst case. + */ + if (ret == -EPROBE_DEFER) { +- pinctrl_free(p, false); + mutex_unlock(&pinctrl_maps_mutex); ++ pinctrl_free(p, false); + return ERR_PTR(ret); + } + } +-- +2.43.0 + diff --git a/queue-6.9/pinctrl-renesas-rzg2l-use-spin_-lock-unlock-_irq-sav.patch b/queue-6.9/pinctrl-renesas-rzg2l-use-spin_-lock-unlock-_irq-sav.patch new file mode 100644 index 00000000000..5597e90d38c --- /dev/null +++ b/queue-6.9/pinctrl-renesas-rzg2l-use-spin_-lock-unlock-_irq-sav.patch @@ -0,0 +1,47 @@ +From b3db375db89108d5211e13e1186dd800de3eb01b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 May 2024 08:54:21 +0300 +Subject: pinctrl: renesas: rzg2l: Use spin_{lock,unlock}_irq{save,restore} + +From: Claudiu Beznea + +[ Upstream commit a39741d38c048a48ae0d65226d9548005a088f5f ] + +On PREEMPT_RT kernels the spinlock_t maps to an rtmutex. Using +raw_spin_lock_irqsave()/raw_spin_unlock_irqrestore() on +&pctrl->lock.rlock breaks the PREEMPT_RT builds. To fix this use +spin_lock_irqsave()/spin_unlock_irqrestore() on &pctrl->lock. + +Fixes: 02cd2d3be1c3 ("pinctrl: renesas: rzg2l: Configure the interrupt type on resume") +Reported-by: Diederik de Haas +Closes: https://lore.kernel.org/all/131999629.KQPSlr0Zke@bagend +Signed-off-by: Claudiu Beznea +Reviewed-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/20240522055421.2842689-1-claudiu.beznea.uj@bp.renesas.com +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/renesas/pinctrl-rzg2l.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c +index 248ab71b9f9da..747b22cd38aea 100644 +--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c ++++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c +@@ -2071,11 +2071,11 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl) + * This has to be atomically executed to protect against a concurrent + * interrupt. + */ +- raw_spin_lock_irqsave(&pctrl->lock.rlock, flags); ++ spin_lock_irqsave(&pctrl->lock, flags); + ret = rzg2l_gpio_irq_set_type(data, irqd_get_trigger_type(data)); + if (!ret && !irqd_irq_disabled(data)) + rzg2l_gpio_irq_enable(data); +- raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags); ++ spin_unlock_irqrestore(&pctrl->lock, flags); + + if (ret) + dev_crit(pctrl->dev, "Failed to set IRQ type for virq=%u\n", virq); +-- +2.43.0 + diff --git a/queue-6.9/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch b/queue-6.9/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch new file mode 100644 index 00000000000..6594002dfe8 --- /dev/null +++ b/queue-6.9/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch @@ -0,0 +1,69 @@ +From 73d4ac45b29ccbc053489745b24a8ac704fdd106 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Jun 2024 20:57:52 +0800 +Subject: pinctrl: rockchip: fix pinmux bits for RK3328 GPIO2-B pins + +From: Huang-Huang Bao + +[ Upstream commit e8448a6c817c2aa6c6af785b1d45678bd5977e8d ] + +The pinmux bits for GPIO2-B0 to GPIO2-B6 actually have 2 bits width, +correct the bank flag for GPIO2-B. The pinmux bits for GPIO2-B7 is +recalculated so it remain unchanged. + +The pinmux bits for those pins are not explicitly specified in RK3328 +TRM, however we can get hint from pad name and its correspinding IOMUX +setting for pins in interface descriptions. The correspinding IOMIX +settings for GPIO2-B0 to GPIO2-B6 can be found in the same row next to +occurrences of following pad names in RK3328 TRM. + +GPIO2-B0: IO_SPIclkm0_GPIO2B0vccio5 +GPIO2-B1: IO_SPItxdm0_GPIO2B1vccio5 +GPIO2-B2: IO_SPIrxdm0_GPIO2B2vccio5 +GPIO2-B3: IO_SPIcsn0m0_GPIO2B3vccio5 +GPIO2-B4: IO_SPIcsn1m0_FLASHvol_sel_GPIO2B4vccio5 +GPIO2-B5: IO_ I2C2sda_TSADCshut_GPIO2B5vccio5 +GPIO2-B6: IO_ I2C2scl_GPIO2B6vccio5 + +This fix has been tested on NanoPi R2S for fixing confliting pinmux bits +between GPIO2-B7 with GPIO2-B5. + +Signed-off-by: Huang-Huang Bao +Reviewed-by: Heiko Stuebner +Fixes: 3818e4a7678e ("pinctrl: rockchip: Add rk3328 pinctrl support") +Link: https://lore.kernel.org/r/20240606125755.53778-2-i@eh5.me +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-rockchip.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 3bedf36a0019d..78dcf4daccde8 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -634,12 +634,6 @@ static struct rockchip_mux_recalced_data rk3308_mux_recalced_data[] = { + + static struct rockchip_mux_recalced_data rk3328_mux_recalced_data[] = { + { +- .num = 2, +- .pin = 12, +- .reg = 0x24, +- .bit = 8, +- .mask = 0x3 +- }, { + .num = 2, + .pin = 15, + .reg = 0x28, +@@ -3763,7 +3757,7 @@ static struct rockchip_pin_bank rk3328_pin_banks[] = { + PIN_BANK_IOMUX_FLAGS(0, 32, "gpio0", 0, 0, 0, 0), + PIN_BANK_IOMUX_FLAGS(1, 32, "gpio1", 0, 0, 0, 0), + PIN_BANK_IOMUX_FLAGS(2, 32, "gpio2", 0, +- IOMUX_WIDTH_3BIT, ++ 0, + IOMUX_WIDTH_3BIT, + 0), + PIN_BANK_IOMUX_FLAGS(3, 32, "gpio3", +-- +2.43.0 + diff --git a/queue-6.9/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch b/queue-6.9/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch new file mode 100644 index 00000000000..518a9d0c9d1 --- /dev/null +++ b/queue-6.9/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch @@ -0,0 +1,111 @@ +From 24077ef0975d724124a73571f9ad75723bb428c8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Jun 2024 20:57:53 +0800 +Subject: pinctrl: rockchip: fix pinmux bits for RK3328 GPIO3-B pins + +From: Huang-Huang Bao + +[ Upstream commit 5ef6914e0bf578357b4c906ffe6b26e7eedb8ccf ] + +The pinmux bits for GPIO3-B1 to GPIO3-B6 pins are not explicitly +specified in RK3328 TRM, however we can get hint from pad name and its +correspinding IOMUX setting for pins in interface descriptions. The +correspinding IOMIX settings for these pins can be found in the same +row next to occurrences of following pad names in RK3328 TRM. + +GPIO3-B1: IO_TSPd5m0_CIFdata5m0_GPIO3B1vccio6 +GPIO3-B2: IO_TSPd6m0_CIFdata6m0_GPIO3B2vccio6 +GPIO3-B3: IO_TSPd7m0_CIFdata7m0_GPIO3B3vccio6 +GPIO3-B4: IO_CARDclkm0_GPIO3B4vccio6 +GPIO3-B5: IO_CARDrstm0_GPIO3B5vccio6 +GPIO3-B6: IO_CARDdetm0_GPIO3B6vccio6 + +Add pinmux data to rk3328_mux_recalced_data as mux register offset for +these pins does not follow rockchip convention. + +Signed-off-by: Huang-Huang Bao +Reviewed-by: Heiko Stuebner +Fixes: 3818e4a7678e ("pinctrl: rockchip: Add rk3328 pinctrl support") +Link: https://lore.kernel.org/r/20240606125755.53778-3-i@eh5.me +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-rockchip.c | 51 ++++++++++++++++++++++++++++++ + 1 file changed, 51 insertions(+) + +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 78dcf4daccde8..23531ea0d088f 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -634,17 +634,68 @@ static struct rockchip_mux_recalced_data rk3308_mux_recalced_data[] = { + + static struct rockchip_mux_recalced_data rk3328_mux_recalced_data[] = { + { ++ /* gpio2_b7_sel */ + .num = 2, + .pin = 15, + .reg = 0x28, + .bit = 0, + .mask = 0x7 + }, { ++ /* gpio2_c7_sel */ + .num = 2, + .pin = 23, + .reg = 0x30, + .bit = 14, + .mask = 0x3 ++ }, { ++ /* gpio3_b1_sel */ ++ .num = 3, ++ .pin = 9, ++ .reg = 0x44, ++ .bit = 2, ++ .mask = 0x3 ++ }, { ++ /* gpio3_b2_sel */ ++ .num = 3, ++ .pin = 10, ++ .reg = 0x44, ++ .bit = 4, ++ .mask = 0x3 ++ }, { ++ /* gpio3_b3_sel */ ++ .num = 3, ++ .pin = 11, ++ .reg = 0x44, ++ .bit = 6, ++ .mask = 0x3 ++ }, { ++ /* gpio3_b4_sel */ ++ .num = 3, ++ .pin = 12, ++ .reg = 0x44, ++ .bit = 8, ++ .mask = 0x3 ++ }, { ++ /* gpio3_b5_sel */ ++ .num = 3, ++ .pin = 13, ++ .reg = 0x44, ++ .bit = 10, ++ .mask = 0x3 ++ }, { ++ /* gpio3_b6_sel */ ++ .num = 3, ++ .pin = 14, ++ .reg = 0x44, ++ .bit = 12, ++ .mask = 0x3 ++ }, { ++ /* gpio3_b7_sel */ ++ .num = 3, ++ .pin = 15, ++ .reg = 0x44, ++ .bit = 14, ++ .mask = 0x3 + }, + }; + +-- +2.43.0 + diff --git a/queue-6.9/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch b/queue-6.9/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch new file mode 100644 index 00000000000..a93571730ed --- /dev/null +++ b/queue-6.9/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch @@ -0,0 +1,42 @@ +From 3f97bc1a77e46ea2f9fd25cea3dab3b0ef9daf3a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Jun 2024 20:57:55 +0800 +Subject: pinctrl: rockchip: fix pinmux reset in rockchip_pmx_set + +From: Huang-Huang Bao + +[ Upstream commit 4ea4d4808e342ddf89ba24b93ffa2057005aaced ] + +rockchip_pmx_set reset all pinmuxs in group to 0 in the case of error, +add missing bank data retrieval in that code to avoid setting mux on +unexpected pins. + +Fixes: 14797189b35e ("pinctrl: rockchip: add return value to rockchip_set_mux") +Reviewed-by: Heiko Stuebner +Signed-off-by: Huang-Huang Bao +Link: https://lore.kernel.org/r/20240606125755.53778-5-i@eh5.me +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-rockchip.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 24ee88863ce39..3f56991f5b892 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -2751,8 +2751,10 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, + + if (ret) { + /* revert the already done pin settings */ +- for (cnt--; cnt >= 0; cnt--) ++ for (cnt--; cnt >= 0; cnt--) { ++ bank = pin_to_bank(info, pins[cnt]); + rockchip_set_mux(bank, pins[cnt] - bank->pin_base, 0); ++ } + + return ret; + } +-- +2.43.0 + diff --git a/queue-6.9/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch b/queue-6.9/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch new file mode 100644 index 00000000000..05425529e93 --- /dev/null +++ b/queue-6.9/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch @@ -0,0 +1,77 @@ +From ace999bdae836e31689445f693fe5e315b1ae908 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Jun 2024 20:57:54 +0800 +Subject: pinctrl: rockchip: use dedicated pinctrl type for RK3328 + +From: Huang-Huang Bao + +[ Upstream commit 01b4b1d1cec48ef4c26616c2fc4600b2c9fec05a ] + +rk3328_pin_ctrl uses type of RK3288 which has a hack in +rockchip_pinctrl_suspend and rockchip_pinctrl_resume to restore GPIO6-C6 +at assume, the hack is not applicable to RK3328 as GPIO6 is not even +exist in it. So use a dedicated pinctrl type to skip this hack. + +Fixes: 3818e4a7678e ("pinctrl: rockchip: Add rk3328 pinctrl support") +Reviewed-by: Heiko Stuebner +Signed-off-by: Huang-Huang Bao +Link: https://lore.kernel.org/r/20240606125755.53778-4-i@eh5.me +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-rockchip.c | 5 ++++- + drivers/pinctrl/pinctrl-rockchip.h | 1 + + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c +index 23531ea0d088f..24ee88863ce39 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.c ++++ b/drivers/pinctrl/pinctrl-rockchip.c +@@ -2478,6 +2478,7 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) + case RK3188: + case RK3288: + case RK3308: ++ case RK3328: + case RK3368: + case RK3399: + case RK3568: +@@ -2536,6 +2537,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, + case RK3188: + case RK3288: + case RK3308: ++ case RK3328: + case RK3368: + case RK3399: + case RK3568: +@@ -2798,6 +2800,7 @@ static bool rockchip_pinconf_pull_valid(struct rockchip_pin_ctrl *ctrl, + case RK3188: + case RK3288: + case RK3308: ++ case RK3328: + case RK3368: + case RK3399: + case RK3568: +@@ -3822,7 +3825,7 @@ static struct rockchip_pin_ctrl rk3328_pin_ctrl = { + .pin_banks = rk3328_pin_banks, + .nr_banks = ARRAY_SIZE(rk3328_pin_banks), + .label = "RK3328-GPIO", +- .type = RK3288, ++ .type = RK3328, + .grf_mux_offset = 0x0, + .iomux_recalced = rk3328_mux_recalced_data, + .niomux_recalced = ARRAY_SIZE(rk3328_mux_recalced_data), +diff --git a/drivers/pinctrl/pinctrl-rockchip.h b/drivers/pinctrl/pinctrl-rockchip.h +index 4759f336941ef..849266f8b1913 100644 +--- a/drivers/pinctrl/pinctrl-rockchip.h ++++ b/drivers/pinctrl/pinctrl-rockchip.h +@@ -193,6 +193,7 @@ enum rockchip_pinctrl_type { + RK3188, + RK3288, + RK3308, ++ RK3328, + RK3368, + RK3399, + RK3568, +-- +2.43.0 + diff --git a/queue-6.9/series b/queue-6.9/series index aac6abd032f..6ac918fd039 100644 --- a/queue-6.9/series +++ b/queue-6.9/series @@ -1,2 +1,9 @@ usb-typec-ucsi-never-send-a-lone-connector-change-ac.patch usb-typec-ucsi-ack-also-failed-get-error-commands.patch +pinctrl-renesas-rzg2l-use-spin_-lock-unlock-_irq-sav.patch +input-ili210x-fix-ili251x_read_touch_data-return-val.patch +pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch +pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch +pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch +pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch +pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch