Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1512000rdd; Thu, 11 Jan 2024 01:05:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6FSoUwPFa95woIgMYXM5i2M/VfHDbaznyODm+5k0Gay8nvcLL9EWK5lOH10UzRuPXjGl+ X-Received: by 2002:a17:903:2807:b0:1d4:672f:1f45 with SMTP id kp7-20020a170903280700b001d4672f1f45mr506196plb.102.1704963952683; Thu, 11 Jan 2024 01:05:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704963952; cv=pass; d=google.com; s=arc-20160816; b=E64xLu1QHP7GJiaUMNeKXxAZCgrt3YikF5lOHscl8WHujU0eF1FJdmXT+mpjl8/Hii +kG+jdlHMrMmXW5G6BNgU2eKURMShjE3HMYpwCFc0vW9hivE3wMpB6DtLkNuRWiuoZJO Otg4LPoMkPQEr1Rfs7r7GB3EckB0DwD4s6P9KYloRoI3azaKfNY/4QvytVg6VdY+AiIa pp21Gk/RiDPMp4SEWp876fEml3pxyN7H5wcJA38EdlaobaUKM66dLFUkBfo2r3bhY1/A 6dIakjHcRh+a6GfRmOmGsFB69H10+8zzuMu81OieJDIB2EP0fD+M76KLEJSGBqHnNH8z lTRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from; bh=RAQ+A/0fQgLmKDY3N94BwR7948qcaAv5N+2ndR5uUe0=; fh=AIbhTKVlrbjCdvqTRYm0MrNe3T1Hh+lXyTtmg258gY0=; b=A1z0NTrF1iBd8sBvBKdj2OK/NUiXTWzRytOQ0ywcl/eCWzP95O9nDICpIPjl/Xj2K8 vuD8I7S8Rn6WWgTEvuioL20vdmksh8J/YggZGH0lr7dLX1LZM8eL8JNg8TYY5Vj1BTVX aQWgr7TlWUGwqQVRIfnP9tjUkmEvauiqCBxrN8DvJdaajWVdTf2CoQnZOyPao/dBhVed IrEDVCbVsCK7vf63bikPi43cLDdH+JUy6hM1YvPUEwdzHbg2Mb92fxqD1psGICmDU9LA VPIb88OGtR9PRznQA9kbKHYsMuPcHRflnFbZvvce3fhgqMsJ7LvohlrsK0yxNf5IxTU3 JTkg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=starfivetech.com dkim=pass dkdomain=starfivetech.com dmarc=pass fromdomain=starfivetech.com); spf=pass (google.com: domain of linux-kernel+bounces-23277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23277-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p20-20020a170902ead400b001d4029129ebsi630990pld.267.2024.01.11.01.05.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 01:05:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23277-linux.lists.archive=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; arc=pass (i=1 spf=pass spfdomain=starfivetech.com dkim=pass dkdomain=starfivetech.com dmarc=pass fromdomain=starfivetech.com); spf=pass (google.com: domain of linux-kernel+bounces-23277-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23277-linux.lists.archive=gmail.com@vger.kernel.org" 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 66A52B26BF8 for ; Thu, 11 Jan 2024 09:03:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1ECA156E7; Thu, 11 Jan 2024 08:58:50 +0000 (UTC) Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on2070.outbound.protection.partner.outlook.cn [139.219.17.70]) (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 866DF1772E; Thu, 11 Jan 2024 08:58:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=La09VxPw8Ybz0K24uDpm4YlxIqiwxYiu5RqnRHWWC+cLaPWiuspKjBYC4NDOx0IB1NxKEtBBAd6UkSanwcfvqRb9ReIlJZuXeyYzirqUQwuw6PmMdreaesa2LD91vV556NDsquE8u5lZIIieYHj1crfy2vklWE9XRBMaAhdRh6cdFJlolcA+lwpfFK+dDR2l+EyaUzBnIsQBn26W2d/nctjR1vwR9IuALKcSA/25jjDtsD9YI4AI0JxYjobl+iwHiBJGRDJAdQ4eLAXr6peKNH7EJM/MkaJP1Mp8gQcn5SUZUeAdsBKfd4SJr2UMsXAEhn5uuoYhIyoIKjur8x3ZeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RAQ+A/0fQgLmKDY3N94BwR7948qcaAv5N+2ndR5uUe0=; b=cqcnT25lExHgU0W/lbiTTqYpDHDXTdTrG0cKyqQ/1qEPhvd/y+BdVf6km+4bJ0Fx/HkGLhVJAi5PjPn08OFgrSsmonT1VYa6Sin0y/QeTO0iT0JIFvSUr4113RBShz/7AURdwKflSDjUldmBvCNkRzLO5bVf9LihuGPNJGOIAkk2ioFc4NAtpMLwg09x1ZJIuPYdVnwFs1suogWYerI/1U3pnaqA0KykiUhFXGePQYXOQnuAI6/ziC69ndnbKsru+k2hE62fp6yeAK3giRXyflrvymLrd3b4l6qB8LtpX8bC/4fwMws6QbUhMfXv1RcCSMrlQD7nIEqC0+YOwENZ8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SH0PR01MB0667.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::21) by SH0PR01MB0747.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:21::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.33; Thu, 11 Jan 2024 08:41:33 +0000 Received: from SH0PR01MB0667.CHNPR01.prod.partner.outlook.cn ([fe80::e255:98f3:ba27:8c7d]) by SH0PR01MB0667.CHNPR01.prod.partner.outlook.cn ([fe80::e255:98f3:ba27:8c7d%3]) with mapi id 15.20.7135.033; Thu, 11 Jan 2024 08:41:33 +0000 From: Changhuang Liang To: Mauro Carvalho Chehab , Greg Kroah-Hartman , Matthias Brugger , Hans Verkuil , Ming Qian , Laurent Pinchart , Nicolas Dufresne , Benjamin Gaignard , Tomi Valkeinen , Mingjia Zhang Cc: Jack Zhu , Changhuang Liang , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v2 07/13] staging: media: starfive: Separate ISP hardware from capture device Date: Thu, 11 Jan 2024 00:41:14 -0800 Message-Id: <20240111084120.16685-8-changhuang.liang@starfivetech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240111084120.16685-1-changhuang.liang@starfivetech.com> References: <20240111084120.16685-1-changhuang.liang@starfivetech.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: NT0PR01CA0009.CHNPR01.prod.partner.outlook.cn (2406:e500:c510::19) To SH0PR01MB0667.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:20::21) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SH0PR01MB0667:EE_|SH0PR01MB0747:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b9aa3a9-6e3f-44ab-a64e-08dc12811d7f X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: paS58XrwgkM+vbb2PaxlbE4Sk9ixwLKik/bnVgUgSHa9JjcLNfO9N6AHxZwo0RlZQKHOqsrdwRt5GE94J91ZYGkBXCCTJ0bJIjVOn0/JP4FQ4ijhFbTBmdwaaKN0w2Y7aMDvFB+RRvpGWutsKAmKHmn0wJa2WpfC2/r7zbeOkcBYLkmp1iIdlGfoP5pIvZu1fZE4q6rUXj9Gg4Z7SZo1Z7DJfauxLhqEEB6IkzK1VZM3YuYj2VZ4Vhx86TVU7ZTMFFnTxxAVWmhVDGqfweeG/HqFE1qnTKfglYy6CMgoUR5uKdFfExktWmml3NauwHiVPVUSoZMpoAPi+ckyvt3qKknmHuX6C/+VKsDBunXiPCuIH6v9LErxU2TqyV3Go9AWYwP5K1yGXef4o+0f3UIJaIP4kNmJYZKIoRR+MTY+2h3vC2dPAwvbDWUGVjZ4+F/cJAiPnS6xZW3K2fqDq6Fb3NXLDB3UKVo0OrakaorrM91xBXCFkWS3HPp8YgbeaB8Z/ZVdkzlKM6I6c85pNsUam1CfIjxE3P2QxZvhq8vePaU/TAyHNIHR25HUhVBeZ5SsEc48leg8FHbNkps3qtzSEQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SH0PR01MB0667.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(346002)(136003)(39830400003)(230922051799003)(186009)(1800799012)(451199024)(64100799003)(6666004)(52116002)(41300700001)(2616005)(508600001)(38100700002)(40160700002)(1076003)(26005)(86362001)(36756003)(921011)(38350700005)(83380400001)(110136005)(54906003)(66556008)(66946007)(66476007)(8676002)(8936002)(41320700001)(4326008)(44832011)(2906002)(40180700001)(5660300002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?5y4GSLcq4G6fg02/HE0gpYACbMwm9YBeEM2UBe9XJKpKtRt+hoJZbEgt9uuP?= =?us-ascii?Q?zcWJYEzqZANr+Mp5BOqr5dnBrQCy2gW4UuvYMQLa1MCrQQZboOUajTruk4Bj?= =?us-ascii?Q?UvO23AwUD5bcwmyVmvXvX5EfUvojQGllZEEx6g5MpuZwNPhzyAEjoD1fuc+4?= =?us-ascii?Q?WjIJqHjy2O8sZrOnPOCHeK+RO2Qgc65PjwQ2NEBxjJBNxaOvB1kABLngroE4?= =?us-ascii?Q?M61uQbIKIASKwJnLJFFtygkm1CyuZ9zRWyhvHrkzX2n3cEhGuv/zTMkZtUPr?= =?us-ascii?Q?DIDuHdkEr6KO6Ce5i71Xz0uVsKeWrq8cXmwzP9lb+zreKuvViaO+rQmSkNu8?= =?us-ascii?Q?E0pVOEO2265l0b9i46YQ1lG9Mgim5r8AFEioiaMUImAdPSfwpD0UzLfMKCpx?= =?us-ascii?Q?KAR+1hzxDUyAUq7YinRAeyiRuFEYV9w8esJ5FKVuAa6UEmkOaux3MYKArmhy?= =?us-ascii?Q?KZIJiFh7YbAh3aTTvlRorcHRIIrgybnv7n5C5z1QXWbFJEzgjbBEFQu58S5X?= =?us-ascii?Q?5AQCTSgsJoIqSWb7Rt/79cGrNex80y8ypqSgAK0tAAsGspRWKTWg9CEcvLXr?= =?us-ascii?Q?Wg3AfNK7lgfEo5K44Dh7KmbFfILAkc9zp6frww9mePC/hdUDwYc671CAN+Uo?= =?us-ascii?Q?ZDg6Tf3k1ZFhYPOfKe9dnItrrjRIlA/MVN4ohCTOo2QeipDFTzIpuEmTctYq?= =?us-ascii?Q?TkZs/naYhaIit5xoDy+wFZzhXZiIUkZyWdJWpkSyw8FCm9tlnmv0C9tkWYOU?= =?us-ascii?Q?L+SYjZXfGc8FWvWZXcPOi8bUXKBTTxGPY8frvZ2IeF16oTd64J56IJPqYNxZ?= =?us-ascii?Q?SyvNxO2rRsyDN8BwWujbLW04kns4cq9TOXMUf83vEQoQp0xMNSAKpkQefn7y?= =?us-ascii?Q?R/p1V11wQM5jtC7aSIGAzl1Y5bMqVtPRTlDNVvWVrN3K88jXDdCQ5za7fOZ8?= =?us-ascii?Q?fO4Z4WLwaX6OKUjxG1qkTjmehH4EvCIoNVmPkHcBKQ8hcRg2bePgPl3+Q0a8?= =?us-ascii?Q?1e/ccTBeuYsyhMUzzM9S5D+FXf+5p96b7jnDcEywbX9xa4OR38yCBGCnK5Sb?= =?us-ascii?Q?RMhD9QaOLR2X0708sUOeJQz0+sqjy3gn2/AMVYEsf9nzMDEl4bkOiKh5uzVb?= =?us-ascii?Q?QdXGj4iuiJ0SFPzHTSvW1M8B9vhq3wYYPQDoOZlSjkPOqcR9aOagprRsEQ3k?= =?us-ascii?Q?1TZur9mENFGwCyuVpk30qPURIdfmuyN5p795uw/d1VIVQJEAyXa8SwbxgkIX?= =?us-ascii?Q?RHXuXHmh1uoz4yqaumtCcpMi3+nPjB/Eop7Q0JNvcdOGiT8mvUoAnfQwOtxj?= =?us-ascii?Q?3XmuWDj/Stnqb9HjAnN2R1ArTllexDAKl1xooiiT6P4hbUDrKxv17gP0B2Bf?= =?us-ascii?Q?uwQHhsijs0FjDm26gG5bK8vjEHE3Z5vEBCPUi4gDdllO7h8t7TReud/c5KPT?= =?us-ascii?Q?Xx3dIAFeCx9YFNvcxh7CLfpDAZnWuzEUsoSMaWoqtx0nEg/ju0x2VI6RDE7R?= =?us-ascii?Q?aU3yZ3pkYDXaMTKB09+uoCwcy5GMOBknOnTWciUh/jHh8Y6FzYX7cv1rfhX2?= =?us-ascii?Q?nGjm2Vg3pWQlUlNlWHrDpvWOAMUipLUi8hrxLjYUjFBeGN5gDzWbnE1njkwN?= =?us-ascii?Q?hGN+lowIAySWNRSLHuUny3w=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b9aa3a9-6e3f-44ab-a64e-08dc12811d7f X-MS-Exchange-CrossTenant-AuthSource: SH0PR01MB0667.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2024 08:41:33.5690 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LhDplDBkP2ccV47xWni6JLeJu38nHjHPuivgx2Q3VnJOOxiseaeB7kirg5XXD4/+2jT0ik0TUmEMf4DQZkowQzDs39tS0TJzrl//zHYeEJmFuTlM/42ypTTZlgWlJ/zx X-MS-Exchange-Transport-CrossTenantHeadersStamped: SH0PR01MB0747 Some ISP hardware operations also use for output device, so separate it from capture device, move them to ISP common file. Signed-off-by: Changhuang Liang --- .../media/starfive/camss/stf-capture.c | 60 ------------------- .../media/starfive/camss/stf-isp-hw-ops.c | 60 +++++++++++++++++++ .../staging/media/starfive/camss/stf-isp.h | 3 + 3 files changed, 63 insertions(+), 60 deletions(-) diff --git a/drivers/staging/media/starfive/camss/stf-capture.c b/drivers/staging/media/starfive/camss/stf-capture.c index 5cbafac46ee6..e91e726a1462 100644 --- a/drivers/staging/media/starfive/camss/stf-capture.c +++ b/drivers/staging/media/starfive/camss/stf-capture.c @@ -66,13 +66,6 @@ static void stf_set_raw_addr(struct stfcamss *stfcamss, dma_addr_t addr) stf_syscon_reg_write(stfcamss, VIN_START_ADDR_N, (long)addr); } -static void stf_set_yuv_addr(struct stfcamss *stfcamss, - dma_addr_t y_addr, dma_addr_t uv_addr) -{ - stf_isp_reg_write(stfcamss, ISP_REG_Y_PLANE_START_ADDR, y_addr); - stf_isp_reg_write(stfcamss, ISP_REG_UV_PLANE_START_ADDR, uv_addr); -} - static void stf_init_addrs(struct stfcamss_video *video) { struct stf_capture *cap = to_stf_capture(video); @@ -307,59 +300,6 @@ irqreturn_t stf_wr_irq_handler(int irq, void *priv) return IRQ_HANDLED; } -irqreturn_t stf_isp_irq_handler(int irq, void *priv) -{ - struct stfcamss *stfcamss = priv; - struct stf_capture *cap = &stfcamss->captures[STF_CAPTURE_YUV]; - struct stfcamss_buffer *ready_buf; - u32 status; - - status = stf_isp_reg_read(stfcamss, ISP_REG_ISP_CTRL_0); - if (status & ISPC_ISP) { - if (status & ISPC_ENUO) { - ready_buf = stf_buf_done(&cap->buffers); - if (ready_buf) - vb2_buffer_done(&ready_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); - } - - stf_isp_reg_write(stfcamss, ISP_REG_ISP_CTRL_0, - (status & ~ISPC_INT_ALL_MASK) | - ISPC_ISP | ISPC_CSI | ISPC_SC); - } - - return IRQ_HANDLED; -} - -irqreturn_t stf_line_irq_handler(int irq, void *priv) -{ - struct stfcamss *stfcamss = priv; - struct stf_capture *cap = &stfcamss->captures[STF_CAPTURE_YUV]; - struct stfcamss_buffer *change_buf; - u32 status; - - status = stf_isp_reg_read(stfcamss, ISP_REG_ISP_CTRL_0); - if (status & ISPC_LINE) { - if (atomic_dec_if_positive(&cap->buffers.frame_skip) < 0) { - if ((status & ISPC_ENUO)) { - change_buf = stf_change_buffer(&cap->buffers); - if (change_buf) - stf_set_yuv_addr(stfcamss, change_buf->addr[0], - change_buf->addr[1]); - } - } - - stf_isp_reg_set_bit(stfcamss, ISP_REG_CSIINTS, - CSI_INTS_MASK, CSI_INTS(0x3)); - stf_isp_reg_set_bit(stfcamss, ISP_REG_IESHD, - SHAD_UP_M | SHAD_UP_EN, 0x3); - - stf_isp_reg_write(stfcamss, ISP_REG_ISP_CTRL_0, - (status & ~ISPC_INT_ALL_MASK) | ISPC_LINE); - } - - return IRQ_HANDLED; -} - static int stf_queue_buffer(struct stfcamss_video *video, struct stfcamss_buffer *buf) { diff --git a/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c b/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c index c34631ff9422..6b3966ca18bf 100644 --- a/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c +++ b/drivers/staging/media/starfive/camss/stf-isp-hw-ops.c @@ -443,3 +443,63 @@ void stf_isp_stream_set(struct stf_isp_dev *isp_dev) stf_isp_reg_write_delay(stfcamss, ISP_REG_CSI_INPUT_EN_AND_STATUS, CSI_EN_S, 10); } + +void stf_set_yuv_addr(struct stfcamss *stfcamss, + dma_addr_t y_addr, dma_addr_t uv_addr) +{ + stf_isp_reg_write(stfcamss, ISP_REG_Y_PLANE_START_ADDR, y_addr); + stf_isp_reg_write(stfcamss, ISP_REG_UV_PLANE_START_ADDR, uv_addr); +} + +irqreturn_t stf_line_irq_handler(int irq, void *priv) +{ + struct stfcamss *stfcamss = priv; + struct stf_capture *cap = &stfcamss->captures[STF_CAPTURE_YUV]; + struct stfcamss_buffer *change_buf; + u32 status; + + status = stf_isp_reg_read(stfcamss, ISP_REG_ISP_CTRL_0); + if (status & ISPC_LINE) { + if (atomic_dec_if_positive(&cap->buffers.frame_skip) < 0) { + if ((status & ISPC_ENUO)) { + change_buf = stf_change_buffer(&cap->buffers); + if (change_buf) + stf_set_yuv_addr(stfcamss, change_buf->addr[0], + change_buf->addr[1]); + } + } + + stf_isp_reg_set_bit(stfcamss, ISP_REG_CSIINTS, + CSI_INTS_MASK, CSI_INTS(0x3)); + stf_isp_reg_set_bit(stfcamss, ISP_REG_IESHD, + SHAD_UP_M | SHAD_UP_EN, 0x3); + + stf_isp_reg_write(stfcamss, ISP_REG_ISP_CTRL_0, + (status & ~ISPC_INT_ALL_MASK) | ISPC_LINE); + } + + return IRQ_HANDLED; +} + +irqreturn_t stf_isp_irq_handler(int irq, void *priv) +{ + struct stfcamss *stfcamss = priv; + struct stf_capture *cap = &stfcamss->captures[STF_CAPTURE_YUV]; + struct stfcamss_buffer *ready_buf; + u32 status; + + status = stf_isp_reg_read(stfcamss, ISP_REG_ISP_CTRL_0); + if (status & ISPC_ISP) { + if (status & ISPC_ENUO) { + ready_buf = stf_buf_done(&cap->buffers); + if (ready_buf) + vb2_buffer_done(&ready_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); + } + + stf_isp_reg_write(stfcamss, ISP_REG_ISP_CTRL_0, + (status & ~ISPC_INT_ALL_MASK) | + ISPC_ISP | ISPC_CSI | ISPC_SC); + } + + return IRQ_HANDLED; +} diff --git a/drivers/staging/media/starfive/camss/stf-isp.h b/drivers/staging/media/starfive/camss/stf-isp.h index bc7e7b0736fa..fcda0502e3b0 100644 --- a/drivers/staging/media/starfive/camss/stf-isp.h +++ b/drivers/staging/media/starfive/camss/stf-isp.h @@ -427,4 +427,7 @@ int stf_isp_init(struct stfcamss *stfcamss); int stf_isp_register(struct stf_isp_dev *isp_dev, struct v4l2_device *v4l2_dev); int stf_isp_unregister(struct stf_isp_dev *isp_dev); +void stf_set_yuv_addr(struct stfcamss *stfcamss, + dma_addr_t y_addr, dma_addr_t uv_addr); + #endif /* STF_ISP_H */ -- 2.25.1