From patchwork Wed Jun 13 14:07:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10462337 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42F19603B4 for ; Wed, 13 Jun 2018 14:17:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E6DD28A4D for ; Wed, 13 Jun 2018 14:17:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22FEB28A4F; Wed, 13 Jun 2018 14:17:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A535828A4D for ; Wed, 13 Jun 2018 14:17:49 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=xZdJlh/iGZsi6A6oG6lUilEIL73Zm9o0sEEOFfLS2cA=; b=u/7Xp/r5Gr/XSefElkon8X+5bI 3ieF5gP8QmoZTSkQDajYtaI+ROy0HS+9jexdWpTHwIwGKDNMfUZ/ow0T8NfXXhKNHq6xfAhc4L/Dt i2t5yyZ75gtLBwkk+kWI/s8dVTJpwZPsT/V2WR2C+jgnmobYvA9UNmnCqIUnqtzPJqzY2YyKP7Uj6 WGOQFA02MTcALkjEYT0CTILBB9kK6mMfZzi/A5OxM0O+3mGLe4D769n0RYGf2xpJJlkNcZeUYvyjd j80Rsdmw7m3LaH49GifmzcNNJ00dNVHbJh01ScnIpa9opfdumaOKOQKfClGLmmyWzRiQ0tHJAk0gO LwTz6KEw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT6am-00008S-GD; Wed, 13 Jun 2018 14:17:44 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fT6Qs-0007Wr-OC for linux-arm-kernel@lists.infradead.org; Wed, 13 Jun 2018 14:07:36 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 2F2D320A20; Wed, 13 Jun 2018 16:07:18 +0200 (CEST) Received: from localhost (AAubervilliers-681-1-37-30.w90-88.abo.wanadoo.fr [90.88.156.30]) by mail.bootlin.com (Postfix) with ESMTPSA id F3024203B4; Wed, 13 Jun 2018 16:07:17 +0200 (CEST) From: Maxime Ripard To: hans.verkuil@cisco.com, acourbot@chromium.org, sakari.ailus@linux.intel.com, Laurent Pinchart Subject: [PATCH 4/9] media: cedrus: make engine type more generic Date: Wed, 13 Jun 2018 16:07:09 +0200 Message-Id: <20180613140714.1686-5-maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180613140714.1686-1-maxime.ripard@bootlin.com> References: <20180613140714.1686-1-maxime.ripard@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180613_070731_094453_75065B2F X-CRM114-Status: GOOD ( 12.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , jenskuske@gmail.com, linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org, tfiga@chromium.org, Paul Kocialkowski , Chen-Yu Tsai , posciak@chromium.org, Thomas Petazzoni , nicolas.dufresne@collabora.com, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The sunxi_cedrus_engine enum actually enumerates pretty much the codecs to use (or we can easily infer the codec engine from the codec). Since we will need the codec type as well in some later refactoring, make that structure more useful by just enumerating the codec, and converting the existing users. Signed-off-by: Maxime Ripard Acked-by: Paul Kocialkowski --- drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h | 6 ++++++ drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c | 6 +++--- drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.h | 6 +----- drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h index b1ed1c8cb130..a5f83c452006 100644 --- a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h +++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_common.h @@ -61,6 +61,12 @@ struct sunxi_cedrus_run { }; }; +enum sunxi_cedrus_codec { + SUNXI_CEDRUS_CODEC_MPEG2, + + SUNXI_CEDRUS_CODEC_LAST, +}; + struct sunxi_cedrus_ctx { struct v4l2_fh fh; struct sunxi_cedrus_dev *dev; diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c index fc688a5c1ea3..bb46a01214e0 100644 --- a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c +++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.c @@ -41,7 +41,7 @@ #define SYSCON_SRAM_C1_MAP_VE 0x7fffffff int sunxi_cedrus_engine_enable(struct sunxi_cedrus_dev *dev, - enum sunxi_cedrus_engine engine) + enum sunxi_cedrus_codec codec) { u32 reg = 0; @@ -53,8 +53,8 @@ int sunxi_cedrus_engine_enable(struct sunxi_cedrus_dev *dev, reg |= VE_CTRL_CACHE_BUS_BW_128; - switch (engine) { - case SUNXI_CEDRUS_ENGINE_MPEG: + switch (codec) { + case SUNXI_CEDRUS_CODEC_MPEG2: reg |= VE_CTRL_DEC_MODE_MPEG; break; diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.h b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.h index 34f3fae462a8..3236c80bfcf4 100644 --- a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.h +++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_hw.h @@ -23,12 +23,8 @@ #ifndef _SUNXI_CEDRUS_HW_H_ #define _SUNXI_CEDRUS_HW_H_ -enum sunxi_cedrus_engine { - SUNXI_CEDRUS_ENGINE_MPEG, -}; - int sunxi_cedrus_engine_enable(struct sunxi_cedrus_dev *dev, - enum sunxi_cedrus_engine engine); + enum sunxi_cedrus_codec codec); void sunxi_cedrus_engine_disable(struct sunxi_cedrus_dev *dev); int sunxi_cedrus_hw_probe(struct sunxi_cedrus_dev *dev); diff --git a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c index 5be3e3b9ceef..85e6fc2fbdb2 100644 --- a/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c +++ b/drivers/media/platform/sunxi/cedrus/sunxi_cedrus_mpeg2.c @@ -83,7 +83,7 @@ void sunxi_cedrus_mpeg2_setup(struct sunxi_cedrus_ctx *ctx, } /* Activate MPEG engine. */ - sunxi_cedrus_engine_enable(dev, SUNXI_CEDRUS_ENGINE_MPEG); + sunxi_cedrus_engine_enable(dev, SUNXI_CEDRUS_CODEC_MPEG2); /* Set quantization matrices. */ for (i = 0; i < 64; i++) {