From c85c0a25fe00451d3b128026a3e3314594c27541 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 5 Nov 2024 12:57:37 +0100 Subject: [PATCH] t4ka3-stuff --- drivers/media/i2c/t4ka3.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/t4ka3.c b/drivers/media/i2c/t4ka3.c index ee4455a5e8e4..ec0fcccf93b7 100644 --- a/drivers/media/i2c/t4ka3.c +++ b/drivers/media/i2c/t4ka3.c @@ -114,9 +114,10 @@ struct t4ka3_ctrls { struct v4l2_ctrl *vblank; struct v4l2_ctrl *hblank; struct v4l2_ctrl *exposure; + struct v4l2_ctrl *gain; struct v4l2_ctrl *test_pattern; struct v4l2_ctrl *link_freq; - struct v4l2_ctrl *gain; + struct v4l2_ctrl *pixel_rate; }; struct t4ka3_mode { @@ -891,7 +892,8 @@ static int t4ka3_init_controls(struct t4ka3_data *sensor) const struct v4l2_ctrl_ops *ops = &t4ka3_ctrl_ops; struct t4ka3_ctrls *ctrls = &sensor->ctrls; struct v4l2_ctrl_handler *hdl = &ctrls->handler; - int min, max, def; + struct v4l2_fwnode_device_properties props; + int ret, min, max, def; static const char * const test_pattern_menu[] = { "Disabled", "Solid White", @@ -900,7 +902,7 @@ static int t4ka3_init_controls(struct t4ka3_data *sensor) "Random Data", }; - v4l2_ctrl_handler_init(hdl, 4); + v4l2_ctrl_handler_init(hdl, 11); hdl->lock = &sensor->lock; @@ -913,6 +915,9 @@ static int t4ka3_init_controls(struct t4ka3_data *sensor) 0, 0, test_pattern_menu); ctrls->link_freq = v4l2_ctrl_new_int_menu(hdl, NULL, V4L2_CID_LINK_FREQ, 0, 0, sensor->link_freq); + ctrls->pixel_rate = v4l2_ctrl_new_std(hdl, NULL, V4L2_CID_PIXEL_RATE, + 0, T4KA3_PIXEL_RATE, + 1, T4KA3_PIXEL_RATE); t4ka3_get_vblank_limits(sensor, &min, &max, &def); ctrls->vblank = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_VBLANK, min, max, 1, def); @@ -930,6 +935,12 @@ static int t4ka3_init_controls(struct t4ka3_data *sensor) T4KA3_MAX_GLOBAL_GAIN_SUPPORTED, 1, T4KA3_MIN_GLOBAL_GAIN_SUPPORTED); + ret = v4l2_fwnode_device_parse(sensor->dev, &props); + if (ret) + return ret; + + v4l2_ctrl_new_fwnode_properties(hdl, ops, &props); + if (hdl->error) return hdl->error; -- 2.47.0