drm/panel: sofef00: Use 16-bit brightness function
authorRichard Acayan <mailingradian@gmail.com>
Mon, 16 Jan 2023 22:49:08 +0000 (17:49 -0500)
committerNeil Armstrong <neil.armstrong@linaro.org>
Thu, 19 Jan 2023 07:21:57 +0000 (08:21 +0100)
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_large() function that
properly handles 16-bit brightness instead of doing special processing
of the brightness values.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Tested-by: Caleb Connolly <caleb@connolly.tech>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230116224909.23884-3-mailingradian@gmail.com
drivers/gpu/drm/panel/panel-samsung-sofef00.c

index 9db49a0..1ebb79e 100644 (file)
@@ -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>
@@ -213,13 +212,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;