[v8,1/4] media: i2c: imx334: replace __v4l2_ctrl_s_ctrl to __v4l2_ctrl_modify_range
Message ID | 20230106072931.2317597-2-shravan.chippa@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp692678wrt; Thu, 5 Jan 2023 23:30:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXsTQTyYIeCT+5wf6UXM/1Ge+KjviPsohjK/7d45cdL7MaJbWuiFw7/sJxJmbXcUXQWTJHQ+ X-Received: by 2002:a05:6a20:3d18:b0:aa:5fed:8d6 with SMTP id y24-20020a056a203d1800b000aa5fed08d6mr83091097pzi.15.1672990257018; Thu, 05 Jan 2023 23:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672990257; cv=none; d=google.com; s=arc-20160816; b=EngXOILNfR+TsSKAGETdhXpyBbPUdnFbIBtq/s26PTWc8YJbT89cuqSPLufWcFTn9P dCiD4BcI+0m9h1lwAhef4CAts6TXuTZEUd/isy2Fb0Ik4TIHeV2TkER9rws6Z84LYfkO MMylR0awf4EMGmE6xlUUXCaaHMaj4EGXN2ygkSO/5H0/rmokkf6tU8uLyEviZSSU9/YQ GFz7uYPU1cMVI10XHlkJNMRPYKxIR3eXA/yJ0rmlq7yROZz2XsJl4Q8hArugNgaTjKqn aGDwN0yyTmuzNsEzTb4Npe655y7e2Sb1Gyr/KWvwXT/ZaEiguMpL1t2v15albmy60IpD zwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cmP0J538ixr6ciNhT4HdZE3g1noWmkVi3KCVQkMuYac=; b=h4OJavBN1oDFBxi0Lz0WPzlnRjvBOupcpsxyXqmigF1kMu2qDoid3as7bkh4ohlxIU 2X68VJbY2hmYbxdWfWT0nLUERrM643b1Mrau8zetg8oncrlcHfOT0mjXao42m2mmBIrW gV36gI78d4UQGOWIlNUAp6Je4FaXfdyrTNZdknB+xeXaG5jmxgO2s0HwerLY0tYuOCmO XfyxtcU+oQ0gJdwOSPlZIVTRifbOT+ZKafg6kB2qbEB3G+v9t1smwjEKkPdBicQiBr8j gdOwOexce6cIsr/RdRxqRASMfrdU19WTkCo19q0U7Svswbi8vvNDXbAT/yBmPq9zdCj9 dbPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=fc3tB4HR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a63e153000000b0047947d45f57si595448pgk.745.2023.01.05.23.30.44; Thu, 05 Jan 2023 23:30:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=fc3tB4HR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbjAFH3y (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Fri, 6 Jan 2023 02:29:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbjAFH3p (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Jan 2023 02:29:45 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67B286F97D; Thu, 5 Jan 2023 23:29:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1672990184; x=1704526184; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GLXh+f0a72t6lGjD1FpAhiA+PzmF9uom00zJlSDPvwc=; b=fc3tB4HRrIrdPPN0/6l7UhNNEhkUVRTEyehVO4b9LreWqCiY67O8l19e L/KxZKW4LMalm+1ugZq4JtAAZUr5+SZ+idjfa5XZBgoSR+QQ4YYEU58Pf raa8m0jx3AYvACsWaoBzAPe/01Xky5r8JWAhq30AFy1epTVGJS7x4SLoV cLgyPUievP7q7ndkQlwBgEnlAFX12KEdHfyXjX4GRA4SARj8zbi1FOTPX +MZem/3r9/ynwFJp/5XLXUstlHvffTjTVe+Oq+qS3xPmszm4bLgo4Ta6z Ra+KmkJhoYvKjcd/Vfco9WrhufUJizva/OQSdbDeJhHrqbP6SgbMOGhLg g==; X-IronPort-AV: E=Sophos;i="5.96,304,1665471600"; d="scan'208";a="194553457" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 06 Jan 2023 00:29:43 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Fri, 6 Jan 2023 00:29:43 -0700 Received: from microchip1-OptiPlex-9020.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Fri, 6 Jan 2023 00:29:40 -0700 From: shravan kumar <shravan.chippa@microchip.com> To: <paul.j.murphy@intel.com>, <daniele.alessandrelli@intel.com>, <mchehab@kernel.org> CC: <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>, "shravan kumar" <shravan.chippa@microchip.com>, Jacopo Mondi <jacopo@jmondi.org> Subject: [PATCH v8 1/4] media: i2c: imx334: replace __v4l2_ctrl_s_ctrl to __v4l2_ctrl_modify_range Date: Fri, 6 Jan 2023 12:59:28 +0530 Message-ID: <20230106072931.2317597-2-shravan.chippa@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230106072931.2317597-1-shravan.chippa@microchip.com> References: <20230106072931.2317597-1-shravan.chippa@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754257431395988822?= X-GMAIL-MSGID: =?utf-8?q?1754257431395988822?= |
Series |
media: i2c: imx334: support lower bandwidth mode
|
|
Commit Message
shravan chippa
Jan. 6, 2023, 7:29 a.m. UTC
From: Shravan Chippa <shravan.chippa@microchip.com> For evry mode we will get new set of values for hbalnk so use __v4l2_ctrl_modify_range() to support multi modes for hblank. The hblank value is readonly in the driver. because of this the function returns error if we try to change. so added dumy return case in imx334_set_ctrl function Suggested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com> --- drivers/media/i2c/imx334.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Comments
Hi Sharavan, I'm a bit confused here On Fri, Jan 06, 2023 at 12:59:28PM +0530, shravan kumar wrote: > From: Shravan Chippa <shravan.chippa@microchip.com> > > For evry mode we will get new set of values for hbalnk so use > __v4l2_ctrl_modify_range() to support multi modes for hblank. > > The hblank value is readonly in the driver. because of this the function > returns error if we try to change. so added dumy return case in > imx334_set_ctrl function > > Suggested-by: Jacopo Mondi <jacopo@jmondi.org> > Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com> > --- > drivers/media/i2c/imx334.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c > index 7b0a9086447d..ebacba3059b3 100644 > --- a/drivers/media/i2c/imx334.c > +++ b/drivers/media/i2c/imx334.c > @@ -382,7 +382,8 @@ static int imx334_update_controls(struct imx334 *imx334, > if (ret) > return ret; > > - ret = __v4l2_ctrl_s_ctrl(imx334->hblank_ctrl, mode->hblank); > + ret = __v4l2_ctrl_modify_range(imx334->hblank_ctrl, mode->hblank, > + mode->hblank, 1, mode->hblank); > if (ret) > return ret; > > @@ -480,6 +481,9 @@ static int imx334_set_ctrl(struct v4l2_ctrl *ctrl) > > pm_runtime_put(imx334->dev); > > + break; > + case V4L2_CID_HBLANK: > + ret = 0; Hblank is said to be read-only if (imx334->hblank_ctrl) imx334->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; So you shouldn't need this safety measure here. However I see that __v4l2_ctrl_modify_range() can call s_ctrl() if the current value has to be adjusted to the new limits. Hans, how does this work ? Do we need the above even if the control is said to be RO ? Sharavan: have you experienced failures here, or is this just for safety ? > break; > default: > dev_err(imx334->dev, "Invalid control %d", ctrl->id); > -- > 2.34.1 >
> -----Original Message----- > From: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > Sent: 06 January 2023 03:15 PM > To: shravan Chippa - I35088 <Shravan.Chippa@microchip.com>; Hans Verkuil > <hverkuil@xs4all.nl> > Cc: paul.j.murphy@intel.com; daniele.alessandrelli@intel.com; > mchehab@kernel.org; linux-media@vger.kernel.org; linux- > kernel@vger.kernel.org > Subject: Re: [PATCH v8 1/4] media: i2c: imx334: replace __v4l2_ctrl_s_ctrl to > __v4l2_ctrl_modify_range > > [You don't often get email from jacopo.mondi@ideasonboard.com. Learn > why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the > content is safe > > Hi Sharavan, > > I'm a bit confused here > > On Fri, Jan 06, 2023 at 12:59:28PM +0530, shravan kumar wrote: > > From: Shravan Chippa <shravan.chippa@microchip.com> > > > > For evry mode we will get new set of values for hbalnk so use > > __v4l2_ctrl_modify_range() to support multi modes for hblank. > > > > The hblank value is readonly in the driver. because of this the > > function returns error if we try to change. so added dumy return case > > in imx334_set_ctrl function > > > > Suggested-by: Jacopo Mondi <jacopo@jmondi.org> > > Signed-off-by: Shravan Chippa <shravan.chippa@microchip.com> > > --- > > drivers/media/i2c/imx334.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c > > index 7b0a9086447d..ebacba3059b3 100644 > > --- a/drivers/media/i2c/imx334.c > > +++ b/drivers/media/i2c/imx334.c > > @@ -382,7 +382,8 @@ static int imx334_update_controls(struct imx334 > *imx334, > > if (ret) > > return ret; > > > > - ret = __v4l2_ctrl_s_ctrl(imx334->hblank_ctrl, mode->hblank); > > + ret = __v4l2_ctrl_modify_range(imx334->hblank_ctrl, mode->hblank, > > + mode->hblank, 1, mode->hblank); > > if (ret) > > return ret; > > > > @@ -480,6 +481,9 @@ static int imx334_set_ctrl(struct v4l2_ctrl *ctrl) > > > > pm_runtime_put(imx334->dev); > > > > + break; > > + case V4L2_CID_HBLANK: > > + ret = 0; > > Hblank is said to be read-only Yes, read-only. > > if (imx334->hblank_ctrl) > imx334->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; > > So you shouldn't need this safety measure here. > > However I see that __v4l2_ctrl_modify_range() can call s_ctrl() if the current > value has to be adjusted to the new limits. > > Hans, how does this work ? Do we need the above even if the control is said > to be RO ? > > Sharavan: have you experienced failures here, or is this just for safety ? The value is changing if we change the mode. While changing mode. I have experienced failures. Thanks, Shravan. > > > > break; > > default: > > dev_err(imx334->dev, "Invalid control %d", ctrl->id); > > -- > > 2.34.1 > >
diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index 7b0a9086447d..ebacba3059b3 100644 --- a/drivers/media/i2c/imx334.c +++ b/drivers/media/i2c/imx334.c @@ -382,7 +382,8 @@ static int imx334_update_controls(struct imx334 *imx334, if (ret) return ret; - ret = __v4l2_ctrl_s_ctrl(imx334->hblank_ctrl, mode->hblank); + ret = __v4l2_ctrl_modify_range(imx334->hblank_ctrl, mode->hblank, + mode->hblank, 1, mode->hblank); if (ret) return ret; @@ -480,6 +481,9 @@ static int imx334_set_ctrl(struct v4l2_ctrl *ctrl) pm_runtime_put(imx334->dev); + break; + case V4L2_CID_HBLANK: + ret = 0; break; default: dev_err(imx334->dev, "Invalid control %d", ctrl->id);