From patchwork Thu Sep 21 20:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13394474 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 B0685E7D0A7 for ; Thu, 21 Sep 2023 20:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OD/YjvsN54uTSBL6fSjEesYOljYucI/DNQdHbcjDKOc=; b=Vc7mVPkpRcHL1d iVhQJR2lZfkjRzvRGs0qs3ZlRRh56uDx+UYwYVlGx9RZFAJK5VjaoqfVw7tLvL8s6WBBTBvDWlndo tK3GoaDBB8y/cQc2riA8A27/dsr2RiG8uwlKurluCE+IkuH4L4PpaSZ9L2Jrj5NPm8+csWsETugvj bFRiniIdbbli3MMEQXjr9a3EqxX2nWrhUSVtSbkxQyOa8Kn/cgd0ZuHfF1G4b/a+1V9qQdwMfHPKv eJUoFp012mxcgQt4AHYnXNttsihuQqDyeGYBPXRuqMHE+XhsktXELQ23qYWOefdS+3D8QB/nVXCp4 8ATIfCPIkJ65tuNuL36Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtd-0072Nc-18; Thu, 21 Sep 2023 20:03:33 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjPtM-0072E8-31 for linux-arm-kernel@lists.infradead.org; Thu, 21 Sep 2023 20:03:19 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qjPtI-0000P2-Pe; Thu, 21 Sep 2023 22:03:12 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qjPtI-00804q-9s; Thu, 21 Sep 2023 22:03:12 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v2 2/6] drm: lcdif: don't clear unrelated bits in CTRLDESCL0_5 when setting up format Date: Thu, 21 Sep 2023 22:03:08 +0200 Message-Id: <20230921200312.3989073-2-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921200312.3989073-1-l.stach@pengutronix.de> References: <20230921200312.3989073-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_130317_004281_50C1B749 X-CRM114-Status: GOOD ( 12.87 ) 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 CTRLDESCL0_5 register also holds other bits that are not related to the format, which should not be overwritten when the format is set up. Use a proper RMW access in lcdif_set_formats(). Signed-off-by: Lucas Stach --- v2: new patch --- drivers/gpu/drm/mxsfb/lcdif_kms.c | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index 07e343e01f3e..e277592e5fa5 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -166,6 +166,7 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, const u32 format = plane_state->fb->format->format; bool in_yuv = false; bool out_yuv = false; + u32 ctrl_desc_5; switch (bus_format) { case MEDIA_BUS_FMT_RGB565_1X16: @@ -186,52 +187,49 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, break; } + ctrl_desc_5 = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5) & + ~(CTRLDESCL0_5_BPP_MASK | CTRLDESCL0_5_YUV_FORMAT_MASK); + switch (format) { /* RGB Formats */ case DRM_FORMAT_RGB565: - writel(CTRLDESCL0_5_BPP_16_RGB565, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_16_RGB565; break; case DRM_FORMAT_RGB888: - writel(CTRLDESCL0_5_BPP_24_RGB888, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_24_RGB888; break; case DRM_FORMAT_XRGB1555: - writel(CTRLDESCL0_5_BPP_16_ARGB1555, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_16_ARGB1555; break; case DRM_FORMAT_XRGB4444: - writel(CTRLDESCL0_5_BPP_16_ARGB4444, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_16_ARGB4444; break; case DRM_FORMAT_XBGR8888: - writel(CTRLDESCL0_5_BPP_32_ABGR8888, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_32_ABGR8888; break; case DRM_FORMAT_XRGB8888: - writel(CTRLDESCL0_5_BPP_32_ARGB8888, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_32_ARGB8888; break; /* YUV Formats */ case DRM_FORMAT_YUYV: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_VY2UY1, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_VY2UY1; in_yuv = true; break; case DRM_FORMAT_YVYU: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_UY2VY1, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_UY2VY1; in_yuv = true; break; case DRM_FORMAT_UYVY: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_Y2VY1U, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_Y2VY1U; in_yuv = true; break; case DRM_FORMAT_VYUY: - writel(CTRLDESCL0_5_BPP_YCbCr422 | CTRLDESCL0_5_YUV_FORMAT_Y2UY1V, - lcdif->base + LCDC_V8_CTRLDESCL0_5); + ctrl_desc_5 |= CTRLDESCL0_5_BPP_YCbCr422 | + CTRLDESCL0_5_YUV_FORMAT_Y2UY1V; in_yuv = true; break; @@ -240,6 +238,8 @@ static void lcdif_set_formats(struct lcdif_drm_private *lcdif, break; } + writel(ctrl_desc_5, lcdif->base + LCDC_V8_CTRLDESCL0_5); + /* * The CSC differentiates between "YCbCr" and "YUV", but the reference * manual doesn't detail how they differ. Experiments showed that the