From patchwork Mon Nov 29 18:26:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 12693945 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7EEBFC433F5 for ; Mon, 29 Nov 2021 18:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FteuW+3Ykp+P34EWdXnMv8y4tokizDGyq7YVg5o0QNg=; b=HSYbiYuPRdy7AC zahnLE+dRE3kRkUAsksx4zPDadrE0CFk6fbWPsR/VD6RHfVH9bZrrYVUEnjDdwW+GyOHaDG91U7gl Ltpb3kp5JieCYQeCT3m6KLQqHzJ2KuTQs6MBfetAoslRIJwFi/lDbwdHCSoinJcQn5IxSFeZiU5zI U4HBcLeL4UyiQNv/W73HucLZUoYt2ianv2qDkOaqkDVLmWwpJJ37/7AA/vcQmdRJfgcS5LSLG+e0y QVcD+YUB5r0dOwykPZXxlzLDUmgGB5Cm5NaGUjMeKxZeoAo4WhPZDO6RU33eypt5PqkZfLhyGB0IJ uDKy6i63svkZFybWmO7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrlOE-001lsd-O0; Mon, 29 Nov 2021 18:28:35 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mrlMW-001l5N-ES for linux-arm-kernel@lists.infradead.org; Mon, 29 Nov 2021 18:26:51 +0000 Received: by mail-wr1-x435.google.com with SMTP id c4so38800438wrd.9 for ; Mon, 29 Nov 2021 10:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sfAAyurwbMN8Wc59AsqGd+iq2BYgkQGpfgJfPJ1lW7c=; b=fLt2iFzUdSChTr/aTeldb9kjU60F46BE43DvUyjznt5ELtiK96hsZ10RUuslx7bqEb u5FmjI/zZ/xHZjKI/lmTzGK4k3SyK54Y7j38OxNHM7VblYS7ywAr3YVumRiMD/AIAQPE nB+fyJlmBmpoF1/ADF6MZWDNHkCy5Hm+3pcAMST4d6R4G/4IcR8UixVxZ5IY7sLAXa7S wqbP/SLYIbLM1QrCuto14PR9h+qNVTlpYcpXYUYC3xB7sGryPv15sGDUW4LbUfMcztC4 Omb4ABKSnHumX/cCIICxETDIinB1++F0Sjkzx69/BMR9IExepaUYrNxJUO0TaIaZilfz lH3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sfAAyurwbMN8Wc59AsqGd+iq2BYgkQGpfgJfPJ1lW7c=; b=br05o6+FWvULooMOUAVtyUQ3/lEwcqCjonzj9qTU56Lk86+bXQ8ZUvWL/orRo193Qa agnkKdQShvEPQAw9L1fMHNNs+rSuTXz4wYrgz30rT0FSp+MahaJzt1PSzXCs/yeTcIro udJocMk6MZH/7QRkpq7wT+Urp/ncAcnLQWk59IhGti52YqdFi6Yh7/8fC1jZP0KZ4QNm bCRgowSbshZYNh+tccS9GX15mUy9WP9t2ZAkQtMZXlrCXuBwLT5HMCrTfPdQQ1OReduZ C+UNs3Pmwyqi2VzL/wVcxeaWG1KC0/SL/QS/3E53VfGfkuGddkcFHt4kTsXrrFf9/Rvf Wq1Q== X-Gm-Message-State: AOAM533J4lRWcCPtCxPZExvo/1r5XqAvocxwwPRgfnN1sLfhl2C7uosO ZaQuuYbvSX98nCMGpW97Qvc= X-Google-Smtp-Source: ABdhPJzfTwh2g5WVNC332WqhJS6YiHqknDrm94kLGyptSuUtiKwlqNGHB6BzHGMR2MpBNhVitm8PBg== X-Received: by 2002:adf:d1e2:: with SMTP id g2mr37291036wrd.105.1638210406497; Mon, 29 Nov 2021 10:26:46 -0800 (PST) Received: from kista.localdomain (cpe-86-58-29-253.static.triera.net. [86.58.29.253]) by smtp.gmail.com with ESMTPSA id o12sm85907wmq.12.2021.11.29.10.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 10:26:46 -0800 (PST) From: Jernej Skrabec To: linux-media@vger.kernel.org Cc: ezequiel@vanguardiasur.com.ar, nicolas.dufresne@collabora.com, mchehab@kernel.org, robh+dt@kernel.org, mripard@kernel.org, wens@csie.org, p.zabel@pengutronix.de, andrzej.p@collabora.com, gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Jernej Skrabec Subject: [PATCH v2 6/9] media: hantro: Convert imx8m_vpu_g2_irq to helper Date: Mon, 29 Nov 2021 19:26:30 +0100 Message-Id: <20211129182633.480021-7-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211129182633.480021-1-jernej.skrabec@gmail.com> References: <20211129182633.480021-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211129_102648_553704_BCBFCA78 X-CRM114-Status: GOOD ( 14.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It turns out that imx8m_vpu_g2_irq() doesn't depend on any platform specifics and can be used with other G2 platform drivers too. Move it to common code. Signed-off-by: Jernej Skrabec Reviewed-by: Andrzej Pietrasiewicz Reviewed-by: Ezequiel Garcia --- drivers/staging/media/hantro/hantro_g2.c | 18 ++++++++++++++++++ drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/imx8m_vpu_hw.c | 20 +------------------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_g2.c b/drivers/staging/media/hantro/hantro_g2.c index 6f3e1f797f83..ee5f14c5f8f2 100644 --- a/drivers/staging/media/hantro/hantro_g2.c +++ b/drivers/staging/media/hantro/hantro_g2.c @@ -24,3 +24,21 @@ void hantro_g2_check_idle(struct hantro_dev *vpu) } } } + +irqreturn_t hantro_g2_irq(int irq, void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vdpu_read(vpu, G2_REG_INTERRUPT); + state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vdpu_write(vpu, 0, G2_REG_INTERRUPT); + vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index dbe51303724b..c33b1f5df37b 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -413,5 +413,6 @@ void hantro_g2_vp9_dec_done(struct hantro_ctx *ctx); int hantro_vp9_dec_init(struct hantro_ctx *ctx); void hantro_vp9_dec_exit(struct hantro_ctx *ctx); void hantro_g2_check_idle(struct hantro_dev *vpu); +irqreturn_t hantro_g2_irq(int irq, void *dev_id); #endif /* HANTRO_HW_H_ */ diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/media/hantro/imx8m_vpu_hw.c index 1a43f6fceef9..f5991b8e553a 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -191,24 +191,6 @@ static irqreturn_t imx8m_vpu_g1_irq(int irq, void *dev_id) return IRQ_HANDLED; } -static irqreturn_t imx8m_vpu_g2_irq(int irq, void *dev_id) -{ - struct hantro_dev *vpu = dev_id; - enum vb2_buffer_state state; - u32 status; - - status = vdpu_read(vpu, G2_REG_INTERRUPT); - state = (status & G2_REG_INTERRUPT_DEC_RDY_INT) ? - VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; - - vdpu_write(vpu, 0, G2_REG_INTERRUPT); - vdpu_write(vpu, G2_REG_CONFIG_DEC_CLK_GATE_E, G2_REG_CONFIG); - - hantro_irq_done(vpu, state); - - return IRQ_HANDLED; -} - static int imx8mq_vpu_hw_init(struct hantro_dev *vpu) { vpu->ctrl_base = vpu->reg_bases[vpu->variant->num_regs - 1]; @@ -280,7 +262,7 @@ static const struct hantro_irq imx8mq_irqs[] = { }; static const struct hantro_irq imx8mq_g2_irqs[] = { - { "g2", imx8m_vpu_g2_irq }, + { "g2", hantro_g2_irq }, }; static const char * const imx8mq_clk_names[] = { "g1", "g2", "bus" };