From patchwork Wed Mar 29 20:51:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng <15330273260@189.cn> X-Patchwork-Id: 76817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp691165vqo; Wed, 29 Mar 2023 14:15:27 -0700 (PDT) X-Google-Smtp-Source: AKy350b3dnUYhEpp0f+5tUjHzeFza6V0TgHL+fSmbAcpbwVURTrxOCX1J1I5Cugqq0xHVcoyI8uK X-Received: by 2002:a17:903:6c5:b0:19d:778:ff5 with SMTP id kj5-20020a17090306c500b0019d07780ff5mr18839011plb.15.1680124527529; Wed, 29 Mar 2023 14:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680124527; cv=none; d=google.com; s=arc-20160816; b=DFhQxgvbv3Q97p4+wpJxRCL3NGnjDpQcquJwrMki3DAbp3koAR5GCgzgPXMY95e+ub ylUMjAbwJvAiMMceHr72qNvmS1EQByzFjGIPSHk4zR/FAY0dbfv4hBiBdbXbsLJC33sH ShpxJ9xMnsMyDMn2sYiGdfiTxTcArQO7KxLSwEgIfdLkMkO3AqUBYuJfmBWfhYutksxr v2mnJl1INJxZdI67jMXsMZmMJUr8gaySqeFQeq+rrqfSJemaheEr7fFy7VR51+Gk89qk cfyJULw6zDRAzL+VisvTuNnPHNS2V6rFujz+2c//3VtF9+hR+gO1RExtGTZskJsFp3ls 7/DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :hmm_source_type:hmm_attache_num:hmm_source_ip; bh=dQ1D16H7SQKOll8LJFVpZZQml0HNUFjnyKmJ9Vp+LAA=; b=NrJdUXfar8vSjKfk2IPBVvXKluYNFcoDeDjLFOKgc8mpFvYeR4V0xFdjlWoSrMXZH0 vr8jAmHleo1fX5nez7Ca4T5b8QksvwEcakMIA4ydiMR2ItpJIuS/9JzsJFe8g2SHPmbP /Vd7N2jOC6/xQa6tYeD8O5YgCvRO3dxEymkFRU81kjl/AFovhwjIuXrr+fz+93E9Ae6j dn/YexcQUImo7ZkMpAGF0T39mpXyTi8rQoHXq7Fhg05ZJiv3MsKAFMbZQOTBhmWd/CJO 6xR5CWk5tDPLisyMCo9iN8xx6335C79NF4buoge7bsmMp5FoaT/ugg2fjVE/L1vjBstR avLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 38-20020a631766000000b005030a59a818si30827527pgx.402.2023.03.29.14.15.10; Wed, 29 Mar 2023 14:15:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjC2Uvr (ORCPT + 99 others); Wed, 29 Mar 2023 16:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjC2Uvp (ORCPT ); Wed, 29 Mar 2023 16:51:45 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CAB3A469E for ; Wed, 29 Mar 2023 13:51:43 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.43:36106.2084148567 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.43]) by 189.cn (HERMES) with SMTP id AEC041002BB; Thu, 30 Mar 2023 04:51:42 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-7b48884fd-tj646 with ESMTP id 353b3cba185c4f20ae970cdfdfb1d751 for l.stach@pengutronix.de; Thu, 30 Mar 2023 04:51:42 CST X-Transaction-ID: 353b3cba185c4f20ae970cdfdfb1d751 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn From: Sui Jingfeng <15330273260@189.cn> To: Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter , Li Yi Cc: linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sui Jingfeng Subject: [PATCH v3 1/6] drm/etnaviv: add a dedicate function to register irq handler for the gpu Date: Thu, 30 Mar 2023 04:51:24 +0800 Message-Id: <20230329205129.1513734-2-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230329205129.1513734-1-15330273260@189.cn> References: <20230329205129.1513734-1-15330273260@189.cn> MIME-Version: 1.0 X-Spam-Status: No, score=0.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FROM_LOCAL_DIGITS,FROM_LOCAL_HEX,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761738256386959602?= X-GMAIL-MSGID: =?utf-8?q?1761738256386959602?= From: Sui Jingfeng Because get irq from a device is platform dependent, pci device has different method to get irq. This patch is a preparation before we introduce support for the pci device. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 34 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index de8c9894967c..636d3f39ddcb 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1817,6 +1817,29 @@ static const struct of_device_id etnaviv_gpu_match[] = { }; MODULE_DEVICE_TABLE(of, etnaviv_gpu_match); +static int etnaviv_gpu_register_irq(struct etnaviv_gpu *gpu, int irq) +{ + struct device *dev = gpu->dev; + int err; + + if (irq < 0) { + dev_err(dev, "failed to get irq: %d\n", irq); + return irq; + } + + err = devm_request_irq(dev, irq, irq_handler, 0, dev_name(dev), gpu); + if (err) { + dev_err(dev, "failed to request IRQ %u: %d\n", irq, err); + return err; + } + + gpu->irq = irq; + + dev_info(dev, "IRQ handler registered, irq = %d\n", irq); + + return 0; +} + static int etnaviv_gpu_platform_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1837,16 +1860,9 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) return PTR_ERR(gpu->mmio); /* Get Interrupt: */ - gpu->irq = platform_get_irq(pdev, 0); - if (gpu->irq < 0) - return gpu->irq; - - err = devm_request_irq(&pdev->dev, gpu->irq, irq_handler, 0, - dev_name(gpu->dev), gpu); - if (err) { - dev_err(dev, "failed to request IRQ%u: %d\n", gpu->irq, err); + err = etnaviv_gpu_register_irq(gpu, platform_get_irq(pdev, 0)); + if (err) return err; - } /* Get Clocks: */ gpu->clk_reg = devm_clk_get_optional(&pdev->dev, "reg");