From patchwork Wed May 20 08:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 11559727 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 B11CB13B1 for ; Wed, 20 May 2020 08:28:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 877ED206C3 for ; Wed, 20 May 2020 08:28:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eLHWj/A8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mb0vm7TH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 877ED206C3 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=bombadil.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=wQ6aeB4y8wlUlqnEey/M2KrM4Zrxr4mTvE/pbuOc8Go=; b=eLHWj/A8jJYmxQ 9mLRIPv2URWZciMSdEDYIX1OH//aes2+8TJd8bkJgS3RnJOltaGsl3dB0JZk2FeZXuW32nHp0IqA3 jog3yDevIjNWasWmswFX9Qzzi/CL2Xl7zAT/NpRq+atMUKoLmhXeSD+ADtxLwRonwuhLVfSJHonpf jUojUxNVL16XvTv28gsxL93OSzxuk5p0sQUbByXEVyX4sJ1o1eoUA+JahuMnwIeFAQohfiS0Zfkj7 Mh+YGtYZEIWxdoFQuxlHx7jnaRSW4HBgtjOmM+1C2/+Iyv5bhoypDw+3ilmPHlJFR0s+PccNcoe0R BLWLaIiJonuFtCqO9BdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbK5I-0002kW-9r; Wed, 20 May 2020 08:28:16 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jbK52-0002Ys-An for linux-mediatek@lists.infradead.org; Wed, 20 May 2020 08:28:12 +0000 Received: by mail-pj1-x1043.google.com with SMTP id nu7so906603pjb.0 for ; Wed, 20 May 2020 01:27:59 -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=Ac7V/sUfRNLpfMuOaTpdWcguR6PzK7tIy5O2XB2td3o=; b=mb0vm7THmbMkGIlT+BNV0Bdzt1EA5w/RCS6CHt4KC/+sQTXBdtcjiA3Q42mDlecffi xp5pybxLQn//gWp2qvkUNFotnb/QzwLoYdwkA5Bjiaxs34eBcCJ8mulwRWyIeDBGgsMf lS6Lm/MXj5NCeJTXxjiEWta1ylKRXrQw2m/CI= 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=Ac7V/sUfRNLpfMuOaTpdWcguR6PzK7tIy5O2XB2td3o=; b=ZxTHJnZBGaffxwoiQUof/CM5Rvp6Zq2fFJVr7H2yKphRsihxKX/SWRnMs/9eRrBLqs jceSRn9ItpCvdUMRz0lCAQ7u96wcKcT7RsMPfy/5vVQxE3Jyf1HLOZkX4A8oDQ2pCKym ednZcFtm/zwP/MaPYpjrdsvO9j5zVEM9VVedO3T3f/CJf2YrtlFchEkwm+niUSQxaELg DbUHajjBQw+Gi04Ee8m47hVEVr6xcKe/eOimsQsMQ6c/HcVJIVjLEIQjQkA2OrpDb/J+ ilmg//jQrRmyQAzubtqA4yI2eBiQqctHHHwAFICc9t1ud0U46069TWuESNAbiXYDu2w7 wO+w== X-Gm-Message-State: AOAM53136hPp+EuBwNQkN9APKcS+iS3h8Cjb5vLe3BVngrxGAj2ss4cA S389qyiXYEoKNkabg+vD3fVcOw== X-Google-Smtp-Source: ABdhPJzu7eB23OTwyBGbvS8Qm1mtpFj6KgSq8osEOzgiMFnzgKjLmUcoUhObMrSrUqAHbCvzHIG19A== X-Received: by 2002:a17:90a:150:: with SMTP id z16mr4175297pje.37.1589963279012; Wed, 20 May 2020 01:27:59 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:8f:203:93d9:de4d:e834:3086]) by smtp.gmail.com with ESMTPSA id gg8sm1447775pjb.39.2020.05.20.01.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 01:27:58 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Rui Wang , Yunfei Dong , Pi-Hsun Shih , Maoguang Meng Subject: [PATCH 05/10] media: mtk-vcodec: venc: specify bitrate range per-chip Date: Wed, 20 May 2020 17:27:18 +0900 Message-Id: <20200520082723.96136-6-acourbot@chromium.org> X-Mailer: git-send-email 2.26.2.761.g0e0b3e54be-goog In-Reply-To: <20200520082723.96136-1-acourbot@chromium.org> References: <20200520082723.96136-1-acourbot@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200520_012800_371581_C42084B6 X-CRM114-Status: GOOD ( 10.94 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.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:1043 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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: 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 e7b155e7432e..b8f913de8d80 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; }; /** 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 c1365209263e..221fa0303075 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -380,6 +380,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[] = {