From patchwork Mon Nov 22 18:46:57 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: 12693353 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 04F79C433F5 for ; Mon, 22 Nov 2021 18:49:15 +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=H7HhGxKQoiVFbDrGKDO9T8fqyCWIwKcIRekouYGPRO8=; b=1iHFUTG1l2uQRM GZlKxfwvLhwgF+tOsfjT5Ys/Mg3iaKZL4Xi5F0J964VjofE1BIgf9It7ZGlG5B58OF9KCON7/38wG 3R8iMG4vYvPfNU8gg49bUdrbwV/XB8DIH6Q+naduld/cPxuVtMnOkfGY2JxPln6v51b1PHsUANo/+ FK0XTobCgo6xPnW3WBdOKHw06xhbctf6zG/nBE+5DQUzmjZJMVHafK7jJR5wT9482ppuoCJDeaFh8 t4JddO5QrBFcvHeddjnmQHF9wtroyIj+86QjpKv0VV2qXgiQZgupixU2UIKCtvs0Qfd9pMKZGsYL6 oponaXahzkJRQGMB2haA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpELu-00HOLf-1Q; Mon, 22 Nov 2021 18:47:42 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpELU-00HOAi-6E for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 18:47:17 +0000 Received: by mail-ed1-x534.google.com with SMTP id x6so69111829edr.5 for ; Mon, 22 Nov 2021 10:47:15 -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=gKAd13ADpuT/g6/zKOnVkwtQVM57IaAtbrKHSQ6bV6A=; b=hJgWH6pywF6UW/vvgqL5V57IsYjartVT3mGfw0/TKtJdbMM6QX9VaQxCzXFli4T+UF Fwvk67TmcufffHzSglF0gQ92NJn6LauHY7+LrSFO1ZlV8cIIheDiwrNETelXdTGeZ6uX L1WKUwr1HAo4sBkS2r3Jia8/FFwn4pYQYAAtw88A1nnzYBQaEy67+5yAjwfyUKehmq+R LV3KZLaE5Xgmo5lAxh+DMQMuBkUnBO1V6x+68ix3x1DiXUFqX4owFOOrUoagQtZiZJVW ihakzwSByhoTxJGQHjtSZoTW+UY+cQ9g3MvtxzO0a2XBpl+EKQ1VAmp6tUyf/mZU+Jw0 xxcg== 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=gKAd13ADpuT/g6/zKOnVkwtQVM57IaAtbrKHSQ6bV6A=; b=j/rpeBgCkKvzsKbTx2N40iV4vxH16y4Y5rN3xgDJyrYlJ3FS3tLzJUuCPCGa2TXLKc D5DrdrpBwBnA403C9cl6PIpsGbPN0Oaqy0zsUCpO/GA9CF8hVqUfCTRAjh/YT/TxGu75 6XY8NrF9gKa5+eIZrth6BkIP9eTj130iUZWeTe+V2G07qVLz9E6MI/YxD3i2la8cAChw 6D1yz43tPiX+wzO6DjtdFWCr79WAQkTBioTQAtAdAxtsHB6U7BQwtxWVR22x0lWdoqn7 oyy+uRVMUl/xeBd9QCHhO+cVuck3z1dyUNbV4XSmsIfrPicWm+meB0DSk0pYW6ooraCu KeoA== X-Gm-Message-State: AOAM533fgmPYzYuzsXVHy07ehl4rJhhNCSOdnGDLC0RhpOqCybarTj1N 40F6Kz8xojO7VT+gIwCCBEQ= X-Google-Smtp-Source: ABdhPJxgENTrJeEAp2FSu442LZx+8rnzsygJjMZ5AXrx66h6EMWLyfL6qetx5t+R4vKDqAWaXyJSuA== X-Received: by 2002:aa7:cada:: with SMTP id l26mr68753520edt.376.1637606834429; Mon, 22 Nov 2021 10:47:14 -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 h10sm4512312edr.95.2021.11.22.10.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 10:47:14 -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 2/7] media: hantro: vp9: use double buffering if needed Date: Mon, 22 Nov 2021 19:46:57 +0100 Message-Id: <20211122184702.768341-3-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211122184702.768341-1-jernej.skrabec@gmail.com> References: <20211122184702.768341-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-20211122_104716_255809_9BC58684 X-CRM114-Status: GOOD ( 11.58 ) 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 Some G2 variants need double buffering to be enabled in order to work correctly, like that found in Allwinner H6 SoC. Add platform quirk for that. Signed-off-by: Jernej Skrabec Reviewed-by: Andrzej Pietrasiewicz --- drivers/staging/media/hantro/hantro.h | 2 ++ drivers/staging/media/hantro/hantro_g2_regs.h | 1 + drivers/staging/media/hantro/hantro_g2_vp9_dec.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 33eb3e092cc1..d03824fa3222 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -73,6 +73,7 @@ struct hantro_irq { * @num_clocks: number of clocks in the array * @reg_names: array of register range names * @num_regs: number of register range names in the array + * @double_buffer: core needs double buffering */ struct hantro_variant { unsigned int enc_offset; @@ -94,6 +95,7 @@ struct hantro_variant { int num_clocks; const char * const *reg_names; int num_regs; + unsigned int double_buffer : 1; }; /** diff --git a/drivers/staging/media/hantro/hantro_g2_regs.h b/drivers/staging/media/hantro/hantro_g2_regs.h index 9c857dd1ad9b..15a391a4650e 100644 --- a/drivers/staging/media/hantro/hantro_g2_regs.h +++ b/drivers/staging/media/hantro/hantro_g2_regs.h @@ -270,6 +270,7 @@ #define g2_apf_threshold G2_DEC_REG(55, 0, 0xffff) #define g2_clk_gate_e G2_DEC_REG(58, 16, 0x1) +#define g2_double_buffer_e G2_DEC_REG(58, 15, 0x1) #define g2_buswidth G2_DEC_REG(58, 8, 0x7) #define g2_max_burst G2_DEC_REG(58, 0, 0xff) diff --git a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c index e04242d10fa2..d4fc649a4da1 100644 --- a/drivers/staging/media/hantro/hantro_g2_vp9_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_vp9_dec.c @@ -847,6 +847,8 @@ config_registers(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp9_frame *dec_p hantro_reg_write(ctx->dev, &g2_clk_gate_e, 1); hantro_reg_write(ctx->dev, &g2_max_cb_size, 6); hantro_reg_write(ctx->dev, &g2_min_cb_size, 3); + if (ctx->dev->variant->double_buffer) + hantro_reg_write(ctx->dev, &g2_double_buffer_e, 1); config_output(ctx, dst, dec_params);