From patchwork Mon Jul 13 06:08:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 11658763 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 7A177913 for ; Mon, 13 Jul 2020 06:09:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6180C207BC for ; Mon, 13 Jul 2020 06:09:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="MJI0XNhB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729284AbgGMGJk (ORCPT ); Mon, 13 Jul 2020 02:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729270AbgGMGJi (ORCPT ); Mon, 13 Jul 2020 02:09:38 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B160BC08C5DD for ; Sun, 12 Jul 2020 23:09:38 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id cv18so6129061pjb.1 for ; Sun, 12 Jul 2020 23:09:38 -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=emr/NGqj2O214H2RbodqJQHnJMZ9UzU1pc+xV9IRc4I=; b=MJI0XNhBy7D66xtLNgM0JoF5yJyBliChbZhl+Ewb7Rxb0zXallIaPeV0iHxOcHqBMM foYz0ZreIMkRc8Pto9PpxS3ZTignfJ5HuqD+fs1zRlIBgymv2Xph23P9lNGblMZGfR8U EdINi2IIzILZ9kdLXxkMo1GtL0K/6kbFSHy7w= 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=emr/NGqj2O214H2RbodqJQHnJMZ9UzU1pc+xV9IRc4I=; b=RfQpHMKuWD/mJduM/eAisyXTHsAd9/IGd8g5T4tEbEu+V5NphLojDD0dL7hcwcGeq1 e+12FWIxw+a0tZwgXBW9kZaCWjG+TJqwo/YEv6n8r1MeFEFt+jka7zIkeiSmYP2DgsJa ZTBaM1l9H3spb0lTtYRXnmYq+B9kjtqx69Y6lrL/vl/taRal3EivmwaT4UnZrxi9ATyz KZOat75N1bsQbvFVXuN5OmxFpeyjnLdGumKRw8xZ2/b/GI/OnBTSZECKIiOPdNl7m9IO AkHrKl2dcgaRCKs+v6eVukxaEgBjqUV4vI4KWoXXxLlorl7ywLlgC9zh/pRb0kU8BeUd iyaA== X-Gm-Message-State: AOAM530hR6TqrQtR7ctQcnuYSW4xEVk3Y5sycnNIn+ysfXEInEk0BXin fdK2JJOfcKdy178trhWlnshdzw== X-Google-Smtp-Source: ABdhPJysjlLkR7LkuQ6sWSWbC6lkJls5Z50Q4yTfrVa+t5ZL7a+g9iV25BOY6gvfVvL6OvzXgbJlvw== X-Received: by 2002:a17:90b:2348:: with SMTP id ms8mr17509414pjb.5.1594620578321; Sun, 12 Jul 2020 23:09:38 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2020 23:09:37 -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 09/16] media: mtk-vcodec: add support for MT8183 encoder Date: Mon, 13 Jul 2020 15:08:35 +0900 Message-Id: <20200713060842.471356-10-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 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Yunfei Dong Now that all the supporting blocks are present, enable encoder for MT8183. Signed-off-by: Yunfei Dong [acourbot: refactor, cleanup and split] Co-developed-by: Alexandre Courbot Signed-off-by: Alexandre Courbot Acked-by: Tiffany Lin --- .../platform/mtk-vcodec/mtk_vcodec_drv.h | 1 + .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h index 59b4b750666b..a271611750ad 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h @@ -302,6 +302,7 @@ struct mtk_vcodec_ctx { enum mtk_chip { MTK_MT8173, + MTK_MT8183, }; /** 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 c8a4b85a81c4..b8fe408dd6c7 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -62,6 +62,14 @@ static const struct mtk_video_fmt mtk_video_formats_capture_mt8173[] = { }, }; +static const struct mtk_video_fmt mtk_video_formats_capture_mt8183[] = { + { + .fourcc = V4L2_PIX_FMT_H264, + .type = MTK_FMT_ENC, + .num_planes = 1, + }, +}; + /* Wake up context wait_queue */ static void wake_up_ctx(struct mtk_vcodec_ctx *ctx, unsigned int reason) { @@ -424,8 +432,22 @@ static const struct mtk_vcodec_enc_pdata mt8173_pdata = { .max_bitrate = 4000000, }; +static const struct mtk_vcodec_enc_pdata mt8183_pdata = { + .chip = MTK_MT8183, + .has_lt_irq = false, + .uses_ext = true, + .capture_formats = mtk_video_formats_capture_mt8183, + .num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_mt8183), + /* MT8183 supports the same output formats as MT8173 */ + .output_formats = mtk_video_formats_output_mt8173, + .num_output_formats = ARRAY_SIZE(mtk_video_formats_output_mt8173), + .min_bitrate = 64, + .max_bitrate = 40000000, +}; + static const struct of_device_id mtk_vcodec_enc_match[] = { {.compatible = "mediatek,mt8173-vcodec-enc", .data = &mt8173_pdata}, + {.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata}, {}, }; MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);