From nobody Tue Oct 7 05:40:52 2025 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 505BA239099; Mon, 14 Jul 2025 08:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480278; cv=none; b=oDktpWsOXAiazhZWc/AGIpSu6HJHmVi9HpxtYf21mhsMrViMFKlwSTKo0U4wlHjxAhXv1LEXShVHFYaJ0zc2x6fYLT711zofG0f/ByjThbQ/7HUqzKPPnyy7T3eWeQb+w6ThgF4h/UpPD8Nu4ieCBFsqU2rmwGOO2Z5+/W6HqLo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480278; c=relaxed/simple; bh=X3ffU5ZPQL/iK6X7dL3NI0KO+0AZSsAr7S+Y6bShp/M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KjUM66Z/BvIYfAVMuhTxLgHAXfKBYC7UqJ+ORczjRQwFMELmNhVyTHIMP0B5qIlVmn76Pw+GuMdAFqW+P8NAnxJ8Xm6bSm3Eni1IVTeXAdOIoEt+ro5WmxR6MmjRdsvgnSWIJW42WP50Q4VoOdKLTvKPWgLEzBV7A8//Rfc3lE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bAV3+5Qc; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bAV3+5Qc" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-553bcf41440so4097239e87.3; Mon, 14 Jul 2025 01:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752480274; x=1753085074; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=C6t5fJRCHpoSZ7F8pJt3tQSM8oWBMiBs4n4p924ZYdk=; b=bAV3+5QcIVmt/Az2q/EUxJNLRG3yyVsG9MimajcwUxn/nZxjeJALt5CCcvq8WZ1PUt jdiVgNyI7PP5JA0fjyY13RUVEHmShA4I4oYzeJWtBH7IRJavzRKyqIWr8f1i87ecsQ0e rETeC0NENPX3aj5qqfwNmSfI3rb023ieobqgJkUxNYQkDP8ZgPj3M3VFkbYskgOloCyz ownVRvyjPQNu/QL/3eWroxC6nf6l8H/GiTWYTCDJM9a3/pWd24f1p/8H3k8PZ8VWIu2c rZZ3XtTkRbJMp+r3OuPPKDmfmGiHk54rNGGW6E2eJyn5hITgEG8e3HuLEJEmsgnv4XDX /8+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752480274; x=1753085074; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C6t5fJRCHpoSZ7F8pJt3tQSM8oWBMiBs4n4p924ZYdk=; b=ZK9rpH1grguMRtaqISUTG9gzcNif/jNI8cv66I2yzPJT4IhXc1A2k2GT/LLW29V6FR 9ZfFspgro36iARZ8ODU5sPnIQiqv3VsTI3ERbPnKjWbKGmH3u8ABiV3MiqSlRUD01u+F Jg48Srm0KqTZQLDTdsjfkEJkElXN9aNcu/FtMbvsm97VuTpmzZ9FkL1brcFh+WyKfOcE Tfdgz2DAXKImc1yfCraAP89LUDctweXeulAkT2K7KoFvx5oyOAOUCv01gBxXeVa2LqHg O/5VjWvgRK2e3WqlQwcOQTv+sNHeYKFAau/k20RUIsnf5Ou00Fqj0vPsHe4IxeBJkTOV qLJA== X-Forwarded-Encrypted: i=1; AJvYcCWJTk84R13H9RcHYfmObkJkOWbhPkZbO33CQszoK18Kv8Af5AJN+pYLEUcR3ReghMijUHx3pl1pK2k4@vger.kernel.org, AJvYcCX3/JOzYRfkv4dYIXxZMUcRrCweuBTSWt1h/I18nskodJ+hAHzJuJEdWCQ61drafbtxYe1QqgyiRHNc7PxB@vger.kernel.org X-Gm-Message-State: AOJu0Yyv1RldssOt375EV1h9rcM890VBLyTjKcabTbAqKTEZ3ipKj4Mn 66MVoYzarIZCib2DXJzEZyL0szpJlZNw1dep3MAevHf3oNB7TqFLolu5 X-Gm-Gg: ASbGncstv+XT/HxAViFPg8Bmk+Avh4mB+lcdkOS19tz0nfcm4xJiZ0U/AFjLpl9hU5v DFCD9vd6dqdwK6I0gI34SvJpkE1G6nmWuS10uii/zUy7DeZ6VD9eqRIUlr9qS+he8eZVjWxDNAn CPwC9fSI+J0jcKTP8B3p2jEWLjBxW6WBPoOGvFcDj6e3/XstTeucF6eISp/kvAnmFeaYR+EP5h9 j2Ftsdf7zYaaMWWO4uPHGRDY0IGPy03Hn55W082HGkbjI7mrhpuPlfTaTta4+KGplrxb2krDHrj wk+bcLB6Zvu4JDmL+D9eCTjIA18Ktu921A6aIJJEFpRT3+UEbBShrYicmAlobxy+znHvZXaJEnh 2QPRb0+riyd99X0MfzptiATQnfSgV0L0pPf/DU5BiX6R0sWDbbbNFhV1UQC82d9fI+MY= X-Google-Smtp-Source: AGHT+IGO+3QtpME4CCrqHVYceKIs+EzxANjanQNgmj5QsH7D8grBIIDUPIbXCvr+3hhKeD3znxuUpw== X-Received: by 2002:a05:6512:239c:b0:554:f9c5:6b3e with SMTP id 2adb3069b0e04-55a046498e8mr3794634e87.41.1752480274141; Mon, 14 Jul 2025 01:04:34 -0700 (PDT) Received: from [192.168.1.198] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55943b6c08esm1864385e87.187.2025.07.14.01.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 01:04:33 -0700 (PDT) From: Marcus Folkesson Date: Mon, 14 Jul 2025 10:03:59 +0200 Subject: [PATCH 1/5] drm/st7571-i2c: correct pixel data format description Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-st7571-format-v1-1-a27e5112baff@gmail.com> References: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> In-Reply-To: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Javier Martinez Canillas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Marcus Folkesson X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1200; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=X3ffU5ZPQL/iK6X7dL3NI0KO+0AZSsAr7S+Y6bShp/M=; b=owEBbQKS/ZANAwAIAYiATm9ZXVIyAcsmYgBodLn2NLRJC7QmCcM48VdTkHlG7HKLR0Zzz7Ym3 1TaJ9VTuz2JAjMEAAEIAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaHS59gAKCRCIgE5vWV1S MluOEADQB0UdULY8BmNpIjqemT9VnYXMEdA6qIDFPHZZx0uqZXCwOZ2axoaN671SPYSwzAEF0AB 3Vr1XZMvhG3YkHUxMEceZbc7pv2MvE1czli5gsrh4ckp+C9xpoatCbVfpAPcX8T794+/zF64W7d Sjo+nin4O87meWMd2Ydu0488b3b+HwyFOeqjweYkCH7gREvMfYbrHXRK+NTkCXBVyZiDSAFYBVp 1Jq4CBN/sMwLnTMNpCh2UONgDXICZUBHZrzSpRJrBrq7NvD3GE6mSNARe6kU4wTfiThRQk0kDLL oBJriXF2L4skdu8Uhn92YgnXwQOpcNBjNwVJA4gomW/tBbKPxfA+SNXJK7i8k3jE7GsLqdvuBlI mbzEEh90o7/Y5eqeUHZwYQUEgh+HfpbmW5bprH2qN40AL113ppFnXzG6qP4SO3mHymMKV7oZQ9D xQlhEMT6JGEh5cCBkRplL2QWIowpZLAgNMrXj6Jq09Ab1mWePpr8fIRcUpZ8OC6V07UiREAs1Om WVnYdH29cwaisTOz9Mpv2BsG8u120tLnE6cALkjbYYCYng/QdJumP/oajR9lGTNQTXqZ4ty2pdr EiI7ogUVMDZpFX36AZTMJhSWHMG1JN3jhGbhtlo4WOJqYzDqLXn6cMdu0mrVxmROQ6D32c4dGgN ELSEbufM2TmTyZw== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 The comment describes the pixel data format as stated in the st7571 datasheet, which is not necessary the same as for the connected display. Instead, describe the expected pixel data format which is used for R1/R2/XRGB8888. Signed-off-by: Marcus Folkesson Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/sitronix/st7571-i2c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitron= ix/st7571-i2c.c index eec846892962dce2d0b86c9c5c226d44135f2b0d..3024c94c890497d1ddbbf0f7f81= ec4664f48d580 100644 --- a/drivers/gpu/drm/sitronix/st7571-i2c.c +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c @@ -382,10 +382,10 @@ static int st7571_fb_update_rect_grayscale(struct drm= _framebuffer *fb, struct dr * even if the format is monochrome. * * The bit values maps to the following grayscale: - * 0 0 =3D White - * 0 1 =3D Light gray - * 1 0 =3D Dark gray - * 1 1 =3D Black + * 0 0 =3D Black + * 0 1 =3D Dark gray + * 1 0 =3D Light gray + * 1 1 =3D White * * For monochrome formats, write the same value twice to get * either a black or white pixel. --=20 2.49.0 From nobody Tue Oct 7 05:40:52 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0FFE237186; Mon, 14 Jul 2025 08:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480279; cv=none; b=hP1yQkNmavvwJ74Rc0b6VlYDdzBzO9YJmoYUze3N1qSOESkr1UuCpf0/H+0VQnSnSRxftQUQAotriMU7kGQkIKrKqk+Mu9KP/GVi9dw6qP/Sn1eUQTooZlt/FRV5gxfI9KeFOH+TvEr7xlr+XBcobu/45g5B/bLl+pVdddHiUAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480279; c=relaxed/simple; bh=9qhFVbTDQlUnWoyhzXl4tt9pDTAcoj21SaN2FI/eQiY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sDkGGUrTaKQ2l5ZHEqMXfeaefvKNwHLl5/61O2fLmUyn2QTBYsuCkIZL/pOWztNSQ5uwp15b40rrsWDIxLjrrad1BJqXLlN4SNBBdE1hn13R+X2PeGqth6ZspCeBA+oOOYQEwE97V49TkSiI4oOPzbVMJJqFKAUt/DR+gGMpphQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M9zOkxiZ; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M9zOkxiZ" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-553d52cb80dso3671549e87.1; Mon, 14 Jul 2025 01:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752480276; x=1753085076; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6s29Ts1SkPQDQu7w5HZtIzuTKDuPYqCu0keY+TlHALs=; b=M9zOkxiZoAiBOzu9z+x3Sp8pZ3e37xG+p1I8zJ5SahtbTqV7qLOsefVAbUy5UWsJFQ tZ9h0LZRBqS4m8udvpjOIQDLhD5nVa2ZXa0Y6XRZlSlUTnVAAVYOhI9DKObhWu5MSgr0 zSN+ovuZjdQ9rBXfBVsn+gh839Qufn5V8sFjJ2E5aWX902fan4wfP5LpiUz6wvaYbB2f crzGkflbAAugRLjOKU7D2Bq4RVA9mra4OTSSAS7nb59rI5n0Bx/7+C6FM0HKBOW8y9yN +HYZzeJqyLHDYOuo/c8bWdtT4jSkjC4tdm5oi7wxSUYR4p5GIykZumeVZThBetoCohgU piTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752480276; x=1753085076; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6s29Ts1SkPQDQu7w5HZtIzuTKDuPYqCu0keY+TlHALs=; b=SgwTH0VR/AeV0L1CnFtwjs4BXXFzmJd0i7Y8sz9v4NeCtm/NVJy2H89uGY0FnutfbJ Pm9yCnq1EZdhp+58x8SAomR26CwNHxAfjDnmpzgvEMLoSq6kgnfR+LkUfKvj9wz05o8e OJS26Xqr9OOWJxccSZLtPO5X+7mUMjWiF1dOrDLdkmfu0gknV0N/rYNbLD2T9G8Nsdmd m1WavqwRWnU4jC/6878ka5x0YH+J3lwjknrcLnRX4a6QgQnoFIEs7Pku81HlnAE3210H WA6HM5NO0g4vTUpE0Ll7+yKymFPh8VPmx/UU04TZZVODPmsfYVQl45E7AXomZXDFyfIV izew== X-Forwarded-Encrypted: i=1; AJvYcCVBnYbVIuvv7XTDMcgMoF89O2FbejxqpUYwGTElTI52ahWix/aTlVjMTBEohItLNYaW/zBdyvz3LzhO@vger.kernel.org, AJvYcCVnSt6HNbvRsRELbg7UXwYoUgp/D413ViOgaCBsZ65M+cASQdLgW6O9SRrUowX0ha9V95W+nKC3NXOwW9vy@vger.kernel.org X-Gm-Message-State: AOJu0YxeEuhbja0ecScOZsT8SFYrmkBWtvz66ZzyEPop+pI4IZ1mIzT9 csh/gmZI7XtevzRfn1zHoGwZKuKLjTz7sNi8N11ZFwTwGCHhzalJMwbx X-Gm-Gg: ASbGncu1C/O3dZPhguW2kwcbZHmtnEPkM6/ycfUQPu3o/VIsl2LdmR6yynk4i2ztsgg CxwOrZcdKCWpgVw+tuj9UxaB7unkzQ9OTG9tbYD8HM29BY6p/B+oJESd+/qI210gTcpjeCzp5c3 ocEehukVHWimW0thvdWqODqeSz4L/4pBtwxceNEhMapJ0zlP0N28z/9Xlp4EdgLi2yoSYT2buN3 9dPXpv+a6VOCxodz06kmIOzlQ0AwFHf7yIGw6DopA6UIJCoSyUzP0xU6liiGWb5EPijZHZS1DHm dSafzr/Gw/H7q6CqKmkgHy/iTGo0lMUql6dG08uhxbZGIoCh5lZ5ydYGrDOW37pEG1j59BY7pPu 0fa4sSQkvKnYsr3NERN6O2cvjzTuXIoZ00WhMm0AA8QOjjQfrwFMfPr0KlhmB+oB2hEw= X-Google-Smtp-Source: AGHT+IGpTrjfqaTHgLcCLsQCtZHA9El8Nls2neMHYylS+9ZWNLkW6HwS5nJKpzuK/j8dl7RkHFN0Hg== X-Received: by 2002:a05:6512:e9e:b0:553:cf72:45d3 with SMTP id 2adb3069b0e04-55a038e3f24mr2907357e87.3.1752480275420; Mon, 14 Jul 2025 01:04:35 -0700 (PDT) Received: from [192.168.1.198] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55943b6c08esm1864385e87.187.2025.07.14.01.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 01:04:34 -0700 (PDT) From: Marcus Folkesson Date: Mon, 14 Jul 2025 10:04:00 +0200 Subject: [PATCH 2/5] dt-bindings: display: sitronix,st7571: add optional inverted property Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-st7571-format-v1-2-a27e5112baff@gmail.com> References: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> In-Reply-To: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Javier Martinez Canillas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Marcus Folkesson X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1227; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=9qhFVbTDQlUnWoyhzXl4tt9pDTAcoj21SaN2FI/eQiY=; b=owEBbQKS/ZANAwAIAYiATm9ZXVIyAcsmYgBodLn7NMEAsj6msiz2IRTvAEkdMP27Gj8qLURkl ACWp3Vk2VSJAjMEAAEIAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaHS5+wAKCRCIgE5vWV1S MmZ+EACMoSu6V685oHN6Scy6hlmCAkFKaSHbE/4zNrMLDOe0PNepbZKaR20D7gEV2p7fMX270Oi PXA+Zj6UEVasO4VzQbJv/eAVjEnM25LD9AsFViFfvP9h37HdKNFF2g8JcCY73HMfCMCMh559/hz 9sZ3IqB8ulTbg+zci0zcUUJIiFKwVD/e0CII7AfO5ovNafX2GuzomyDnDBaj0Zt8FAAhwAF04wB wiEcoHTjS5/WTDnYcEyH8VhrVGvFJWTE/HWiB7ZhYOIfwXT2ky4jpS+W1a7CeO4R1LLwsq0Flux qfpivCs+PfsFZhe/KlMZ88/T5Mqz9Y3pc4o2R0buPVXKFDpLQKYMoei8zswKnjUgQ/GsKX1RTVC UJh9G5VYW8+8LfUMmANwx5eGWaBkf95qlLcuAgo89fUt6JrvqoGi9pT6M1okrEe803/he27Ertl V0JaZssLndLQgMYP5ZdCyP2jbZJsNhIJsL4fQjH0CmlrX7Y7xVqnodGKoGy58Ezva4jLOC/UFZH F1Lvy/lnnkIyD0PRQVMWi2iWuRjQmaDOUR1Gi+xAkvdnRQHzv6QfzUxLX5MgY/c97nX012qAwer d7WQkgmbbkZQr81mx1cjXLZ/ldBWjQXafEll6jztX9eVhmXhoRIAtf+iaOLFOllqQYRVprrQVn1 7m0IdCAgyAm6dJg== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 Depending on which display that is connected to the controller, an "1" means either a black or a white pixel. The supported formats (R1/R2/XRGB8888) expects the pixels to map against (4bit): 00 =3D> Black 01 =3D> Dark Gray 10 =3D> Light Gray 11 =3D> White If this is not what the display map against, the controller has support to invert these values. Signed-off-by: Marcus Folkesson Reviewed-by: Javier Martinez Canillas --- Documentation/devicetree/bindings/display/sitronix,st7571.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/display/sitronix,st7571.yaml= b/Documentation/devicetree/bindings/display/sitronix,st7571.yaml index 4fea782fccd701f5095a08290c13722a12a58b52..065d61b718dc92e04419056b1e2= d73fd0b2cb345 100644 --- a/Documentation/devicetree/bindings/display/sitronix,st7571.yaml +++ b/Documentation/devicetree/bindings/display/sitronix,st7571.yaml @@ -28,6 +28,11 @@ properties: description: Display supports 4-level grayscale. =20 + sitronix,inverted: + type: boolean + description: | + Display pixels are inverted, i.e. 0 is white and 1 is black. + reset-gpios: true width-mm: true height-mm: true --=20 2.49.0 From nobody Tue Oct 7 05:40:52 2025 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C419F23A9BF; Mon, 14 Jul 2025 08:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480280; cv=none; b=N6AtQ1d8gduRyF+w+aCrdC3Ok9b13gQi2o292gG8NpBt7TyTDNJkpr/LePKC71PGwSUJUM+KUUNEY6rNPhUxPyIzFQxo1jd7b9hQHl6JlPSgFD3dCqfjiPlvsL7LM1hS7Aga+1NkjYqKMGmw37leWLOZBRMZnukKLt3bV9HPv3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480280; c=relaxed/simple; bh=nKfuyWks/Dpzizjd9fHnZs7Z2hrno+oTXUBiw5zduxE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S0/8+h1CVmte3crKcWGMmAjLWrVPaXhY12MKe03zwi5qK0iSPm2FvD71kdHWFr6K/bQMJqvz0WU75nYxGVNwGe2k3szk8kjYutzCuSNHskX1im4qJZ9w9SkT9h49Rv4DLSB4xYrm9LSqjnxvvTv3V8eJgIkuDuMEoB1J9p7fB8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YYFzBP4P; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YYFzBP4P" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-553b3316160so4289226e87.2; Mon, 14 Jul 2025 01:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752480277; x=1753085077; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=B9GGTSztthPX9RjXgUnWoKPJH6hGe57hUvqPeJEkExw=; b=YYFzBP4P5czitjS6x2cyCmLdhrbPphFgu1GqGVPIKRdbIxv+dqUgK6Hm2UTYgyRDmU FjGR49EzBQ1k3aX5ISSQAw3Su0EwZeztGti+3VIvOIo05Y7q5VjL29PAQTSpEgR+mH2P d/22+m+T0ZMDU2fVLDS0jzYUfHd+QABN29e803GN8o3i1gfJP+aTbrpu6ExCEMOo9Noq ZsaIlrWyIIDdM4eua/gswCuwOYV05F/Hpo0mOwoxW5k2RJ0f4Wwne6wo4DjrfRVa0cFy B2+HjBiOpnRHRSv2Ydbeie3GoxWW3f6K//QTOtbbnPkYRDzYAvk9ZKNhrKBNWJO+ZBo8 7KEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752480277; x=1753085077; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B9GGTSztthPX9RjXgUnWoKPJH6hGe57hUvqPeJEkExw=; b=KTvVMMDjj4WoJ7hcxfAc72dLYOkSL1uyRnVK/qigFtgqXoabg80VP8nSPl2focNfTe vbFldASy6ks/ryi1vPu58/5OWpymuXnxEMn9OurU7p2V9e0nHu5pEO+2+KqkE3fMZsBx 0IFmblfh+Xoi1Qw5WLDtupCYf7tDho6bjzT+PMIVh3d3UlBhCx+Fk6iqdJrFsdPwybPX VvVJIWQdTF1t95kioonLUbns7NV5pY7DV5mX+BlqfyTODYE2dWzn7/SEOCYTOeJwLNVG hXmexfMMEnnaMD3sbdeKTTsJmJ9pkKlUsmDccVY2DzAnvSUlQaP+IqeXy0ABZ4os3npD MH0A== X-Forwarded-Encrypted: i=1; AJvYcCVRjtk3BfWXVWHODm0+l6Or+8C8+MiXoLYA81e6QtxpEQM/kq8G5J2Lt8DyYcSEaYiv51CeQ2ayxDHD@vger.kernel.org, AJvYcCXxzYA2o7teUc17tERc+SBdacufBkrTwySfZCzRUUZ9ltoSlj4d6eJG6aV//vC86ONvxxznV4EYZRKGKKA3@vger.kernel.org X-Gm-Message-State: AOJu0Yx/9550zZe9lLMkrwuU+P/GQmFLQFE9noO+nUT+A4oeQPdx54D3 IXP6NXwmWmYT9ujrCTJaHlC3XVlEiI3u0wI5YU9zEmNrgVwJNOmWj9a5 X-Gm-Gg: ASbGncuJApOLxsWg3t1d5l4co6zgiI0IIQvrM3mlg6xdd5hB90wnLN3zcl8xxuaJaD+ WEcnTtrYOnK0aL84bJw6uXztXfJRlo1UVhRg8caqyRPK8X7n/k5y/+hrtH64kdeXncmnhNklk7T O5CLgA1i67bpy+DbfGijbKa5KentLUfj2LYB/Qk+tSjGczWUT+UE6vLbfnAzrq6BE49HmUEzKtz JlBTwlRIPE5QN5xG1gzrc+yRf4KpXDb/fsGwCm6q8/9v/TjTqBctn3UGWqMhheoA9oSZcG/kclX YH8yDp2jmLXguzRGd6iNDWKd18RlDYpdGlZUS355eU9hfeUcBIlCVfhIlufrrbUC0QXeGKHETDt xSEBy7GCMTZJinatOuc3qXOfo8snd4wO/IBNNFAsvOtFfGJ4DFTzeEEAYeq5sPXcnMJ8= X-Google-Smtp-Source: AGHT+IG3FjnhooHqlt3ucCpOZF7GxfsZEIc9G4pFe0tKlk9LOep+bdnRRtjfBZr1RODnwJKZWhsU2g== X-Received: by 2002:a05:6512:32c6:b0:553:2def:1ae8 with SMTP id 2adb3069b0e04-55a04609b20mr3587657e87.30.1752480276593; Mon, 14 Jul 2025 01:04:36 -0700 (PDT) Received: from [192.168.1.198] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55943b6c08esm1864385e87.187.2025.07.14.01.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 01:04:36 -0700 (PDT) From: Marcus Folkesson Date: Mon, 14 Jul 2025 10:04:01 +0200 Subject: [PATCH 3/5] drm/st7571-i2c: add support inverted pixel format Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-st7571-format-v1-3-a27e5112baff@gmail.com> References: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> In-Reply-To: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Javier Martinez Canillas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Marcus Folkesson X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1681; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=nKfuyWks/Dpzizjd9fHnZs7Z2hrno+oTXUBiw5zduxE=; b=owEBbQKS/ZANAwAIAYiATm9ZXVIyAcsmYgBodLoAG2jgkwWTSyu2OAKveT8gTVJB/txNKVHU+ 0nUy0hNL9qJAjMEAAEIAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaHS6AAAKCRCIgE5vWV1S MricD/4nwH7czcMqAZ8egg5+wPkfzZojgNpJ0vpw9f2C1QUKSbImn7pakYeNLXzirNnzD4ESh+c gRs7gnOvNfQZrlngleXgqdPPskryz8IGNuWrA0Hb0wTeB1BrJ75aEbxpnzr6zF3zKrrrOQ/vnbK uOW6IaE+TiJ+pPjQ/R5EMoMzvrAmtSEjHA57psyKBfOI2j92zLtYL3n/eaQEVa2oC+2ldRyieoP VTj6VIHcB/sv60o/3sNxTbiCT+qLkv1qrok/StbL8AHX/nCg/jwEJjXKe860UYkkm/NQAoDw+A9 zIHQOUIPqA4yvUCy0PncpUM0X39YreAv2jtgonYakTZ+FhdMOtUUMpJjaoSC4qQsczV8TLq/NEb bnwBkc7igs2iizEo1RGns5OMzpE/E78YZADddn2F6qRO/WCeAEjFaqMUPtlxPy06P54GYWaDkgY gF9I+Jt8d6tQgVEnQ98d1vP3wVPxVzN5ZUnK4IN2nX+rcELocu1KLu0yAqXwn+7/K874SX0+GyX 6Cvt23K316jduhtNv5piDyZxP4/XeDKPy6iKlRawHst8e1wFM7svM9JvkTqRXOJbDQxggPn9iVB C/cTeTDESc0LlQqtAU7mU7Dk174TGRM+z44xfrFVqItqkN6mK/D7y4ygO6eEAh4rt9YxNtdEEL/ hQ0v8fVckWk+h0w== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 Depending on which display that is connected to the controller, an "1" means either a black or a white pixel. The supported formats (R1/R2/XRGB8888) expects the pixels to map against (4bit): 00 =3D> Black 01 =3D> Dark Gray 10 =3D> Light Gray 11 =3D> White If this is not what the display map against, make it possible to invert the pixels. Signed-off-by: Marcus Folkesson Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/sitronix/st7571-i2c.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitron= ix/st7571-i2c.c index 3024c94c890497d1ddbbf0f7f81ec4664f48d580..6a5d719f8b0044ec700ff119972= b580c904ffb27 100644 --- a/drivers/gpu/drm/sitronix/st7571-i2c.c +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c @@ -147,6 +147,7 @@ struct st7571_device { bool ignore_nak; =20 bool grayscale; + bool inverted; u32 height_mm; u32 width_mm; u32 startline; @@ -789,6 +790,7 @@ static int st7571_parse_dt(struct st7571_device *st7571) of_property_read_u32(np, "width-mm", &st7571->width_mm); of_property_read_u32(np, "height-mm", &st7571->height_mm); st7571->grayscale =3D of_property_read_bool(np, "sitronix,grayscale"); + st7571->inverted =3D of_property_read_bool(np, "sitronix,inverted"); =20 if (st7571->grayscale) { st7571->pformat =3D &st7571_grayscale; @@ -853,7 +855,7 @@ static int st7571_lcd_init(struct st7571_device *st7571) ST7571_SET_COLOR_MODE(st7571->pformat->mode), ST7571_COMMAND_SET_NORMAL, =20 - ST7571_SET_REVERSE(0), + ST7571_SET_REVERSE(st7571->inverted ? 1 : 0), ST7571_SET_ENTIRE_DISPLAY_ON(0), }; =20 --=20 2.49.0 From nobody Tue Oct 7 05:40:52 2025 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33F1623BCED; Mon, 14 Jul 2025 08:04:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480282; cv=none; b=BHKody6J6Yc/Z9FyVWZjPlL0JzcfG3QlU91K8beeoLWy5igaV8rZxDHB633Utvd+MjKHGkjEe508A2RSY5YHJ1QWlfCvOlboEhyCw4CyyU4CV55ap5cOHYPEnGFB2j8UtZNc2Q6OMedGADpOfVsKFYApMd5awavWpnH5khwM7ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480282; c=relaxed/simple; bh=ooFuzc1HYLH/b7G70oju18p8HTIYAY5mUG8vjFp+a4E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kyzNJAzkyCqwOalgriI7nBqWD+9NwQW8JT6JJOM53DkyejTZuCUBXuK2phmEvEb/KhNaEJpF2rQ+8QaZP+NM/RJQ3tQR6as76LZEhNOS7hqm5cYlrdtJHFVxsOg8JQmCm92ZBtvEFGLPvIEX0ttauCKCx86lwGS1iRKhmkvV45E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hn0LpUoa; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hn0LpUoa" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-553d52cb80dso3671570e87.1; Mon, 14 Jul 2025 01:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752480278; x=1753085078; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=O6n/TwiMXWZ+ZdKfM/oDMUklaYFacBzQ7BUUpsRuWbs=; b=hn0LpUoam7wHbVedK7w0zv5ntK+AuwZAoltCSgetWPkuH18xteclasxt64HNADeBof 9Ruk+8QhkOkjVNfFpTjUd7Lk33cHbC5s7r4PR6bqaJWQldr7bftLXRg8uF3zCRvjPPtq wFJyRqQhotCpizd6akqaSdblcQDceP7ponviADp62DLZlMm0vq+yTV/cCRFso1Gnu/DC 8YhjY7s4kWBvXDcojq9X6ofKUyAifrH0rpGZGN6AM06/NSCywG7yG9LrrrtQWsLIRhT3 PrYDu1oeo5WHqq6vWd2FQwBgZKavtyPeIVgubMCBOt/nJGYmLReF7JvBhcf6dJFAzbOr iRSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752480278; x=1753085078; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O6n/TwiMXWZ+ZdKfM/oDMUklaYFacBzQ7BUUpsRuWbs=; b=uHn9cmUt3jiT+Z28O+iunqy2l55n/gGr782DIwJvIV0JWw/i9JfWEB5o18tRekGoRr 76NTKXVlsd5ZS8819UYGDnxEbEhw+6l4bquurstSzZgiZlDoYgV/Z4dbRwf8jqS4Bk6v kbFfqeqf4+bxwP0EapgrU07MYNWA4TELjfQNwfJdjXSJhoPwkVgJf+22EKKTOd441hJM eCI4F77rtPhzEA/g1vKsXSZKU9aSlwDPFyFqF2RiODUCkT+l0w4ZbKAn5CkhEReCpcH1 8L/0V7ZXorOstcM5RMiHMOibGG+57ax3yIP9iJ6PgtyRlp5B2Gv1+vQNXEA/x+0b7UqN +g1w== X-Forwarded-Encrypted: i=1; AJvYcCVu3E33Uhq0iRVcHFr3SlZd9/XTbmm+j7CskbzpaWWX7Fxgo/hTlExrPdBntW0c94WNTYI5SiFgwIBy8PLo@vger.kernel.org, AJvYcCWHwDlqg65/H3z0oRVNgT/gI+iIZHYQ7Fq+taKg5PTd8270f04T/Xq9TXXv3CGqVSRGSw5+AaR6lWSK@vger.kernel.org X-Gm-Message-State: AOJu0YwCqTMlSPjF5hW3MoEQ1RscVayNOsUt8KautwkpgPnHK8bjYJuN KSSKAgISu83hDyn/mKe4AOGD5qiDWpIHR3I2MnXhXDS2pGuiJbBFIIpB X-Gm-Gg: ASbGnct1/+IJ5tl52xfcC5Qmzk1BfMZ5KljfgAu5ecfXqVfaKdvvQMP0dgG/KIi12Yh n0jMXdWL7lazOthY6EM9Nql/SkyhPUie7Rby9D7b+fJp7h3Y8KlJzZ+3jd0fyV9We8wWWY28tCU IPE5A1k+sIhq1pF+sastKmjSv+IsdPBnRJXpqnBmnIPAGrXGlSfAe1KoJHaVZV7LDb3yd4tT+gE TPGbWYsnnH4sTsTVdlJ/XIIb68POS00oGh3D/P9Xz3Pof7p9ZFW0LuTW8fR7sFwgcR/nOOHoyn8 s3pm03MHuhrRB83BgQ+DwKBLmyLvXj52stKkDkQ/aVBHZi47XHa2JKIGpR/63cnYO+sjpiMF2cZ cweko1i3Y/YwT26E5bsiNdAWlrYIA966yHBt1Tc57rCMQou5DdXeQazc9H8b9HXHelUo= X-Google-Smtp-Source: AGHT+IEBE9Cy/LCHX7ybxe5olrJJBgZsocOmqcWEkUaqPVygE09g2iOxi2b1SpZvEuhz9qq28SJV5g== X-Received: by 2002:a05:6512:a82:b0:554:f82f:180e with SMTP id 2adb3069b0e04-55900715435mr4867704e87.16.1752480277970; Mon, 14 Jul 2025 01:04:37 -0700 (PDT) Received: from [192.168.1.198] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55943b6c08esm1864385e87.187.2025.07.14.01.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 01:04:37 -0700 (PDT) From: Marcus Folkesson Date: Mon, 14 Jul 2025 10:04:02 +0200 Subject: [PATCH 4/5] drm/format-helper: introduce drm_fb_xrgb8888_to_gray2() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-st7571-format-v1-4-a27e5112baff@gmail.com> References: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> In-Reply-To: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Javier Martinez Canillas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Marcus Folkesson X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10226; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=ooFuzc1HYLH/b7G70oju18p8HTIYAY5mUG8vjFp+a4E=; b=owEBbQKS/ZANAwAIAYiATm9ZXVIyAcsmYgBodLoF0ZTa/9a0Qdm2qtUpwNofhWVkNVOPnD9ne Q5kubcTwyuJAjMEAAEIAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaHS6BQAKCRCIgE5vWV1S Mr1lEACqCwR6AEgqV8hZXgC3lhcGfGGsjZCWqN/PYINIXepXrFQgripCiZM4yiTtVj4kvcwr4di vshmO8yqdv03J1uf+Hd4XVGBSyh3XKfXjnpGA4MAU7sVpQgDiZUsJAsDkfo8LUW2wV0xEXGk889 jRCf9OhWivNIMXsIda4HRqEBCyDN06vRjP15CQnCJ13YE2iDAkGmU9IQ59TWEo+i45LWIMqT8jw vsyrLGjjfqKxAwmDGBvoMJ3NW8LMTt2Uw9WrE3XLAPWn8D4bD1vF3mMcZnU3ZwazfAHLsQyG0H8 iE1yWTrMhmlECoQT9RdkNylPM24i5sqSnN9nEEwdAwK0aSaulc6h0eRrlZE5W7AgbQ2u6FuGYav ae2xjatJMsWPoYdZ1kGc4RPYTE6pPJecpSjVIpXLZTOi3LiC6upSNUNgldSzOWYh/eeipfMGttY fkCv3AVtKkoEDvMjlNgG+2rOPUFnYLnAb9O2Wl2HBCKo15r3YfOd00wwVB8XLITk5pUEFbStxhF f1d+lDwKUQ4gN2naASe3AKQ4bHyQi8iJhkfIF2tLdhAVTbj8miuLObmFwO6mYlloYvYFIzu7MCU 6loezOb/47UtkPfCIsvJ6nEwMS7F9a2xbKd04gOYPl2/tdBU5vLy0PCwOMzSSXhfyUqaMFR6ub8 QoHxFM90ZqlNIgw== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 drm_fb_xrgb8888_to_gray2() works like and share much code with drm_fb_xrgb8888_to_mono(), but converts XRGB8888 to 2bit grayscale instead. It uses drm_fb_xrgb8888_to_gray8() to convert the pixels to gray8 as an intermediate step before converting to gray2. Signed-off-by: Marcus Folkesson --- drivers/gpu/drm/drm_format_helper.c | 148 ++++++++++++++++++++++++++------= ---- include/drm/drm_format_helper.h | 4 + 2 files changed, 110 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_form= at_helper.c index 8f3daf38ca639d3d39742c2c9fa0c54a3a9297a5..2f2171b3df609263cc9ce6809bf= 6144028c25380 100644 --- a/drivers/gpu/drm/drm_format_helper.c +++ b/drivers/gpu/drm/drm_format_helper.c @@ -1253,6 +1253,25 @@ int drm_fb_blit(struct iosys_map *dst, const unsigne= d int *dst_pitch, uint32_t d } EXPORT_SYMBOL(drm_fb_blit); =20 +static void drm_fb_gray8_to_gray2_line(void *dbuf, const void *sbuf, unsig= ned int pixels) +{ + u8 *dbuf8 =3D dbuf; + const u8 *sbuf8 =3D sbuf; + u8 px; + + while (pixels) { + unsigned int i, bits =3D min(pixels, 4U); + u8 byte =3D 0; + + for (i =3D 0; i < bits; i++, pixels--) { + byte >>=3D 2; + px =3D (*sbuf8++ * 3 + 127) / 255; + byte |=3D (px &=3D 0x03) << 6; + } + *dbuf8++ =3D byte; + } +} + static void drm_fb_gray8_to_mono_line(void *dbuf, const void *sbuf, unsign= ed int pixels) { u8 *dbuf8 =3D dbuf; @@ -1270,40 +1289,11 @@ static void drm_fb_gray8_to_mono_line(void *dbuf, c= onst void *sbuf, unsigned int } } =20 -/** - * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome - * @dst: Array of monochrome destination buffers (0=3Dblack, 1=3Dwhite) - * @dst_pitch: Array of numbers of bytes between the start of two consecut= ive scanlines - * within @dst; can be NULL if scanlines are stored next to ea= ch other. - * @src: Array of XRGB8888 source buffers - * @fb: DRM framebuffer - * @clip: Clip rectangle area to copy - * @state: Transform and conversion state - * - * This function copies parts of a framebuffer to display memory and conve= rts the - * color format during the process. Destination and framebuffer formats mu= st match. The - * parameters @dst, @dst_pitch and @src refer to arrays. Each array must h= ave at - * least as many entries as there are planes in @fb's format. Each entry s= tores the - * value for the format's respective color plane at the same index. - * - * This function does not apply clipping on @dst (i.e. the destination is = at the - * top-left corner). The first pixel (upper left corner of the clip rectan= gle) will - * be converted and copied to the first bit (LSB) in the first byte of the= monochrome - * destination buffer. If the caller requires that the first pixel in a by= te must - * be located at an x-coordinate that is a multiple of 8, then the caller = must take - * care itself of supplying a suitable clip rectangle. - * - * DRM doesn't have native monochrome support. Drivers can use this functi= on for - * monochrome devices that don't support XRGB8888 natively. Such drivers c= an - * announce the commonly supported XR24 format to userspace and use this f= unction - * to convert to the native format. - * - * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale a= nd - * then the result is converted from grayscale to monochrome. - */ -void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, const unsigned int *ds= t_pitch, - const struct iosys_map *src, const struct drm_framebuffer *fb, - const struct drm_rect *clip, struct drm_format_conv_state *state) +static void drm_fb_xrgb8888_to_gray(u8 *dst, const unsigned int *dst_pitch, + u8 *src, const struct drm_framebuffer *fb, + const struct drm_rect *clip, struct drm_format_conv_state *state, + u8 bpp, + void (*xfrm_line)(void *dbuf, const void *sbuf, unsigned int npixe= ls)) { static const unsigned int default_dst_pitch[DRM_FORMAT_MAX_PLANES] =3D { 0, 0, 0, 0 @@ -1313,11 +1303,10 @@ void drm_fb_xrgb8888_to_mono(struct iosys_map *dst,= const unsigned int *dst_pitc unsigned int cpp =3D fb->format->cpp[0]; unsigned int len_src32 =3D linepixels * cpp; struct drm_device *dev =3D fb->dev; - void *vaddr =3D src[0].vaddr; unsigned int dst_pitch_0; unsigned int y; - u8 *mono =3D dst[0].vaddr, *gray8; u32 *src32; + u8 *gray8; =20 if (drm_WARN_ON(dev, fb->format->format !=3D DRM_FORMAT_XRGB8888)) return; @@ -1330,7 +1319,7 @@ void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, c= onst unsigned int *dst_pitc * The mono destination buffer contains 1 bit per pixel */ if (!dst_pitch_0) - dst_pitch_0 =3D DIV_ROUND_UP(linepixels, 8); + dst_pitch_0 =3D DIV_ROUND_UP(linepixels, 8 / bpp); =20 /* * The dma memory is write-combined so reads are uncached. @@ -1349,13 +1338,88 @@ void drm_fb_xrgb8888_to_mono(struct iosys_map *dst,= const unsigned int *dst_pitc =20 gray8 =3D (u8 *)src32 + len_src32; =20 - vaddr +=3D clip_offset(clip, fb->pitches[0], cpp); + src +=3D clip_offset(clip, fb->pitches[0], cpp); for (y =3D 0; y < lines; y++) { - src32 =3D memcpy(src32, vaddr, len_src32); + src32 =3D memcpy(src32, src, len_src32); drm_fb_xrgb8888_to_gray8_line(gray8, src32, linepixels); - drm_fb_gray8_to_mono_line(mono, gray8, linepixels); - vaddr +=3D fb->pitches[0]; - mono +=3D dst_pitch_0; + xfrm_line(dst, gray8, linepixels); + src +=3D fb->pitches[0]; + dst +=3D dst_pitch_0; } } + +/** + * drm_fb_xrgb8888_to_mono - Convert XRGB8888 to monochrome + * @dst: Array of monochrome destination buffers (0=3Dblack, 1=3Dwhite) + * @dst_pitch: Array of numbers of bytes between the start of two consecut= ive scanlines + * within @dst; can be NULL if scanlines are stored next to ea= ch other. + * @src: Array of XRGB8888 source buffers + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * @state: Transform and conversion state + * + * DRM doesn't have native monochrome support. Drivers can use this functi= on for + * monochrome devices that don't support XRGB8888 natively. Such drivers c= an + * announce the commonly supported XR24 format to userspace and use this f= unction + * to convert to the native format. + * + * This function copies parts of a framebuffer to display memory and conve= rts the + * color format during the process. Destination and framebuffer formats mu= st match. The + * parameters @dst, @dst_pitch and @src refer to arrays. Each array must h= ave at + * least as many entries as there are planes in @fb's format. Each entry s= tores the + * value for the format's respective color plane at the same index. + * + * This function does not apply clipping on @dst (i.e. the destination is = at the + * top-left corner). The first pixel (upper left corner of the clip rectan= gle) will + * be converted and copied to the first bit (LSB) in the first byte of the= monochrome + * destination buffer. If the caller requires that the first pixel in a by= te must + * be located at an x-coordinate that is a multiple of 8, then the caller = must take + * care itself of supplying a suitable clip rectangle. + * + * + * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale a= nd + * then the result is converted from grayscale to monochrome. + */ + + +void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, const unsigned int *ds= t_pitch, + const struct iosys_map *src, const struct drm_framebuffer *fb, + const struct drm_rect *clip, struct drm_format_conv_state *state) +{ + drm_fb_xrgb8888_to_gray(dst[0].vaddr, dst_pitch, src[0].vaddr, fb, clip, = state, + 1, drm_fb_gray8_to_mono_line); +} EXPORT_SYMBOL(drm_fb_xrgb8888_to_mono); + +/** + * drm_fb_xrgb8888_to_gray2 - Convert XRGB8888 to gray2 + * @dst: Array of gray2 destination buffers + * @dst_pitch: Array of numbers of bytes between the start of two consecut= ive scanlines + * within @dst; can be NULL if scanlines are stored next to ea= ch other. + * @src: Array of XRGB8888 source buffers + * @fb: DRM framebuffer + * @clip: Clip rectangle area to copy + * @state: Transform and conversion state + * + * This function copies parts of a framebuffer to display memory and conve= rts the + * color format during the process. Destination and framebuffer formats mu= st match. The + * parameters @dst, @dst_pitch and @src refer to arrays. Each array must h= ave at + * least as many entries as there are planes in @fb's format. Each entry s= tores the + * value for the format's respective color plane at the same index. + * + * DRM doesn't have native gray2 support. Drivers can use this function for + * gray2 devices that don't support XRGB8888 natively. Such drivers can + * announce the commonly supported XR24 format to userspace and use this f= unction + * to convert to the native format. + * + * This function uses drm_fb_xrgb8888_to_gray8() to convert to grayscale a= nd + * then the result is converted from grayscale to gray2. + */ +void drm_fb_xrgb8888_to_gray2(struct iosys_map *dst, const unsigned int *d= st_pitch, + const struct iosys_map *src, const struct drm_framebuffer *fb, + const struct drm_rect *clip, struct drm_format_conv_state *state) +{ + drm_fb_xrgb8888_to_gray(dst[0].vaddr, dst_pitch, src[0].vaddr, fb, clip, = state, + 2, drm_fb_gray8_to_gray2_line); +} +EXPORT_SYMBOL(drm_fb_xrgb8888_to_gray2); diff --git a/include/drm/drm_format_helper.h b/include/drm/drm_format_helpe= r.h index 562bc383ece4e90d96aa92b47b4f69609f825a6e..8488befafb7e0e0311f87bd2fef= 5011bab45065b 100644 --- a/include/drm/drm_format_helper.h +++ b/include/drm/drm_format_helper.h @@ -136,4 +136,8 @@ void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, con= st unsigned int *dst_pitc const struct iosys_map *src, const struct drm_framebuffer *fb, const struct drm_rect *clip, struct drm_format_conv_state *state); =20 +void drm_fb_xrgb8888_to_gray2(struct iosys_map *dst, const unsigned int *d= st_pitch, + const struct iosys_map *src, const struct drm_framebuffer *fb, + const struct drm_rect *clip, struct drm_format_conv_state *state); + #endif /* __LINUX_DRM_FORMAT_HELPER_H */ --=20 2.49.0 From nobody Tue Oct 7 05:40:52 2025 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97A2423C397; Mon, 14 Jul 2025 08:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480283; cv=none; b=lPYz0Ck/uMoSDG3Rg9xzxXIQ21l7fFDvzaDcbN/5O7ErPHCrpu08NmNnN//wHdRPMW0ej/GCLmZSNWyb0v/U+s4jbiB5vN6NjEcRGlpra5dwxzBFmfFyCB41aYmxEoJBTyWWO7kbe0UELmmMLJxxpgbnJtqbXtphb15enySQqog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752480283; c=relaxed/simple; bh=lEahKLLZv0LLgcdxOGD69aUK2W4QHfqMPLiGWzoEYP0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rNFs9BTYUtcqVMmodKnI3RIS0+LDpq1suuZBkm2K91DudruwgC6sMzk9ofXVoXQtsndIjwJmlaSOwxz4A6IFbYnp1KW3PqgxwNUc7D6aBManM9Uh4nbqVJXOaVpqUyV+hycYMVQ3rwcqQrL2IBf8D1JIkUGSF4RE3LzSQe3T+PI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JAPttOUt; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JAPttOUt" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-553b16a0e38so4246505e87.1; Mon, 14 Jul 2025 01:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752480280; x=1753085080; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=p263TqCClLXlOHu3dp7Z4XuoCZcYckTKI9E2PFULeZU=; b=JAPttOUto2l8iLucogK/EaaJr4/Y/c1GCYm8eX3JuHZxeZ8dLPZiV9UiSaNqShOKte +VV5FYnG5Mi6mCvI8UGo685u+MEU0ZRjjl5AmqjNSx3SnZrYoWc8M5vTPRY3dC2rORG+ C0Eqy+bjA9YSuHjrvWjbm1V/w8u1Z+rtTno9NWPUbtdnwkYwEdG4ZYmTw/uGZ7Y4XpGy kKmGhjAR2MGj8SmnwI5FGPBMBdBB+7Ok3dgrGUATAND3Dea+2j5NWk01g0CthLoOXa4c 7oZGI5epLe5B1nY37hXzJ87MldmPT59Cc1BUpGmiL0pD84xKQuDlQ/SfFBjnkC5YmXo2 yReA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752480280; x=1753085080; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p263TqCClLXlOHu3dp7Z4XuoCZcYckTKI9E2PFULeZU=; b=T0EBBU9IuAqmr2TAzqpHyUX9vRjHme5/B4lqTVzoj2x7WiKfjZIKODVPAMEEFqmXbv TBDKqi4ekSFikJqBEKjq/FxM8Y4glKYJfAG/IwTIM9yoNu9Jak4bIiOptrssKHF4iIIu gBqbDInxjGuWryrSlakaFjbW2lkcqHPveTpkqsegQXoMU7aPO2pK2H4jjp2AwKQn4mxA C6JIHHN/jqtXalDarfN1fzGARBBytEKGUy9pzFCcEN3BiH4KWO1x3vKIA7zSecMz9ep5 dR6b3jHqACRaaSb3ngpRH9s4ZgOM2ZQqtv3iA+JI+Q8jCl2ISvb6xSqcPDwjlsB3sNYC 054g== X-Forwarded-Encrypted: i=1; AJvYcCV2uWQSY7YSV4o/OmCiJVDTlA6NBxlW2dm1c3et2UsJq0E4mluHFovy41XLYFgW797ABPbpR4VRWa5wjRTB@vger.kernel.org, AJvYcCViCZWpwYI4PLsvd+5VkJuPuc0BpaviDMQqJoGkuCNvZRi3knZiX0g7h5OcJWlG8H8ghZWSjIatCZj/@vger.kernel.org X-Gm-Message-State: AOJu0YyiNG7l4WznqcjWqNKH+MeS6w6dFkvOjhlKahHrJ8BJDMZpnrno r/YAkFFEfI+/Y55Vt5wCu/YNtj7g5D8fIbh4z4aMGAD95F6QN8c25HGt X-Gm-Gg: ASbGncu6Nsb5+1wzwXvNusVUanGZ5KTOg0dBZztFAQo++emxKbanAluDX6io16Z7sQQ 6NK23Op/wj/YutPSD6/x8GzpjnTQ3oEaPUMoEWfEOMXOVNl9Egioz+XJVIN4HRJyTLAl5silbvw F0IRJZLndp1N9876h+bfPMwEtV14oRc+5Re1piCuPQKDB/k8oLZztP6MbCXbTMnBjSCrDj8FWYP AMDdytGW7miUp8a6SQ3mS/wjg2tmFYgHDP/kCDBjUIs/bUF0klGIGszPFA7YM7syGxbbyrXpIto t5IKVXhPxei70GS1aTmeKmXXmas88936H587qilBPYlRsCjF51h6s6LQMulP6auajJi4BoRPJiW zOnQ+BfJpmkpsTLSf14oWDEVKkIDwpqdhvs5sVSOUODmIlE7MsopCupzkeKcSZ75KEH0= X-Google-Smtp-Source: AGHT+IE3ZGGk8mZi8PoK4ms4CTR4TyCRXk7fcOY1Cm8zIS7n5cos+N2F2WJeqZ5ykBVRsyCfAC7TLg== X-Received: by 2002:a05:6512:1384:b0:553:a490:fee0 with SMTP id 2adb3069b0e04-55a044d1e73mr3798544e87.10.1752480279357; Mon, 14 Jul 2025 01:04:39 -0700 (PDT) Received: from [192.168.1.198] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55943b6c08esm1864385e87.187.2025.07.14.01.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 01:04:38 -0700 (PDT) From: Marcus Folkesson Date: Mon, 14 Jul 2025 10:04:03 +0200 Subject: [PATCH 5/5] drm/st7571-i2c: add support for 2bit grayscale for XRGB8888 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250714-st7571-format-v1-5-a27e5112baff@gmail.com> References: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> In-Reply-To: <20250714-st7571-format-v1-0-a27e5112baff@gmail.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Javier Martinez Canillas Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Marcus Folkesson X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3579; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=lEahKLLZv0LLgcdxOGD69aUK2W4QHfqMPLiGWzoEYP0=; b=owEBbQKS/ZANAwAIAYiATm9ZXVIyAcsmYgBodLoKlMDoV62CdpZv99GtIylRkXaQLIgIy6fzV /c8d65lA0CJAjMEAAEIAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaHS6CgAKCRCIgE5vWV1S MhgJD/46rCLbofHMykyf7wYDHr1TeW7OTQOPfm4/xt0V5SR16spFYk9WNtfROaJOvNKjD22h14J 8l8hAIBl9TyUgpPB1RgyQt6E6KcIWLb3crFcefFMorm5BK+kfuNOl+fUDmaU0H7vzEArNP/jF6a UGZL0lq/KAEZFHnepTZ5gx/oDWkLftwDA4N84po1d7zo1jWewiDsrooiwIkYPzdrep04nYGy9JB X1ZE+iVHzJX9q2aoUTAfq6FmgNCJsEhlrlx/R0eVQjgTyOW1DtP2ZxpXKaGc5wXTcNtZHrdIRTy 7vIl3LMqXbu4KpNBqkmZcCqSl/JbykhneDMeId8clmcdzsajmfJ960T36E6XU4CBUJrEe1FZ4cf MPBAH5M12rWvpqVntdnQH+EBg36hsvQ6hsG0BpK0twJ936RBSv+LMs8VV0Vv7Zl4EKPH4H+HIdC gmKnqNcqPha7EtYe+26O7P0FYqipFVd5ZFaEkeYDuSBwHWIl+0IRiQiEcbjt6GxMMqycs2Eo9pn T9CmDtOQjyN8uIMjtK2+CebhgSoMFnEqEJElDIEhurPahT/GsRPnMsvwz3WsNAMY6JSj+fa/hhx nxexDgw6d1G8G5d8m8Yuo9AzFLA0RbWcaewPi1RvZdA2BdqbStpDfdLXLDZI/8CfL8+5zz/GVdL p0wjLz3aZ5HqxCw== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 Add support for 2bit grayscale and use it for XRGB8888 when grayscale is supported. Signed-off-by: Marcus Folkesson Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/sitronix/st7571-i2c.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/sitronix/st7571-i2c.c b/drivers/gpu/drm/sitron= ix/st7571-i2c.c index 6a5d719f8b0044ec700ff119972b580c904ffb27..2af800a4c5e4960f3dfcebfeda4= 554b56015915f 100644 --- a/drivers/gpu/drm/sitronix/st7571-i2c.c +++ b/drivers/gpu/drm/sitronix/st7571-i2c.c @@ -215,10 +215,11 @@ static int st7571_send_command_list(struct st7571_dev= ice *st7571, return ret; } =20 -static inline u8 st7571_transform_xy(const char *p, int x, int y) +static inline u8 st7571_transform_xy(const char *p, int x, int y, u8 bpp) { int xrest =3D x % 8; u8 result =3D 0; + u8 row_len =3D 16 * bpp; =20 /* * Transforms an (x, y) pixel coordinate into a vertical 8-bit @@ -233,7 +234,7 @@ static inline u8 st7571_transform_xy(const char *p, int= x, int y) =20 for (int i =3D 0; i < 8; i++) { int row_idx =3D y + i; - u8 byte =3D p[row_idx * 16 + x]; + u8 byte =3D p[row_idx * row_len + x]; u8 bit =3D (byte >> xrest) & 1; =20 result |=3D (bit << i); @@ -300,11 +301,11 @@ static void st7571_prepare_buffer_grayscale(struct st= 7571_device *st7571, struct iosys_map dst; =20 switch (fb->format->format) { - case DRM_FORMAT_XRGB8888: /* Only support XRGB8888 in monochrome mode */ - dst_pitch =3D DIV_ROUND_UP(drm_rect_width(rect), 8); + case DRM_FORMAT_XRGB8888: + dst_pitch =3D DIV_ROUND_UP(drm_rect_width(rect), 4); iosys_map_set_vaddr(&dst, st7571->hwbuf); =20 - drm_fb_xrgb8888_to_mono(&dst, &dst_pitch, vmap, fb, rect, fmtcnv_state); + drm_fb_xrgb8888_to_gray2(&dst, &dst_pitch, vmap, fb, rect, fmtcnv_state); break; =20 case DRM_FORMAT_R1: @@ -330,7 +331,7 @@ static int st7571_fb_update_rect_monochrome(struct drm_= framebuffer *fb, struct d =20 for (int y =3D rect->y1; y < rect->y2; y +=3D ST7571_PAGE_HEIGHT) { for (int x =3D rect->x1; x < rect->x2; x++) - row[x] =3D st7571_transform_xy(st7571->hwbuf, x, y); + row[x] =3D st7571_transform_xy(st7571->hwbuf, x, y, 1); =20 st7571_set_position(st7571, rect->x1, y); =20 @@ -355,14 +356,13 @@ static int st7571_fb_update_rect_grayscale(struct drm= _framebuffer *fb, struct dr rect->y2 =3D min_t(unsigned int, round_up(rect->y2, ST7571_PAGE_HEIGHT), = st7571->nlines); =20 switch (format) { - case DRM_FORMAT_XRGB8888: - /* Threated as monochrome (R1) */ - fallthrough; case DRM_FORMAT_R1: - x1 =3D rect->x1; - x2 =3D rect->x2; + x1 =3D rect->x1 * 1; + x2 =3D rect->x2 * 1; break; case DRM_FORMAT_R2: + fallthrough; + case DRM_FORMAT_XRGB8888: x1 =3D rect->x1 * 2; x2 =3D rect->x2 * 2; break; @@ -370,7 +370,7 @@ static int st7571_fb_update_rect_grayscale(struct drm_f= ramebuffer *fb, struct dr =20 for (int y =3D rect->y1; y < rect->y2; y +=3D ST7571_PAGE_HEIGHT) { for (int x =3D x1; x < x2; x++) - row[x] =3D st7571_transform_xy(st7571->hwbuf, x, y); + row[x] =3D st7571_transform_xy(st7571->hwbuf, x, y, 2); =20 st7571_set_position(st7571, rect->x1, y); =20 @@ -391,7 +391,7 @@ static int st7571_fb_update_rect_grayscale(struct drm_f= ramebuffer *fb, struct dr * For monochrome formats, write the same value twice to get * either a black or white pixel. */ - if (format =3D=3D DRM_FORMAT_R1 || format =3D=3D DRM_FORMAT_XRGB8888) + if (format =3D=3D DRM_FORMAT_R1) regmap_bulk_write(st7571->regmap, ST7571_DATA_MODE, row + x, 1); } } --=20 2.49.0