patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Peng Fan <peng.fan@nxp.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Sasha Levin <sashal@kernel.org>,
	bgolaszewski@baylibre.com, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 6.6 16/18] gpiolib: of: Add polarity quirk for s5m8767
Date: Fri, 30 May 2025 08:40:45 -0400	[thread overview]
Message-ID: <20250530124047.2575954-16-sashal@kernel.org> (raw)
In-Reply-To: <20250530124047.2575954-1-sashal@kernel.org>

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"
-- 
2.39.5


  parent reply	other threads:[~2025-05-30 12:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 12:40 [PATCH AUTOSEL 6.6 01/18] ACPICA: fix acpi operand cache leak in dswstate.c Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 02/18] ASoC: amd: yc: Add quirk for Lenovo Yoga Pro 7 14ASP9 Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 03/18] clocksource: Fix the CPUs' choice in the watchdog per CPU verification Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 04/18] tools/nolibc: use intmax definitions from compiler Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 05/18] power: supply: collie: Fix wakeup source leaks on device unbind Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 06/18] mmc: Add quirk to disable DDR50 tuning Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 07/18] ACPICA: Avoid sequence overread in call to strncmp() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 08/18] mmc: sdhci-esdhc-imx: Save tuning value when card stays powered in suspend Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 09/18] ASoC: tas2770: Power cycle amp on ISENSE/VSENSE change Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 10/18] ACPI: bus: Bail out if acpi_kobj registration fails Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 11/18] ACPI: Add missing prototype for non CONFIG_SUSPEND/CONFIG_X86 case Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 12/18] ACPICA: fix acpi parse and parseext cache leaks Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 13/18] power: supply: bq27xxx: Retrieve again when busy Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 14/18] ACPICA: utilities: Fix overflow check in vsnprintf() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 15/18] ASoC: tegra210_ahub: Add check to of_device_get_match_data() Sasha Levin
2025-05-30 12:40 ` Sasha Levin [this message]
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 17/18] PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() Sasha Levin
2025-05-30 12:40 ` [PATCH AUTOSEL 6.6 18/18] ACPI: battery: negate current when discharging Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250530124047.2575954-16-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=peng.fan@nxp.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).