From 6de641667efcdbb7f934a7ce03d9657d8917e066 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 27 Jun 2024 10:07:01 -0400 Subject: [PATCH] Fixes for 6.6 Signed-off-by: Sasha Levin --- ...x-ili251x_read_touch_data-return-val.patch | 41 +++++++ ...lock-in-create_pinctrl-when-handling.patch | 48 ++++++++ ...-fix-pinmux-bits-for-rk3328-gpio2-b-.patch | 69 +++++++++++ ...-fix-pinmux-bits-for-rk3328-gpio3-b-.patch | 111 ++++++++++++++++++ ...-fix-pinmux-reset-in-rockchip_pmx_se.patch | 42 +++++++ ...-use-dedicated-pinctrl-type-for-rk33.patch | 77 ++++++++++++ queue-6.6/series | 6 + 7 files changed, 394 insertions(+) create mode 100644 queue-6.6/input-ili210x-fix-ili251x_read_touch_data-return-val.patch create mode 100644 queue-6.6/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch create mode 100644 queue-6.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch create mode 100644 queue-6.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch create mode 100644 queue-6.6/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch create mode 100644 queue-6.6/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch diff --git a/queue-6.6/input-ili210x-fix-ili251x_read_touch_data-return-val.patch b/queue-6.6/input-ili210x-fix-ili251x_read_touch_data-return-val.patch new file mode 100644 index 00000000000..8796829fb2e --- /dev/null +++ b/queue-6.6/input-ili210x-fix-ili251x_read_touch_data-return-val.patch @@ -0,0 +1,41 @@ +From 61f88072919f12147111d44930ed104c68d4a78f 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 ad6828e4f2e2d..ae7ba0c419f5a 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.6/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch b/queue-6.6/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch new file mode 100644 index 00000000000..fb524d79114 --- /dev/null +++ b/queue-6.6/pinctrl-fix-deadlock-in-create_pinctrl-when-handling.patch @@ -0,0 +1,48 @@ +From b268839d4d286d7b5e2d472995e0cb5bdc6ecfe9 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 9e7b3e6c79cb1..e19ee66e027bb 100644 +--- a/drivers/pinctrl/core.c ++++ b/drivers/pinctrl/core.c +@@ -1098,8 +1098,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.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch b/queue-6.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch new file mode 100644 index 00000000000..4a4ec99a05a --- /dev/null +++ b/queue-6.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio2-b-.patch @@ -0,0 +1,69 @@ +From a132324a8aff0715ccb30298792ab27f502bd4cf 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 45e416f68e74f..c99a290a938af 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, +@@ -3765,7 +3759,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.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch b/queue-6.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch new file mode 100644 index 00000000000..8f6e364560a --- /dev/null +++ b/queue-6.6/pinctrl-rockchip-fix-pinmux-bits-for-rk3328-gpio3-b-.patch @@ -0,0 +1,111 @@ +From 954deec0109525a4d268fd755b151df71bf78b89 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 c99a290a938af..6072b5d72ee54 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.6/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch b/queue-6.6/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch new file mode 100644 index 00000000000..1ccb84de740 --- /dev/null +++ b/queue-6.6/pinctrl-rockchip-fix-pinmux-reset-in-rockchip_pmx_se.patch @@ -0,0 +1,42 @@ +From 5a93f80fb2cac65f49b3600d07376a9dc77997c8 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 974f16f83e59d..caf8d0a98c327 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.6/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch b/queue-6.6/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch new file mode 100644 index 00000000000..2e00c413f36 --- /dev/null +++ b/queue-6.6/pinctrl-rockchip-use-dedicated-pinctrl-type-for-rk33.patch @@ -0,0 +1,77 @@ +From b23fd33dc92f4087cc66f27729f4f21c68d7b485 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 6072b5d72ee54..974f16f83e59d 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: +@@ -3824,7 +3827,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.6/series b/queue-6.6/series index 81691d12fc3..c86c181028b 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -3,3 +3,9 @@ iio-pressure-bmp280-fix-bmp580-temperature-reading.patch usb-typec-ucsi-never-send-a-lone-connector-change-ac.patch usb-typec-ucsi-ack-also-failed-get-error-commands.patch x86-mm-numa-use-numa_no_node-when-calling-memblock_s.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 -- 2.47.3