Skip to content

Commit

Permalink
drivers: video: introduce "GET" sub-operations
Browse files Browse the repository at this point in the history
The video_get_ctrl() API permits to retreive a value from a device using
standard CIDs from <zephyr/drivers/video-controls.h>. The CIDs do not come with
a range information, and to know which value to apply to a video driver, knowing
the minimum and maximum value before-hand is required. This prevents building
generic layers that handle any video devices, such as protocols such as USB UVC,
GigE Vision, or anything making use of "zephyr,camera" chosen node.

This commit introduces extra flags added to the CIDs that indicates to the
target device that instead of returning the current value, they should return
the minimum, maximum, or default value instead, with the same type as the
current value.

The GET_CUR operation having a flag of 0x00, this makes all drivers implicitly
support this new API, with an opt-in migration to also support the extra
controls, correctly rejecting the unsupported extra operations by default.

Signed-off-by: Josuah Demangeon <[email protected]>
  • Loading branch information
josuah committed Sep 18, 2024
1 parent 53f547b commit 26f0023
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/zephyr/drivers/video-controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ extern "C" {
* @}
*/

/**
* @name Control Get operations
* @{
*/
#define VIDEO_CTRL_GET_CUR 0x00000000 /**< Get the curent value */

Check warning on line 49 in include/zephyr/drivers/video-controls.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TYPO_SPELLING

include/zephyr/drivers/video-controls.h:49 'curent' may be misspelled - perhaps 'current'?
#define VIDEO_CTRL_GET_MIN 0x00001000 /**< Get the minimum value */
#define VIDEO_CTRL_GET_MAX 0x00002000 /**< Get the maximum value */
#define VIDEO_CTRL_GET_DEF 0x00003000 /**< Get the default value */
#define VIDEO_CTRL_GET_MASK 0x0000f000 /**< Mask for get operations */
/**

Check notice on line 54 in include/zephyr/drivers/video-controls.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/drivers/video-controls.h:54 -#define VIDEO_CTRL_GET_CUR 0x00000000 /**< Get the curent value */ -#define VIDEO_CTRL_GET_MIN 0x00001000 /**< Get the minimum value */ -#define VIDEO_CTRL_GET_MAX 0x00002000 /**< Get the maximum value */ -#define VIDEO_CTRL_GET_DEF 0x00003000 /**< Get the default value */ -#define VIDEO_CTRL_GET_MASK 0x0000f000 /**< Mask for get operations */ +#define VIDEO_CTRL_GET_CUR 0x00000000 /**< Get the curent value */ +#define VIDEO_CTRL_GET_MIN 0x00001000 /**< Get the minimum value */ +#define VIDEO_CTRL_GET_MAX 0x00002000 /**< Get the maximum value */ +#define VIDEO_CTRL_GET_DEF 0x00003000 /**< Get the default value */ +#define VIDEO_CTRL_GET_MASK 0x0000f000 /**< Mask for get operations */
* @}
*/

/**
* @name Generic class control IDs
* @{
Expand Down

0 comments on commit 26f0023

Please sign in to comment.