Skip to content

media: ov9282: Add external trigger mode support#6954

Merged
6by9 merged 2 commits intoraspberrypi:rpi-6.12.yfrom
omeredemen:rpi-6.12.y
Oct 15, 2025
Merged

media: ov9282: Add external trigger mode support#6954
6by9 merged 2 commits intoraspberrypi:rpi-6.12.yfrom
omeredemen:rpi-6.12.y

Conversation

@omeredemen
Copy link
Copy Markdown

Adds DT property trigger-mode to enable FSIN-triggered frame capture. Includes overlay and README update for ov9281_trig.

#5349 (comment)

@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented Jul 15, 2025

Please squash your ov9282 commits into one, then split that in two - one for the driver changes and one for the overlay changes. You can then run scripts/checkpatch.pl -g HEAD^ and scripts/checkpatch.pl -g HEAD to check for remaining indentation complaints. It would also be nice if the Signed-off-by lines weren't "Your Name". After all that, use git push -f ... to update your branch (and hence the PR).

With those changes, I presume you are happy with this @6by9?

@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented Aug 12, 2025

Any comments or progress on this?

Copy link
Copy Markdown
Contributor

@6by9 6by9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing.

Comment thread drivers/media/i2c/ov9282.c Outdated
/* Start streaming */
ret = ov9282_write_reg(ov9282, OV9282_REG_MODE_SELECT,
1, OV9282_MODE_STREAMING);
1, OV9282_MODE_STREAMING);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Odd whitespace change for no reason

Comment thread drivers/media/i2c/ov9282.c Outdated

/* Setup handler will write actual exposure and gain */
ret = __v4l2_ctrl_handler_setup(ov9282->sd.ctrl_handler);
ret = __v4l2_ctrl_handler_setup(ov9282->sd.ctrl_handler);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking again I'll acknowledge that it's wrong in the original, but changing it should be a separate patch.

Comment thread drivers/media/i2c/ov9282.c Outdated

/* 1 frame per trigger */
ov9282_write_reg(ov9282, OV9282_REG_NUM_FRAME_ON_TRIG, 1, 0x01);
if (ret) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've not saved the result of ov9282_write_reg to ret, so this will never fail.

Ditto subsequent calls.

@stalinbeltran
Copy link
Copy Markdown

I need external trigger in order to capture laser light reflected from a moving mirror, so I tried this code with:

sudo rpi-update pulls/6954

It works. Tested with CAM-MIPIOV9281V2 (Innomaker) on a Raspberry 5.
If I can help somehow, please let me know. This should be made available in the official kernel (not everybody can find this pull request)

Thank you.

@omeredemen
Copy link
Copy Markdown
Author

I need external trigger in order to capture laser light reflected from a moving mirror, so I tried this code with:

sudo rpi-update pulls/6954

It works. Tested with CAM-MIPIOV9281V2 (Innomaker) on a Raspberry 5. If I can help somehow, please let me know. This should be made available in the official kernel (not everybody can find this pull request)

Thank you.

Sorry for the latency. @stalinbeltran i am glad it worked for you.

Copy link
Copy Markdown
Contributor

@6by9 6by9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but this seems to be worse than last time.

You haven't address pelwell's comment

Please squash your ov9282 commits into one, then split that in two - one for the driver changes and one for the overlay changes.

We have a number of whitespace changes. One is correct, but whitespace cleanups should never be merged into the same commit as functional changes.

Comment thread drivers/media/i2c/ov9282.c Outdated

/* Setup handler will write actual exposure and gain */
ret = __v4l2_ctrl_handler_setup(ov9282->sd.ctrl_handler);
ret = __v4l2_ctrl_handler_setup(ov9282->sd.ctrl_handler);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking again I'll acknowledge that it's wrong in the original, but changing it should be a separate patch.

Comment thread drivers/media/i2c/ov9282.c Outdated
Comment thread drivers/media/i2c/ov9282.c Outdated
Comment thread arch/arm/boot/dts/overlays/ov9281-overlay.dts
@omeredemen
Copy link
Copy Markdown
Author

So i think i had made some changes in the original. and didn't squash the commits with the correct changes. i just changed the necessary part for the trigger mode and didn't make any changes on the other parts.

Copy link
Copy Markdown
Contributor

@6by9 6by9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One slight nasty here.

Seeing as this won't get upstreamed in this form I am prepared to accept it as is, but it would be nicer if you'd update.

Thanks.

Comment thread drivers/media/i2c/ov9282.c Outdated
dev_err(ov9282->dev, "failed to config external trigger mode");
return ret;
}
return 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit of a gotcha here with this early bail out that I hadn't noticed it in the previous review pass.

My preference would be to keep setting OV9282_REG_MODE_SELECT here in both cases, ie.

	/* Configure FSIN external trigger mode */
	if (ov9282->trigger_mode > 0) {
		ret = ov9282_apply_trigger_config(ov9282);
		if (ret) {
			dev_err(ov9282->dev, "failed to config external trigger mode");
			return ret;
		}
		/* stay in standby mode and wait for trigger signal */
		ret = ov9282_write_reg(ov9282, OV9282_REG_MODE_SELECT,
				       1, OV9282_MODE_STANDBY);
	} else {
		/* Start streaming */
		ret = ov9282_write_reg(ov9282, OV9282_REG_MODE_SELECT,
				       1, OV9282_MODE_STREAMING);
	}

	if (ret)
		dev_err(ov9282->dev, "fail to start streaming");

	return ret;
}

Comment thread drivers/media/i2c/ov9282.c Outdated
return ret;

/* stay standby mode and wait for trigger signal */
ret = ov9282_write_reg(ov9282, OV9282_REG_MODE_SELECT,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't say it explicitly, but we now have a duplication here. Just drop this write.

Omer Faruk Edemen added 2 commits September 22, 2025 07:43
This patch adds support for external FSIN-triggered snapshot mode
to the OmniVision OV9282 sensor driver. It enables frame capture
synchronized with an external hardware trigger signal.

Signed-off-by: Omer Faruk Edemen <ofedemen@lectrontech.com>
Adds DT property `trigger-mode` to enable FSIN-triggered frame capture.
Includes overlay and README update for ov9281_trig.

Signed-off-by: Omer Faruk Edemen <ofedemen@lectrontech.com>
@pelwell
Copy link
Copy Markdown
Contributor

pelwell commented Oct 15, 2025

FYI we don't (always?) get notifications of branch updates, so adding a comment once you've done so helps to avoid long delays.

I think this is good now. Feel free to merge if you agree, @6by9.

@6by9 6by9 merged commit f02b096 into raspberrypi:rpi-6.12.y Oct 15, 2025
12 checks passed
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Oct 17, 2025
kernel: Add config settings and i2c-sensor support for the TMP117
See: raspberrypi/linux#7083

kernel: Upstream patches for TC358743 colour swap
See: raspberrypi/linux#7070

kernel: media: ov9282: Add external trigger mode support
See: raspberrypi/linux#6954

kernel: Improve the RP1 DMA channel allocation scheme
See: raspberrypi/linux#7089
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Oct 17, 2025
kernel: Add config settings and i2c-sensor support for the TMP117
See: raspberrypi/linux#7083

kernel: Upstream patches for TC358743 colour swap
See: raspberrypi/linux#7070

kernel: media: ov9282: Add external trigger mode support
See: raspberrypi/linux#6954

kernel: Improve the RP1 DMA channel allocation scheme
See: raspberrypi/linux#7089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants