From patchwork Thu Feb 22 11:31:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jai Luthra X-Patchwork-Id: 204698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp190028dyb; Thu, 22 Feb 2024 03:36:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW8RtHdsa2NR66HL4Cgqnywm1Au0qcPa7Cd5QyiB6q8FqYMqEN6Kt0EvXqavQtC9vwC+5ZZ++W3+QXLnQtA9MyFIWps9Q== X-Google-Smtp-Source: AGHT+IERhmZwR8UoUkipgy8g2TBbKGIcrMQVMEEor6Iu2p8Xa36QnZl+qRF0IxE4k/PF6mEKNAYs X-Received: by 2002:a05:6a21:8183:b0:19e:9143:2ab5 with SMTP id pd3-20020a056a21818300b0019e91432ab5mr14239040pzb.25.1708601783237; Thu, 22 Feb 2024 03:36:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708601783; cv=pass; d=google.com; s=arc-20160816; b=KkrCDMAnDHCClaHsTz4yfyjRb6uZNemlLZi7U8FQ67KyVoG6e8F/pwBp6I5IZia3p/ xniK1Feg5UcgJ+n06on6edP/tL+/KMc9vfJI1BJtUGNC0iv3V8oTGwiT3QbC11GkHYwn oqFeIka8r6ip7leHBHKjJRoqwgFKlYSiIroT4oGysFC3NtgMEqxIBY4mMDGJNIR9hZLh EZIJVsc6YjVhvkyrGew4qnYwO8C17kqnP1fGa7zxkxg5wtO0HlCa5r4jsPShknt5TmtS cIxnD6oo1xjoTn6GFN0pzUrl6NnTJYEZ4dtBZ4OAD5eQFzpQ0KCrHMdzTyjb/9v6FOxf j0dQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=vgG8Pl1M4grO/Gh8T9ZEbDeHXu7+7KB9qSq+V1q4TSs=; fh=7Ze5xPQXuwRxFNHD2ILqwMPZ5wjg3PcSuREjIh8VhDo=; b=LM9pLIKZKDzhKBGVsMeLnJZFExT1NTmCKxeDZyeNy6bBvHyZiPNAeNbXfR0Gs7GWQO EuRgyR6iQc/p0ENaPXzWBSDu4Ia6pNRwhnuciJ1pcYCJNsee9JCIk2lMrz0fVXMR0y1Q wQVwdXAnbGKLVHChchOzezBLZ0NLzUw4r3aqqxBs4V2hc6fg8On4RsKS6dCqoVRih/CG B/dQOiMNejOvb+ploW1/ZZs08U5M/hQb8MlX5U1rPShfwPEUAQEaFf+CExCOPiT/NWW3 jjXFKytSa0g42WNQqRfyA3BdxZtGXgMN7d37qx++IV5fs+1lqi0KOwtCxVWcdAg3mW9Q AO+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=mLQk3L5p; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-76422-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76422-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x13-20020aa7918d000000b006e1358dc6fbsi10024006pfa.378.2024.02.22.03.36.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:36:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76422-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=mLQk3L5p; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-76422-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76422-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A7FD1281A58 for ; Thu, 22 Feb 2024 11:36:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 794F24F615; Thu, 22 Feb 2024 11:33:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="mLQk3L5p" Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 EB5D9482E2; Thu, 22 Feb 2024 11:33:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.142 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601618; cv=none; b=SKBUQBhYQv+JNH4Q3w//gIXs8WNY+P4xm4+Ll++1o+En1HpPysW/EQ+6+xhVrcuRJKEN/Y9VOzxbsbuYEHyF1I70oxOCN0plSbCtCrLw1LWaspZfHJ/q9lemy634czk7uPK86D/6YU1aEpG2E/XPbaaptmPVZOQrWq33gSRJBsg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708601618; c=relaxed/simple; bh=i3XZLUwa1rEf80HvLKRoXBv74vvKRzQwjCodPjjVeY0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=cZSp6MZhw/j1gYwzeOZ6wfr8cCvVVFdpp+w8/Yfxx7yVVrxEHRhNbzwD/PYxVGIT75j/9Tw0Po2M5sOYcD3VHlIWn/Zl7fJDSRpW5fXW2Y/6orxlw2EIW64psacXTu22PCVOUlN/14VJVjsDgOBaFtCPjAcXQNU829LeLUroEJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=mLQk3L5p; arc=none smtp.client-ip=198.47.19.142 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXHdu027789; Thu, 22 Feb 2024 05:33:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1708601597; bh=vgG8Pl1M4grO/Gh8T9ZEbDeHXu7+7KB9qSq+V1q4TSs=; h=From:Date:Subject:References:In-Reply-To:To:CC; b=mLQk3L5pPmt8OmZI+1d8AexppK3hHYKcbLchap9zrDNL5jYwX0FMmUfbW6Dv8AXBL CrvLzMpSRd0JRhTeU2NvscwZYcC+OZh7bTcXk94kWEtx4gfIT8pmks2+aE/jecZAw7 D5JO6Vmt4oQ/aQ0tpuqhqfC5+9z3iBcx1KZcbr50= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 41MBXH7V014080 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 22 Feb 2024 05:33:17 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) 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; Thu, 22 Feb 2024 05:33:17 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) 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 via Frontend Transport; Thu, 22 Feb 2024 05:33:17 -0600 Received: from localhost (jluthra.dhcp.ti.com [172.24.227.217]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 41MBXGTi091164; Thu, 22 Feb 2024 05:33:17 -0600 From: Jai Luthra Date: Thu, 22 Feb 2024 17:01:22 +0530 Subject: [PATCH RFC 06/21] media: ti: j721e-csi2rx: prepare SHIM code for multiple contexts Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20240222-multistream-v1-6-1837ed916eeb@ti.com> References: <20240222-multistream-v1-0-1837ed916eeb@ti.com> In-Reply-To: <20240222-multistream-v1-0-1837ed916eeb@ti.com> To: Tomi Valkeinen , Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Vaishnav Achath , Maxime Ripard , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , Vignesh Raghavendra , Aradhya Bhatia , Devarsh Thakkar , Changhuang Liang , Jack Zhu , Julien Massot , Jayshri Pawar , Jai Luthra X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2436; i=j-luthra@ti.com; h=from:subject:message-id; bh=hRPOamfPuHrERb/eWqzY/9jpUuBkempbM1uAnmFujKs=; b=owEBbQKS/ZANAwAIAUPekfkkmnFFAcsmYgBl1zDfNYkMPiKCTC2JPadipH7bxiCc5pmmNv4vj vnxTvztoxOJAjMEAAEIAB0WIQRN4NgY5dV16NRar8VD3pH5JJpxRQUCZdcw3wAKCRBD3pH5JJpx RRpsD/4wwJTyJYUjpaEjB/52IwpCWMs9edpqHg/ZBPFc/d1o/+MmQ/Kc9mymRzwh8fHOBBi5KXL Ah3zSbvx1c1kV5k1gVfRNFIALl/Ldw7U4BwCDK1r44FW1cAuqBm016GDCrlKwP6ZXrUmyg7DrHM EG8cwJIGHdMDk8Ejc2PumjM9RRJdUl0tXWeVP1Ro3lheDS5hpxrlhcTAPiRFQ+OiMwwWnNoDElI vXdbk1JeIl3Zm+wULZ66BNumLPV/4T78SN8ptEhYFM4/TOpcxw2HxOKveP1ZaDUPAYRBiSB8wlI 3KpoDpycMhZ8pnnlL1K4TG3ao1zDZG/RMmxySFkg7nvKlSeVOo3QKUol1wPcwmKJZBChL90tcQF QvdbJ+KDgC0gy4+OPNwBzirADwWvadUyDTbZlLi7AYaKVwFlpRY0ozkls60YsGG8Kh7Bp89nSRR HSizx33PukEbZuus9QQiQyLe99iRXMs+LR1W5d0klLpvxZf5WYFOHXSRyfnmcLeWJptzTROduAp oHEiFu4HAZzJMUuTsgViHbertPncOl3/trD3qBbmDft7wz3Jb4yBq9+qiAi3YMjNBAGr+HdTAbG ZwdhVHFyG52Ja5D/Cz9PdZ/lHRDPVwvirtaXR5q9Se161cPHm/yoCrbbPC5VB63NXG1yEvkc0CI YsM2Y3nnK00wrog== X-Developer-Key: i=j-luthra@ti.com; a=openpgp; fpr=4DE0D818E5D575E8D45AAFC543DE91F9249A7145 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791598823356667869 X-GMAIL-MSGID: 1791598823356667869 From: Pratyush Yadav Currently the SHIM code to configure the context only touches the first context. Add support for writing to the context's registers based on the context index. Signed-off-by: Pratyush Yadav Signed-off-by: Jai Luthra --- drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c index 51fac664d01c..e42941d8c457 100644 --- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c @@ -25,7 +25,7 @@ #define SHIM_CNTL 0x10 #define SHIM_CNTL_PIX_RST BIT(0) -#define SHIM_DMACNTX 0x20 +#define SHIM_DMACNTX(i) (0x20 + ((i) * 0x20)) #define SHIM_DMACNTX_EN BIT(31) #define SHIM_DMACNTX_YUV422 GENMASK(27, 26) #define SHIM_DMACNTX_SIZE GENMASK(21, 20) @@ -35,7 +35,7 @@ #define SHIM_DMACNTX_SIZE_16 1 #define SHIM_DMACNTX_SIZE_32 2 -#define SHIM_PSI_CFG0 0x24 +#define SHIM_PSI_CFG0(i) (0x24 + ((i) * 0x20)) #define SHIM_PSI_CFG0_SRC_TAG GENMASK(15, 0) #define SHIM_PSI_CFG0_DST_TAG GENMASK(31, 16) @@ -573,11 +573,11 @@ static void ti_csi2rx_setup_shim(struct ti_csi2rx_ctx *ctx) reg |= FIELD_PREP(SHIM_DMACNTX_SIZE, fmt->size); - writel(reg, csi->shim + SHIM_DMACNTX); + writel(reg, csi->shim + SHIM_DMACNTX(ctx->idx)); reg = FIELD_PREP(SHIM_PSI_CFG0_SRC_TAG, 0) | FIELD_PREP(SHIM_PSI_CFG0_DST_TAG, 0); - writel(reg, csi->shim + SHIM_PSI_CFG0); + writel(reg, csi->shim + SHIM_PSI_CFG0(ctx->idx)); } static void ti_csi2rx_drain_callback(void *param) @@ -894,7 +894,7 @@ static int ti_csi2rx_start_streaming(struct vb2_queue *vq, unsigned int count) err_pipeline: video_device_pipeline_stop(&ctx->vdev); writel(0, csi->shim + SHIM_CNTL); - writel(0, csi->shim + SHIM_DMACNTX); + writel(0, csi->shim + SHIM_DMACNTX(ctx->idx)); err: ti_csi2rx_cleanup_buffers(ctx, VB2_BUF_STATE_QUEUED); return ret; @@ -909,7 +909,7 @@ static void ti_csi2rx_stop_streaming(struct vb2_queue *vq) video_device_pipeline_stop(&ctx->vdev); writel(0, csi->shim + SHIM_CNTL); - writel(0, csi->shim + SHIM_DMACNTX); + writel(0, csi->shim + SHIM_DMACNTX(ctx->idx)); ret = v4l2_subdev_call(csi->source, video, s_stream, 0); if (ret)