From: Matthew Laux <matthew.laux@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@kernel.org>,
Mehdi Djait <mehdi.djait@bootlin.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
Matthew Laux <matthew.laux@gmail.com>,
Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: [PATCH v8 01/12] media: tw9900: Disable regulator on runtime resume failure
Date: Wed, 25 Nov 2026 13:49:40 -0600 [thread overview]
Message-ID: <20261125194951.19072-2-matthew.laux@gmail.com> (raw)
In-Reply-To: <20261125194951.19072-1-matthew.laux@gmail.com>
If writing the initialization registers fails, put the chip back in reset
and disable the regulator before returning the error. Fixes this warning:
WARNING: drivers/regulator/core.c:2657 at regulator_put+0x61/0x70
RIP: 0010:regulator_put+0x61/0x70
Call Trace:
<TASK>
release_nodes+0x46/0xd0
devres_release_group+0x11f/0x150
i2c_device_remove+0x41/0xb0
device_release_driver_internal+0x19c/0x200
bus_remove_device+0xca/0x140
device_del+0x160/0x3e0
device_unregister+0x17/0x70
v4l2_device_unregister+0x9c/0xd0 [videodev]
usb3hdcap_release+0x26/0x40 [usb3hdcap]
v4l2_device_put+0x37/0x60 [videodev]
release_card_device+0x51/0x90 [snd]
device_release+0x37/0x90
kobject_put+0x8e/0x210
snd_card_file_remove+0x174/0x190 [snd]
snd_ctl_release+0x14d/0x160 [snd]
__fput+0xe6/0x2a0
__x64_sys_close+0x3d/0x80
do_syscall_64+0x120/0x1610
? do_syscall_64+0x15e/0x1610
? irqentry_exit+0x7b/0x590
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Fixes: 918b14a26b12 ("media: i2c: Introduce a driver for the Techwell TW9900 decoder")
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Matthew Laux <matthew.laux@gmail.com>
---
drivers/media/i2c/tw9900.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/tw9900.c b/drivers/media/i2c/tw9900.c
index 60c102aba750..e07924faa84b 100644
--- a/drivers/media/i2c/tw9900.c
+++ b/drivers/media/i2c/tw9900.c
@@ -624,13 +624,20 @@ static int tw9900_runtime_resume(struct device *dev)
ret = tw9900_write_array(tw9900->client, tw9900_init_regs,
ARRAY_SIZE(tw9900_init_regs));
+ if (ret) {
+ if (tw9900->reset_gpio)
+ gpiod_set_value_cansleep(tw9900->reset_gpio, 1);
+ regulator_disable(tw9900->regulator);
+ mutex_unlock(&tw9900->mutex);
+ return ret;
+ }
mutex_unlock(&tw9900->mutex);
/* This sleep is needed for the Horizontal Sync PLL to lock. */
msleep(300);
- return ret;
+ return 0;
}
static int tw9900_runtime_suspend(struct device *dev)
--
2.47.3
next prev parent reply other threads:[~2026-11-25 19:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 19:49 [PATCH v8 00/12] Add driver for StarTech USB3HDCAP capture device Matthew Laux
2026-11-25 19:49 ` Matthew Laux [this message]
2026-11-25 19:49 ` [PATCH v8 02/12] media: tw9900: release the device when stopping the stream fails Matthew Laux
2026-11-25 19:49 ` [PATCH v8 03/12] media: tw9900: accept the TW9910 chip ID Matthew Laux
2026-11-25 19:49 ` [PATCH v8 04/12] media: tw9900: add saturation, hue and sharpness controls Matthew Laux
2026-11-25 19:49 ` [PATCH v8 05/12] media: tw9900: program all mode registers in the PAL table Matthew Laux
2026-11-25 19:49 ` [PATCH v8 06/12] media: tw9900: power off the device on remove if still active Matthew Laux
2026-11-25 19:49 ` [PATCH v8 07/12] media: tw9900: power down analog blocks in runtime suspend Matthew Laux
2026-11-25 19:49 ` [PATCH v8 08/12] media: tw9900: use runtime PM autosuspend Matthew Laux
2026-11-25 19:49 ` [PATCH v8 09/12] media: tw9900: allow board-specific register tables via platform data Matthew Laux
2026-11-25 19:49 ` [PATCH v8 10/12] media: tw9900: add S-Video input and progressive source detection Matthew Laux
2026-11-25 19:49 ` [PATCH v8 11/12] media: Add subdevice driver for the Mstar MST3367 HDMI receiver Matthew Laux
2026-11-25 19:49 ` [PATCH v8 12/12] media: add driver for StarTech USB3HDCAP Matthew Laux
2026-11-26 7:16 ` Markus Elfring
2026-11-26 8:09 ` Markus Elfring
2026-11-25 20:33 ` [PATCH v8 00/12] Add driver for StarTech USB3HDCAP capture device Markus Elfring
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=20261125194951.19072-2-matthew.laux@gmail.com \
--to=matthew.laux@gmail.com \
--cc=hverkuil@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mehdi.djait@bootlin.com \
--cc=paul.kocialkowski@bootlin.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.