Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2580400lqp; Mon, 25 Mar 2024 03:24:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvgU7g2m+Pld4fh1i5t1zsWN3TSErrioNvpQqGh4RRJjrM/wEvmvAUeozIt0YUFAImOXJFa8AENnBthA/UjvPHX5aj9NL7DwM/YV0jvg== X-Google-Smtp-Source: AGHT+IHvN1DWrZGZg8V9+QeoaxDC71zuaYSot1BiWxrSDbFTFxJ8CtHRwOP5xffb6Z59ZEEeBFaQ X-Received: by 2002:a17:906:1515:b0:a46:ede0:2370 with SMTP id b21-20020a170906151500b00a46ede02370mr4661892ejd.57.1711362275677; Mon, 25 Mar 2024 03:24:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711362275; cv=pass; d=google.com; s=arc-20160816; b=jwtbggwwwqxRz1ppUthgd82T7Iz5MwF4k6B9xtiX3d5dfSqoEa8pShLeILHwa49Lm9 fbZDpB3tReWDBkxhCoK3EXPJwjw65gjEF+Z1CDJNF7lBLbGyMvOzKHJBgu8S2JiyP78n bViWVYKrw4iCwXQ/o1AbvOZ/fTeAUEhtlxbkl5h5W8oewX0G5Q6RtaJ3lK4oCL+3F+2m /rcAeJlBbYbo9qt6TO5KyE5uGZvcrxr3woUYRy+j7I2RfzI8ZkKQ4YXKOfgghQ5rN/sg c8qEwJGFmjBZRws+UiteTET8j5jSnsUWHd6TQewo0Iu8aP7ArMlWQsXDzsyK0/wOn+Vc VkWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=m4YNxMi1e0ub+anAAOGyGJsCXwWihGJNpVk7Y0zYQW4=; fh=HOakZXBVQ0KaHOP9YFvwmFY4FoLErVF1H9S6BhsF9MU=; b=WprRsurXxl3Pe7v+GT21SBSZIhppTS69f+it9x3iXbqvOQSo7iDh+l6p1PCdOLc16K Hal5suj3tiBw1pJ1mZc4eaVDQR9A7R5vgnyMdwoDzMB32rnYS9H0gyvhXHjL2uuXneNI rv3MpZicX/dsKgfKGCLIXq5Z/q9JflJnWeXywcBsvUyZyOgP2uz87VWA24NJTpMMbDI6 ndrbiVSryvmPyzMxZaZZfO97wzDVoHHGdfu70ricPUXNMGZIp4cERgk7YbaRJe5Ox/YN R5R66IWTuA3qGL2woO5OOMBv7ytY54RFqMp6kDvOm985RND/nlKCQEjIDRa7R5G+WjJZ 2ZPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oK+WseEv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116188-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116188-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l19-20020a170906079300b00a469d33f3b2si2363485ejc.1038.2024.03.25.03.24.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 03:24:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116188-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oK+WseEv; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116188-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116188-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 68A221F32632 for ; Mon, 25 Mar 2024 10:24:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FC503B95DF; Mon, 25 Mar 2024 03:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oK+WseEv" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B9702210DC; Sun, 24 Mar 2024 23:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323783; cv=none; b=INPOeLgXnHcw11GpT0LUPijc6bBi9g82sA8SnGUpHjH1JrH4QZGAhVf+PMU7uUUje/TNlryGo6FRUIQ0Bhx1zUlej0XfaBvHA/qlEq0mZdf6hYs+m4bbieRWm6heBswYdswgG8FJ0ugbUbs13tzogo7OowKXB2Ts7/x7qnqy04w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323783; c=relaxed/simple; bh=UPmJ0oqA11Byc24wBO8q/HFCvObuB20jWO6DOQOtKK4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D/IPu5QHY7OKubHcnAmTrQDneTUQDPVLMsZluD8z09GUXSQ+SXu6Lwd++hFQL9+6ipqL07GUcKzWm4a21lo/jRmdGgKMYE4zPePCSqAeCuIzC2V5yt+J5V1+nti4HBEJkHLLRNvROu7PfKD/l8HMnp1UBWpZR4/ksKJyhtr/VvE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oK+WseEv; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8D6C43609; Sun, 24 Mar 2024 23:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323783; bh=UPmJ0oqA11Byc24wBO8q/HFCvObuB20jWO6DOQOtKK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oK+WseEvX1xPAK3hwjgG8TrGzU4yB7xLbjjHGhU5zyYGkYz67cEVfpHMyS1m2T91+ ILw/tXh7dJRlu44bcrk1TWsDTfflvMZDfIRZHBKjOMQr5Uqh2u5SrsSMUxTfPlmaDO CuDlB68hgvGWmAFSwSXWtYJiYXLbWHDZiMLdnPm/teABwZnQTywsAyz9pbl/MOHjzr SX2xQmiM7ZRcwqsapMdjPlMAXtgvlJvryUEYPzBKp28nz9FJ8ewOwUecUlncPyMgd6 J2Jc+jVRluS4xYFz6X7SIlZ5CBhlkiafraCHzuyoGlNzlYbNAZJREB45XpGPmxXND3 zHUUw/I8/q/sA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: AngeloGioacchino Del Regno , Alexandre Mergnat , CK Hu , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.10 159/238] drm/mediatek: dsi: Fix DSI RGB666 formats and definitions Date: Sun, 24 Mar 2024 19:39:07 -0400 Message-ID: <20240324234027.1354210-160-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: AngeloGioacchino Del Regno [ Upstream commit fae6f815505301b92d9113764f4d76d0bfe45607 ] The register bits definitions for RGB666 formats are wrong in multiple ways: first, in the DSI_PS_SEL bits region, the Packed 18-bits RGB666 format is selected with bit 1, while the Loosely Packed one is bit 2, and second - the definition name "LOOSELY_PS_18BIT_RGB666" is wrong because the loosely packed format is 24 bits instead! Either way, functions mtk_dsi_ps_control_vact() and mtk_dsi_ps_control() do not even agree on the DSI_PS_SEL bit to set in DSI_PSCTRL: one sets loosely packed (24) on RGB666, the other sets packed (18), and the other way around for RGB666_PACKED. Fixing this entire stack of issues is done in one go: - Use the correct bit for the Loosely Packed RGB666 definition - Rename LOOSELY_PS_18BIT_RGB666 to LOOSELY_PS_24BIT_RGB666 - Change ps_bpp_mode in mtk_dsi_ps_control_vact() to set: - Loosely Packed, 24-bits for MIPI_DSI_FMT_RGB666 - Packed, 18-bits for MIPI_DSI_FMT_RGB666_PACKED Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") Reviewed-by: Alexandre Mergnat Reviewed-by: CK Hu Signed-off-by: AngeloGioacchino Del Regno Link: https://patchwork.kernel.org/project/dri-devel/patch/20240215085316.56835-3-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c index a6e71b7b69b83..17d45f06cedf3 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -68,8 +68,8 @@ #define DSI_PS_WC 0x3fff #define DSI_PS_SEL (3 << 16) #define PACKED_PS_16BIT_RGB565 (0 << 16) -#define LOOSELY_PS_18BIT_RGB666 (1 << 16) -#define PACKED_PS_18BIT_RGB666 (2 << 16) +#define PACKED_PS_18BIT_RGB666 (1 << 16) +#define LOOSELY_PS_24BIT_RGB666 (2 << 16) #define PACKED_PS_24BIT_RGB888 (3 << 16) #define DSI_VSA_NL 0x20 @@ -365,10 +365,10 @@ static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi) ps_bpp_mode |= PACKED_PS_24BIT_RGB888; break; case MIPI_DSI_FMT_RGB666: - ps_bpp_mode |= PACKED_PS_18BIT_RGB666; + ps_bpp_mode |= LOOSELY_PS_24BIT_RGB666; break; case MIPI_DSI_FMT_RGB666_PACKED: - ps_bpp_mode |= LOOSELY_PS_18BIT_RGB666; + ps_bpp_mode |= PACKED_PS_18BIT_RGB666; break; case MIPI_DSI_FMT_RGB565: ps_bpp_mode |= PACKED_PS_16BIT_RGB565; @@ -419,7 +419,7 @@ static void mtk_dsi_ps_control(struct mtk_dsi *dsi) dsi_tmp_buf_bpp = 3; break; case MIPI_DSI_FMT_RGB666: - tmp_reg = LOOSELY_PS_18BIT_RGB666; + tmp_reg = LOOSELY_PS_24BIT_RGB666; dsi_tmp_buf_bpp = 3; break; case MIPI_DSI_FMT_RGB666_PACKED: -- 2.43.0