[libcamera-devel,v2,01/10,TEMP] include: linux: Update v4l2-controls.h

Message ID 20191205204350.28196-2-jacopo@jmondi.org
State Superseded
Headers show
Series
  • Introduce camera properties
Related show

Commit Message

Jacopo Mondi Dec. 5, 2019, 8:43 p.m. UTC
Import a temporary version of the v4l2-controls.h with the newly added
definition of V4L2_CID_CAMERA_SENSOR_LOCATION control.

This patch should be temporary applied waiting for the newly added
control to land in the mainline kernel version.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 include/linux/v4l2-controls.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Niklas Söderlund Dec. 6, 2019, 7:02 p.m. UTC | #1
Hi Jacopo,

Thanks for your work.

On 2019-12-05 21:43:41 +0100, Jacopo Mondi wrote:
> Import a temporary version of the v4l2-controls.h with the newly added
> definition of V4L2_CID_CAMERA_SENSOR_LOCATION control.
> 
> This patch should be temporary applied waiting for the newly added
> control to land in the mainline kernel version.

How do you wish to play this, shall we aim to merge this series before 
the kernel patches hits the media-tree or hold of? My preference would 
be to wait until a new kernel feature hits media-tree, I'm however open 
to discuss it.

> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  include/linux/v4l2-controls.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
> index ef2ee5b796b4..d18a7749d3f1 100644
> --- a/include/linux/v4l2-controls.h
> +++ b/include/linux/v4l2-controls.h
> @@ -910,6 +910,13 @@ enum v4l2_auto_focus_range {
>  #define V4L2_CID_PAN_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+32)
>  #define V4L2_CID_TILT_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+33)
>  
> +#define V4L2_CID_CAMERA_SENSOR_LOCATION		(V4L2_CID_CAMERA_CLASS_BASE+34)
> +#define V4L2_LOCATION_FRONT			0
> +#define V4L2_LOCATION_BACK			1
> +#define V4L2_LOCATION_EXTERNAL			2
> +
> +#define V4L2_CID_CAMERA_SENSOR_ROTATION		(V4L2_CID_CAMERA_CLASS_BASE+35)
> +
>  /* FM Modulator class control IDs */
>  
>  #define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
> -- 
> 2.23.0
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Jacopo Mondi Dec. 8, 2019, 5:51 p.m. UTC | #2
Hi Niklas,

On Fri, Dec 06, 2019 at 08:02:42PM +0100, Niklas Söderlund wrote:
> Hi Jacopo,
>
> Thanks for your work.
>
> On 2019-12-05 21:43:41 +0100, Jacopo Mondi wrote:
> > Import a temporary version of the v4l2-controls.h with the newly added
> > definition of V4L2_CID_CAMERA_SENSOR_LOCATION control.
> >
> > This patch should be temporary applied waiting for the newly added
> > control to land in the mainline kernel version.
>
> How do you wish to play this, shall we aim to merge this series before
> the kernel patches hits the media-tree or hold of? My preference would
> be to wait until a new kernel feature hits media-tree, I'm however open
> to discuss it.

Good question.

I'm not sure when that series will land to be honest. It was targeted
for v5.6 but you never know. We currently use headers from v5.2, so it
might take a while before we get to use headers from the right kernel
version...

Not sure, to be honest :)

>
> >
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > ---
> >  include/linux/v4l2-controls.h | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
> > index ef2ee5b796b4..d18a7749d3f1 100644
> > --- a/include/linux/v4l2-controls.h
> > +++ b/include/linux/v4l2-controls.h
> > @@ -910,6 +910,13 @@ enum v4l2_auto_focus_range {
> >  #define V4L2_CID_PAN_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+32)
> >  #define V4L2_CID_TILT_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+33)
> >
> > +#define V4L2_CID_CAMERA_SENSOR_LOCATION		(V4L2_CID_CAMERA_CLASS_BASE+34)
> > +#define V4L2_LOCATION_FRONT			0
> > +#define V4L2_LOCATION_BACK			1
> > +#define V4L2_LOCATION_EXTERNAL			2
> > +
> > +#define V4L2_CID_CAMERA_SENSOR_ROTATION		(V4L2_CID_CAMERA_CLASS_BASE+35)
> > +
> >  /* FM Modulator class control IDs */
> >
> >  #define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
> > --
> > 2.23.0
> >
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel
>
> --
> Regards,
> Niklas Söderlund
Kieran Bingham Dec. 9, 2019, 1:36 p.m. UTC | #3
Hi Jacopo/Niklas,

On 08/12/2019 17:51, Jacopo Mondi wrote:
> Hi Niklas,
> 
> On Fri, Dec 06, 2019 at 08:02:42PM +0100, Niklas Söderlund wrote:
>> Hi Jacopo,
>>
>> Thanks for your work.
>>
>> On 2019-12-05 21:43:41 +0100, Jacopo Mondi wrote:
>>> Import a temporary version of the v4l2-controls.h with the newly added
>>> definition of V4L2_CID_CAMERA_SENSOR_LOCATION control.
>>>
>>> This patch should be temporary applied waiting for the newly added
>>> control to land in the mainline kernel version.
>>
>> How do you wish to play this, shall we aim to merge this series before
>> the kernel patches hits the media-tree or hold of? My preference would
>> be to wait until a new kernel feature hits media-tree, I'm however open
>> to discuss it.
> 
> Good question.
> 
> I'm not sure when that series will land to be honest. It was targeted
> for v5.6 but you never know. We currently use headers from v5.2, so it
> might take a while before we get to use headers from the right kernel
> version...
> 
> Not sure, to be honest :)

IMO, here we are bringing in a non-kernel define for a new feature
before it has landed in the kernel.

If this was a feature that /someone else/ was in control of, I might be
more reserved - but the fact that 'we' ("or rather you, Jacopo") are in
control of the feature as it progresses to mainline - means I'm quite
comfortable bringing in this feature to libcamera while it is being
developed.

We should make sure that this doesn't cause any unexpected/undefined
behaviour when run against kernels which do not have these controls
defined though.


It's a shame we can't mark a #define with some sort of
__attribute__((deprecated("Not Yet In Mainline"))) though ...

--
Kieran



>>> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
>>> ---
>>>  include/linux/v4l2-controls.h | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>>
>>> diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
>>> index ef2ee5b796b4..d18a7749d3f1 100644
>>> --- a/include/linux/v4l2-controls.h
>>> +++ b/include/linux/v4l2-controls.h
>>> @@ -910,6 +910,13 @@ enum v4l2_auto_focus_range {
>>>  #define V4L2_CID_PAN_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+32)
>>>  #define V4L2_CID_TILT_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+33)
>>>
>>> +#define V4L2_CID_CAMERA_SENSOR_LOCATION		(V4L2_CID_CAMERA_CLASS_BASE+34)
>>> +#define V4L2_LOCATION_FRONT			0
>>> +#define V4L2_LOCATION_BACK			1
>>> +#define V4L2_LOCATION_EXTERNAL			2
>>> +
>>> +#define V4L2_CID_CAMERA_SENSOR_ROTATION		(V4L2_CID_CAMERA_CLASS_BASE+35)
>>> +
>>>  /* FM Modulator class control IDs */
>>>
>>>  #define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
>>> --
>>> 2.23.0
>>>
>>> _______________________________________________
>>> libcamera-devel mailing list
>>> libcamera-devel@lists.libcamera.org
>>> https://lists.libcamera.org/listinfo/libcamera-devel
>>
>> --
>> Regards,
>> Niklas Söderlund
>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel@lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
index ef2ee5b796b4..d18a7749d3f1 100644
--- a/include/linux/v4l2-controls.h
+++ b/include/linux/v4l2-controls.h
@@ -910,6 +910,13 @@  enum v4l2_auto_focus_range {
 #define V4L2_CID_PAN_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+32)
 #define V4L2_CID_TILT_SPEED			(V4L2_CID_CAMERA_CLASS_BASE+33)
 
+#define V4L2_CID_CAMERA_SENSOR_LOCATION		(V4L2_CID_CAMERA_CLASS_BASE+34)
+#define V4L2_LOCATION_FRONT			0
+#define V4L2_LOCATION_BACK			1
+#define V4L2_LOCATION_EXTERNAL			2
+
+#define V4L2_CID_CAMERA_SENSOR_ROTATION		(V4L2_CID_CAMERA_CLASS_BASE+35)
+
 /* FM Modulator class control IDs */
 
 #define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)