From: Peng Fan peng.fan@nxp.com
[ Upstream commit 4e310626eb4df52a31a142c1360fead0fcbd3793 ]
This is prepare patch for switching s5m8767 regulator driver to use GPIO descriptor. DTS for exynos5250 spring incorrectly specifies "active low" polarity for the DVS and DS line. But per datasheet, they are actually active high. So add polarity quirk for it.
Signed-off-by: Peng Fan peng.fan@nxp.com Reviewed-by: Linus Walleij linus.walleij@linaro.org Link: https://lore.kernel.org/r/20250327004945.563765-1-peng.fan@oss.nxp.com Signed-off-by: Bartosz Golaszewski bartosz.golaszewski@linaro.org Signed-off-by: Sasha Levin sashal@kernel.org ---
Based on my analysis of the commit, the code changes, and the kernel context: **YES** This commit should be backported to stable kernel trees. Here's my extensive analysis: **Code Analysis:** The commit adds a polarity quirk for the s5m8767 regulator driver by modifying `drivers/gpio/gpiolib-of.c`. It adds these entries to the `of_gpio_try_fixup_polarity` function: ```c #if IS_ENABLED(CONFIG_REGULATOR_S5M8767) /bin /bin.usr-is-merged /boot /dev /etc /home /init /lib /lib.usr-is-merged /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /sbin.usr-is-merged /snap /srv /sys /tmp /usr /var 0001-Fix-Clippy-warnings.patch 0002-Enhance-inference-prompt- to-utilize-CVEKERNELDIR-whe.patch 0003-Update-to-latest-version-of- clap.patch Cargo.lock Cargo.toml LICENSE README.md analyze_merge_commit.sh io_uring_analysis.txt ksmbd_analysis.txt merge_commit_analysis.txt model prompt src target test_gpio_cleanup.txt test_patch.txt According to S5M8767, the DVS and DS pin are 0001-Fix- Clippy-warnings.patch 0002-Enhance-inference-prompt-to-utilize- CVEKERNELDIR-whe.patch 0003-Update-to-latest-version-of-clap.patch Cargo.lock Cargo.toml LICENSE README.md analyze_merge_commit.sh io_uring_analysis.txt ksmbd_analysis.txt merge_commit_analysis.txt model prompt src target test_gpio_cleanup.txt test_patch.txt active-high signals. However, exynos5250-spring.dts use 0001-Fix-Clippy- warnings.patch 0002-Enhance-inference-prompt-to-utilize-CVEKERNELDIR- whe.patch 0003-Update-to-latest-version-of-clap.patch Cargo.lock Cargo.toml LICENSE README.md analyze_merge_commit.sh io_uring_analysis.txt ksmbd_analysis.txt merge_commit_analysis.txt model prompt src target test_gpio_cleanup.txt test_patch.txt active-low setting. model/ prompt/ src/ target/ { "samsung,s5m8767-pmic", "s5m8767,pmic-buck-dvs-gpios", true }, { "samsung,s5m8767-pmic", "s5m8767,pmic-buck-ds-gpios", true }, #endif ``` **Why this should be backported:** 1. **Clear Bug Fix**: This fixes incorrect GPIO polarity in existing Device Tree Source (DTS) files. The commit message clearly states that `exynos5250-spring.dts` incorrectly specifies "active low" polarity while the S5M8767 datasheet specifies these signals as "active high". 2. **Follows Established Pattern**: This change follows the exact same pattern as the similar commits I examined, all of which were marked as "Backport Status: YES". The structure and purpose are identical to successful backports like the TSC2005, Himax LCD, and Lantiq PCI quirks. 3. **Preparation for Driver Conversion**: The commit message indicates this is a "prepare patch for switching s5m8767 regulator driver to use GPIO descriptor". Without this quirk, the driver conversion would break existing hardware using incorrect DTS polarity. 4. **Small and Contained**: The change is minimal - only 8 lines of code adding two entries to an existing quirk table. It's confined to the GPIO polarity handling subsystem. 5. **No Architectural Changes**: This doesn't change any kernel architecture or introduce new features. It's purely a compatibility fix for existing hardware. 6. **Critical for Hardware Functionality**: DVS (Dynamic Voltage Scaling) and DS (Deep Sleep) GPIO lines are critical for power management. Incorrect polarity could lead to system instability, power management failures, or hardware damage. 7. **Well-Tested Pattern**: The `of_gpio_try_fixup_polarity` mechanism is well-established and has been successfully used for similar fixes across multiple subsystems. 8. **Prevents Regression**: When the s5m8767 driver is converted to use GPIO descriptors (which respect polarity flags), existing systems with incorrect DTS would break without this quirk. **Risk Assessment:** - **Very Low Risk**: The change only affects devices with "samsung,s5m8767-pmic" compatible string and specific GPIO property names - **Contained Impact**: Only affects the specific GPIO properties mentioned, no broader system impact - **Follows Stable Rules**: Fixes important bugs with minimal risk, exactly what stable trees are for The commit perfectly fits the stable tree criteria: it's a targeted bug fix for existing hardware, has minimal risk of regression, and prevents functional issues when the related driver is modernized.
drivers/gpio/gpiolib-of.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index a0a2a0f75bba4..c1e83b2926ae4 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -203,6 +203,15 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np, */ { "lantiq,pci-xway", "gpio-reset", false }, #endif +#if IS_ENABLED(CONFIG_REGULATOR_S5M8767) + /* + * According to S5M8767, the DVS and DS pin are + * active-high signals. However, exynos5250-spring.dts use + * active-low setting. + */ + { "samsung,s5m8767-pmic", "s5m8767,pmic-buck-dvs-gpios", true }, + { "samsung,s5m8767-pmic", "s5m8767,pmic-buck-ds-gpios", true }, +#endif #if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2005) /* * DTS for Nokia N900 incorrectly specified "active high"