Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2388182lqp; Sun, 24 Mar 2024 17:13:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVboEbfKvzeKD6AkiaORft8ivWlD1gOnauh58KF4JYzgdc97/9n+3btTJ6ytMYrmru5spAWel+m/terMGr9ifkJpKVrFEwAt94UcFJQ1Q== X-Google-Smtp-Source: AGHT+IGeieoDbsj1IWWDZ3RA2MgJnox6yF38vQoz4e32MWu79nRH2AY8+33zZFZS1cY1P0avNJOf X-Received: by 2002:a17:906:a5a:b0:a47:37a4:8b1 with SMTP id x26-20020a1709060a5a00b00a4737a408b1mr3289483ejf.6.1711325584472; Sun, 24 Mar 2024 17:13:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325584; cv=pass; d=google.com; s=arc-20160816; b=k+4lCbDCbU66bWCrcHCPtRBqCwZTJx7kdsxoUpRqHIWLECVsaOkc/hGA9XaH+q1R4E yI/6xFpxXW4paefL+BWxFDYCNTgUzpRB+cGQLIWVBps1jcpARChWMqcCnNGmDB+/UsE9 BtxCV6VIKYTDnrDLOMWSqMg4hu7/0bZWSKryVkqnaIgGbsNyXBPH3Z+kEJPAuFPpNXNm Eqv6EHb7XJ8SY+gHq3YIrrk8muyoR5xi53pR9wzhsTPoQ/8pGfZBwYCt2GFrJV/vSHaa 4KGpYcLGIEUzzx3nFJaW/9bMBLL5Hjei8teRj2tJ6pAgTcLdtanQNl5gN+T8z0c3TkFX tM2w== 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=+wQ7t3PxKBQF7y8i7dSJp7wFGwpo0O8khAz5cokQoqY=; fh=HOakZXBVQ0KaHOP9YFvwmFY4FoLErVF1H9S6BhsF9MU=; b=BalGs8D/7wAM2RuNq9O9A2lSE7WgaigPR5ps10ZXKNZnaTD3L4fqcjPKfMZBTqUwwn doEqzTEcYLMZBcKTgygspN06YsfSpCeYuVGyw5DYBRrr3tbJUQht8m83jdIZlgpo3uL+ CEuVKfEFJlYiwS9OHdL/picX3C6EVmIkwF8hY3le8GeieOYSqtYilq/uXpNDXhFD/07B 8fOJSIc0K4zsXcb9kLELevJgCLNMrNvuvuynZiWizPa3nG6Hjz9IEoB/gKDfCBOsQfi2 zNhzmw609n2uxmIX6ctZCpeQExQnsIzCAhCYUq14B3MW7jJqPYKubuVvPnTNF2jT50V5 GShQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=J8Wo+qON; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113338-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113338-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 c12-20020a1709060fcc00b00a462d5daf8fsi2030339ejk.947.2024.03.24.17.13.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:13:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113338-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=J8Wo+qON; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113338-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113338-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 2A4C81F2227B for ; Mon, 25 Mar 2024 00:13:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C0F0197CAC; Sun, 24 Mar 2024 22:42:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="J8Wo+qON" 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 9B40F197C8B; Sun, 24 Mar 2024 22:42:19 +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=1711320139; cv=none; b=VWBlZHQv52zxPh5fkhxX2xxyHczd3ZlVKTJSjXarjiERPT0f5B3+D7IEO15Oc1kgUtegPX482LRbU4LNMQGk7ELA5yhezKGQX9v5MPDQnq72EJuE4hATd6QBa6YzVZgxG4Cum0UKZ6BHT0Tip692gDF0SQH2Me+EzlsH5JZNRzg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320139; c=relaxed/simple; bh=LWuvjGXmSIv+FW+AijAYZOvNO/xI0y8Az5kY4SNjsaw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TQtJeov8bX+n9s82Nc6HyHJA6qCOuxMIO9l07lyFaN1CYYHMi9bDQ8j8wk1L4QnbfTz/8LI/m7lUYlk6MWZcjVegzTPqDFRprUxm2tQd0XkhNE4YtYFkwzdxDFy3EtxwKcAKjUzEzBeru2zq6MZQp0y2z3p7QEdlv/SaSX4Jc2c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J8Wo+qON; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A233BC43394; Sun, 24 Mar 2024 22:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320139; bh=LWuvjGXmSIv+FW+AijAYZOvNO/xI0y8Az5kY4SNjsaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J8Wo+qONKqUMsUtVvpnzaEJsMiARCoKnNsuhwalMxlTJIdw3uBL3gTeYQPb60oeMf alFzWrfaAl4qK77gjiA+i3j2fcagzHgFEC76IOaC8SJhiyAaW86v+sumxnmKDPPcYh 6jnKmRSXopbZn6u1Q7+vBvZaE32XKyxl5805uEXDM4J/krfW5A9JNzPVCxD3GBe11d cowV9qKm+edpCR1xjPQFsDmU22lhGAXmVTsfE2gSx78IvFoSAC6v2AT7oCTMahOMqD jzoq2dhg2IR6elv+7ARKwKGhH+fmdj66/2KRZiniBjaJcVXJToDHUcN+IY/uHUBwu5 Wd99BuN29gIcw== 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 6.8 447/715] drm/mediatek: dsi: Fix DSI RGB666 formats and definitions Date: Sun, 24 Mar 2024 18:30:26 -0400 Message-ID: <20240324223455.1342824-448-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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 a2fdfc8ddb153..cd19885ee017f 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -71,8 +71,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 @@ -369,10 +369,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; @@ -426,7 +426,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