From patchwork Wed Feb 7 14:53:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 197967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2283919dyb; Wed, 7 Feb 2024 06:57:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqI2ZgsXVa5yXbe5PB5MDzqHFic4BgrfnGdI5Uh7tva35/t4mFHmu9B2FgiojZuP2OJpUM X-Received: by 2002:a05:6359:4c28:b0:176:4f31:75de with SMTP id kj40-20020a0563594c2800b001764f3175demr3137551rwc.6.1707317867103; Wed, 07 Feb 2024 06:57:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707317867; cv=pass; d=google.com; s=arc-20160816; b=v/BQN5IwPYV4g/tq/fN037swmN51EB32NaZI/TWVmRxkm2G1cy4W/D9r3ackJH231Q fsE7N8Umx6dzP8/oBRr8umpAhfDrkZLD76i7GinbtbinemY6iWPhcFkgX13EljlwK863 wpwtk6n8pOZpmNPxoQ+HyYuDUN0BU0BJqMY1FNGj39T9HiqJHcHHDjgm7CyC8plFyNBy OqbGJ+xUQf3XEBQaeSjzirzbcbtdJtxbLLlncg9v2lW+aGtuB72aQKRD63+do/fSE/mh lhgmP7FtnrHLFkHaXQLhlGT4LYeOJlA5hL5dX46Bs9G4nzrdXE/PF2uYaP3fHz5V1LUl r5BQ== 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=NdENuGIEppsIKuF5TrRDOeen1SrRoK2aJBKPR6mumb8=; fh=A9Crf8VJz3D7sDhkMvG5DwtiSXudCt5Ti16VkC1ln4o=; b=hIywkwPE8LQQlBIShwKbrNdpO0Q9qrzv/yuzj9ALPiwLjBDzJli7L7dFETBh/nzVEz 0J6xVfRSTN3uJdJBH8tDk5vs9EBLFedQfdacBosaq3Ckj2ZM4Fip5LBk5vkBwkR2T9Ew cVoLlZBTEEERfxisBQfCKFaTJ1pBt99kTYEPgZlkwpsZuewfqR49yXOXlPWEVOuqUo79 NRr9kpY3ox6mIu2dAofAh8S11j6xaeZT8cTEjR9g4GL5gO7h05SrVyMECCqM1bI8VEaF fwP6sWwpKkZLq5qQc//ZEqmneTpQJOYfgov9WUJ+Ta1tpgvONaN2VurPuOnm+3pEgwV9 +Hjw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=4lQ7wFZv; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-56661-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56661-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=2; AJvYcCV/hjgY1YMtolWXbDSz2XW0fKlO1IhWozZO5927m53F52k2L4EcaI+4ZLqSFmgdAn7q+KY79sH8xuW/bQYLhMAQsytubQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q24-20020a656858000000b005ce018f427csi1642024pgt.235.2024.02.07.06.57.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 06:57:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56661-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=4lQ7wFZv; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-56661-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56661-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id A185BB27C55 for ; Wed, 7 Feb 2024 14:54:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C19C7762B; Wed, 7 Feb 2024 14:53:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="4lQ7wFZv" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 2E4B27E77A for ; Wed, 7 Feb 2024 14:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707317599; cv=none; b=ar48uxiBuaYqtViGfGGY/bTdw5uKHEhM3YrDmWBl2RPFgdQL0H8FyvR14r2Ph1T+f4KHBcoA0Wy8SWPytsnJNAt02K5ojIiRmerQHecTQ3zJb9MGhP1S1SPM/zIRbMJBeoheD5Ec4BJVv12je0b6f/9AQPP5FSFbuqWfni9Nbo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707317599; c=relaxed/simple; bh=B+4BoPKeDWxrOkfeevUGd3P+sMEtbS1rN/IafPC00UE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NFjxWTyBKSsPxmW6H9ZmeMkIKvwWBRAEkCPJ46pY9gn+18oz7fD4NxLKPSr5xv/76vYgTijGx3sAlYkh3JByaS88RDWzgF+AVBx3Uiz2JB7WdPuzACLnjBPhpoYVBLqdxRFGA/ORWnr/D0vvytYN7q/QV1p0Z6aq/EJAAiepnqg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=4lQ7wFZv; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707317596; bh=B+4BoPKeDWxrOkfeevUGd3P+sMEtbS1rN/IafPC00UE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=4lQ7wFZvWeJLyWfrstglXGp/Fh2ZY37IqjkR6yvrN1bWBK+oarLqUSBnAGiT1CBXl 21k8Pk57jE2QHEZHxpbkBUDl30+eY13NoCAIEO4sTFea3jp4dIvvr7SOab71ak/POf tC0XpjDG+UIQC1tY2HhmJiorqkxtVtpqbsTTtaKX6mEF/Xd/3RpODwbF7nQzOzngZJ wOQMuDTh6C0HsXL8xNiOoGvM5FBoET30loGPSoqDfPsJgkvy887mklrT5FqIxhKTYz FkKpTwwVDYFkb/1MFpiFY0MNxxoCf3zg47cMU0tWpP3RBrTRQ5dKmbQonfYebO1qbN eFM3sHKEk6lLw== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 9BB4A3782073; Wed, 7 Feb 2024 14:53:15 +0000 (UTC) From: AngeloGioacchino Del Regno To: chunkuang.hu@kernel.org Cc: fshao@chromium.org, p.zabel@pengutronix.de, airlied@gmail.com, daniel@ffwll.ch, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, Alexandre Mergnat Subject: [PATCH v5 2/9] drm/mediatek: dsi: Fix DSI RGB666 formats and definitions Date: Wed, 7 Feb 2024 15:53:00 +0100 Message-ID: <20240207145307.1626009-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207145307.1626009-1-angelogioacchino.delregno@collabora.com> References: <20240207145307.1626009-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790252540154919269 X-GMAIL-MSGID: 1790252540154919269 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 Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: CK Hu --- 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 c66e18006070..8af0afbe9e3d 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 GENMASK(13, 0) #define DSI_PS_SEL GENMASK(17, 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 @@ -370,10 +370,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; @@ -427,7 +427,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: