Skip to content

Backport media changes for use with HSB.#1

Merged
AndreHeinemans-NXP merged 14 commits intoimx95-navq-lf-6.12.yfrom
imx95-navq-lf-6.12.y-hsb
Apr 20, 2026
Merged

Backport media changes for use with HSB.#1
AndreHeinemans-NXP merged 14 commits intoimx95-navq-lf-6.12.yfrom
imx95-navq-lf-6.12.y-hsb

Conversation

@PetervdPerk-NXP
Copy link
Copy Markdown
Member

Backport media changes for use with HSB.

mrabule1 added 14 commits March 19, 2026 10:14
… and set_routing

The init_state() callback is invoked during v4l2_open, specifically
via __v4l2_subdev_state_alloc. Since v4l2_open should not alter
the current pad formats, init_state() must use the current format
rather than the default one.

For that to be possible, the sensor’s current mode must be
initialized before calling v4l2_subdev_init_finalize() in the
probe function, otherwise a null pointer dereference may occur.

Fix the same problem in set_routing(), which is also called
during init_state().

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Tested-by: Celine Laurencin <celine.laurencin@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
…r supported sizes and mbus codes

Remove supported_modes_count and supported_codes_count members
from ox05b1s_plat_data structure, instead add a sentinel item
at the end of each array, for easier maintenance.

While at it, use v4l2_area type for the supported sizes.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
To ensure consistency, set all os08a20 modes to non-HDR by default.
Update frame rate documentation to reflect this behavior.
Switching to HDR will result in halved frame rates.

Replace the fps field with a statically computed pixel_rate per mode.
Unlike fps, which can vary with user-space changes to
V4L2_CID_VBLANK/HBLANK, pixel_rate remains constant and provides
clearer semantics.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
…-cci.h

Refactor register access and configuration functions to
use standard CCI helpers from v4l2-cci.h:
 - replace ox05b1s_write_reg(), ox05b1s_read_reg(), and ox05b1s_update_bits()
   with standard cci_write(), cci_read(), and cci_update_bits() calls.
 - remove ox05b1s_set_hts(), ox05b1s_set_vts(), ox05b1s_set_exp(), and
   ox05b1s_set_analog_gain(); use cci_write() directly instead.
 - remove ox05b1s_write_reg_array, instead use standard cci_multi_reg_write
 - switch from struct ox05b1s_reg to struct standard cci_reg_sequence, also
   use CCI_REG8/16/24 macros.
 - consolidate HDR and context switch enable/disable operations into
   cci_reg_sequence arrays.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Replace ambiguous GPL-2.0 with GPL-2.0-only
Wrap lines to 80 where possible
Added spaces inside brackets
Remove some redundant initializations
Constify structs
Add missing ending \n
Fix extra/missing spaces
Rename retval to ret in probe for consistency
Use devm_mutex_init instead of mutex_init
Replace dev_err's with dev_err_probe
Use new PM macros, pm_ptr, DEFINE_RUNTIME_DEV_PM_OPS
Add MODULE_AUTHOR
Use return -ENODEV & return 0 to ease reading
Remove .owner = THIS_MODULE, already done via module_i2c_driver,
i2c_register_driver(THIS_MODULE, driver)

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Remove resolution registers, x_output_size and y_output_size, from static
register configuration lists. These timing registers are now set dynamically
in ox05b1s_apply_current_mode, using the values already existing in
sensor->mode.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Add avdd, dvdd, and dovdd regulators, now mandatory in the device
tree binding, to enable a complete and accurate hardware description.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
The clock is now a required property in the sensor driver
bindings, to enable a complete and accurate hardware description,
so print an error instead of warning in probe.

Drop clock name, it is not needed in case of single clock.

Use dev_err_probe instead of dev_warn for missing clock.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Significantly clean register initializer lists by removing entries that
match reset values or appear unnecessary for streaming.

Refactor os08a20 settings:
- extract common settings across all modes into a shared register list.
- separate 10-bit and 12-bit mode-specific settings into distinct lists.
- isolate mode-specific settings into individual lists.

Update reg_data type to support the new structure, use arrays of
cci_reg_sequence per mode.

Adopt a consistent coding style for register initializer lists,
instead of }, {, use:
},
{

Remove individual header files containing per-mode register lists.
Add a new source file with the new factorized register lists,
ox05b1s_modes.c
Add a new header file, ox05b1s.h, for type definitions.

Update accordingly the Makefile, change module name from ox05b1s_mipi.ko
to ox05b1s.ko (either had to change ox05b1s_mipi.c filename, or the
module name, choose module name, to align with upstream).

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
…or multiple exposures

The current standard controls for exposure and gain allow a single value
for a single capture. For sensors with HDR capabilities or context
switching, this is not sufficient, so add new array controls that allow
multiple values—one for each capture.

Differentiate control implementations for os08a20 versus ox05b1s, as there
are slight differences between registers. Also, there are no dedicated
short exposure registers for ox05b1s (as there are for os08a20), instead,
use group hold to implement exposure control for ox05b1s in
context-switching mode.

Add functions to manipulate long/short exposure and gains.
Add function to manipulate group holds.
Add control for digital gain.
Rename gain control handler to again.
Add uapi header.

The os08a20 does not behave well if the exposure on the short capture
is above 0x20, only the first few frames are captured correctly with
libcamera, followed by dark frames. Limit OX05B1S_VS_EXP_MAX to 0x20.
Set min exposure to 1 for all captures

Let the multi-controls take effect only when in HDR mode.

Keep the exposure_multi control value be in sync with the single-capture
exposure control by updating the ranges and current value after a mode
change in ox05b1s_update_controls().

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
The image on os08a20 in 1080p mode looks washed out after the register
list cleanup. Add back two registers, BLC_CTRL08 and BLC_CTRL09, and the
image looks fine. Only BLC_CTRL09 rollback is needed to fix the image,
but since BLC_CTRL09 (0x4009) is bl_end and BLC_CTRL08 (0x4008) is bl_start,
with no other information in the datasheet, restore them both to the
original settings from Omnivision.

Fixes: 3e4b00b ("LF-16264-12: media: ox05b1s: Cleanup and factorize register init lists")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Tested-by: Celine Laurencin <celine.laurencin@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
…pported mbus code

Fix ox05b1s_find_code for unsupported mbus code. Use
model->supported_codes[model->default_mode_index].code instead of
supported_codes[model->default_mode_index].code to avoid accessing
past the array end when the requested code is not found.

Also, simplify ox05b1s_find_code by returning directly from the loop
instead of using break. This also helps keep lines within 80 characters.

Fixes: 44c721d ("LF-16264-1: media: ox05b1s: Remove static definition of array size for supported sizes and mbus codes")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Alexi Birlinger <alexi.birlinger@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Only on some imx95-19x19 boards the image on os08a20
in 4k-12b and in 1080p mode is flickering.
Restore 0x305 register to original Omnivision setting
for all modes to fix the issue.

Fixes: 3e4b00b ("LF-16264-12: media: ox05b1s: Cleanup and factorize register init lists")

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Tested-by: Anle Pan <anle.pan@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
Add V4L2_CID_EXPOSURE_MULTI, V4L2_CID_AGAIN_MULTI, and
V4L2_CID_DGAIN_MULTI for exposure and gain control for
multiple-exposure sensors.

Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
@AndreHeinemans-NXP AndreHeinemans-NXP merged commit 312bcbb into imx95-navq-lf-6.12.y Apr 20, 2026
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.

3 participants