From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Hans de Goede <johannes.goede@oss.qualcomm.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Sasha Levin <sashal@kernel.org>,
linux-media@vger.kernel.org
Subject: [PATCH AUTOSEL 6.19-6.12] media: mt9m114: Avoid a reset low spike during probe()
Date: Fri, 13 Feb 2026 19:58:08 -0500 [thread overview]
Message-ID: <20260214010245.3671907-8-sashal@kernel.org> (raw)
In-Reply-To: <20260214010245.3671907-1-sashal@kernel.org>
From: Hans de Goede <johannes.goede@oss.qualcomm.com>
[ Upstream commit 84359d0a5e3afce5e3e3b6562efadff690614d5b ]
mt9m114_probe() requests the reset GPIO in output low state:
sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
and then almost immediately afterwards calls mt9m114_power_on() which does:
gpiod_set_value(sensor->reset, 1);
fsleep(duration);
gpiod_set_value(sensor->reset, 0);
which means that if the reset pin was high before this code runs that
it will very briefly be driven low because of passing GPIOD_OUT_LOW when
requesting the GPIO only to be driven high again possibly directly after
that. Such a very brief driving low of the reset pin may put the chip in
a confused state.
Request the GPIO in high (reset the chip) state instead to avoid this,
turning the initial gpiod_set_value() in mt9m114_power_on() into a no-op.
and the fsleep() ensures that it will stay high long enough to properly
reset the chip.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis of mt9m114 Reset GPIO Spike Fix
### Commit Message Analysis
The commit describes a hardware initialization ordering issue in the
mt9m114 camera sensor driver. During `probe()`, the reset GPIO is
requested in `GPIOD_OUT_LOW` (deasserted) state, but then
`mt9m114_power_on()` immediately drives it high (asserted/reset),
sleeps, then drives it low (deasserted). If the reset pin was already
high before probe, this creates a brief low spike that could put the
chip in a "confused state."
The fix changes `GPIOD_OUT_LOW` to `GPIOD_OUT_HIGH` so the GPIO starts
in the reset-asserted state, making the first
`gpiod_set_value(sensor->reset, 1)` in `mt9m114_power_on()` a no-op, and
the subsequent sleep ensures proper reset timing.
### Code Change Analysis
The change is a single-line modification:
```c
- sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
```
This is an extremely minimal, surgical change. It changes the initial
state of the reset GPIO from low (deasserted) to high (asserted/in-
reset), which avoids a brief glitch that could leave the sensor in a bad
state.
### Bug Classification
This is a **hardware initialization bug fix**. The brief low spike on
the reset pin is a real hardware issue that can cause the mt9m114 sensor
to enter an undefined state during probe. This can manifest as:
- Sensor failing to initialize properly
- Unreliable camera operation
- Potentially different behavior depending on the prior state of the
GPIO (non-deterministic)
### Scope and Risk Assessment
- **Lines changed**: 1 (single token change: `GPIOD_OUT_LOW` →
`GPIOD_OUT_HIGH`)
- **Files changed**: 1 (`drivers/media/i2c/mt9m114.c`)
- **Risk**: Very low. The change is logically sound — since
`mt9m114_power_on()` immediately asserts reset (high), starting in the
high state eliminates the transient glitch without changing the
overall reset sequence.
- **Subsystem**: Media/camera driver (i2c sensor driver)
### Stability Indicators
- **Reviewed-by**: Laurent Pinchart (well-known media subsystem
maintainer)
- **Multiple sign-offs**: Hans de Goede, Sakari Ailus, Hans Verkuil (all
experienced media/kernel developers)
- The logic is straightforward and obviously correct
### User Impact
Users with the mt9m114 camera sensor could experience unreliable
initialization. This is a real hardware issue — the reset pin glitch
depends on the prior GPIO state, making it potentially intermittent and
hard to debug. The fix ensures deterministic, correct behavior.
### Dependency Check
The change is self-contained. It modifies a single GPIO request flag and
doesn't depend on any other commits. The mt9m114 driver has been in the
kernel for a while, so it exists in stable trees.
### Risk vs. Benefit
- **Benefit**: Fixes a real hardware initialization issue that can cause
unreliable sensor operation
- **Risk**: Essentially zero — the change is a single constant that
aligns the initial GPIO state with what `mt9m114_power_on()` expects
- **Trade-off**: Strongly favorable for backporting
### Concerns
This is a minor driver fix for a specific camera sensor. While the user
base may not be huge, the fix is trivially correct, has essentially zero
regression risk, and fixes a genuine hardware issue. It meets all stable
kernel criteria:
1. Obviously correct and reviewed by multiple experts
2. Fixes a real bug (hardware reset glitch)
3. Important for affected users (unreliable device initialization)
4. Extremely small and contained (1 line)
5. No new features or APIs
**YES**
drivers/media/i2c/mt9m114.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
index 51ebbe7ae9969..554f25071cca6 100644
--- a/drivers/media/i2c/mt9m114.c
+++ b/drivers/media/i2c/mt9m114.c
@@ -2434,7 +2434,7 @@ static int mt9m114_probe(struct i2c_client *client)
goto error_ep_free;
}
- sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(sensor->reset)) {
ret = PTR_ERR(sensor->reset);
dev_err_probe(dev, ret, "Failed to get reset GPIO\n");
--
2.51.0
next prev parent reply other threads:[~2026-02-14 1:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-14 0:58 [PATCH AUTOSEL 6.19-6.12] media: ipu6: Close firmware streams on streaming enable failure Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.12] media: chips-media: wave5: Fix conditional in start_streaming Sasha Levin
2026-02-14 0:58 ` Sasha Levin [this message]
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.1] media: amphion: Clear last_buffer_dequeued flag for DEC_CMD_START Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-5.10] media: adv7180: fix frame interval in progressive mode Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.6] media: v4l2-async: Fix error handling on steps after finding a match Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.1] media: rkisp1: Fix filter mode register configuration Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.12] media: ipu6: Ensure stream_mutex is acquired when dealing with node list Sasha Levin
2026-02-14 0:58 ` [PATCH AUTOSEL 6.19-6.12] media: mt9m114: Return -EPROBE_DEFER if no endpoint is found Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.18] media: uvcvideo: Create an ID namespace for streaming output terminals Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.12] media: ipu6: Always close firmware stream Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.18] media: qcom: camss: Do not enable cpas fast ahb clock for SM8550 VFE lite Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-5.10] media: solo6x10: Check for out of bounds chip_id Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.18] drm/amdgpu: Refactor amdgpu_gem_va_ioctl for Handling Last Fence Update and Timeline Management v4 Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-6.12] media: chips-media: wave5: Process ready frames when CMD_STOP sent to Encoder Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-5.10] media: pvrusb2: fix URB leak in pvr2_send_request_ex Sasha Levin
2026-02-14 0:59 ` [PATCH AUTOSEL 6.19-5.10] media: dvb-core: dmxdevfilter must always flush bufs 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=20260214010245.3671907-8-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=hverkuil+cisco@kernel.org \
--cc=johannes.goede@oss.qualcomm.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=sakari.ailus@linux.intel.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