diff mbox series

[4/5] media: i2c: imx355: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips

Message ID 20221202152727.1010207-5-dave.stevenson@raspberrypi.com (mailing list archive)
State New, archived
Headers show
Series Ensure sensor drivers set V4L2_CTRL_FLAG_MODIFY_LAYOUT for flips | expand

Commit Message

Dave Stevenson Dec. 2, 2022, 3:27 p.m. UTC
The driver changes the Bayer order based on the flips, but
does not define the control correctly with the
V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.

Add the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/media/i2c/imx355.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

kernel test robot Dec. 3, 2022, 3:42 a.m. UTC | #1
Hi Dave,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on sailus-media-tree/streams linus/master v6.1-rc7 next-20221202]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dave-Stevenson/Ensure-sensor-drivers-set-V4L2_CTRL_FLAG_MODIFY_LAYOUT-for-flips/20221202-233038
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20221202152727.1010207-5-dave.stevenson%40raspberrypi.com
patch subject: [PATCH 4/5] media: i2c: imx355: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips
config: i386-randconfig-a001
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/3d6eb61d35f205d799bbe3475b66f94262a4b52a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Dave-Stevenson/Ensure-sensor-drivers-set-V4L2_CTRL_FLAG_MODIFY_LAYOUT-for-flips/20221202-233038
        git checkout 3d6eb61d35f205d799bbe3475b66f94262a4b52a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/media/i2c/imx355.c: In function 'imx355_init_controls':
>> drivers/media/i2c/imx355.c:1625:17: error: 'ctrls' undeclared (first use in this function)
    1625 |                 ctrls->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
         |                 ^~~~~
   drivers/media/i2c/imx355.c:1625:17: note: each undeclared identifier is reported only once for each function it appears in


vim +/ctrls +1625 drivers/media/i2c/imx355.c

  1558	
  1559	/* Initialize control handlers */
  1560	static int imx355_init_controls(struct imx355 *imx355)
  1561	{
  1562		struct i2c_client *client = v4l2_get_subdevdata(&imx355->sd);
  1563		struct v4l2_ctrl_handler *ctrl_hdlr;
  1564		s64 exposure_max;
  1565		s64 vblank_def;
  1566		s64 vblank_min;
  1567		s64 hblank;
  1568		u64 pixel_rate;
  1569		const struct imx355_mode *mode;
  1570		u32 max;
  1571		int ret;
  1572	
  1573		ctrl_hdlr = &imx355->ctrl_handler;
  1574		ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
  1575		if (ret)
  1576			return ret;
  1577	
  1578		ctrl_hdlr->lock = &imx355->mutex;
  1579		max = ARRAY_SIZE(link_freq_menu_items) - 1;
  1580		imx355->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx355_ctrl_ops,
  1581							   V4L2_CID_LINK_FREQ, max, 0,
  1582							   link_freq_menu_items);
  1583		if (imx355->link_freq)
  1584			imx355->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
  1585	
  1586		/* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
  1587		pixel_rate = imx355->link_def_freq * 2 * 4;
  1588		do_div(pixel_rate, 10);
  1589		/* By default, PIXEL_RATE is read only */
  1590		imx355->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
  1591						       V4L2_CID_PIXEL_RATE, pixel_rate,
  1592						       pixel_rate, 1, pixel_rate);
  1593	
  1594		/* Initialize vblank/hblank/exposure parameters based on current mode */
  1595		mode = imx355->cur_mode;
  1596		vblank_def = mode->fll_def - mode->height;
  1597		vblank_min = mode->fll_min - mode->height;
  1598		imx355->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
  1599						   V4L2_CID_VBLANK, vblank_min,
  1600						   IMX355_FLL_MAX - mode->height,
  1601						   1, vblank_def);
  1602	
  1603		hblank = mode->llp - mode->width;
  1604		imx355->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
  1605						   V4L2_CID_HBLANK, hblank, hblank,
  1606						   1, hblank);
  1607		if (imx355->hblank)
  1608			imx355->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
  1609	
  1610		/* fll >= exposure time + adjust parameter (default value is 10) */
  1611		exposure_max = mode->fll_def - 10;
  1612		imx355->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
  1613						     V4L2_CID_EXPOSURE,
  1614						     IMX355_EXPOSURE_MIN, exposure_max,
  1615						     IMX355_EXPOSURE_STEP,
  1616						     IMX355_EXPOSURE_DEFAULT);
  1617	
  1618		imx355->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
  1619						  V4L2_CID_HFLIP, 0, 1, 1, 0);
  1620		if (imx355->hflip)
  1621			imx355->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
  1622		imx355->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
  1623						  V4L2_CID_VFLIP, 0, 1, 1, 0);
  1624		if (imx355->vflip)
> 1625			ctrls->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
  1626	
  1627		v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
  1628				  IMX355_ANA_GAIN_MIN, IMX355_ANA_GAIN_MAX,
  1629				  IMX355_ANA_GAIN_STEP, IMX355_ANA_GAIN_DEFAULT);
  1630	
  1631		/* Digital gain */
  1632		v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops, V4L2_CID_DIGITAL_GAIN,
  1633				  IMX355_DGTL_GAIN_MIN, IMX355_DGTL_GAIN_MAX,
  1634				  IMX355_DGTL_GAIN_STEP, IMX355_DGTL_GAIN_DEFAULT);
  1635	
  1636		v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &imx355_ctrl_ops,
  1637					     V4L2_CID_TEST_PATTERN,
  1638					     ARRAY_SIZE(imx355_test_pattern_menu) - 1,
  1639					     0, 0, imx355_test_pattern_menu);
  1640		if (ctrl_hdlr->error) {
  1641			ret = ctrl_hdlr->error;
  1642			dev_err(&client->dev, "control init failed: %d", ret);
  1643			goto error;
  1644		}
  1645	
  1646		imx355->sd.ctrl_handler = ctrl_hdlr;
  1647	
  1648		return 0;
  1649	
  1650	error:
  1651		v4l2_ctrl_handler_free(ctrl_hdlr);
  1652	
  1653		return ret;
  1654	}
  1655
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c
index b46178681c05..f515cf1e52e7 100644
--- a/drivers/media/i2c/imx355.c
+++ b/drivers/media/i2c/imx355.c
@@ -1617,8 +1617,12 @@  static int imx355_init_controls(struct imx355 *imx355)
 
 	imx355->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
 					  V4L2_CID_HFLIP, 0, 1, 1, 0);
+	if (imx355->hflip)
+		imx355->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
 	imx355->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops,
 					  V4L2_CID_VFLIP, 0, 1, 1, 0);
+	if (imx355->vflip)
+		ctrls->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
 
 	v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
 			  IMX355_ANA_GAIN_MIN, IMX355_ANA_GAIN_MAX,