git: 56d4dee82de1 - main - fwcam: defer ISO streaming to first read
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Jul 2026 02:54:11 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=56d4dee82de1b5c8c77d5be79f7bf4183b327b57
commit 56d4dee82de1b5c8c77d5be79f7bf4183b327b57
Author: Abdelkader Boudih <freebsd@seuros.com>
AuthorDate: 2026-07-09 02:52:12 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-07-09 02:52:18 +0000
fwcam: defer ISO streaming to first read
Moved ISO start to first usage. Opening the device now
only validates state and increments the open count, allowing info
queries and mode changes without starting the camera. ISO streaming
begins on demand when userland first reads frame data.
This avoid the camera led to turn-on at attach.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D58100
---
sys/dev/firewire/fwcam.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/sys/dev/firewire/fwcam.c b/sys/dev/firewire/fwcam.c
index 27451316d613..c5e5cf545fe9 100644
--- a/sys/dev/firewire/fwcam.c
+++ b/sys/dev/firewire/fwcam.c
@@ -288,7 +288,7 @@ fwcam_probe_task(void *arg, int pending __unused)
sc->state = FWCAM_STATE_PROBED;
FWCAM_UNLOCK(sc);
- if (sc->open_count > 0 &&
+ if (sc->dma_ch >= 0 &&
sc->state != FWCAM_STATE_DETACHING)
fwcam_iso_start(sc);
}
@@ -601,7 +601,6 @@ static int
fwcam_cdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
struct fwcam_softc *sc = dev->si_drv1;
- int err = 0;
FWCAM_LOCK(sc);
if (sc->state == FWCAM_STATE_DETACHING) {
@@ -615,18 +614,8 @@ fwcam_cdev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
}
sc->open_count++;
- if (sc->open_count == 1 && sc->state == FWCAM_STATE_PROBED) {
- FWCAM_UNLOCK(sc);
- err = fwcam_iso_start(sc);
- if (err) {
- FWCAM_LOCK(sc);
- sc->open_count--;
- FWCAM_UNLOCK(sc);
- }
- } else {
- FWCAM_UNLOCK(sc);
- }
- return (err);
+ FWCAM_UNLOCK(sc);
+ return (0);
}
static int
@@ -657,6 +646,13 @@ fwcam_cdev_read(struct cdev *dev, struct uio *uio, int ioflag)
int err;
FWCAM_LOCK(sc);
+ if (sc->state == FWCAM_STATE_PROBED) {
+ FWCAM_UNLOCK(sc);
+ err = fwcam_iso_start(sc);
+ if (err)
+ return (err);
+ FWCAM_LOCK(sc);
+ }
while (!sc->frame_ready) {
if (sc->state != FWCAM_STATE_STREAMING) {
FWCAM_UNLOCK(sc);