Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19277622 authored by Rajeev Nandan's avatar Rajeev Nandan
Browse files

Revert "disp: msm: dsi: update args for mipi_dsi_dcs_set_display_brightness"



This reverts commit a54fdd7a which was
added because of upstream android-kernel API change 8a744ca6.
In latest android-kernel revision, the commit 8a744ca6
("ANDROID: drm/dsi: Fix byte order of DCS set/get brightness")
got reverted, which was modifying the upstream API and was making
hard to reconcile it to android-4.19 without breaking APIs for GKI.
Android kernel has rolled back the upstream API change and suggested
to implemnet it in downstream side.
The MIPI brightness byte ordering issue is already been taken care in
current dsi driver using bl_inverted_dbv panel config flag.

Change-Id: Ia8964a08a8e0b8290b1bb10ee583de064550017a
Signed-off-by: default avatarRajeev Nandan <rajeevny@codeaurora.org>
parent dc9cb139
Loading
Loading
Loading
Loading
+3 −27
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#include <linux/of_gpio.h>
#include <linux/pwm.h>
#include <video/mipi_display.h>
#include <linux/version.h>

#include "dsi_panel.h"
#include "dsi_ctrl_hw.h"
@@ -643,9 +642,7 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
{
	int rc = 0;
	struct mipi_dsi_device *dsi;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 117))
	size_t num_params = 1;
#endif

	if (!panel || (bl_lvl > 0xffff)) {
		DSI_ERR("invalid params\n");
		return -EINVAL;
@@ -653,31 +650,10 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,

	dsi = &panel->mipi_device;

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 117))
	/* The MIPI DCS specification demands that brightness values are sent in
	 * big endian byte order i.e. first parameter is high byte and second
	 * is low byte. But some panels require it in little endian byte order.
	 * The `bl_inverted_dbv` bool was introduced for the panels
	 * supporting big endian order, at the time when the driver was sending
	 * commands in little endian order. We should fix the flag name which
	 * sounds misleading. But, we can not change it at this moment of time,
	 * due to some backward compatibility issue in device tree.
	 */
	if (panel->bl_config.bl_max_level > 0xff) {
		num_params = 2;
		if (!panel->bl_config.bl_inverted_dbv) {
			/* panel requires bl_lvl in little endian */
	if (panel->bl_config.bl_inverted_dbv)
		bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8));
		}
	}
	rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl, num_params);
#else
	if (panel->bl_config.bl_inverted_dbv) {
		/* panel requires bl_lvl in big endian */
		bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8));
	}

	rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl);
#endif
	if (rc < 0)
		DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl);