From patchwork Fri Nov 25 05:08:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shravan chippa X-Patchwork-Id: 13055534 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 E7A9DC4332F for ; Fri, 25 Nov 2022 05:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbiKYFJQ (ORCPT ); Fri, 25 Nov 2022 00:09:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbiKYFJE (ORCPT ); Fri, 25 Nov 2022 00:09:04 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB48028727; Thu, 24 Nov 2022 21:09:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669352944; x=1700888944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GMVRwSHQ1d1bppR8aOD0mgZ9k9ac8N+YUIDRalV7lhM=; b=WfDy/eKGqfqKvwKKd0X5RS2nIj2/UD4EbcJFBQHBhy5dRGF8/dlPIwH6 lfrNyyxdyl+OjZhdFmaTIMdGb2z2CLBy/ccQ6MKCJi7FjzC6/Bar2QIEP dlm+/Kq9IJ7g99Of0fiRcuCiAff8dc6fEJe5Az9EkEz6ocZ6PSm1r6pYn MahK9PS20iS/3/DgWnNd+ULM6w8tJJeoIis2YyMkk60rrsdslOOTG18bD wb08N8s0bpLb/a8hZOeOxMBfqae33vq3qdKj2V3DaIIa81l6WpM+b2B6I aHIFEIbBEMsdbi6I4PLJDCMjKYJsC6X7kA81gT3+9vD/+pVwm8fNVMUH0 Q==; X-IronPort-AV: E=Sophos;i="5.96,192,1665471600"; d="scan'208";a="185123096" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Nov 2022 22:09:03 -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; Thu, 24 Nov 2022 22:09:02 -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; Thu, 24 Nov 2022 22:09:00 -0700 From: shravan kumar To: , , CC: , , "Shravan Chippa" , Sakari Ailus Subject: [PATCH v5 6/6] media: i2c: imx334: updating pixel and link frequency Date: Fri, 25 Nov 2022 10:38:07 +0530 Message-ID: <20221125050807.1857479-7-shravan.chippa@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221125050807.1857479-1-shravan.chippa@microchip.com> References: <20221125050807.1857479-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 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 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index 0e5575604d87..ec77835d94a2 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 */ @@ -471,7 +473,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, @@ -601,6 +603,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, IMX334_REG_MIN, IMX334_REG_MAX, 1, mode->hblank); if (ret) @@ -700,6 +707,10 @@ 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: + ret = 0; break; default: dev_err(imx334->dev, "Invalid control %d", ctrl->id);