From patchwork Sat Jul 13 15:48:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13732441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 04A77C3DA4B for ; Sat, 13 Jul 2024 15:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=cA2Q2MbVe9fskbOQDrWM2YYpTo6SJI1WDaOk84HRv6E=; b=xpEOcTbF0yMf6n7Dh6UWbPQHl5 7Zs+7tB23LbjTzOtuKgnajkn0vrLVkpevvDqMrwqvffpPv0BQmp7xoQhLKARuAMrcT3baVW14X8fZ 0VmXx6t7c92dGH5ioT3pEmc3Q4fTS9MyTPuMttKKbNf+GMxgB/4qn1DiK7UucBtOxqm0fZ6as3Eha C7MuxsNCAKk3Mkj+z3qVasV52spfav5Nj83Y8rK+WUoA5/UrRbDbK3/X1lr09/x50mu0gNOUGj6id gWfLiFqw/BrZkMWLzYOajxrtl6B9PBhFO6n6s2bxgxYoUaunUzA549zorwrFtpXzP3EDcqW+GaFHy Y5PtjrzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSf11-00000002oJr-3bbw; Sat, 13 Jul 2024 15:50:27 +0000 Received: from phobos.denx.de ([2a01:238:438b:c500:173d:9f52:ddab:ee01]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSf0i-00000002oGU-2qAP for linux-arm-kernel@lists.infradead.org; Sat, 13 Jul 2024 15:50:10 +0000 Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id F1B8A884EA; Sat, 13 Jul 2024 17:50:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1720885806; bh=cA2Q2MbVe9fskbOQDrWM2YYpTo6SJI1WDaOk84HRv6E=; h=From:To:Cc:Subject:Date:From; b=rqiku9PLrtGSmTxzkGlpWeUXVCdxPDgk2i7Hv6kkcYdDs1G9wBO4P5B7So0feFGLW kz6sLNG80uAr9KjwjNyDKejV/yeMNRs/kJSl3SsjokT8fdu0cdNBF3uUwc4p53g86z hWiZBad9VxlyCAI+FtCPlOsnXg0b68TGbeVH2xe6MDoVbh/oZqhRkyyjFF43Ih7h6S R/hBcgFBVtGHZ8hZ5j5GzagLLtm4MmUfGRNE3iWxPnff9/1tmeFUXgaG04bAKAyB6i WIobz/AAixPeEj+dFJ7V6YBLf3g/ee71B582rutt1bL07AT4rxwmRTg6G6EADdG12u J0nliiIJoQfyg== From: Marek Vasut To: linux-media@vger.kernel.org Cc: Marek Vasut , Daniel Vetter , David Airlie , Fabio Estevam , Greg Kroah-Hartman , Helge Deller , Mauro Carvalho Chehab , Pengutronix Kernel Team , Philipp Zabel , Sascha Hauer , Shawn Guo , Steve Longerbeam , dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 1/2] gpu: ipu-v3: vdic: Simplify ipu_vdi_setup() Date: Sat, 13 Jul 2024 17:48:01 +0200 Message-ID: <20240713154934.109318-1-marex@denx.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240713_085009_036571_598C49A1 X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 'code' parameter only ever selects between YUV 4:2:0 and 4:2:2 subsampling, turn it into boolean to select exactly that and update related code accordingly. Signed-off-by: Marek Vasut --- Cc: Daniel Vetter Cc: David Airlie Cc: Fabio Estevam Cc: Greg Kroah-Hartman Cc: Helge Deller Cc: Mauro Carvalho Chehab Cc: Pengutronix Kernel Team Cc: Philipp Zabel Cc: Sascha Hauer Cc: Shawn Guo Cc: Steve Longerbeam Cc: dri-devel@lists.freedesktop.org Cc: imx@lists.linux.dev Cc: linux-arm-kernel@lists.infradead.org Cc: linux-fbdev@vger.kernel.org Cc: linux-media@vger.kernel.org Cc: linux-staging@lists.linux.dev --- drivers/gpu/ipu-v3/ipu-vdi.c | 14 +++----------- drivers/staging/media/imx/imx-media-vdic.c | 3 +-- include/video/imx-ipu-v3.h | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-vdi.c b/drivers/gpu/ipu-v3/ipu-vdi.c index a593b232b6d3e..4df2821977c0c 100644 --- a/drivers/gpu/ipu-v3/ipu-vdi.c +++ b/drivers/gpu/ipu-v3/ipu-vdi.c @@ -117,10 +117,10 @@ void ipu_vdi_set_motion(struct ipu_vdi *vdi, enum ipu_motion_sel motion_sel) } EXPORT_SYMBOL_GPL(ipu_vdi_set_motion); -void ipu_vdi_setup(struct ipu_vdi *vdi, u32 code, int xres, int yres) +void ipu_vdi_setup(struct ipu_vdi *vdi, bool yuv422not420, int xres, int yres) { unsigned long flags; - u32 pixel_fmt, reg; + u32 reg; spin_lock_irqsave(&vdi->lock, flags); @@ -131,16 +131,8 @@ void ipu_vdi_setup(struct ipu_vdi *vdi, u32 code, int xres, int yres) * Full motion, only vertical filter is used. * Burst size is 4 accesses */ - if (code == MEDIA_BUS_FMT_UYVY8_2X8 || - code == MEDIA_BUS_FMT_UYVY8_1X16 || - code == MEDIA_BUS_FMT_YUYV8_2X8 || - code == MEDIA_BUS_FMT_YUYV8_1X16) - pixel_fmt = VDI_C_CH_422; - else - pixel_fmt = VDI_C_CH_420; - reg = ipu_vdi_read(vdi, VDI_C); - reg |= pixel_fmt; + reg |= yuv422not420 ? VDI_C_CH_422 : VDI_C_CH_420; reg |= VDI_C_BURST_SIZE2_4; reg |= VDI_C_BURST_SIZE1_4 | VDI_C_VWM1_CLR_2; reg |= VDI_C_BURST_SIZE3_4 | VDI_C_VWM3_CLR_2; diff --git a/drivers/staging/media/imx/imx-media-vdic.c b/drivers/staging/media/imx/imx-media-vdic.c index 09da4103a8dbe..ea5b4ef3573de 100644 --- a/drivers/staging/media/imx/imx-media-vdic.c +++ b/drivers/staging/media/imx/imx-media-vdic.c @@ -376,8 +376,7 @@ static int vdic_start(struct vdic_priv *priv) * only supports 4:2:2 or 4:2:0, and this subdev will only * negotiate 4:2:2 at its sink pads. */ - ipu_vdi_setup(priv->vdi, MEDIA_BUS_FMT_UYVY8_2X8, - infmt->width, infmt->height); + ipu_vdi_setup(priv->vdi, true, infmt->width, infmt->height); ipu_vdi_set_field_order(priv->vdi, V4L2_STD_UNKNOWN, infmt->field); ipu_vdi_set_motion(priv->vdi, priv->motion); diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h index c422a403c0990..75f435d024895 100644 --- a/include/video/imx-ipu-v3.h +++ b/include/video/imx-ipu-v3.h @@ -466,7 +466,7 @@ void ipu_ic_dump(struct ipu_ic *ic); struct ipu_vdi; void ipu_vdi_set_field_order(struct ipu_vdi *vdi, v4l2_std_id std, u32 field); void ipu_vdi_set_motion(struct ipu_vdi *vdi, enum ipu_motion_sel motion_sel); -void ipu_vdi_setup(struct ipu_vdi *vdi, u32 code, int xres, int yres); +void ipu_vdi_setup(struct ipu_vdi *vdi, bool yuv422not420, int xres, int yres); void ipu_vdi_unsetup(struct ipu_vdi *vdi); int ipu_vdi_enable(struct ipu_vdi *vdi); int ipu_vdi_disable(struct ipu_vdi *vdi);