mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Acayan <mailingradian@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Emil Velikov <emil.l.velikov@gmail.com>,
	Vinay Simha BN <simhavcs@gmail.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: Daniel Mentz <danielmentz@google.com>,
	Caleb Connolly <caleb@connolly.tech>,
	Richard Acayan <mailingradian@gmail.com>
Subject: [RFC PATCH v2 2/2] drm/panel: sofef00: Use 16-bit panel brightness
Date: Fri, 13 Jan 2023 20:00:06 -0500	[thread overview]
Message-ID: <20230114010006.50471-3-mailingradian@gmail.com> (raw)
In-Reply-To: <20230114010006.50471-1-mailingradian@gmail.com>

These panels communicate brightness in big endian. This is not a quirk
of the panels themselves, but rather, a part of the MIPI standard. Use
the new mipi_dsi_dcs_set_display_brightness_wide() function that
properly handles 16-bit brightness instead of doing special processing
of the brightness values.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
---
 drivers/gpu/drm/panel/panel-samsung-sofef00.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
index 1a0d24595faa..014fe350bc59 100644
--- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c
+++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c
@@ -10,7 +10,6 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/regulator/consumer.h>
-#include <linux/swab.h>
 #include <linux/backlight.h>
 
 #include <video/mipi_display.h>
@@ -221,13 +220,9 @@ static int sofef00_panel_bl_update_status(struct backlight_device *bl)
 {
 	struct mipi_dsi_device *dsi = bl_get_data(bl);
 	int err;
-	u16 brightness;
+	u16 brightness = (u16)backlight_get_brightness(bl);
 
-	brightness = (u16)backlight_get_brightness(bl);
-	// This panel needs the high and low bytes swapped for the brightness value
-	brightness = __swab16(brightness);
-
-	err = mipi_dsi_dcs_set_display_brightness(dsi, brightness);
+	err = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness);
 	if (err < 0)
 		return err;
 
-- 
2.39.0


  parent reply	other threads:[~2023-01-14  1:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14  1:00 [RFC PATCH v2 0/2] drm/dsi-mipi: 16-bit Brightness Endianness Fix Richard Acayan
2023-01-14  1:00 ` [RFC PATCH v2 1/2] drm/dsi-mipi: Fix byte order of DCS set/get brightness Richard Acayan
2023-01-14  1:36   ` Richard Acayan
2023-01-14  1:00 ` Richard Acayan [this message]
2023-01-14  1:30   ` [RFC PATCH v2 2/2] drm/panel: sofef00: Use 16-bit panel brightness Caleb Connolly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230114010006.50471-3-mailingradian@gmail.com \
    --to=mailingradian@gmail.com \
    --cc=airlied@gmail.com \
    --cc=caleb@connolly.tech \
    --cc=daniel@ffwll.ch \
    --cc=danielmentz@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=simhavcs@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®