diff mbox series

[v3,2/8] media: v4l: ctrls: Fill V4L2_CID_TOF_CLASS controls

Message ID d3fb74f580865c972877047f95cb65b65e773837.1669381013.git.vkh@melexis.com (mailing list archive)
State New, archived
Headers show
Series media: i2c: mlx7502x ToF camera support | expand

Commit Message

Volodymyr Kharuk Nov. 25, 2022, 1:34 p.m. UTC
Define names, flags and types of TOF controls. *dims* is driver specific.
It also means, that it is not possible to use new_std for arrays.

Signed-off-by: Volodymyr Kharuk <vkh@melexis.com>
---
 drivers/media/v4l2-core/v4l2-ctrls-defs.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Hans Verkuil Nov. 25, 2022, 2:22 p.m. UTC | #1
On 25/11/2022 14:34, Volodymyr Kharuk wrote:
> Define names, flags and types of TOF controls. *dims* is driver specific.
> It also means, that it is not possible to use new_std for arrays.
> 
> Signed-off-by: Volodymyr Kharuk <vkh@melexis.com>
> ---
>  drivers/media/v4l2-core/v4l2-ctrls-defs.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> index 564fedee2c88..1135d33c1baa 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> @@ -1196,6 +1196,13 @@ const char *v4l2_ctrl_get_name(u32 id)
>  	case V4L2_CID_COLORIMETRY_CLASS:	return "Colorimetry Controls";
>  	case V4L2_CID_COLORIMETRY_HDR10_CLL_INFO:		return "HDR10 Content Light Info";
>  	case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:	return "HDR10 Mastering Display";
> +
> +	/* Time of light camera controls */
> +	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
> +	case V4L2_CID_TOF_CLASS:	return "Time of light Camera Controls";

light -> Flight

> +	case V4L2_CID_TOF_PHASE_SEQ:	return "TOF phase sequence";

Capitalize, so: "TOF Phase Sequence"

> +	case V4L2_CID_TOF_FMOD:		return "TOF frequency modulation";

"TOF Frequency Modulation"

> +	case V4L2_CID_TOF_TINT:		return "TOF time integration";

"TOF Time Integration"

>  	default:
>  		return NULL;
>  	}
> @@ -1403,6 +1410,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  	case V4L2_CID_DETECT_CLASS:
>  	case V4L2_CID_CODEC_STATELESS_CLASS:
>  	case V4L2_CID_COLORIMETRY_CLASS:
> +	case V4L2_CID_TOF_CLASS:
>  		*type = V4L2_CTRL_TYPE_CTRL_CLASS;
>  		/* You can neither read nor write these */
>  		*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
> @@ -1541,6 +1549,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>  	case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:
>  		*type = V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY;
>  		break;
> +	case V4L2_CID_TOF_PHASE_SEQ:
> +		*type = V4L2_CTRL_TYPE_U16;
> +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> +		break;
> +	case V4L2_CID_TOF_FMOD:
> +		*type = V4L2_CTRL_TYPE_U8;
> +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> +		break;
> +	case V4L2_CID_TOF_TINT:
> +		*type = V4L2_CTRL_TYPE_U16;
> +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> +		break;
>  	default:
>  		*type = V4L2_CTRL_TYPE_INTEGER;
>  		break;

Regards,

	Hans
Volodymyr Kharuk Nov. 25, 2022, 3:07 p.m. UTC | #2
Thanks for your review.
I'll fix your remarks in next version.

On Fri, Nov 25, 2022 at 03:22:16PM +0100, Hans Verkuil wrote:
> On 25/11/2022 14:34, Volodymyr Kharuk wrote:
> > Define names, flags and types of TOF controls. *dims* is driver specific.
> > It also means, that it is not possible to use new_std for arrays.
> > 
> > Signed-off-by: Volodymyr Kharuk <vkh@melexis.com>
> > ---
> >  drivers/media/v4l2-core/v4l2-ctrls-defs.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > index 564fedee2c88..1135d33c1baa 100644
> > --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
> > @@ -1196,6 +1196,13 @@ const char *v4l2_ctrl_get_name(u32 id)
> >  	case V4L2_CID_COLORIMETRY_CLASS:	return "Colorimetry Controls";
> >  	case V4L2_CID_COLORIMETRY_HDR10_CLL_INFO:		return "HDR10 Content Light Info";
> >  	case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:	return "HDR10 Mastering Display";
> > +
> > +	/* Time of light camera controls */
> > +	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
> > +	case V4L2_CID_TOF_CLASS:	return "Time of light Camera Controls";
> 
> light -> Flight
> 
> > +	case V4L2_CID_TOF_PHASE_SEQ:	return "TOF phase sequence";
> 
> Capitalize, so: "TOF Phase Sequence"
> 
> > +	case V4L2_CID_TOF_FMOD:		return "TOF frequency modulation";
> 
> "TOF Frequency Modulation"
> 
> > +	case V4L2_CID_TOF_TINT:		return "TOF time integration";
> 
> "TOF Time Integration"
> 
> >  	default:
> >  		return NULL;
> >  	}
> > @@ -1403,6 +1410,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
> >  	case V4L2_CID_DETECT_CLASS:
> >  	case V4L2_CID_CODEC_STATELESS_CLASS:
> >  	case V4L2_CID_COLORIMETRY_CLASS:
> > +	case V4L2_CID_TOF_CLASS:
> >  		*type = V4L2_CTRL_TYPE_CTRL_CLASS;
> >  		/* You can neither read nor write these */
> >  		*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
> > @@ -1541,6 +1549,18 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
> >  	case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:
> >  		*type = V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY;
> >  		break;
> > +	case V4L2_CID_TOF_PHASE_SEQ:
> > +		*type = V4L2_CTRL_TYPE_U16;
> > +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> > +		break;
> > +	case V4L2_CID_TOF_FMOD:
> > +		*type = V4L2_CTRL_TYPE_U8;
> > +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> > +		break;
> > +	case V4L2_CID_TOF_TINT:
> > +		*type = V4L2_CTRL_TYPE_U16;
> > +		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
> > +		break;
> >  	default:
> >  		*type = V4L2_CTRL_TYPE_INTEGER;
> >  		break;
> 
> Regards,
> 
> 	Hans
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
index 564fedee2c88..1135d33c1baa 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
@@ -1196,6 +1196,13 @@  const char *v4l2_ctrl_get_name(u32 id)
 	case V4L2_CID_COLORIMETRY_CLASS:	return "Colorimetry Controls";
 	case V4L2_CID_COLORIMETRY_HDR10_CLL_INFO:		return "HDR10 Content Light Info";
 	case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:	return "HDR10 Mastering Display";
+
+	/* Time of light camera controls */
+	/* Keep the order of the 'case's the same as in v4l2-controls.h! */
+	case V4L2_CID_TOF_CLASS:	return "Time of light Camera Controls";
+	case V4L2_CID_TOF_PHASE_SEQ:	return "TOF phase sequence";
+	case V4L2_CID_TOF_FMOD:		return "TOF frequency modulation";
+	case V4L2_CID_TOF_TINT:		return "TOF time integration";
 	default:
 		return NULL;
 	}
@@ -1403,6 +1410,7 @@  void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_DETECT_CLASS:
 	case V4L2_CID_CODEC_STATELESS_CLASS:
 	case V4L2_CID_COLORIMETRY_CLASS:
+	case V4L2_CID_TOF_CLASS:
 		*type = V4L2_CTRL_TYPE_CTRL_CLASS;
 		/* You can neither read nor write these */
 		*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
@@ -1541,6 +1549,18 @@  void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
 	case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:
 		*type = V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY;
 		break;
+	case V4L2_CID_TOF_PHASE_SEQ:
+		*type = V4L2_CTRL_TYPE_U16;
+		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
+		break;
+	case V4L2_CID_TOF_FMOD:
+		*type = V4L2_CTRL_TYPE_U8;
+		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
+		break;
+	case V4L2_CID_TOF_TINT:
+		*type = V4L2_CTRL_TYPE_U16;
+		*flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
+		break;
 	default:
 		*type = V4L2_CTRL_TYPE_INTEGER;
 		break;