From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 426DCC636CC for ; Fri, 3 Feb 2023 07:21:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232463AbjBCHU7 (ORCPT ); Fri, 3 Feb 2023 02:20:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbjBCHUx (ORCPT ); Fri, 3 Feb 2023 02:20:53 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB9C719A4 for ; Thu, 2 Feb 2023 23:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675408817; x=1706944817; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JX2JZ5XmwgI15QiJ8VXvfLMZ/Y4ubIDjs9ROlX9pD8I=; b=J/MzsMYFtW0r8eSw6Nk+KLV+ETS6G8IHj3+FVYFZD8yAV2sVbxj/B3yo UeXWNG4VoHAaNc+u3ie2GuuW5N01BnPCtNRLcGi0c2/shyMoUM0bdiPXG /mlJ1ceOrYnj+gqhWJJ1A9d9ZnsnaXmR+7TVSmdOf3siKP8Y1U8giYmMa cG1sDlspszixpJN0sNwmlizprbKIDSbClBL4bqLDBtUxSD9Bfu0IXoIFc DB1JPcJz52BmC5p1eKoJn/kxm8PMtNH2CZnfqKJGSuzuSYod9tZ7JWXFh rae7a/ZF0pQUJATgaQpyT7SIyszOninCS0EZO/aXGlzYp43OdKFAIQu6s Q==; X-IronPort-AV: E=Sophos;i="5.97,269,1669071600"; d="scan'208";a="28844384" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 03 Feb 2023 08:19:49 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 03 Feb 2023 08:19:49 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 03 Feb 2023 08:19:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1675408789; x=1706944789; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JX2JZ5XmwgI15QiJ8VXvfLMZ/Y4ubIDjs9ROlX9pD8I=; b=j3He25BM7ghNzombvswUR3sc4GnMLgMKSaA8cMxtLd+2dvLl62AlSFvd /K1dSi7QAv9fGgNEcpOcdMYvKa3c1Xc8oRdoOm9oHea+A4Y4fvh+r0EaY Zbdq9xkhK6siarpiO2/jhMKu39Euq63NgYdOcs0ju+Tvfgs/IkIDAjob1 BRPySVpeEb2DO7GzMINe7O0onl2szLttl0ix1Zn2z1Huy/6h7W86NRC/D Yv2IjH044q0adxJLYf9PQd6j3GmHzpEGqWzeYXa+mYyGLS+9c9OEcuWAz BsVeP/VEoFeBAx+QIzDhMmmnQ+G0TYdhsP5O8yc2HD7OylW0nW2gzGzFJ w==; X-IronPort-AV: E=Sophos;i="5.97,269,1669071600"; d="scan'208";a="28844382" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 03 Feb 2023 08:19:49 +0100 Received: from steina-w.localnet (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id C2FDD280056; Fri, 3 Feb 2023 08:19:48 +0100 (CET) From: Alexander Stein To: Manivannan Sadhasivam , Mauro Carvalho Chehab , Laurent Pinchart , linux-media@vger.kernel.org, Dave Stevenson Cc: Dave Stevenson Subject: Re: [PATCH 07/11] media: i2c: imx290: Convert V4L2_CID_HBLANK to read/write Date: Fri, 03 Feb 2023 08:19:45 +0100 Message-ID: <8218660.NyiUUSuA9g@steina-w> Organization: TQ-Systems GmbH In-Reply-To: <20230131192016.3476937-8-dave.stevenson@raspberrypi.com> References: <20230131192016.3476937-1-dave.stevenson@raspberrypi.com> <20230131192016.3476937-8-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Hi Dave, thanks for the patch. Am Dienstag, 31. Januar 2023, 20:20:12 CET schrieb Dave Stevenson: > The driver exposed V4L2_CID_HBLANK as a read only control to allow > for exposure calculations and determination of the frame rate. > > Convert to a read/write control so that the frame rate can be > controlled. > > Signed-off-by: Dave Stevenson > --- > drivers/media/i2c/imx290.c | 33 +++++++++++++++++++-------------- > 1 file changed, 19 insertions(+), 14 deletions(-) > > diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c > index 9ddd6382b127..9006be6e5e7c 100644 > --- a/drivers/media/i2c/imx290.c > +++ b/drivers/media/i2c/imx290.c > @@ -47,6 +47,7 @@ > #define IMX290_GAIN IMX290_REG_8BIT(0x3014) > #define IMX290_VMAX IMX290_REG_24BIT(0x3018) > #define IMX290_HMAX IMX290_REG_16BIT(0x301c) > +#define IMX290_HMAX_MAX 0xffff > #define IMX290_SHS1 IMX290_REG_24BIT(0x3020) > #define IMX290_WINWV_OB IMX290_REG_8BIT(0x303a) > #define IMX290_WINPV IMX290_REG_16BIT(0x303c) > @@ -167,7 +168,7 @@ struct imx290_regval { > struct imx290_mode { > u32 width; > u32 height; > - u32 hmax; > + u32 hmax_min; > u8 link_freq_index; > > const struct imx290_regval *data; > @@ -410,7 +411,7 @@ static const struct imx290_mode imx290_modes_2lanes[] = > { { > .width = 1920, > .height = 1080, > - .hmax = 2200, > + .hmax_min = 2200, > .link_freq_index = FREQ_INDEX_1080P, > .data = imx290_1080p_settings, > .data_size = ARRAY_SIZE(imx290_1080p_settings), > @@ -418,7 +419,7 @@ static const struct imx290_mode imx290_modes_2lanes[] = > { { > .width = 1280, > .height = 720, > - .hmax = 3300, > + .hmax_min = 3300, > .link_freq_index = FREQ_INDEX_720P, > .data = imx290_720p_settings, > .data_size = ARRAY_SIZE(imx290_720p_settings), > @@ -429,7 +430,7 @@ static const struct imx290_mode imx290_modes_4lanes[] = > { { > .width = 1920, > .height = 1080, > - .hmax = 2200, > + .hmax_min = 2200, > .link_freq_index = FREQ_INDEX_1080P, > .data = imx290_1080p_settings, > .data_size = ARRAY_SIZE(imx290_1080p_settings), > @@ -437,7 +438,7 @@ static const struct imx290_mode imx290_modes_4lanes[] = > { { > .width = 1280, > .height = 720, > - .hmax = 3300, > + .hmax_min = 3300, > .link_freq_index = FREQ_INDEX_720P, > .data = imx290_720p_settings, > .data_size = ARRAY_SIZE(imx290_720p_settings), > @@ -686,6 +687,12 @@ static int imx290_set_ctrl(struct v4l2_ctrl *ctrl) You will need to remove V4L2_CID_HBLANK on the immediately return check at the beginning of the function. Otherwise this setting will never reach the device. Best regards Alexander > } > break; > > + case V4L2_CID_HBLANK: > + ret = imx290_write(imx290, IMX290_HMAX, > + ctrl->val + imx290->current_mode- >width, > + NULL); > + break; > + > default: > ret = -EINVAL; > break; > @@ -716,12 +723,14 @@ static void imx290_ctrl_update(struct imx290 *imx290, > const struct v4l2_mbus_framefmt *format, > const struct imx290_mode *mode) > { > - unsigned int hblank = mode->hmax - mode->width; > + unsigned int hblank_min = mode->hmax_min - mode->width; > + unsigned int hblank_max = IMX290_HMAX_MAX - mode->width; > unsigned int vblank = IMX290_VMAX_DEFAULT - mode->height; > > __v4l2_ctrl_s_ctrl(imx290->link_freq, mode->link_freq_index); > > - __v4l2_ctrl_modify_range(imx290->hblank, hblank, hblank, 1, hblank); > + __v4l2_ctrl_modify_range(imx290->hblank, hblank_min, hblank_max, 1, > + hblank_min); > __v4l2_ctrl_modify_range(imx290->vblank, vblank, vblank, 1, vblank); > } > > @@ -778,10 +787,11 @@ static int imx290_ctrl_init(struct imx290 *imx290) > ARRAY_SIZE(imx290_test_pattern_menu) - 1, > 0, 0, imx290_test_pattern_menu); > > + /* > + * Actual range will be set from imx290_ctrl_update later in the probe. > + */ > imx290->hblank = v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, > V4L2_CID_HBLANK, 1, 1, 1, 1); > - if (imx290->hblank) > - imx290->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; > > imx290->vblank = v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, > V4L2_CID_VBLANK, 1, 1, 1, 1); > @@ -850,11 +860,6 @@ static int imx290_start_streaming(struct imx290 > *imx290, return ret; > } > > - ret = imx290_write(imx290, IMX290_HMAX, imx290->current_mode->hmax, > - NULL); > - if (ret) > - return ret; > - > /* Apply customized values from user */ > ret = __v4l2_ctrl_handler_setup(imx290->sd.ctrl_handler); > if (ret) {