From patchwork Mon Dec 5 05:19:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shravan kumar X-Patchwork-Id: 13064142 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 CE23EC47088 for ; Mon, 5 Dec 2022 05:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbiLEFU5 (ORCPT ); Mon, 5 Dec 2022 00:20:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbiLEFUa (ORCPT ); Mon, 5 Dec 2022 00:20:30 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3779B13F91; Sun, 4 Dec 2022 21:20:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1670217617; x=1701753617; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mXhoSw88V/7yBb8oczsmPuNJJvEtejt3CszxH0XbUxo=; b=Pix+f2m3QxHXoRZXM2Pna9AkTv1gjctfmYnRxgJXF77YzBHZsXiYWv98 hEyAys1SYP8jwhR+DvFr7Iuett4LZiqbjeTCWqlLyj/kwDLPwHkJsxJRL fXpsq/7bPNbdhu+FAr39wlkJCJgXmwRU3u2pwtQnobW/4fCAsj7M8OHo2 oR9BICMKJxkYmeW2FnH1prCq5cceb3nM2vXOPmksvSWAWEf/nSHj4JOvK /9Ava2vHS/8RZU+5j23o2Rydg0uS//L2JIDx3LHXPGDyxE7PWbp84JNG0 0i8EkV/qRkndwTJukNzIAzRwX3dxq9oJ13aLVt3tZWp37ADau6MAb2rpB w==; X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="126455461" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 Dec 2022 22:20:15 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Sun, 4 Dec 2022 22:20:15 -0700 Received: from microchip1-OptiPlex-9020.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Sun, 4 Dec 2022 22:20:13 -0700 From: shravan kumar To: , , CC: , , "Shravan Chippa" , Sakari Ailus Subject: [PATCH v6 5/5] media: i2c: imx334: update pixel and link frequency Date: Mon, 5 Dec 2022 10:49:37 +0530 Message-ID: <20221205051937.3897001-7-shravan.chippa@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205051937.3897001-1-shravan.chippa@microchip.com> References: <20221205051937.3897001-1-shravan.chippa@microchip.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Shravan Chippa Update pixel_rate and link frequency for 1920x1080@30 while changing mode. Add dummy ctrl cases for pixel_rate and link frequency to avoid error while changing the modes dynamically Suggested-by: Sakari Ailus Signed-off-by: Shravan Chippa --- drivers/media/i2c/imx334.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index d5b566085da9..64ed77c4258c 100644 --- a/drivers/media/i2c/imx334.c +++ b/drivers/media/i2c/imx334.c @@ -50,6 +50,7 @@ /* CSI2 HW configuration */ #define IMX334_LINK_FREQ 1782000000 +#define IMX334_LINK_FREQ_891M 891000000 #define IMX334_NUM_DATA_LANES 4 #define IMX334_REG_MIN 0x00 @@ -145,6 +146,7 @@ struct imx334 { static const s64 link_freq[] = { IMX334_LINK_FREQ, + IMX334_LINK_FREQ_891M, }; /* Sensor mode registers */ @@ -468,7 +470,7 @@ static const struct imx334_mode supported_modes[] = { .vblank_min = 90, .vblank_max = 132840, .pclk = 74250000, - .link_freq_idx = 0, + .link_freq_idx = 1, .reg_list = { .num_of_regs = ARRAY_SIZE(mode_1920x1080_regs), .regs = mode_1920x1080_regs, @@ -598,6 +600,11 @@ static int imx334_update_controls(struct imx334 *imx334, if (ret) return ret; + ret = __v4l2_ctrl_modify_range(imx334->pclk_ctrl, mode->pclk, + mode->pclk, 1, mode->pclk); + if (ret) + return ret; + ret = __v4l2_ctrl_modify_range(imx334->hblank_ctrl, mode->hblank, mode->hblank, 1, mode->hblank); if (ret) @@ -698,6 +705,8 @@ static int imx334_set_ctrl(struct v4l2_ctrl *ctrl) pm_runtime_put(imx334->dev); break; + case V4L2_CID_PIXEL_RATE: + case V4L2_CID_LINK_FREQ: case V4L2_CID_HBLANK: ret = 0; break;