From patchwork Fri Aug 21 10:35:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 11728859 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A03C175D for ; Fri, 21 Aug 2020 10:36:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03B1920738 for ; Fri, 21 Aug 2020 10:36:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oPX45q2t"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="R+zAOoZH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 03B1920738 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VV+XksqIc2gv0UWPuFs5N0q8jrQQwHfuz/g/Jx+MOD4=; b=oPX45q2tDMDbdn8dEIBwYJPis GjeGR87PQLUsPOC7utLyNoCS1/rC+Fl5qQ8F4cVmkz8fcRRieXc+qUZb/GrcMUA6g+sP06+SZYqoJ dDdKGI412z28LdsNiMTdHnoqRB+ZqiP29oJGcLmOL1/jJbPb4SOd2vmPwM9HuFs3KDv4uDHuJ0NAi UTh3TfS0PzZKAy8/BSDgGQcpP0E0go3eCzTXvQsrSxm+tcYjLPi+K6Jr3oewgyflfgkIN14uC9Qad 4dhlpY+bFJ5dio1A29FKoq/lEqtAh6GEpXx65JKvszF8y1sknKFZURnjR6EQNJPh2XlKU3eobejYm V3pk6z5rw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k94Pp-0002B5-7C; Fri, 21 Aug 2020 10:36:57 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k94Pn-00028K-GR for linux-mediatek@lists.infradead.org; Fri, 21 Aug 2020 10:36:56 +0000 Received: by mail-pj1-x1042.google.com with SMTP id n3so622801pjq.1 for ; Fri, 21 Aug 2020 03:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wSZSbDZ08cylSEX/G8IrfjovP8UHcDWFoSMCGLeK/OE=; b=R+zAOoZHsNc/stod/r/22gFK6RbLZtdiNUGAaLfmTULxkEppYgt/JtzLl+/kg+PIoa Cn+eEXY+M2apC2Klr5JWM02ho9+2TEBh45Viqjg9UsCOaH7VZMTCfeZB5vN4pES1P4Sy Gr53ndmfioz+ugcsmrGOsngymjRQUKuQdjkOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wSZSbDZ08cylSEX/G8IrfjovP8UHcDWFoSMCGLeK/OE=; b=dx+rKT/O64lhAsgnuv/ohk9FoVHDjKeSfdJsxpE1z5qR3Ia6l2PnI0IXd3SJjXjGHS 8Y2PqxsbaQzLsF41j2bsGbRvTpnJd1ddPvNBHoP8GLkXZQWcgrtR796eDZjyDA/JdYcF l5ByoeE2cjLHnDsC1+lxXUr2eOkQaxX6EG2SVGta9E/77nf/yI1fmV/NCMCK/Gwh/2OO o+TL2kurNGVp5B6c9Me2xvd3gjcSh4ixz14ZI3RIlzaPn4+s7XkmtgVGoiu8zSHy0CY4 9B7FiR82zIj23xHvlmyt1X+IhFlzeYdCaqoBosj52wWwNN9AOeyXVO40mZ+qUZo3MA70 vUSQ== X-Gm-Message-State: AOAM533HToJT3ZRr7qOSCoD9mBta2qjZlm8XmbNYVaW07V4yYs3MRSJ6 LziRE4NQbN57+TMFBEbzYdQ4fA== X-Google-Smtp-Source: ABdhPJxOimO6yUX1CD+nnRroMZNOhDxgH6Dc+cxLXKfy60hZyujyWWzQxkjkFARUJ+QFUULBwkeb5g== X-Received: by 2002:a17:902:c286:: with SMTP id i6mr1820004pld.63.1598006212707; Fri, 21 Aug 2020 03:36:52 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:8f:203:eeb1:d7ff:fe57:b7e5]) by smtp.gmail.com with ESMTPSA id y20sm2081525pfn.183.2020.08.21.03.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 03:36:51 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Hans Verkuil , Yunfei Dong , Maoguang Meng , Matthias Brugger Subject: [PATCH v4 06/17] media: mtk-vcodec: venc: specify bitrate range per-chip Date: Fri, 21 Aug 2020 19:35:57 +0900 Message-Id: <20200821103608.2310097-7-acourbot@chromium.org> X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog In-Reply-To: <20200821103608.2310097-1-acourbot@chromium.org> References: <20200821103608.2310097-1-acourbot@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200821_063655_559638_BBCAB8B5 X-CRM114-Status: GOOD ( 13.68 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Courbot , linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org Different chips have different supported bitrate ranges. Move the min and max supported bitrates to the platform data. Signed-off-by: Alexandre Courbot Acked-by: Tiffany Lin --- drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 4 ++++ drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 3 ++- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index 1676c26eb229..e4b28fefcc95 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -311,12 +311,16 @@ enum mtk_chip { * * @uses_ext: whether the encoder uses the extended firmware messaging format * @has_lt_irq: whether the encoder uses the LT irq + * @min_birate: minimum supported encoding bitrate + * @max_bitrate: maximum supported encoding bitrate */ struct mtk_vcodec_enc_pdata { enum mtk_chip chip; bool uses_ext; bool has_lt_irq; + unsigned long min_bitrate; + unsigned long max_bitrate; }; #define MTK_ENC_CTX_IS_EXT(ctx) ((ctx)->dev->venc_pdata->uses_ext) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index d469ff6464b2..50ba9da59153 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -1232,7 +1232,8 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx) v4l2_ctrl_handler_init(handler, MTK_MAX_CTRLS_HINT); v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_BITRATE, - 1, 4000000, 1, 4000000); + ctx->dev->venc_pdata->min_bitrate, + ctx->dev->venc_pdata->max_bitrate, 1, 4000000); v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_B_FRAMES, 0, 2, 1, 0); v4l2_ctrl_new_std(handler, ops, V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE, diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index 379b6638f7a9..602f6a9c13e3 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -386,6 +386,8 @@ static int mtk_vcodec_probe(struct platform_device *pdev) static const struct mtk_vcodec_enc_pdata mt8173_pdata = { .chip = MTK_MT8173, .has_lt_irq = true, + .min_bitrate = 1, + .max_bitrate = 4000000, }; static const struct of_device_id mtk_vcodec_enc_match[] = {