From: Greg Kroah-Hartman Date: Tue, 14 May 2024 09:34:13 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.19.314~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c67352138d5606ef45fc08eaa0430eb3f6bdbf73;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: pinctrl-mediatek-fix-fallback-behavior-for-bias_set_combo.patch pinctrl-mediatek-fix-some-off-by-one-bugs.patch pinctrl-mediatek-paris-fix-pin_config_input_schmitt_enable-readback.patch pinctrl-mediatek-remove-set-but-not-used-variable-e.patch --- diff --git a/queue-5.4/pinctrl-mediatek-fix-fallback-behavior-for-bias_set_combo.patch b/queue-5.4/pinctrl-mediatek-fix-fallback-behavior-for-bias_set_combo.patch new file mode 100644 index 00000000000..75a5ed9a285 --- /dev/null +++ b/queue-5.4/pinctrl-mediatek-fix-fallback-behavior-for-bias_set_combo.patch @@ -0,0 +1,47 @@ +From 798a315fc359aa6dbe48e09d802aa59b7e158ffc Mon Sep 17 00:00:00 2001 +From: Hsin-Yi Wang +Date: Thu, 1 Jul 2021 16:09:55 +0800 +Subject: pinctrl: mediatek: Fix fallback behavior for bias_set_combo + +From: Hsin-Yi Wang + +commit 798a315fc359aa6dbe48e09d802aa59b7e158ffc upstream. + +Some pin doesn't support PUPD register, if it fails and fallbacks with +bias_set_combo case, it will call mtk_pinconf_bias_set_pupd_r1_r0() to +modify the PUPD pin again. + +Since the general bias set are either PU/PD or PULLSEL/PULLEN, try +bias_set or bias_set_rev1 for the other fallback case. If the pin +doesn't support neither PU/PD nor PULLSEL/PULLEN, it will return +-ENOTSUPP. + +Fixes: 81bd1579b43e ("pinctrl: mediatek: Fix fallback call path") +Signed-off-by: Hsin-Yi Wang +Reviewed-by: Chen-Yu Tsai +Reviewed-by: Zhiyong Tao +Link: https://lore.kernel.org/r/20210701080955.2660294-1-hsinyi@chromium.org +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +@@ -877,12 +877,10 @@ int mtk_pinconf_adv_pull_set(struct mtk_ + err = hw->soc->bias_set(hw, desc, pullup); + if (err) + return err; +- } else if (hw->soc->bias_set_combo) { +- err = hw->soc->bias_set_combo(hw, desc, pullup, arg); +- if (err) +- return err; + } else { +- return -ENOTSUPP; ++ err = mtk_pinconf_bias_set_rev1(hw, desc, pullup); ++ if (err) ++ err = mtk_pinconf_bias_set(hw, desc, pullup); + } + } + diff --git a/queue-5.4/pinctrl-mediatek-fix-some-off-by-one-bugs.patch b/queue-5.4/pinctrl-mediatek-fix-some-off-by-one-bugs.patch new file mode 100644 index 00000000000..49653a205ea --- /dev/null +++ b/queue-5.4/pinctrl-mediatek-fix-some-off-by-one-bugs.patch @@ -0,0 +1,70 @@ +From 3385ab72d995fc0b876818a36203bf2429445686 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Tue, 18 Feb 2020 08:52:47 +0300 +Subject: pinctrl: mediatek: Fix some off by one bugs + +From: Dan Carpenter + +commit 3385ab72d995fc0b876818a36203bf2429445686 upstream. + +These comparisons should be >= instead of > to prevent accessing one +element beyond the end of the hw->soc->pins[] array. + +Fixes: 3de7deefce69 ("pinctrl: mediatek: Check gpio pin number and use binary search in mtk_hw_pin_field_lookup()") +Fixes: 184d8e13f9b1 ("pinctrl: mediatek: Add support for pin configuration dump via debugfs.") +Signed-off-by: Dan Carpenter +Link: https://lore.kernel.org/r/20200218055247.74s2xa7veqx2do34@kili.mountain +Reviewed-by: Matthias Brugger +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/mediatek/pinctrl-paris.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-paris.c ++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c +@@ -610,7 +610,7 @@ static int mtk_gpio_get_direction(struct + const struct mtk_pin_desc *desc; + int value, err; + +- if (gpio > hw->soc->npins) ++ if (gpio >= hw->soc->npins) + return -EINVAL; + + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; +@@ -628,7 +628,7 @@ static int mtk_gpio_get(struct gpio_chip + const struct mtk_pin_desc *desc; + int value, err; + +- if (gpio > hw->soc->npins) ++ if (gpio >= hw->soc->npins) + return -EINVAL; + + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; +@@ -645,7 +645,7 @@ static void mtk_gpio_set(struct gpio_chi + struct mtk_pinctrl *hw = gpiochip_get_data(chip); + const struct mtk_pin_desc *desc; + +- if (gpio > hw->soc->npins) ++ if (gpio >= hw->soc->npins) + return; + + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; +@@ -657,7 +657,7 @@ static int mtk_gpio_direction_input(stru + { + struct mtk_pinctrl *hw = gpiochip_get_data(chip); + +- if (gpio > hw->soc->npins) ++ if (gpio >= hw->soc->npins) + return -EINVAL; + + return pinctrl_gpio_direction_input(chip->base + gpio); +@@ -668,7 +668,7 @@ static int mtk_gpio_direction_output(str + { + struct mtk_pinctrl *hw = gpiochip_get_data(chip); + +- if (gpio > hw->soc->npins) ++ if (gpio >= hw->soc->npins) + return -EINVAL; + + mtk_gpio_set(chip, gpio, value); diff --git a/queue-5.4/pinctrl-mediatek-paris-fix-pin_config_input_schmitt_enable-readback.patch b/queue-5.4/pinctrl-mediatek-paris-fix-pin_config_input_schmitt_enable-readback.patch new file mode 100644 index 00000000000..c2a9637bbe0 --- /dev/null +++ b/queue-5.4/pinctrl-mediatek-paris-fix-pin_config_input_schmitt_enable-readback.patch @@ -0,0 +1,40 @@ +From 08f66a8edd08f6f7cfa769c81634b29a2b123908 Mon Sep 17 00:00:00 2001 +From: Chen-Yu Tsai +Date: Wed, 27 Mar 2024 17:13:33 +0800 +Subject: pinctrl: mediatek: paris: Fix PIN_CONFIG_INPUT_SCHMITT_ENABLE readback + +From: Chen-Yu Tsai + +commit 08f66a8edd08f6f7cfa769c81634b29a2b123908 upstream. + +In the generic pin config library, readback of some options are handled +differently compared to the setting of those options: the argument value +is used to convey enable/disable of an option in the set path, but +success or -EINVAL is used to convey if an option is enabled or disabled +in the debugfs readback path. + +PIN_CONFIG_INPUT_SCHMITT_ENABLE is one such option. Fix the readback of +the option in the mediatek-paris library, so that the debugfs dump is +not showing "input schmitt enabled" for pins that don't have it enabled. + +Fixes: 1bea6afbc842 ("pinctrl: mediatek: Refine mtk_pinconf_get()") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Message-ID: <20240327091336.3434141-2-wenst@chromium.org> +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/mediatek/pinctrl-paris.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/pinctrl/mediatek/pinctrl-paris.c ++++ b/drivers/pinctrl/mediatek/pinctrl-paris.c +@@ -141,6 +141,8 @@ static int mtk_pinconf_get(struct pinctr + } + + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SMT, &ret); ++ if (!ret) ++ err = -EINVAL; + break; + case PIN_CONFIG_DRIVE_STRENGTH: + if (!hw->soc->drive_get) diff --git a/queue-5.4/pinctrl-mediatek-remove-set-but-not-used-variable-e.patch b/queue-5.4/pinctrl-mediatek-remove-set-but-not-used-variable-e.patch new file mode 100644 index 00000000000..f66f6c802a2 --- /dev/null +++ b/queue-5.4/pinctrl-mediatek-remove-set-but-not-used-variable-e.patch @@ -0,0 +1,49 @@ +From 86ecb7d6853c77711c14cb6600179196f179ee2d Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Tue, 18 Feb 2020 10:36:25 +0800 +Subject: pinctrl: mediatek: remove set but not used variable 'e' + +From: YueHaibing + +commit 86ecb7d6853c77711c14cb6600179196f179ee2d upstream. + +drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c: In function mtk_hw_pin_field_lookup: +drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:70:39: warning: + variable e set but not used [-Wunused-but-set-variable] + +Since commit 3de7deefce69 ("pinctrl: mediatek: Check gpio pin +number and use binary search in mtk_hw_pin_field_lookup()"), +it is not used any more, so remove it, also remove redundant +assignment to variable c, it will be assigned a new value later +before used. + +Reported-by: Hulk Robot +Signed-off-by: YueHaibing +Reviewed-by: Matthias Brugger +Link: https://lore.kernel.org/r/20200218023625.14324-1-yuehaibing@huawei.com +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c ++++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c +@@ -67,7 +67,7 @@ static int mtk_hw_pin_field_lookup(struc + const struct mtk_pin_desc *desc, + int field, struct mtk_pin_field *pfd) + { +- const struct mtk_pin_field_calc *c, *e; ++ const struct mtk_pin_field_calc *c; + const struct mtk_pin_reg_calc *rc; + int start = 0, end, check; + bool found = false; +@@ -82,8 +82,6 @@ static int mtk_hw_pin_field_lookup(struc + } + + end = rc->nranges - 1; +- c = rc->range; +- e = c + rc->nranges; + + while (start <= end) { + check = (start + end) >> 1; diff --git a/queue-5.4/series b/queue-5.4/series index 7990c4d00ae..f1b91757922 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -78,3 +78,7 @@ dyndbg-fix-old-bug_on-in-control-parser.patch drm-vmwgfx-fix-invalid-reads-in-fence-signaled-events.patch net-fix-out-of-bounds-access-in-ops_init.patch regulator-core-fix-debugfs-creation-regression.patch +pinctrl-mediatek-fix-fallback-behavior-for-bias_set_combo.patch +pinctrl-mediatek-fix-some-off-by-one-bugs.patch +pinctrl-mediatek-remove-set-but-not-used-variable-e.patch +pinctrl-mediatek-paris-fix-pin_config_input_schmitt_enable-readback.patch