Hi Daniel,

On Tue, Apr 14, 2020 at 10:01:50PM +0200, Daniel Gomez wrote:
> Add a v4l2 control ID to handle the temperature.
> 
> Signed-off-by: Daniel Gomez <[email protected]>
> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c | 5 +++++
>  include/uapi/linux/v4l2-controls.h   | 4 +++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
> b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 93d33d1db4e8..17b93111baa8 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -783,6 +783,7 @@ const char *v4l2_ctrl_get_name(u32 id)
>       case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:   return "Min Number of Output 
> Buffers";
>       case V4L2_CID_ALPHA_COMPONENT:          return "Alpha Component";
>       case V4L2_CID_COLORFX_CBCR:             return "Color Effects, CbCr";
> +     case V4L2_CID_TEMPERATURE:              return "Temperature";

What's the unit of this control? I think it should have one.

As Hans pointed out, documentation is needed.

>  
>       /* Codec controls */
>       /* The MPEG controls are applicable to all codec controls
> @@ -1344,6 +1345,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
> v4l2_ctrl_type *type,
>               *type = V4L2_CTRL_TYPE_INTEGER;
>               *flags |= V4L2_CTRL_FLAG_READ_ONLY;
>               break;
> +     case V4L2_CID_TEMPERATURE:
> +             *type = V4L2_CTRL_TYPE_INTEGER;
> +             *flags |= V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY;
> +             break;
>       case V4L2_CID_MPEG_VIDEO_DEC_PTS:
>               *type = V4L2_CTRL_TYPE_INTEGER64;
>               *flags |= V4L2_CTRL_FLAG_VOLATILE | V4L2_CTRL_FLAG_READ_ONLY;
> diff --git a/include/uapi/linux/v4l2-controls.h 
> b/include/uapi/linux/v4l2-controls.h
> index 1a58d7cc4ccc..76ec0a6da8d5 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -143,8 +143,10 @@ enum v4l2_colorfx {
>  #define V4L2_CID_ALPHA_COMPONENT             (V4L2_CID_BASE+41)
>  #define V4L2_CID_COLORFX_CBCR                        (V4L2_CID_BASE+42)
>  
> +#define V4L2_CID_TEMPERATURE                 (V4L2_CID_BASE+43)
> +
>  /* last CID + 1 */
> -#define V4L2_CID_LASTP1                         (V4L2_CID_BASE+43)
> +#define V4L2_CID_LASTP1                         (V4L2_CID_BASE+44)
>  
>  /* USER-class private control IDs */
>  

-- 
Kind regards,

Sakari Ailus

Reply via email to