media: i2c: imx258: Parse and register properties
PATCH v2 1/1 media: i2c: imx258: Parse and register properties
Analogous to e.g. the imx219. This enables propagating V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION values.
The motivation is to allow libcamera detect these values from the device tree and propagate them further to e.g. Pipewire.
While at it, reserve space for 3 additional controls even if v4l2_ctrl_new_fwnode_properties() can only register 2 of them, to fix the existing implementation which reserve space for 8 controls but actually registers 9.
Changes in v2:
- Reserve 11 instead of 10 controls
- Change order of variable declaration
- Slightly extend description
--- drivers/media/i2c/imx258.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/media/i2c/imx258.c +12 -1
@@ -9,6 +9,7 @@#include <linux/pm_runtime.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> +#include <media/v4l2-fwnode.h> #include <asm/unaligned.h> #define IMX258_REG_VALUE_08BIT 1
@@ -1148,6 +1149,7 @@ static const struct v4l2_subdev_internal_ops imx258_internal_ops = {static int imx258_init_controls (struct imx258 *imx258) {struct i2c_client *client =v4l2_get_subdevdata (&imx258->sd); +struct v4l2_fwnode_device_properties props;struct v4l2_ctrl_handler *ctrl_hdlr;s64 vblank_def;s64 vblank_min;
@@ -1156,7 +1158,7 @@ static int imx258_init_controls(struct imx258 *imx258)int ret; ctrl_hdlr = &imx258->ctrl_handler; - ret =v4l2_ctrl_handler_init (ctrl_hdlr,8 ); + ret =v4l2_ctrl_handler_init (ctrl_hdlr,11 );if (ret)return ret;
@@ -1232,6 +1234,15 @@ static int imx258_init_controls(struct imx258 *imx258) goto error; } + ret =v4l2_fwnode_device_parse (&client->dev, &props); +if (ret) + goto error; + + ret =v4l2_ctrl_new_fwnode_properties (ctrl_hdlr, &imx258_ctrl_ops, + &props); +if (ret) + goto error; + imx258->sd.ctrl_handler = ctrl_hdlr;return 0 ;
Signature · 1 line
2.39.0
Hi Robert
Quoted 11 lines · Robert Mader
Analogous to e.g. the imx219. This enables propagating
V4L2_CID_CAMERA_ORIENTATIONandV4L2_CID_CAMERA_SENSOR_ROTATIONvalues.
The motivation is to allow libcamera detect these values from the device tree and propagate them further to e.g. Pipewire.While at it, reserve space for 3 additional controls even if
v4l2_ctrl_new_fwnode_properties()can only register 2 of them, to fix the existing implementation which reserve space for 8 controls but actually registers 9.
Quoted 4 lines
Changes in v2:
- Reserve 11 instead of 10 controls
- Change order of variable declaration
- Slightly extend description
This part should go below, after ---, as it shouldn't be part of the commit message
The patch looks good
Quoted 54 lines
Signed-off-by Robert Mader <[email protected]>--- drivers/media/i2c/imx258.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/media/i2c/imx258.c +12
-2@@ -9,6 +9,7 @@#include <linux/pm_runtime.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> +#include <media/v4l2-fwnode.h> #include <asm/unaligned.h> #define IMX258_REG_VALUE_08BIT 1@@ -1148,6 +1149,7 @@ static const struct v4l2_subdev_internal_ops imx258_internal_ops = {static int imx258_init_controls (struct imx258 *imx258) {struct i2c_client *client =v4l2_get_subdevdata (&imx258->sd); +struct v4l2_fwnode_device_properties props;struct v4l2_ctrl_handler *ctrl_hdlr;s64 vblank_def;s64 vblank_min;@@ -1156,7 +1158,7 @@ static int imx258_init_controls(struct imx258 *imx258)int ret; ctrl_hdlr = &imx258->ctrl_handler; - ret =v4l2_ctrl_handler_init (ctrl_hdlr,8 ); + ret =v4l2_ctrl_handler_init (ctrl_hdlr,11 );if (ret)return ret;@@ -1232,6 +1234,15 @@ static int imx258_init_controls(struct imx258 *imx258) goto error; } + ret =v4l2_fwnode_device_parse (&client->dev, &props); +if (ret) + goto error; + + ret =v4l2_ctrl_new_fwnode_properties (ctrl_hdlr, &imx258_ctrl_ops, + &props); +if (ret) + goto error; + imx258->sd.ctrl_handler = ctrl_hdlr;return 0 ; --2.39.0
Quoted 18 lines · Jacopo Mondi
Hi Robert
Quoted 11 lines · Robert Mader
Analogous to e.g. the imx219. This enables propagating
V4L2_CID_CAMERA_ORIENTATIONandV4L2_CID_CAMERA_SENSOR_ROTATIONvalues.
The motivation is to allow libcamera detect these values from the device tree and propagate them further to e.g. Pipewire.While at it, reserve space for 3 additional controls even if
v4l2_ctrl_new_fwnode_properties()can only register 2 of them, to fix the existing implementation which reserve space for 8 controls but actually registers 9.Quoted 4 lines
Changes in v2:
- Reserve 11 instead of 10 controls
- Change order of variable declaration
- Slightly extend description
Quoted 6 lines
This part should go below, after ---, as it shouldn't be part of the commit message
The patch looks good
Reviewed-by Jacopo Mondi <[email protected]>
Thanks! And ops, right, make sense. Should I spin a v3 for that or is it simple enough to fix when pulling?
Quoted 53 lines
Quoted 53 lines
Signed-off-by Robert Mader <[email protected]>--- drivers/media/i2c/imx258.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/media/i2c/imx258.c +12
-2@@ -9,6 +9,7 @@#include <linux/pm_runtime.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> +#include <media/v4l2-fwnode.h> #include <asm/unaligned.h> #define IMX258_REG_VALUE_08BIT 1@@ -1148,6 +1149,7 @@ static const struct v4l2_subdev_internal_ops imx258_internal_ops = {static int imx258_init_controls (struct imx258 *imx258) {struct i2c_client *client =v4l2_get_subdevdata (&imx258->sd); +struct v4l2_fwnode_device_properties props;struct v4l2_ctrl_handler *ctrl_hdlr;s64 vblank_def;s64 vblank_min;@@ -1156,7 +1158,7 @@ static int imx258_init_controls(struct imx258 *imx258)int ret; ctrl_hdlr = &imx258->ctrl_handler; - ret =v4l2_ctrl_handler_init (ctrl_hdlr,8 ); + ret =v4l2_ctrl_handler_init (ctrl_hdlr,11 );if (ret)return ret;@@ -1232,6 +1234,15 @@ static int imx258_init_controls(struct imx258 *imx258) goto error; } + ret =v4l2_fwnode_device_parse (&client->dev, &props); +if (ret) + goto error; + + ret =v4l2_ctrl_new_fwnode_properties (ctrl_hdlr, &imx258_ctrl_ops, + &props); +if (ret) + goto error; + imx258->sd.ctrl_handler = ctrl_hdlr;return 0 ; --2.39.0
Sakari Ailus
maintainerHi Robert,
Quoted 19 lines · Robert Mader
Quoted 18 lines · Jacopo Mondi
Hi Robert
Quoted 15 lines · Robert Mader
Analogous to e.g. the imx219. This enables propagating
V4L2_CID_CAMERA_ORIENTATIONandV4L2_CID_CAMERA_SENSOR_ROTATIONvalues.
The motivation is to allow libcamera detect these values from the device tree and propagate them further to e.g. Pipewire.While at it, reserve space for 3 additional controls even if
v4l2_ctrl_new_fwnode_properties()can only register 2 of them, to fix the existing implementation which reserve space for 8 controls but actually registers 9.Changes in v2:
- Reserve 11 instead of 10 controls
- Change order of variable declaration
- Slightly extend description
Quoted 8 lines
Quoted 6 lines
This part should go below, after ---, as it shouldn't be part of the commit message
The patch looks good
Reviewed-by Jacopo Mondi <[email protected]>Thanks! And ops, right, make sense. Should I spin a v3 for that or is it simple enough to fix when pulling?
I can fix it while applying the patch.
Signature · 3 lines
Regards, Sakari Ailus
Quoted 25 lines · Sakari Ailus
Hi Robert,
Quoted 22 lines · Robert Mader
Quoted 21 lines · Jacopo Mondi
Hi Robert
Quoted 11 lines · Robert Mader
Analogous to e.g. the imx219. This enables propagating
V4L2_CID_CAMERA_ORIENTATIONandV4L2_CID_CAMERA_SENSOR_ROTATIONvalues.
The motivation is to allow libcamera detect these values from the device tree and propagate them further to e.g. Pipewire.While at it, reserve space for 3 additional controls even if
v4l2_ctrl_new_fwnode_properties()can only register 2 of them, to fix the existing implementation which reserve space for 8 controls but actually registers 9.Quoted 4 lines
Changes in v2:
- Reserve 11 instead of 10 controls
- Change order of variable declaration
- Slightly extend descriptionThis part should go below, after ---, as it shouldn't be part of the commit message
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
The patch looks good
Reviewed-by Jacopo Mondi <[email protected]>Thanks! And ops, right, make sense. Should I spin a v3 for that or is it simple enough to fix when pulling?
I can fix it while applying the patch.
No need for line breaks after period, just let your editor to break them before 74 or so.
Signature · 1 line
Sakari Ailus