From patchwork Thu Feb 22 06:22:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Skvortsov X-Patchwork-Id: 204574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp64354dyb; Wed, 21 Feb 2024 22:23:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWoh5raJf2GpKPxf9IsUZCrb891nNWZZPLTosy7sA9SfzM0WROcpg6ue6OpEl8Pfxy+FIr7YnqGJkC/LPuHYQtHkALH6g== X-Google-Smtp-Source: AGHT+IEAA3Uz6mXWLPDDl2yPiZDv0z6fYvdaMufrSKfxJ2cQy6luOJGKGZxBWPDKdR5O0pzGLm1J X-Received: by 2002:a17:902:ed4c:b0:1db:fed2:7a90 with SMTP id y12-20020a170902ed4c00b001dbfed27a90mr2008974plb.29.1708583029341; Wed, 21 Feb 2024 22:23:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708583029; cv=pass; d=google.com; s=arc-20160816; b=p7J+WXw661Z/IFLcV03JIMWLROfF/0VUckuzh7SircbGRnRXrTNhfY73c2P+2h+gYE 2u8+0ojn+r5yxWjOCODTfqsPU0WlzaZujLaWJ5M03lj974pJhohHQZYv0Lx5kGHZjiUr F9Vq6E+P3hC+GsFHzq82yDO7yooVqX9gjwreN1c4s6W+UqLWQ7NPDJ5/PlUMBYlD7jF5 fOZvXkhyCC6PmMNolCHjERZDC/ka+1blqe3cDA3QT7oZPQZeKq0YApnBrjffUAF6qUiT NAV3CqB6pP0NTYRGegTAnU4iFYs9LTyBXn6d59ovFTpyuQnXCpuBxvwOdLC6SuHGRnip cE9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=U5JGI2+oNzQGJrEAe98nuh6vyQ6RUCgO7wKW8s1KZo0=; fh=fbw7lU42GYiwN67f8m1INdSygnPFFK24z51oWgcXRno=; b=nYLrX8Yp2Z3H2vHYuz7zzSUSQDiCtcC6IX4B3LxJLVMPf1WW1lmvezxweVhNtqBXPO ddc8b/cN8+HzrcF3sOeCphJBXFLlgENfApgDy58vnFdFBndspLwZmtjeDPK4edhiB6rX 12xNhoRIK//4yZQzvp+PqA4BwLZG/FaLIWinBB4F6kZNW1b3ZE0DgP3aWfKfp9U6zk5O ewlqQNXxA5T4q1y4dynHxB4QbU5WVqtCJTneAOK5n/zmYOK/iHif6KGQVMaN3QrR4DPr wsL0WrQsYJwQeXiCg2dAnJgTlLNhm8P4/OlTOK8t6AZ1dKrI+XVpbMl7JMwWjIjDs966 XJ9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hlujfPRz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75978-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75978-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y5-20020a17090322c500b001dbcb39dd7csi9195304plg.198.2024.02.21.22.23.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 22:23:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75978-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hlujfPRz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75978-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75978-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 61C31B23DDE for ; Thu, 22 Feb 2024 06:23:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F08A41799C; Thu, 22 Feb 2024 06:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hlujfPRz" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3202182BE; Thu, 22 Feb 2024 06:22:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708582957; cv=none; b=G7VguSG/hA2fbPV+wyhU43OxqQxUKD3ehU5y1390YnxV9MjTFFtLJOM5PFWUroCbZY+NV6CMppMI02IyVMkKV0yh0v+lCVP9x+yD/BIgfn5BT9XnX1jS1WTAUlwKuW2Aq+ibrIt0J8acVUIiChDIykDstKD6TLktv4e69KteVp8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708582957; c=relaxed/simple; bh=vIsSLGDNtUSIiU6tl1KOY8sKDArMa+47j5IPg6SrZSw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Brci+1KOXB3DeKFhaijXvKVSpYGbpr7bx9ypNlsP4gyTYcol+nIO4iyDArhIOM1+kjIF97khxKElHYDo9d7ZzECZqH3M1afdZPP9KSuUYL0IOlmfLyGPVzB8TGPwYQo/OkCcaewWMOdbDN6gps9e5VR+antw88ynbbxUcJRkyvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hlujfPRz; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-512db550e3fso451356e87.2; Wed, 21 Feb 2024 22:22:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708582953; x=1709187753; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U5JGI2+oNzQGJrEAe98nuh6vyQ6RUCgO7wKW8s1KZo0=; b=hlujfPRzdzi0RhjO+E36UzZlZZ0Fr6woxWpZPdEzt5HpS3LfkHTnzOvJMd90SRyFOQ nFDtvNJky14iVlSPFyz9Xs4ZIQzT3ZfMENk4jFjosBWlC5P5+QG9znyNIDf/EGsdNnKQ 1q2oFpSKDfbCM6Ltsbt/LTmDfw+lPhqOUMLVseS1H1ISIAC80/UntgRtKoHcH4usiibS d205VDi8lhbXsOHgN+uWWdHoIYNcj6CfTS9hHaQdmYpdUcVnLNail+bAWDtW3Fxo2G9n 7L+J8ubX/zbLdTzsDX9PVynmg8/R4L+2UPJm2DWvccLY6N2GHhNRT96TfG7iEyzzQSS3 md8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708582953; x=1709187753; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U5JGI2+oNzQGJrEAe98nuh6vyQ6RUCgO7wKW8s1KZo0=; b=k3zfdLQ/8XjpHY0N+tU3FhoAWyfed/H+N4F/q/HCgxE3EheGWqepBLrdMy82F15O1V GMQkdAvtWBo7YGbvPbDXtcJrcFyDEADlx7zTOphxB58OtgWqSW3Z9w8xXlXqUTuIkxsu Xn25O3r2dEforP5AbLPwCrLuLlYWif/OD5Vwfw77Mz3EOumqzl77NiQL/kjnS7ThZv5k xS2fLkZ9wE3cgdSXAN64/qAUoCpD778DdyExkfIE3VUJjMkfpSoPJv3zaZY0m9ac7QVf 2m1Dva5KTKWBDGV72Vme00DrmtFn2jM7rsJ1NJ10bpNlR7aPfvEcQVMZtef2Zo7lLmxY WSxg== X-Forwarded-Encrypted: i=1; AJvYcCW+nUEJghq+8N1ndJ2XzOtoYROEIhtbNMz7ZozbJIxnOMzGl2nTyJceeYFalE22u65hKOBNWrcPXj+05mToin/cHYQCAk39P8jvZ6KbyaVGO5wS2ZrmQW/vwmXwkbMPCPXITIy/EUIfDC9+GMPIQNfka+1+SbyraEtTgiOuG7cDZrpDpHnY X-Gm-Message-State: AOJu0YyaNKcMHxWnzd3jAuNo/W0p8VMcrPtIgnEVMBu2VHaQlD7scCZ8 gVXQriHwtWugiQluRup/yAGc16+7NdFvTFEivB2mGH4QFpKLVD61 X-Received: by 2002:a05:6512:3a7:b0:512:b37f:a9ae with SMTP id v7-20020a05651203a700b00512b37fa9aemr5910127lfp.63.1708582952671; Wed, 21 Feb 2024 22:22:32 -0800 (PST) Received: from localhost.localdomain ([2a05:3580:f312:6c02:29d4:49b1:c3dc:494c]) by smtp.gmail.com with ESMTPSA id e8-20020a05651236c800b0051296788949sm1945574lfs.232.2024.02.21.22.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 22:22:30 -0800 (PST) From: Andrey Skvortsov To: Sakari Ailus , Alain Volmat , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ond=C5=99ej_Jirman?= , Pavel Machek , Arnaud Ferraris , Andrey Skvortsov , Krzysztof Kozlowski Subject: [PATCH v2 1/2] dt-bindings: media: i2c: add galaxycore,gc2145 DVP bus support Date: Thu, 22 Feb 2024 09:22:13 +0300 Message-ID: <20240222062214.2627810-2-andrej.skvortzov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222062214.2627810-1-andrej.skvortzov@gmail.com> References: <20240222062214.2627810-1-andrej.skvortzov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791579159007944731 X-GMAIL-MSGID: 1791579159007944731 Signed-off-by: Andrey Skvortsov Acked-by: Krzysztof Kozlowski --- .../bindings/media/i2c/galaxycore,gc2145.yaml | 65 ++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml index 1726ecca4c77..3ca5bb94502d 100644 --- a/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml +++ b/Documentation/devicetree/bindings/media/i2c/galaxycore,gc2145.yaml @@ -61,8 +61,38 @@ properties: properties: link-frequencies: true + bus-type: + enum: + - 4 # CSI-2 D-PHY + - 5 # Parallel + default: 4 + + bus-width: + const: 8 + + hsync-active: + enum: [0, 1] + default: 1 + + vsync-active: + enum: [0, 1] + default: 1 + + pclk-sample: + enum: [0, 1] + default: 1 + required: - - link-frequencies + - bus-type + + allOf: + - if: + properties: + bus-type: + const: 4 + then: + required: + - link-frequencies required: - endpoint @@ -84,6 +114,7 @@ additionalProperties: false examples: - | + #include #include i2c { @@ -103,6 +134,7 @@ examples: port { endpoint { remote-endpoint = <&mipid02_0>; + bus-type = ; data-lanes = <1 2>; link-frequencies = /bits/ 64 <120000000 192000000 240000000>; }; @@ -110,4 +142,35 @@ examples: }; }; + - | + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + camera@3c { + compatible = "galaxycore,gc2145"; + reg = <0x3c>; + clocks = <&clk_ext_camera>; + iovdd-supply = <&scmi_v3v3_sw>; + avdd-supply = <&scmi_v3v3_sw>; + dvdd-supply = <&scmi_v3v3_sw>; + powerdown-gpios = <&mcp23017 3 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; + reset-gpios = <&mcp23017 4 (GPIO_ACTIVE_LOW | GPIO_PUSH_PULL)>; + + port { + endpoint { + remote-endpoint = <¶llel_from_gc2145>; + bus-type = ; + bus-width = <8>; + hsync-active = <1>; + vsync-active = <1>; + pclk-sample = <1>; + }; + }; + }; + }; + ... From patchwork Thu Feb 22 06:22:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Skvortsov X-Patchwork-Id: 204573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp64322dyb; Wed, 21 Feb 2024 22:23:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX6cQMGwa5rKwhGNEZInH9Ipi9LCzY+FSsx/OvEJhPx4FeiNSCl09i2ce/s4o4W5rujtOmEUwBiLb84VXZS99XRo2exWw== X-Google-Smtp-Source: AGHT+IHaqqK05C7sp0RRXNc4BoOuQ3tqePnaW3Bj3qSbVcUNpy+F6ajHDJX3atPsHkzxCwWIifkw X-Received: by 2002:a05:6402:b38:b0:564:aa2c:a6e0 with SMTP id bo24-20020a0564020b3800b00564aa2ca6e0mr5782523edb.4.1708583020444; Wed, 21 Feb 2024 22:23:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708583020; cv=pass; d=google.com; s=arc-20160816; b=pNMU7qUyLql/QX71S01FCHTNPSFDtB1Iz9Zhzb6WwzJzr0VrKSw1v1VPrYCA0Q4Ocq cDkOujce90891s0oaZlg1rZjWggETSnyQCssihnN2aAOBj8pbFJS5urcxncJVOBR2NkZ Zj4gdo0lRhF/IfCsZwqsLar8L8cKGsPsZCmmCi2iqJpl4x3HiHX9w5FTyzT5hTTK9fyl u5zJhLrOnNFfcVpBWmQ4tjZHfrx1pCPRdrzMafEiDq76pjrKZ/XL61eA/c6wQU3GNNp/ vuI/bQ1BQS1HHJzS+7DOLXedhqIcUZex4Kio1nCuDLCJKQgyt2CJjxurSpsFFOtGUoKZ tXbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8HAmPH36vkNVR/rLtY2ZH6iPhLV0i4g5sTx72BRLCdw=; fh=g9Uxuvq9+3pnUwgJkVairze4juiCLQv5R9br2ka8XPE=; b=jxnLHfafueWUAR/+vWKARHpPslYRAs/QPdIUXdJZjRh7JBKMUexBy91cVOjaFe4/KF 2mwoubTyVJ6bVFG/wLgWGS/P56fLHGGgMHCDr2mu62cT9wAvrX8dVgref7e8nEuxMtOg HnY1715wn4J98k9EQ8MH0O4yBAiNIOc2/V7qMOhUK+exXVeVkIudz+iwEx4Rax/PEBA0 qP6M9Jdn9bd8KZDF+/jPsP7Shrqpzz6/3G9ftr7jloV7Zi9456dDJ58vRK3U1wHpTQIP IFFFmyxIWDuqc8JvmMi1yzZ82K9op5mg5eRGp/6m1/XlgZNkYMt612voON+grmP7hDuH ceuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XZ5Ea6HR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75979-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75979-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t28-20020a50d71c000000b005645b115772si3816519edi.220.2024.02.21.22.23.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 22:23:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75979-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XZ5Ea6HR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-75979-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75979-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DDC6A1F234DA for ; Thu, 22 Feb 2024 06:23:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5524B1B5A0; Thu, 22 Feb 2024 06:22:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XZ5Ea6HR" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED208182BE; Thu, 22 Feb 2024 06:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708582962; cv=none; b=b8WKFNs9bJuTde3R62w8kzCKx3Jj2oB9xOXgNKRNQmEszsUl+JO3tosgWdd365vvfUitKR9nNAm7dbJn7NxX5JIZyrVi4GzCtnA8cbOKFcUg3B1zzAJQkTco0NlK1b98d290yZG1HedJP2FOb8Ja0h4bzKYFJm1zzD4LPzF7NPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708582962; c=relaxed/simple; bh=CiNzg6Yp843nKshqdagjyTnr1I83W2fCS43AP+wDXEQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CF8JtBf379LDeNGugZ/uZD3XbU7ihqRCRAKl1wp/Mywc87jWUzmyiUhOdTLYy8gfAhTLCrBFWRrkMIlQs+K45eNwF+nV63U4wQLfKchj9atjf9ALXHqCDnwo2334nybu7jz8y5EkYphOUlC7NI42y8c9HPpXq9lB4kfRA28gRa8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XZ5Ea6HR; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-512b3b04995so1518215e87.3; Wed, 21 Feb 2024 22:22:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708582959; x=1709187759; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8HAmPH36vkNVR/rLtY2ZH6iPhLV0i4g5sTx72BRLCdw=; b=XZ5Ea6HR6HWmn252b6QRJkZaNoQY39bzkzHZ9CC7r2/lslHz+6uSEUkvZkTPfAqEL6 /sGPpzjyPRyfb3AlUe+0HIEZQ1O6/RNAg/T0B5eb/LaGC9O5gJjrdUun172ptFVrS+el gjZDxTaub8+I6VmdrujS//bwJ9a3F/LUATLG9mgV4tpur47/36MbhYdQUc5uKZj25HHX 4f137iKsk61wAd3ROauqVM/TGXrPTSHD7g7EUDpxKkz516if5iBolQ5kShCf1tD3uEj5 NvEUOuXmn+LyWLNAxAETtK/CzQWg6eqDBVeJ5qF1g2E+AUZph8scy5TU+TJYsNZvfojL 2FtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708582959; x=1709187759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8HAmPH36vkNVR/rLtY2ZH6iPhLV0i4g5sTx72BRLCdw=; b=olTiIhnn6JS3dy0uDrOlHfIjtD6knRFHMe46J4RweKbv7t/FGNcU4tv1yAZVYUuY8Q RBQ3owdbLmTeFFUuUlfzmclCcaRyig3kGw7G4m06fPFIc15VuoQOxUXKJh2z0dpnzW/v JWcE7zlvhWd7k8FXZFefCOlaDVVaVtDjbZSFwzADfwMRchkuGEf4Usm9Ipe/aPnLYOW+ v4hsTen1uBvnQ4NcrkD12bA6XAgKvMwNzUcZDWUZmfIrTyYIbuddVGMpFslBDb1Xoc62 bJT2ilhQwxa0bDgsl/93UA7mT3y2Kys7cYXFPQoqhvFM82qk6ul2ZMG4onzLBLu8BE3s 7B9Q== X-Forwarded-Encrypted: i=1; AJvYcCWq7DKFqh+kw0O+OcE38Mv6yW+KqVPC/Lj5+8pcgOSSHmyta/ywUY9nG3jeK+XURgkW1TPbLrAcV8V8KpD9L81Jub5df6fLGrwfQgAL+5VU6MD2IsxLJLmV58pOvZ08Y3B0tB8qAPkj9QSfPt5V0WjnOhy4CHK5cDeGFYAW0+1v0vKToR8z X-Gm-Message-State: AOJu0YzNF4VXbMRd+9pU2I7ut0TEgVGvQG4vBN5cQVhubbMIaGTQXaw0 u1Ushsu61ykGyIngyAZfIuc9vZYCl5ykcASWt9wAGP5brf6EuB/y X-Received: by 2002:ac2:4c4b:0:b0:512:bfb7:6d2c with SMTP id o11-20020ac24c4b000000b00512bfb76d2cmr5768401lfk.53.1708582958982; Wed, 21 Feb 2024 22:22:38 -0800 (PST) Received: from localhost.localdomain ([2a05:3580:f312:6c02:29d4:49b1:c3dc:494c]) by smtp.gmail.com with ESMTPSA id e8-20020a05651236c800b0051296788949sm1945574lfs.232.2024.02.21.22.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 22:22:37 -0800 (PST) From: Andrey Skvortsov To: Sakari Ailus , Alain Volmat , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?utf-8?q?Ond=C5=99ej_Jirman?= , Pavel Machek , Arnaud Ferraris , Andrey Skvortsov Subject: [PATCH v2 2/2] media: gc2145: implement basic dvp bus support Date: Thu, 22 Feb 2024 09:22:14 +0300 Message-ID: <20240222062214.2627810-3-andrej.skvortzov@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222062214.2627810-1-andrej.skvortzov@gmail.com> References: <20240222062214.2627810-1-andrej.skvortzov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791579148958976722 X-GMAIL-MSGID: 1791579148958976722 Signed-off-by: Andrey Skvortsov --- drivers/media/i2c/gc2145.c | 122 +++++++++++++++++++++++++++++-------- 1 file changed, 96 insertions(+), 26 deletions(-) diff --git a/drivers/media/i2c/gc2145.c b/drivers/media/i2c/gc2145.c index bef7b0e056a8..2c5c9f3de5ff 100644 --- a/drivers/media/i2c/gc2145.c +++ b/drivers/media/i2c/gc2145.c @@ -39,6 +39,10 @@ #define GC2145_REG_ANALOG_MODE1 CCI_REG8(0x17) #define GC2145_REG_OUTPUT_FMT CCI_REG8(0x84) #define GC2145_REG_SYNC_MODE CCI_REG8(0x86) +#define GC2145_SYNC_MODE_VSYNC_POL BIT(0) +#define GC2145_SYNC_MODE_HSYNC_POL BIT(1) +#define GC2145_SYNC_MODE_OPCLK_POL BIT(2) +#define GC2145_SYNC_MODE_OPCLK_GATE BIT(3) #define GC2145_SYNC_MODE_COL_SWITCH BIT(4) #define GC2145_SYNC_MODE_ROW_SWITCH BIT(5) #define GC2145_REG_BYPASS_MODE CCI_REG8(0x89) @@ -53,6 +57,12 @@ #define GC2145_REG_GLOBAL_GAIN CCI_REG8(0xb0) #define GC2145_REG_CHIP_ID CCI_REG16(0xf0) #define GC2145_REG_PAD_IO CCI_REG8(0xf2) +#define GC2145_REG_PLL_MODE1 CCI_REG8(0xf7) +#define GC2145_REG_PLL_MODE2 CCI_REG8(0xf8) +#define GC2145_REG_CM_MODE CCI_REG8(0xf9) +#define GC2145_REG_CLK_DIV_MODE CCI_REG8(0xfa) +#define GC2145_REG_ANALOG_PWC CCI_REG8(0xfc) +#define GC2145_REG_PAD_IO CCI_REG8(0xf2) #define GC2145_REG_PAGE_SELECT CCI_REG8(0xfe) /* Page 3 */ #define GC2145_REG_DPHY_ANALOG_MODE1 CCI_REG8(0x01) @@ -598,6 +608,7 @@ struct gc2145 { struct v4l2_subdev sd; struct media_pad pad; + struct v4l2_fwnode_endpoint ep; /* the parsed DT endpoint info */ struct regmap *regmap; struct clk *xclk; @@ -773,6 +784,38 @@ static int gc2145_set_pad_format(struct v4l2_subdev *sd, return 0; } +static int gc2145_config_dvp_mode(struct gc2145 *gc2145, + const struct gc2145_format *gc2145_format) +{ + int ret = 0; + u64 sync_mode; + int flags; + + flags = gc2145->ep.bus.parallel.flags; + + ret = cci_read(gc2145->regmap, GC2145_REG_SYNC_MODE, &sync_mode, NULL); + if (ret) + return ret; + + sync_mode &= ~(GC2145_SYNC_MODE_VSYNC_POL | + GC2145_SYNC_MODE_HSYNC_POL | + GC2145_SYNC_MODE_OPCLK_POL); + + if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW) + sync_mode |= GC2145_SYNC_MODE_VSYNC_POL; + + if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW) + sync_mode |= GC2145_SYNC_MODE_HSYNC_POL; + + if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) + sync_mode |= GC2145_SYNC_MODE_OPCLK_POL; + + cci_write(gc2145->regmap, GC2145_REG_SYNC_MODE, sync_mode, &ret); + cci_write(gc2145->regmap, GC2145_REG_PAD_IO, 0x0f, &ret); + + return ret; +} + static const struct cci_reg_sequence gc2145_common_mipi_regs[] = { {GC2145_REG_PAGE_SELECT, 0x03}, {GC2145_REG_DPHY_ANALOG_MODE1, GC2145_DPHY_MODE_PHY_CLK_EN | @@ -895,10 +938,13 @@ static int gc2145_start_streaming(struct gc2145 *gc2145, goto err_rpm_put; } - /* Perform MIPI specific configuration */ - ret = gc2145_config_mipi_mode(gc2145, gc2145_format); + /* Perform interface specific configuration */ + if (gc2145->ep.bus_type == V4L2_MBUS_CSI2_DPHY) + ret = gc2145_config_mipi_mode(gc2145, gc2145_format); + else + ret = gc2145_config_dvp_mode(gc2145, gc2145_format); if (ret) { - dev_err(&client->dev, "%s failed to write mipi conf\n", + dev_err(&client->dev, "%s failed to write interface conf\n", __func__); goto err_rpm_put; } @@ -924,6 +970,9 @@ static void gc2145_stop_streaming(struct gc2145 *gc2145) GC2145_CSI2_MODE_EN | GC2145_CSI2_MODE_MIPI_EN, 0, &ret); cci_write(gc2145->regmap, GC2145_REG_PAGE_SELECT, 0x00, &ret); + + /* Disable dvp streaming */ + cci_write(gc2145->regmap, GC2145_REG_PAD_IO, 0x00, &ret); if (ret) dev_err(&client->dev, "%s failed to write regs\n", __func__); @@ -1233,9 +1282,8 @@ static int gc2145_init_controls(struct gc2145 *gc2145) static int gc2145_check_hwcfg(struct device *dev) { struct fwnode_handle *endpoint; - struct v4l2_fwnode_endpoint ep_cfg = { - .bus_type = V4L2_MBUS_CSI2_DPHY - }; + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct gc2145 *gc2145 = to_gc2145(sd); int ret; endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL); @@ -1244,36 +1292,57 @@ static int gc2145_check_hwcfg(struct device *dev) return -EINVAL; } - ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &ep_cfg); + + gc2145->ep.bus_type = V4L2_MBUS_CSI2_DPHY; + ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &gc2145->ep); + if (ret) { + gc2145->ep.bus_type = V4L2_MBUS_PARALLEL; + ret = v4l2_fwnode_endpoint_alloc_parse(endpoint, &gc2145->ep); + } fwnode_handle_put(endpoint); - if (ret) + if (ret) { + dev_err(dev, "could not parse endpoint\n"); return ret; - - /* Check the number of MIPI CSI2 data lanes */ - if (ep_cfg.bus.mipi_csi2.num_data_lanes != 2) { - dev_err(dev, "only 2 data lanes are currently supported\n"); - ret = -EINVAL; - goto out; } - /* Check the link frequency set in device tree */ - if (!ep_cfg.nr_of_link_frequencies) { - dev_err(dev, "link-frequency property not found in DT\n"); + switch (gc2145->ep.bus_type) { + case V4L2_MBUS_CSI2_DPHY: + /* Check the link frequency set in device tree */ + if (!gc2145->ep.nr_of_link_frequencies) { + dev_err(dev, "link-frequencies property not found in DT\n"); + ret = -EINVAL; + goto out; + } + + /* Check the number of MIPI CSI2 data lanes */ + if (gc2145->ep.bus.mipi_csi2.num_data_lanes != 2) { + dev_err(dev, "only 2 data lanes are currently supported\n"); + ret = -EINVAL; + goto out; + } + + if (gc2145->ep.nr_of_link_frequencies != 3 || + gc2145->ep.link_frequencies[0] != GC2145_640_480_LINKFREQ || + gc2145->ep.link_frequencies[1] != GC2145_1280_720_LINKFREQ || + gc2145->ep.link_frequencies[2] != GC2145_1600_1200_LINKFREQ) { + dev_err(dev, "Invalid link-frequencies provided\n"); + ret = -EINVAL; + goto out; + } + break; + + case V4L2_MBUS_PARALLEL: + break; + default: + dev_err(dev, "unsupported bus type %u\n", gc2145->ep.bus_type); ret = -EINVAL; goto out; } - if (ep_cfg.nr_of_link_frequencies != 3 || - ep_cfg.link_frequencies[0] != GC2145_640_480_LINKFREQ || - ep_cfg.link_frequencies[1] != GC2145_1280_720_LINKFREQ || - ep_cfg.link_frequencies[2] != GC2145_1600_1200_LINKFREQ) { - dev_err(dev, "Invalid link-frequencies provided\n"); - ret = -EINVAL; - } + return 0; out: - v4l2_fwnode_endpoint_free(&ep_cfg); - + v4l2_fwnode_endpoint_free(&gc2145->ep); return ret; } @@ -1421,6 +1490,7 @@ static void gc2145_remove(struct i2c_client *client) if (!pm_runtime_status_suspended(&client->dev)) gc2145_power_off(&client->dev); pm_runtime_set_suspended(&client->dev); + v4l2_fwnode_endpoint_free(&gc2145->ep); } static const struct of_device_id gc2145_dt_ids[] = {