From patchwork Mon Oct 9 13:09:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731288 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 072A5E95A91 for ; Mon, 9 Oct 2023 13:10:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376747AbjJINKD (ORCPT ); Mon, 9 Oct 2023 09:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376781AbjJINKB (ORCPT ); Mon, 9 Oct 2023 09:10:01 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8B6793; Mon, 9 Oct 2023 06:09:58 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9hMt055512; Mon, 9 Oct 2023 08:09:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856983; bh=Lz2x3xIw/kJkOKbJx/niYJH/N0ewRr5xZQck2iUm7x0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=B7zVxk8H83ezeoHAY3h34LXQOTdmhymSr2IzCbeW+R+Z4/CRGGnzJaA2zAiXTvizL iHWwetwRcEKd5TsYNIMUCLBU+lzOER2+CZIpBncTSuKFPTJ/pNgiHmB5nFs9LtVRVB Vvtzlunpa3y5b5kZXQmDM2k3OwvbWyuNWbNHjpQY= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9hAD076964 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:43 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:43 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:42 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9gd0055488; Mon, 9 Oct 2023 08:09:42 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 01/13] media: dt-bindings: Make sure items in data-lanes are unique Date: Mon, 9 Oct 2023 18:39:27 +0530 Message-ID: <20231009-upstream_csi-v10-1-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1388; i=j-luthra@ti.com; h=from:subject:message-id; bh=OCxVyiBNv/iKEBoQi4+IK0XyQm++LE8DE/EIGdFNE6Q=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/slBKH+PkDCYAQAJv4U95j33kYS7kF8cIYg6 bVOJONCs3OJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7JQAKCRBD3pH5JJpx RSe3EACMzIvgxPmloW2hDwypwO0Yexi5djPKJq0LRH/Zv+4tycwi3VmARg/n77w+HnFKOXlG0Vo 6xEPIxMPrJazPQDEuw0y7UOfeIx0OGIxE5nH6ul4x4ZAiofrA5gjJtPPlJ7tC0Of7R49BtomHeS V/sC1xqjEe7/j22AAmwmBwIYBDWR2425ahfK2lYgNHZ+PI69rQgXjgWouIBFrIiIrQGF5/9++fN 3HVJJJSkwZ54WC+hZDWFistPIPWxtf1q8zyHg1wTRgl5tAmv5hQFUlGv22xEiCtQ1biiwP/77jw gHBz7yv5/Y3hBS2QsCxhOY+P/TY4ddJruSJYGoODYxZxak89apPCx61iutEtNaEQ+NqOSiPw7iy SL7a/VS70w//H/2pVy0kPuSsHkYMvqcB7R7cQc/vwuEPMK/5IW9AlKLbz1yeOuuI85Jdc7GQA1S mUfsNdEl6kH5bsDfKX4M5fuFdStA8UQpTY8arTu6Or6+V4xN6tUcHzGwfrTdG7lmPCVU+jreSmO 9me4lE9eIDyiq6YWo1IuugERZBkS0AB8vqHqB/jF/szrzCBzv37jQ3+AAcEEg8NCtF4LJcj967t vFZ9WB8BhqIUJpCMrqhk5U98WI8PvUGU+Wa3+krJ4D9/Rl/54e/4HyGmoEEFFePLgUs/B0YaOGl 6j+UBfcVteci6/g== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Pratyush Yadav The data-lanes property maps the logical lane numbers to the physical lane numbers. The position of an entry is the logical lane number and its value is the physical lane number. Since one physical lane can only map to one logical lane, no number in the list should repeat. Add the uniqueItems constraint on the property to enforce this. Signed-off-by: Pratyush Yadav Tested-by: Julien Massot Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Reviewed-by: Maxime Ripard Acked-by: Rob Herring Signed-off-by: Jai Luthra --- Documentation/devicetree/bindings/media/video-interfaces.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/media/video-interfaces.yaml b/Documentation/devicetree/bindings/media/video-interfaces.yaml index a211d49dc2ac..26e3e7d7c67b 100644 --- a/Documentation/devicetree/bindings/media/video-interfaces.yaml +++ b/Documentation/devicetree/bindings/media/video-interfaces.yaml @@ -160,6 +160,7 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32-array minItems: 1 maxItems: 8 + uniqueItems: true items: # Assume up to 9 physical lane indices maximum: 8 From patchwork Mon Oct 9 13:09:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731286 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 D2EE4E95A9C for ; Mon, 9 Oct 2023 13:10:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376801AbjJINKJ (ORCPT ); Mon, 9 Oct 2023 09:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376780AbjJINKE (ORCPT ); Mon, 9 Oct 2023 09:10:04 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 952FABA; Mon, 9 Oct 2023 06:10:02 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9iBd043923; Mon, 9 Oct 2023 08:09:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856984; bh=BgxjJaKkhypgGTDotppIbabHhDLsyOxiD/tKF7b/5FI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZqW54PP/AxS+p73SATwC9HUEgdTUUhWoBKhYUyzEjt12mijfuSVAdPB3iUNe6pIct 18E9IVDZ1EN3lek2sgg4TIT7sBAkRsWvXI7Yy7yeWXcddxfK2SMqQTktp7rVl7mSx7 qkO46RFBtOUdxPLsuSVCO+vBHuHZEJJW0SknWbbM= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9i7R076972 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:44 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:44 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:44 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9hPS117909; Mon, 9 Oct 2023 08:09:44 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 02/13] media: dt-bindings: cadence-csi2rx: Add TI compatible string Date: Mon, 9 Oct 2023 18:39:28 +0530 Message-ID: <20231009-upstream_csi-v10-2-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=970; i=j-luthra@ti.com; h=from:subject:message-id; bh=yrzgWB6pzGmHW+FN3ZDQrdA1db60oGi+PIM018sEEvc=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/smnhGLhA7u9h02i3/0Kd8QycjSAZBnEvf7V PPfSv3v3s+JAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7JgAKCRBD3pH5JJpx Rb5vD/9cHjnkUGH6ekQ9asA/a8pWobsNyak08z5s0JHR1M/dAGkWrqTvrQpK0o7tKRbPfUu/tkZ uZnCk1KMH+cy/K6kQXlJi6+QO8oFkdjsSPrXpo9/zXFpdwPKjzR4n+pPxHPxpAe5v7aGw/RMMlM M2RHMeejKY0UOwfFe8OSy3/GW/tqRKRz4KAfJwAJxA2QoOuBlXlxjovgpbGLCoZ8gPRM4SxAJDo BjRE6XHYo6PTdm6XL/YqXDuGUIUWZcDTeGZebV1To++Mr3BBdlPbnA80KGm+nW+3ps76XBqk38L hlAEMdgpGwVLh0Q7zSGUk2Ph2ghqM3LJnS096+sjjsTUIzAgcWCBBmmUhjc4c1l/HPYpMWBFOnU TZg31qnFf3tcX07pGKVl36xPPrX7iAcBINDpITyHjMiywVn4ZfOaoxzJ//99ZnAuNFqExcZ8vqv +UG4LdlaA3jWKr/LnTkcBkYVUOOjUTa91T5bRdOwk1b0pzN9IHyVvwpq1f+GdW+nttLhKCclJxv uIHmbEx7K5TZqlsABoALdPb2ymZhYdI90LY5YWSykFUb+oP8tx56I9fnnvqaDuvt1BSLJHU/Kca JPf5VXC+JJSq+mHTQMOWMUs4KHOswEiHPtDVLArh8jCz5vjfTHU2D+mVFFNQAvyFrJKFRfnRigj EhCIzy3U5aQEzTA== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a SoC-specific compatible string for TI's integration of this IP in J7 and AM62 line of SoCs. Tested-by: Julien Massot Reviewed-by: Maxime Ripard Reviewed-by: Laurent Pinchart Acked-by: Krzysztof Kozlowski Signed-off-by: Jai Luthra --- Documentation/devicetree/bindings/media/cdns,csi2rx.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml b/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml index 30a335b10762..2008a47c0580 100644 --- a/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml +++ b/Documentation/devicetree/bindings/media/cdns,csi2rx.yaml @@ -18,6 +18,7 @@ properties: items: - enum: - starfive,jh7110-csi2rx + - ti,j721e-csi2rx - const: cdns,csi2rx reg: From patchwork Mon Oct 9 13:09:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731287 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 DDBEAE95A9A for ; Mon, 9 Oct 2023 13:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376787AbjJINKE (ORCPT ); Mon, 9 Oct 2023 09:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376710AbjJINKD (ORCPT ); Mon, 9 Oct 2023 09:10:03 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81C92B6; Mon, 9 Oct 2023 06:10:01 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9nCW055525; Mon, 9 Oct 2023 08:09:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856989; bh=bGpb3GLN/T4dyh3nBcjV+qVV/RdD272uzDzrTHNjjwE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dl/Ioopdtg9WMkVDWs+Cfy4PUT16w9RnRKTCWRdhfPIt/XRS6iie1BXDF1Q6NC6Fu 7eCYQ1DF9lPQZpfHoaREY93giMqR/8MjcHeFiB/qrQZKX/wPkXaibjITWwCsNOKEUf 5hCYyjmqgIQyUH+/Syt0mrqj+aDfyHRKN7mBWz88= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9nat014508 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:49 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:49 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:49 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9mho117965; Mon, 9 Oct 2023 08:09:48 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 05/13] media: cadence: csi2rx: Add get_fmt and set_fmt pad ops Date: Mon, 9 Oct 2023 18:39:31 +0530 Message-ID: <20231009-upstream_csi-v10-5-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5517; i=j-luthra@ti.com; h=from:subject:message-id; bh=5t1qq9VUbX4/94lsj2wyTmgoRSNIADX7Km2mBA5J5xg=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/sp4pcyzfDa11JqnxFJADGerfjALIggwbqdU GYowoyIBVWJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7KQAKCRBD3pH5JJpx RbxbEACDhnX++uR9OkD5TCEHwglqAdls0JD6287seW81r1yg78Zi91aFAO3lUkhlMNE0XK52EL9 yvPF1dg0urNMKhfN9of+K+EGoPx1+5n85Nm4fNxSk1VPK1lHk3NQgYrlT3hf+hMVwHcOs/FgtQ0 dE5IUedCvxOpx6huEn5WTQNi5cd/qlyq+JYlOj3EXJmZuuL8dkTE9jl/lzSXkOnguBBU2SHYhKG AUd0SaGoD4IDz9y0eja6NFO1lH8VlYXBAvuZHi+FfggjRg8mgJcIJ8kjuNO6seXLbnE+WOY4Cd5 SEZLVqS2slJ9CznjN6eXEsTzLwLBaoSY/yJjM+BhQNyp2iDPRiIsXajdEtYgJdRlbG3grW8CLND GdGRpqTpcxzsiHJ61RxIWytuk+Q/585znCjyb60m8LqPCqXSSy+48sRLkdzofHELWiM6Jh202Gn +guJhHSDTl4tCEZpbJ3iZBFg+OUJS5VbusUMZj5eticHYTOywYAkR2fCxverRJveoUeh3xAOAge fegneLujgKSOAJ+gFeMjHKw1Jvhk4a4SUEaNSJb9qsUsPYjIwGlojf3TpDoowacjox4JrkhyJJm 24qYQGIyOImTt+jibY/e5YfuVoJCjzbB231t9Fot8M2iKGrJ9IBe+jUMnQRKVs9d0WrTpu/iKK+ LGU5zhxi85yEdQQ== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Pratyush Yadav The format is needed to calculate the link speed for the external DPHY configuration. It is not right to query the format from the source subdev. Add get_fmt and set_fmt pad operations so that the format can be configured and correct bpp be selected. Initialize and use the v4l2 subdev active state to keep track of the active formats. Also propagate the new format from the sink pad to all the source pads. Signed-off-by: Pratyush Yadav Tested-by: Julien Massot Reviewed-by: Maxime Ripard Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Co-developed-by: Jai Luthra Signed-off-by: Jai Luthra --- Changes in v10: - Remove redundant checks in set_fmt() as we ensure pad is SINK drivers/media/platform/cadence/cdns-csi2rx.c | 96 +++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 399b2f800dc4..f9b41451f4a4 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -61,6 +61,11 @@ enum csi2rx_pads { CSI2RX_PAD_MAX, }; +struct csi2rx_fmt { + u32 code; + u8 bpp; +}; + struct csi2rx_priv { struct device *dev; unsigned int count; @@ -95,6 +100,32 @@ struct csi2rx_priv { int source_pad; }; +static const struct csi2rx_fmt formats[] = { + { .code = MEDIA_BUS_FMT_YUYV8_1X16, .bpp = 16, }, + { .code = MEDIA_BUS_FMT_UYVY8_1X16, .bpp = 16, }, + { .code = MEDIA_BUS_FMT_YVYU8_1X16, .bpp = 16, }, + { .code = MEDIA_BUS_FMT_VYUY8_1X16, .bpp = 16, }, + { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SGBRG8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SGRBG8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .bpp = 8, }, + { .code = MEDIA_BUS_FMT_SBGGR10_1X10, .bpp = 10, }, + { .code = MEDIA_BUS_FMT_SGBRG10_1X10, .bpp = 10, }, + { .code = MEDIA_BUS_FMT_SGRBG10_1X10, .bpp = 10, }, + { .code = MEDIA_BUS_FMT_SRGGB10_1X10, .bpp = 10, }, +}; + +static const struct csi2rx_fmt *csi2rx_get_fmt_by_code(u32 code) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(formats); i++) + if (formats[i].code == code) + return &formats[i]; + + return NULL; +} + static inline struct csi2rx_priv *v4l2_subdev_to_csi2rx(struct v4l2_subdev *subdev) { @@ -303,12 +334,68 @@ static int csi2rx_s_stream(struct v4l2_subdev *subdev, int enable) return ret; } +static int csi2rx_set_fmt(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *state, + struct v4l2_subdev_format *format) +{ + struct v4l2_mbus_framefmt *fmt; + unsigned int i; + + /* No transcoding, source and sink formats must match. */ + if (format->pad != CSI2RX_PAD_SINK) + return v4l2_subdev_get_fmt(subdev, state, format); + + if (!csi2rx_get_fmt_by_code(format->format.code)) + format->format.code = formats[0].code; + + format->format.field = V4L2_FIELD_NONE; + + /* Set sink format */ + fmt = v4l2_subdev_get_pad_format(subdev, state, format->pad); + *fmt = format->format; + + /* Propagate to source formats */ + for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++) { + fmt = v4l2_subdev_get_pad_format(subdev, state, i); + *fmt = format->format; + } + + return 0; +} + +static int csi2rx_init_cfg(struct v4l2_subdev *subdev, + struct v4l2_subdev_state *state) +{ + struct v4l2_subdev_format format = { + .pad = CSI2RX_PAD_SINK, + .format = { + .width = 640, + .height = 480, + .code = MEDIA_BUS_FMT_UYVY8_1X16, + .field = V4L2_FIELD_NONE, + .colorspace = V4L2_COLORSPACE_SRGB, + .ycbcr_enc = V4L2_YCBCR_ENC_601, + .quantization = V4L2_QUANTIZATION_LIM_RANGE, + .xfer_func = V4L2_XFER_FUNC_SRGB, + }, + }; + + return csi2rx_set_fmt(subdev, state, &format); +} + +static const struct v4l2_subdev_pad_ops csi2rx_pad_ops = { + .get_fmt = v4l2_subdev_get_fmt, + .set_fmt = csi2rx_set_fmt, + .init_cfg = csi2rx_init_cfg, +}; + static const struct v4l2_subdev_video_ops csi2rx_video_ops = { .s_stream = csi2rx_s_stream, }; static const struct v4l2_subdev_ops csi2rx_subdev_ops = { .video = &csi2rx_video_ops, + .pad = &csi2rx_pad_ops, }; static int csi2rx_async_bound(struct v4l2_async_notifier *notifier, @@ -532,9 +619,13 @@ static int csi2rx_probe(struct platform_device *pdev) if (ret) goto err_cleanup; + ret = v4l2_subdev_init_finalize(&csi2rx->subdev); + if (ret) + goto err_cleanup; + ret = v4l2_async_register_subdev(&csi2rx->subdev); if (ret < 0) - goto err_cleanup; + goto err_free_state; dev_info(&pdev->dev, "Probed CSI2RX with %u/%u lanes, %u streams, %s D-PHY\n", @@ -544,6 +635,8 @@ static int csi2rx_probe(struct platform_device *pdev) return 0; +err_free_state: + v4l2_subdev_cleanup(&csi2rx->subdev); err_cleanup: v4l2_async_nf_unregister(&csi2rx->notifier); v4l2_async_nf_cleanup(&csi2rx->notifier); @@ -560,6 +653,7 @@ static void csi2rx_remove(struct platform_device *pdev) v4l2_async_nf_unregister(&csi2rx->notifier); v4l2_async_nf_cleanup(&csi2rx->notifier); v4l2_async_unregister_subdev(&csi2rx->subdev); + v4l2_subdev_cleanup(&csi2rx->subdev); media_entity_cleanup(&csi2rx->subdev.entity); kfree(csi2rx); } From patchwork Mon Oct 9 13:09:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731285 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 B4A5AE95A91 for ; Mon, 9 Oct 2023 13:10:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376814AbjJINKO (ORCPT ); Mon, 9 Oct 2023 09:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376810AbjJINKL (ORCPT ); Mon, 9 Oct 2023 09:10:11 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E40BAF; Mon, 9 Oct 2023 06:10:08 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9pIP067945; Mon, 9 Oct 2023 08:09:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856991; bh=osyCAViLVBaJwUwzPfMFvHCi5OOIvQquFZEhN1wmj6I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rWIuf/JL49ME416VKZNZTuJe/4Q05XdDE6WGE0KW/mvwmEst1cN/CcqoXNjADawD9 hdkNWLxlP+AqT1QT3fiXxgSl3u4xZa3T+ejgEnr1bi3LUV9+HpKiPLkfAEiWgDW7V7 k9tAEOXMKqZgoF++EtL+g6nPuYp3PR1iiIFlU2AM= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9pRe077021 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:51 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:50 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:50 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9nsj055571; Mon, 9 Oct 2023 08:09:50 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 06/13] media: cadence: csi2rx: Configure DPHY using link freq Date: Mon, 9 Oct 2023 18:39:32 +0530 Message-ID: <20231009-upstream_csi-v10-6-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1901; i=j-luthra@ti.com; h=from:subject:message-id; bh=RUZIs/V1zB7ojxrNBwsr2VePDUlHFcaYY3FI90aQFqc=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/sqauE21D0LzrllxQ8Zm96qKPACTyyvIfOKE DfQrHtbhmSJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7KgAKCRBD3pH5JJpx RbiRD/sGU8AH/zCNvt5XjV9NEqO8d+OHg3Sue5Gk+a99KX6/iJNH6pKTXw2DwrGfI91tLvelI/P OTqtoxLacF408Tb77W/fide0gGKvZZMVjIR7ybBERGtit7W6pqXmGy6aovFDvC5N3dQI1XVy75W oF3r87dS6mv+7rVDmjmNy6tJ1bNobHB50wGDLCEImiJ7njN1SeDYBq96X52URntPTYDhQNHtOq0 qf9C1uZ+FAWL+XOM/RaM4BYAWkBO3Nz+n3TO59XsfX5wBg96GEHAUYa4bYGPtNw8OsM3jiUli4a Tydd5Wl2lk6QoZeMBTFSN473kkcKz7pJe4K7tAFcTTNbxJPlpb+fLRUy3duGbDqDvVdhu1AsQKm UrLcXIAMNEkx/04iHhp7i0x6QIqmwJx7qid0arCVM5uZW4fj+rGXhspyKqzYp6G1B4QxkUoOxw9 toj+ebKr+85lDxJg61/HEkGhJSsMLuiRdGzoIeVX5XEQBKFQrwIba5FHKqUecXArU7Q7afBAUDN bEMHfpAcGiuMg4bWzi8OaZoeVe3PEajHz8oDwfMhrpKQKi4NJxo97jF966uaAwYngkFGFR87NQn 5iAwRcDgEKTV43xizNfPlO2X/+yD1vCIjwVgx+LDQayvc9V1tKYQgCOSY5O2bfyqCB8cd4OOwYV +5G0xqErUCTcBpg== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Pratyush Yadav Some platforms like TI's J721E can have the CSI2RX paired with an external DPHY. Use the generic PHY framework to configure the DPHY with the correct link frequency. Signed-off-by: Pratyush Yadav Tested-by: Julien Massot Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Reviewed-by: Maxime Ripard Co-developed-by: Jai Luthra Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index f9b41451f4a4..77e2413c345a 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -145,8 +145,32 @@ static void csi2rx_reset(struct csi2rx_priv *csi2rx) static int csi2rx_configure_ext_dphy(struct csi2rx_priv *csi2rx) { union phy_configure_opts opts = { }; + struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; + struct v4l2_subdev_format sd_fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .pad = CSI2RX_PAD_SINK, + }; + const struct csi2rx_fmt *fmt; + s64 link_freq; int ret; + ret = v4l2_subdev_call_state_active(&csi2rx->subdev, pad, get_fmt, + &sd_fmt); + if (ret < 0) + return ret; + + fmt = csi2rx_get_fmt_by_code(sd_fmt.format.code); + + link_freq = v4l2_get_link_freq(csi2rx->source_subdev->ctrl_handler, + fmt->bpp, 2 * csi2rx->num_lanes); + if (link_freq < 0) + return link_freq; + + ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq, + csi2rx->num_lanes, cfg); + if (ret) + return ret; + ret = phy_power_on(csi2rx->dphy); if (ret) return ret; From patchwork Mon Oct 9 13:09:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731284 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 24F82E95A97 for ; Mon, 9 Oct 2023 13:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376850AbjJINKS (ORCPT ); Mon, 9 Oct 2023 09:10:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376806AbjJINKK (ORCPT ); Mon, 9 Oct 2023 09:10:10 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CCCA94; Mon, 9 Oct 2023 06:10:06 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9s5x035863; Mon, 9 Oct 2023 08:09:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856994; bh=vtgYRdhRlk1YmzBEx3yb0mO0lU3pX1Lt5Kg7jv1XUqo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KhE8NnpkwZjv3z4LQITwymDZDqQlfBKXZE75SNdbh2c+BgGFYwFQLNXJTgXlbkL90 x4GDL4gtXxF1C62iVcQXu06A0Dw99Q95XY15ufuoZpfOpStJPSSwAZw0JCZ536D3Tv fzrD8cakucoQx+V/+kWyZ651xAeKER4TLPA0QXEM= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9sFW014548 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:54 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:53 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:53 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9rXu007359; Mon, 9 Oct 2023 08:09:53 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 08/13] media: cadence: csi2rx: Set the STOP bit when stopping a stream Date: Mon, 9 Oct 2023 18:39:34 +0530 Message-ID: <20231009-upstream_csi-v10-8-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2528; i=j-luthra@ti.com; h=from:subject:message-id; bh=yTXIIHZ7yHvfkBehaXvly8sQUzrqAsJQob6QxmW6ETc=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/sssGXfTN0tDNfaKfrem+MZS1CyNLez01/xX 8FBJez74+GJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7LAAKCRBD3pH5JJpx RdRUD/98bxH17x9qQpAtrD9RgbsXY0FDbGxBI52epF0LkkxtecvitpLpr0KAgiW13usR0JGIHNu EICehuM9EwWJwElxkXdrfYR51fGXcJH3xU5oJM7cVg1GAiJrLmBzY4XxVmSE3r/rlxMmqpNlg/C tjPRGw1iGkTKZi8s/x6F5uoiu/37PkL/XoO2st9z0aLsOw4KZcNOsbBmypp5rx6AnWHmfstWcrb PmH2ja5f00Bjnl0FtoI6zwVDYbee/PWcM101KX4olF4xKspHU/hDHZ7rmQGi0UnUfq8tmZ3Qeur gpZvAZzYJBw13phWDqhZEm0OI89qW8L8pEL71xeYi8/trGPdN1TRLghqS2T2ol9l0HdDlZbCIK6 gJt4LwRBSGW8k1Xb9TdcuH+QQ7CKudBQcp7GYV9O0HxGvOfQvcu8JdmtMtd64bas4wWzU79DCVh BrvHeiXkt07ByBOYEVm2OSUOUkPyX5+bG/RhB2M6fjI2U4Ys7FjQObotwvLqSkwICygQCXyfI7Y ZbsV65Ye00kWINAg3IXGz07sNLErUPOvedAW4DlbugPK2bzrDzBxrxFsvC0RalwtYyr78noWizk W4uxQehxmSF3+qoQx5tD8ztWg4Jr3T8BFDHPihh9w0g3CUywcWpkFgwxZXZ0FcsNRIDdRDwDV+0 KH3YwIVWscwUnHQ== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Pratyush Yadav The stream stop procedure says that the STOP bit should be set when the stream is to be stopped, and then the ready bit in stream status register polled to make sure the STOP operation is finished. Signed-off-by: Pratyush Yadav Tested-by: Julien Massot Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Reviewed-by: Maxime Ripard Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 913f84c341f4..230c627ef1f4 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -41,8 +42,12 @@ #define CSI2RX_STREAM_CTRL_REG(n) (CSI2RX_STREAM_BASE(n) + 0x000) #define CSI2RX_STREAM_CTRL_SOFT_RST BIT(4) +#define CSI2RX_STREAM_CTRL_STOP BIT(1) #define CSI2RX_STREAM_CTRL_START BIT(0) +#define CSI2RX_STREAM_STATUS_REG(n) (CSI2RX_STREAM_BASE(n) + 0x004) +#define CSI2RX_STREAM_STATUS_RDY BIT(31) + #define CSI2RX_STREAM_DATA_CFG_REG(n) (CSI2RX_STREAM_BASE(n) + 0x008) #define CSI2RX_STREAM_DATA_CFG_EN_VC_SELECT BIT(31) #define CSI2RX_STREAM_DATA_CFG_VC_SELECT(n) BIT((n) + 16) @@ -310,13 +315,25 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx) static void csi2rx_stop(struct csi2rx_priv *csi2rx) { unsigned int i; + u32 val; + int ret; clk_prepare_enable(csi2rx->p_clk); reset_control_assert(csi2rx->sys_rst); clk_disable_unprepare(csi2rx->sys_clk); for (i = 0; i < csi2rx->max_streams; i++) { - writel(0, csi2rx->base + CSI2RX_STREAM_CTRL_REG(i)); + writel(CSI2RX_STREAM_CTRL_STOP, + csi2rx->base + CSI2RX_STREAM_CTRL_REG(i)); + + ret = readl_relaxed_poll_timeout(csi2rx->base + + CSI2RX_STREAM_STATUS_REG(i), + val, + !(val & CSI2RX_STREAM_STATUS_RDY), + 10, 10000); + if (ret) + dev_warn(csi2rx->dev, + "Failed to stop streaming on pad%u\n", i); reset_control_assert(csi2rx->pixel_rst[i]); clk_disable_unprepare(csi2rx->pixel_clk[i]); From patchwork Mon Oct 9 13:09:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731282 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 DF70AE95A96 for ; Mon, 9 Oct 2023 13:10:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376866AbjJINKZ (ORCPT ); Mon, 9 Oct 2023 09:10:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376779AbjJINKN (ORCPT ); Mon, 9 Oct 2023 09:10:13 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF6159E; Mon, 9 Oct 2023 06:10:11 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9vDe055536; Mon, 9 Oct 2023 08:09:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856997; bh=wzciJJ2YTFJVP2b52Ols5dE9idQaEIAPyxn7t7coENY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CWfc5bqvAQaJLN6j/XkXFrcmRO0vP4UOBG90Wuk/yJGdrSYaYvBOOi1EAw0NVax0+ rTI6Y4wz9EjS+CG1H3MYsND92S/ZyE9UfpJ+37vJ+g3xUiPPA/ocBLSxdRiI/moDuI m5RAW9qI3zIt0EGQivA2/hf1/czJQjlwqs3/cWG4= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9vr6014598 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:57 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:56 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:56 -0500 Received: from localhost (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9uYE007422; Mon, 9 Oct 2023 08:09:56 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 10/13] media: cadence: csi2rx: Populate subdev devnode Date: Mon, 9 Oct 2023 18:39:36 +0530 Message-ID: <20231009-upstream_csi-v10-10-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1279; i=j-luthra@ti.com; h=from:subject:message-id; bh=bDHn/MyiN9Cg1dBR/V+/tvt/oG+ArF4duwVMUN+kd6w=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/st6XqfcSRECGzh8gspwZdhiJGOXJDFbNkmQ 2yEKKpbYtaJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7LQAKCRBD3pH5JJpx RVmAEACdtqsZMsiylF4NAfMIE2WT+Pq8Db2VpoPxWm0zq6gcuy7eOdX6rrry8TPhQLP6zr0Vy1u sXJpAizqJLsGDw9pLNdrGM6DD4bBkUIHC9LFRF18JL+Bhbg7tS3WCpr6bfOZIJP0UTVRVUgxxnQ 8hNTso1LvKTsXrBzT8GReQN/s6V0L1XMpTW21ATreVisbWn8Hx6eHPslspd0IDWq5UO9cbNruhK TC8rbMJr1Rkmgrdqy32B+ozS2FZiO6OQzB+EB+t9+eyQ4DcN7H2FIgJF5dkU5iy/rf9nopfXhMx chZlz05N6KOIoBBIhODTWZ/5FAZv85Bi6OznIUZPHvjHW8j57eGaAuW9EOxjzASw/NWTCGY82Fe wZ1R7Juy9eGHORHhGhwBwV+WCZ2p6Q8wbyG3JlLt+zDZqzS9b3NM1EcXd0qd/EaZef0sfOTvUpl C/Qi3nFFYqpoj1JxrjDW1MOMNa2cdthljgz6vQexM7TpvZ+PUIcIojcJQ5rnb/wH14DAOOun1mB bG8nd2CftzfGXL7oBeLNMHfREOFx6EYP4e14NRhc3y4zG4Urxf02z9048rDCF38l2WrRO14GPNo VIZ1KRpwspstUA94VIoZdAt2wISbIhTlfjyKHowDwKA7B3m7p3NQAaVIZedV+ThqXNggqOrHx13 tG7JlSe0uP0Nfaw== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Pratyush Yadav The devnode can be used by media-ctl and other userspace tools to perform configurations on the subdev. Without it, media-ctl returns ENOENT when setting format on the sensor subdev. Signed-off-by: Pratyush Yadav Tested-by: Julien Massot Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Reviewed-by: Maxime Ripard Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 812f31dfaab1..d0c2a5b3d0d5 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -668,6 +668,7 @@ static int csi2rx_probe(struct platform_device *pdev) csi2rx->pads[CSI2RX_PAD_SINK].flags = MEDIA_PAD_FL_SINK; for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++) csi2rx->pads[i].flags = MEDIA_PAD_FL_SOURCE; + csi2rx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ret = media_entity_pads_init(&csi2rx->subdev.entity, CSI2RX_PAD_MAX, csi2rx->pads); From patchwork Mon Oct 9 13:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 731283 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 A8907E95A9B for ; Mon, 9 Oct 2023 13:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376857AbjJINKW (ORCPT ); Mon, 9 Oct 2023 09:10:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376788AbjJINKM (ORCPT ); Mon, 9 Oct 2023 09:10:12 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E137DC6; Mon, 9 Oct 2023 06:10:09 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 399D9wB3067976; Mon, 9 Oct 2023 08:09:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1696856998; bh=07dWCB21kyjDiChID1v5HFl8K/TwWhxZIuKPCitG0vg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BGuXCaK51VjDHP+GrftwE208jXP/YXXokTN3CL5Nv0OA+ByloTrnkragHLsYzJKDp oQWn1+VwYApYxSt69aqEmKu6Eq4JhImCu7l4AoD41z+wH/Orn3prUtFEMJbiNwfNm+ IPzh4pQ0t4qxLGzIepgLroSmmGoAaCD/x+LX3/xg= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 399D9weH071560 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Oct 2023 08:09:58 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 9 Oct 2023 08:09:58 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 9 Oct 2023 08:09:58 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 399D9vHh055692; Mon, 9 Oct 2023 08:09:58 -0500 From: Jai Luthra To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sakari Ailus , Tomi Valkeinen CC: , , , , Laurent Pinchart , Mauro Carvalho Chehab , Maxime Ripard , , Benoit Parrot , Vaishnav Achath , Vignesh Raghavendra , , , , , Martyn Welch , Julien Massot Subject: [PATCH v10 11/13] media: cadence: csi2rx: Add link validation Date: Mon, 9 Oct 2023 18:39:37 +0530 Message-ID: <20231009-upstream_csi-v10-11-330aaed24c5d@ti.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> References: <20231009-upstream_csi-v10-0-330aaed24c5d@ti.com> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1569; i=j-luthra@ti.com; h=from:subject:message-id; bh=zo2hhYXbGio5ee2AnO4qGHe/0axDO9Ru33qV+Q96O/g=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBlI/sujDKPDTZgS8DjBKPkV3nZaRwdBaRViIeP5 xP8SJiUx7OJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZSP7LgAKCRBD3pH5JJpx RXWAEAC0/lEKXqIXdPmkqGm2QKz7hgG6egceWWJTskc/AhBUncWgdWa1OPpu/WUq1gj2ZIahjqq 9Igkyu7Skk5cwW5nCdRn4PuADw4AX0Yt4gJ6WiOPh2knVYbavEjRalWfIkfb+I1DoQd4JvIxYUE Wwr4Y6eOi8dtYR4cOJuWRZ0uhq+XpO4i7ipEjYhUcfKFkY8K3RhvmBvkp+15AiMOlezbAgZeNcw fhR1859Gtv0ppmK7qISpVVDj4pjjgkMYr708y67uyz0RRpTLCQ60Fcge5pXpGCmaHIMUx9MZAih Nh5qAoQtv3kHmXsUswMvhtaGK/C7IzD1kza8b0ZguOWqtPnRKWgA5oYLXOQjEwGV8yd4PIzwVuy IaamnFjJVsushLfEFrPDuPcRpYS0Ai73SE0n2Iul0wnz6y2X19+j8QvXpPX3mODBUAILXtBXQRD opRpKrsRl56Rdv1nDdI1/xXfY82/DGefzjVdR6l9wEp/v/0KSc8U2y5SEabe8FatILDnPDGdQcR 1bj47PpVA67K8S7FW0wY8WiKZ9jKJ0yXPdY8Gpp64Z6/0aLIn55pkxEvfOVX0IvTGN3wvLsTkET wTUCNQ8PQ8/rZOBbC6CKZCVUq7MUMIy9BP9Zsl5QS4dpcJmrImUhrwhwVNNC3eJOgQtMZ97lq56 KRtvmIFgHqiVIJg== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Pratyush Yadav Add media link validation to make sure incorrectly configured pipelines are caught. Signed-off-by: Pratyush Yadav Tested-by: Julien Massot Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen Reviewed-by: Maxime Ripard Signed-off-by: Jai Luthra --- drivers/media/platform/cadence/cdns-csi2rx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index d0c2a5b3d0d5..889f4fbbafb3 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -453,6 +453,10 @@ static const struct v4l2_subdev_ops csi2rx_subdev_ops = { .pad = &csi2rx_pad_ops, }; +static const struct media_entity_operations csi2rx_media_ops = { + .link_validate = v4l2_subdev_link_validate, +}; + static int csi2rx_async_bound(struct v4l2_async_notifier *notifier, struct v4l2_subdev *s_subdev, struct v4l2_async_connection *asd) @@ -669,6 +673,7 @@ static int csi2rx_probe(struct platform_device *pdev) for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++) csi2rx->pads[i].flags = MEDIA_PAD_FL_SOURCE; csi2rx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; + csi2rx->subdev.entity.ops = &csi2rx_media_ops; ret = media_entity_pads_init(&csi2rx->subdev.entity, CSI2RX_PAD_MAX, csi2rx->pads);