From patchwork Thu Aug 24 08:01:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Zhu X-Patchwork-Id: 716747 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 577B0C6FA8F for ; Thu, 24 Aug 2023 08:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234549AbjHXIBt convert rfc822-to-8bit (ORCPT ); Thu, 24 Aug 2023 04:01:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbjHXIBT (ORCPT ); Thu, 24 Aug 2023 04:01:19 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2FAC170B; Thu, 24 Aug 2023 01:01:15 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 5DF998159; Thu, 24 Aug 2023 16:01:13 +0800 (CST) Received: from EXMBX073.cuchost.com (172.16.6.83) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 24 Aug 2023 16:01:13 +0800 Received: from xiaofei.localdomain (180.164.60.184) by EXMBX073.cuchost.com (172.16.6.83) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 24 Aug 2023 16:01:12 +0800 From: Jack Zhu To: Mauro Carvalho Chehab , Robert Foss , Todor Tomov , , Rob Herring , "Krzysztof Kozlowski" , Conor Dooley , Greg Kroah-Hartman , Philipp Zabel , Laurent Pinchart , Hans Verkuil CC: , , , , , Subject: [PATCH v8 7/8] media: staging: media: starfive: camss: Add interrupt handling Date: Thu, 24 Aug 2023 16:01:08 +0800 Message-ID: <20230824080109.89613-8-jack.zhu@starfivetech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230824080109.89613-1-jack.zhu@starfivetech.com> References: <20230824080109.89613-1-jack.zhu@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [180.164.60.184] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX073.cuchost.com (172.16.6.83) X-YovoleRuleAgent: yovoleflag Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Parse interrupt resources and register interrupt handlers. Signed-off-by: Jack Zhu --- .../staging/media/starfive/camss/stf_camss.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/staging/media/starfive/camss/stf_camss.c b/drivers/staging/media/starfive/camss/stf_camss.c index 75ebc3a35218..918b8b2a7713 100644 --- a/drivers/staging/media/starfive/camss/stf_camss.c +++ b/drivers/staging/media/starfive/camss/stf_camss.c @@ -35,6 +35,12 @@ static const char * const stfcamss_resets[] = { "rst_isp_top_axi", }; +static const struct stf_isr_data stf_isrs[] = { + {"wr_irq", stf_wr_irq_handler}, + {"isp_irq", stf_isp_irq_handler}, + {"line_irq", stf_line_irq_handler}, +}; + static int stfcamss_get_mem_res(struct stfcamss *stfcamss) { struct platform_device *pdev = to_platform_device(stfcamss->dev); @@ -157,6 +163,21 @@ static int stfcamss_probe(struct platform_device *pdev) stfcamss->dev = dev; + for (i = 0; i < ARRAY_SIZE(stf_isrs); ++i) { + int irq; + + irq = platform_get_irq(pdev, i); + if (irq < 0) + return irq; + + ret = devm_request_irq(stfcamss->dev, irq, stf_isrs[i].isr, 0, + stf_isrs[i].name, stfcamss); + if (ret) { + dev_err(dev, "request irq failed: %d\n", ret); + return ret; + } + } + stfcamss->nclks = ARRAY_SIZE(stfcamss->sys_clk); for (i = 0; i < stfcamss->nclks; ++i) stfcamss->sys_clk[i].id = stfcamss_clocks[i];