Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp744970ybh; Sun, 12 Jul 2020 23:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxePL6nMwmK7TzNjV6nT9SJmdsq3kRw/IClN02FX1MOpzaZi5N9Xejz7LQ58uOnEZK6rZ5S X-Received: by 2002:a17:906:1d1b:: with SMTP id n27mr74628401ejh.272.1594620623833; Sun, 12 Jul 2020 23:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594620623; cv=none; d=google.com; s=arc-20160816; b=iE7DJUIqJ9lA4Y1rgJtIHML75h1k0/DlWV3N0cyACaEzXMo6wdawaYuV+Xx8QX4Skb icpghiRAVJRT90FYSkeYeSU5nGaKwaR5/Epoi3XwSrtu+NF/D8IRyZsn0Jukvk1BSj4P PHuceD2hIqfMKI2U5Md2h6dZzVwxaYYOv1laXKaqNU42u3AIGoesyNlX4jkl8s1mfeW0 Wm7JEjoOexv2vOb2+JCS29T/zGV4qFJic/BrE2W2hVuAkJVvgV+eblnnzzSRSgukxDle 7HC4qIuVwOJO71+C3IQ/jM2OTf0E7hxgCi8x5d2bbfFtXke3f2Tp4Kz1m6qASANfbVn5 r2gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TMz+TFk15UWK//DhjPPAaUR+8tluYpYaBAxgr8yuuTI=; b=qSXQX4VDrQ7QYb7O4fZplPxW0QEH6KWF/BBbzThRjJE/cDu8k7ju+XoAdlufKnJ1uY 7pvhSZjozEw1NfQHHXu4ks2O7Kr5LqUZ9yqsveEPnyMNLJisTJlrijf64qXJGv8bbWIh Tx4nEJl0A3dJoYrIZkqmqvOodfR1CwZ4QPocIcvmjffpH2E0AwO4tGJGpBJQ3ovzzO9/ hqwK6muNHPAVenZ98eoqzvXpvLW9ZoxYAfeFJD3dBW2deXeTjY+n2tguVOT+LCkTUoy+ m6amGzUtyA0mxC4k9hW+u+x95gZE+J2SY4uvoCNynWLQldWeUws/glpl5x6capwy3KC7 zthg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GCaQYJow; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r23si8162150edy.317.2020.07.12.23.10.01; Sun, 12 Jul 2020 23:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GCaQYJow; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729225AbgGMGJb (ORCPT + 99 others); Mon, 13 Jul 2020 02:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729216AbgGMGJ3 (ORCPT ); Mon, 13 Jul 2020 02:09:29 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6716FC08C5DB for ; Sun, 12 Jul 2020 23:09:29 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id j19so5564211pgm.11 for ; Sun, 12 Jul 2020 23:09:29 -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=TMz+TFk15UWK//DhjPPAaUR+8tluYpYaBAxgr8yuuTI=; b=GCaQYJowMgdDFdP50tGtRMz1K9X4UO6ZWbfx0pr17+JwN6FTKDU/QFIUN0a2CVRg6f egszfIJOcOkNzZOV/bQHLvBE0Jf6tAD3d3OufOdlmG8eIyddehYYd68qTDDA0aU/xDtM uIllW0vM4KZvwsT9f85e21iCbp001pqKJMJ9I= 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=TMz+TFk15UWK//DhjPPAaUR+8tluYpYaBAxgr8yuuTI=; b=ly1FLELQdZpEb6iOGMI4OvbVsxAiCM3lSTVUlhnJ7wvdkFrgEF1wJw99zSyHdjMKbD EzRjz1kh0+/93HKyBajgIDLCwIyEYZ8G4QRVML7CBP+mCxEIYVnEdyP4ky/EPw0vzMPA ImcGUFE8AksLe2m6aYuHDnpk6QYeEtCglShPK9Lp9pFn6OPPnf4yTXxMIH66EH+uiSZ1 ScYnsW4cvPPYJbBjVyD1Xawc6uao/vo+CYwYQsbm7ZrwD6mFvku7ivBYMCw7o9bkHDQ0 CLvRtt92b9w/cTaoOs6AxDycgTn55dtpibDzdi7lqHl1FhU6WBpJpN/UZaWJO3SU6WPY Rx9A== X-Gm-Message-State: AOAM533cFc4B52Ybp5wIzDln7uLKQQskhLc+2lu+NYPrkMtIXarPPRaH lMtL+rnQ0P6ljFC19v0jhQl11w== X-Received: by 2002:a65:60d4:: with SMTP id r20mr63448777pgv.436.1594620569005; Sun, 12 Jul 2020 23:09:29 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:8f:203:eeb1:d7ff:fe57:b7e5]) by smtp.gmail.com with ESMTPSA id c134sm13134934pfc.115.2020.07.12.23.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 23:09:28 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Hans Verkuil , Yunfei Dong , Maoguang Meng Cc: linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [PATCH v3 06/16] media: mtk-vcodec: venc: specify bitrate range per-chip Date: Mon, 13 Jul 2020 15:08:32 +0900 Message-Id: <20200713060842.471356-7-acourbot@chromium.org> X-Mailer: git-send-email 2.27.0.383.g050319c2ae-goog In-Reply-To: <20200713060842.471356-1-acourbot@chromium.org> References: <20200713060842.471356-1-acourbot@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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[] = { -- 2.27.0.383.g050319c2ae-goog