| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 2beb8ff8039f3ee8262f05d7f3d91c44826e5df9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrey Konovalov <andrey.konovalov@linaro.org> |
| 3 | Date: Fri, 12 Jun 2020 15:53:46 +0200 |
| 4 | Subject: [PATCH] media: i2c: imx290: set the format before |
| 5 | VIDIOC_SUBDEV_G_FMT is called |
| 6 | |
| 7 | Commit d46cfdc86c30d5ec768924f0b1e2683c8d20b671 upstream. |
| 8 | |
| 9 | With the current driver 'media-ctl -p' issued right after the imx290 driver |
| 10 | is loaded prints: |
| 11 | pad0: Source |
| 12 | [fmt:unknown/0x0] |
| 13 | |
| 14 | The format value of zero is due to the current_format field of the imx290 |
| 15 | struct not being initialized yet. |
| 16 | |
| 17 | As imx290_entity_init_cfg() calls imx290_set_fmt(), the current_mode field |
| 18 | is also initialized, so the line which set current_mode to a default value |
| 19 | in driver's probe() function is no longer needed. |
| 20 | |
| 21 | Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org> |
| 22 | Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
| 23 | Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> |
| 24 | Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> |
| 25 | --- |
| 26 | drivers/media/i2c/imx290.c | 6 +++--- |
| 27 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 28 | |
| 29 | --- a/drivers/media/i2c/imx290.c |
| 30 | +++ b/drivers/media/i2c/imx290.c |
| 31 | @@ -722,9 +722,6 @@ static int imx290_probe(struct i2c_clien |
| 32 | goto free_err; |
| 33 | } |
| 34 | |
| 35 | - /* Set default mode to max resolution */ |
| 36 | - imx290->current_mode = &imx290_modes[0]; |
| 37 | - |
| 38 | /* get system clock (xclk) */ |
| 39 | imx290->xclk = devm_clk_get(dev, "xclk"); |
| 40 | if (IS_ERR(imx290->xclk)) { |
| 41 | @@ -809,6 +806,9 @@ static int imx290_probe(struct i2c_clien |
| 42 | goto free_ctrl; |
| 43 | } |
| 44 | |
| 45 | + /* Initialize the frame format (this also sets imx290->current_mode) */ |
| 46 | + imx290_entity_init_cfg(&imx290->sd, NULL); |
| 47 | + |
| 48 | ret = v4l2_async_register_subdev(&imx290->sd); |
| 49 | if (ret < 0) { |
| 50 | dev_err(dev, "Could not register v4l2 device\n"); |