From patchwork Fri Dec 20 13:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Apitzsch_via_B4_Relay?= X-Patchwork-Id: 852671 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 624BB2163A3; Fri, 20 Dec 2024 13:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701194; cv=none; b=WYE5s/u8Mf7DGcKlN0zovUZIMou2PxqOOoC7vuuK9yjx71xtQjOwPEOVtxkiHfLPNVeuxXVheff4Jgus3KJCYhIzINlGBdvLVFRGvvmAL0eaIq0v/gunn+plFjDN+7N78y7dZdiYPw8Ix5pFSGihCtlgb4AnNRteRivKhNHWwts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734701194; c=relaxed/simple; bh=Ld7YTXvBxZPDIj+jtmVBVzOpYRHENGO3HL8vAxNnog4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qlym5H3Swpi+S/fj8fuBRyNeLPSi9CWfAUbhoaTbQmMZYx1tAMGvTuFuTc+8njtnIm84BIc3iR/yl1RbaIKnDbxVRYtiJCG4plXqwDpe8cTf0dYj3byrvd7caFcJyYudSVytjTPPJ7gpToAmbrNzQ6sGcrlkPr3bsqW3fnDL6v8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WZhuG3L9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WZhuG3L9" Received: by smtp.kernel.org (Postfix) with ESMTPS id 105E9C4CEE6; Fri, 20 Dec 2024 13:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734701194; bh=Ld7YTXvBxZPDIj+jtmVBVzOpYRHENGO3HL8vAxNnog4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=WZhuG3L9X+wGnoz12Gk+6m+rTyhtJjHXVsSPn5uGbaB/QNRVtZuwhHvRrxeHudpp4 OL+G/FisOyyzITFKoe2EeUHl6MoayZ9nyy+qKOLHsjUim1uUViVhbh07fHrWSi9B2y /uBu7khbtjY/aXkvNGG7SIG/DANf7S9D7DjKT5A6o3zasPSw+3qt4nm9vqynttlTMN yHXVWuvGBW+GKsq0O7ibVOLid3ztWqSLfElJHqO1g4GYem7HSw9wo5+436yogzDmLF 9ORPuoLDy1E51lHhJ9OxIs23iDZjlH/Ml+5Dhj2mDuk3pQiIKpOgNLNMY6zFeBMbYU UvJqAxuyAovwg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 049CCE7718C; Fri, 20 Dec 2024 13:26:34 +0000 (UTC) From: =?utf-8?q?Andr=C3=A9_Apitzsch_via_B4_Relay?= Date: Fri, 20 Dec 2024 14:26:05 +0100 Subject: [PATCH v6 06/13] media: i2c: imx214: Check number of lanes from device tree Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-imx214-v6-6-d90a185d82e5@apitzsch.eu> References: <20241220-imx214-v6-0-d90a185d82e5@apitzsch.eu> In-Reply-To: <20241220-imx214-v6-0-d90a185d82e5@apitzsch.eu> To: Ricardo Ribalda , Sakari Ailus , Mauro Carvalho Chehab Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Dave Stevenson , Vincent Knecht , =?utf-8?q?Andr=C3=A9_Apitzsch?= , Ricardo Ribalda X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734701191; l=2286; i=git@apitzsch.eu; s=20240325; h=from:subject:message-id; bh=kGBTGQW3yjp+KF2H7SRL1ipKMVJ3Z0zLTnYkR0YvOEk=; b=m624UWQljSG0cT7UOMIEXmOcBa2mjZjtz0B83DKKoOCKxyRiwfruTP29Q4w0gbl5LdewqDRJM UEZo0y3qsbSDRIDGBdktBlCouzwy+Hd/5wvnCcx4ansZiCGczfWGzlV X-Developer-Key: i=git@apitzsch.eu; a=ed25519; pk=wxovcZRfvNYBMcTw4QFFtNEP4qv39gnBfnfyImXZxiU= X-Endpoint-Received: by B4 Relay for git@apitzsch.eu/20240325 with auth_id=142 X-Original-From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Reply-To: git@apitzsch.eu From: André Apitzsch The imx214 camera is capable of either two-lane or four-lane operation. Currently only the four-lane mode is supported, as proper pixel rates and link frequences for the two-lane mode are unknown. Acked-by: Ricardo Ribalda Signed-off-by: André Apitzsch --- drivers/media/i2c/imx214.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 4e9a8e0e2c5f2ac3fd72be06906979dcd3aaa2a4..4f6c4f845a7ab36c7674a4ce8c1664d48e46c4d0 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -197,7 +197,6 @@ struct imx214 { /*From imx214_mode_tbls.h*/ static const struct cci_reg_sequence mode_4096x2304[] = { - { IMX214_REG_CSI_LANE_MODE, IMX214_CSI_4_LANE_MODE }, { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF }, { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH }, { IMX214_REG_EXPOSURE_RATIO, 1 }, @@ -270,7 +269,6 @@ static const struct cci_reg_sequence mode_4096x2304[] = { }; static const struct cci_reg_sequence mode_1920x1080[] = { - { IMX214_REG_CSI_LANE_MODE, IMX214_CSI_4_LANE_MODE }, { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF }, { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH }, { IMX214_REG_EXPOSURE_RATIO, 1 }, @@ -787,6 +785,13 @@ static int imx214_start_streaming(struct imx214 *imx214) return ret; } + ret = cci_write(imx214->regmap, IMX214_REG_CSI_LANE_MODE, + IMX214_CSI_4_LANE_MODE, NULL); + if (ret) { + dev_err(imx214->dev, "failed to configure lanes\n"); + return ret; + } + state = v4l2_subdev_get_locked_active_state(&imx214->sd); fmt = v4l2_subdev_state_get_format(state, 0); mode = v4l2_find_nearest_size(imx214_modes, ARRAY_SIZE(imx214_modes), @@ -951,6 +956,13 @@ static int imx214_parse_fwnode(struct device *dev) goto done; } + /* Check the number of MIPI CSI2 data lanes */ + if (bus_cfg.bus.mipi_csi2.num_data_lanes != 4) { + ret = dev_err_probe(dev, -EINVAL, + "only 4 data lanes are currently supported\n"); + goto done; + } + for (i = 0; i < bus_cfg.nr_of_link_frequencies; i++) if (bus_cfg.link_frequencies[i] == IMX214_DEFAULT_LINK_FREQ) break;