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

Commit 319c3bc8 authored by Rajesh Bharathwaj's avatar Rajesh Bharathwaj
Browse files

disp: msm: sde: updating DSI command packet creation for MIPI flags



At present, code is checking only for MSM_REQ_ACK flag which is set for
read commands and ignores all other flag states.
This fix takes all the different states that are configured as the DSI
Command MIPI Flag states and sets it.
Also, added the backlight brightness control support with different DCS
command(0xC2) to update backlight brightness.

Change-Id: I689e902e7d997afcb629084e89e42361bf1c685b
Signed-off-by: default avatarRajesh Bharathwaj <rajeshbharathwaj@codeaurora.org>
parent 68475922
Loading
Loading
Loading
Loading
+35 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/delay.h>
@@ -637,11 +637,28 @@ static int dsi_panel_wled_register(struct dsi_panel *panel,
	return 0;
}

static int dsi_panel_dcs_set_display_brightness_c2(struct mipi_dsi_device *dsi,
			u32 bl_lvl)
{
	u16 brightness = (u16)bl_lvl;
	u8 first_byte = brightness & 0xff;
	u8 second_byte = brightness >> 8;
	u8 payload[8] = {second_byte, first_byte,
		second_byte, first_byte,
		second_byte, first_byte,
		second_byte, first_byte};

	return mipi_dsi_dcs_write(dsi, 0xC2, payload, sizeof(payload));
}



static int dsi_panel_update_backlight(struct dsi_panel *panel,
	u32 bl_lvl)
{
	int rc = 0;
	struct mipi_dsi_device *dsi;
	struct dsi_backlight_config *bl;

	if (!panel || (bl_lvl > 0xffff)) {
		DSI_ERR("invalid params\n");
@@ -649,11 +666,16 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
	}

	dsi = &panel->mipi_device;
	bl = &panel->bl_config;

	if (panel->bl_config.bl_inverted_dbv)
		bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8));

	if (panel->bl_config.bl_dcs_subtype == 0xc2)
		rc = dsi_panel_dcs_set_display_brightness_c2(dsi, bl_lvl);
	else
		rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl);

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

@@ -1874,7 +1896,7 @@ static int dsi_panel_create_cmd_packets(const char *data,
		cmd[i].msg.type = data[0];
		cmd[i].last_command = (data[1] == 1);
		cmd[i].msg.channel = data[2];
		cmd[i].msg.flags |= (data[3] == 1 ? MIPI_DSI_MSG_REQ_ACK : 0);
		cmd[i].msg.flags |= data[3];
		cmd[i].msg.ctrl = 0;
		cmd[i].post_wait_ms = cmd[i].msg.wait_ms = data[4];
		cmd[i].msg.tx_len = ((data[5] << 8) | (data[6]));
@@ -2383,6 +2405,16 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
		panel->bl_config.brightness_max_level = val;
	}

	rc = utils->read_u32(utils->data, "qcom,mdss-dsi-bl-ctrl-dcs-subtype",
		&val);
	if (rc) {
		DSI_DEBUG("[%s] bl-ctrl-dcs-subtype, defautling to zero\n",
			panel->name);
		panel->bl_config.bl_dcs_subtype = 0;
	} else {
		panel->bl_config.bl_dcs_subtype = val;
	}

	panel->bl_config.bl_inverted_dbv = utils->read_bool(utils->data,
		"qcom,mdss-dsi-bl-inverted-dbv");

+2 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#ifndef _DSI_PANEL_H_
@@ -122,6 +122,7 @@ struct dsi_backlight_config {
	u32 bl_scale;
	u32 bl_scale_sv;
	bool bl_inverted_dbv;
	u32 bl_dcs_subtype;

	int en_gpio;
	/* PWM params */