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

Commit 78aad70c authored by Rajeev Nandan's avatar Rajeev Nandan Committed by Gerrit - the friendly Code Review server
Browse files

disp: msm: dsi: select timing mode shared from kernel command line



If the command line timing is given, select corresponding
drm display mode as preferred mode. Select first sub mode of
that timing as preferred mode if dynamic clock or dynamic fps
is enabled.

Change-Id: I688b3bc07f79f4d014b8a7797204d3d6a873222d
Signed-off-by: default avatarRajeev Nandan <rajeevny@codeaurora.org>
parent e54eff08
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -631,6 +631,7 @@ struct dsi_display_mode_priv_info {
 * @pixel_clk_khz:  Pixel clock in Khz.
 * @dsi_mode_flags: Flags to signal other drm components via private flags
 * @panel_mode:      Panel mode
 * @is_preferred:   Is mode preferred
 * @priv_info:      Mode private info
 */
struct dsi_display_mode {
@@ -638,6 +639,7 @@ struct dsi_display_mode {
	u32 pixel_clk_khz;
	u32 dsi_mode_flags;
	enum dsi_op_mode panel_mode;
	bool is_preferred;
	struct dsi_display_mode_priv_info *priv_info;
};

+26 −18
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@

#define to_dsi_display(x) container_of(x, struct dsi_display, host)
#define INT_BASE_10 10
#define NO_OVERRIDE -1

#define MISR_BUFF_SIZE	256
#define ESD_MODE_STRING_MAX_LEN 256
@@ -2187,26 +2186,23 @@ static void dsi_display_parse_cmdline_topology(struct dsi_display *display,
		display->sw_te_using_wd = true;

	str = strnstr(boot_str, ":config", strlen(boot_str));
	if (!str)
		goto end;

	if (kstrtol(str + strlen(":config"), INT_BASE_10,
				(unsigned long *)&cmdline_topology)) {
		DSI_ERR("invalid config index override: %s\n", boot_str);
	if (str) {
		if (sscanf(str, ":config%lu", &cmdline_topology) != 1) {
			DSI_ERR("invalid config index override: %s\n",
				boot_str);
			goto end;
		}
	}

	str = strnstr(boot_str, ":timing", strlen(boot_str));
	if (!str)
		goto end;

	if (kstrtol(str + strlen(":timing"), INT_BASE_10,
				(unsigned long *)&cmdline_timing)) {
		DSI_ERR("invalid timing index override: %s. resetting both timing and config\n",
	if (str) {
		if (sscanf(str, ":timing%lu", &cmdline_timing) != 1) {
			DSI_ERR("invalid timing index override: %s\n",
				boot_str);
			cmdline_topology = NO_OVERRIDE;
			goto end;
		}
	}
	DSI_DEBUG("successfully parsed command line topology and timing\n");
end:
	display->cmdline_topology = cmdline_topology;
@@ -6182,13 +6178,21 @@ int dsi_display_get_modes(struct dsi_display *display,

	timing_mode_count = display->panel->num_timing_nodes;

	/* Validate command line timing */
	if ((display->cmdline_timing != NO_OVERRIDE) &&
		(display->cmdline_timing >= timing_mode_count))
		display->cmdline_timing = NO_OVERRIDE;

	for (mode_idx = 0; mode_idx < timing_mode_count; mode_idx++) {
		struct dsi_display_mode display_mode;
		int topology_override = NO_OVERRIDE;
		bool is_preferred = false;
		u32 frame_threshold_us = ctrl->ctrl->frame_threshold_time_us;

		if (display->cmdline_timing == mode_idx)
		if (display->cmdline_timing == mode_idx) {
			topology_override = display->cmdline_topology;
			is_preferred = true;
		}

		memset(&display_mode, 0, sizeof(display_mode));

@@ -6278,6 +6282,10 @@ int dsi_display_get_modes(struct dsi_display *display,
			continue;

		_dsi_display_populate_bit_clks(display, start, end, &array_idx);
		if (is_preferred) {
			/* Set first timing sub mode as preferred mode */
			display->modes[start].is_preferred = true;
		}
	}

exit:
+8 −2
Original line number Diff line number Diff line
@@ -849,9 +849,15 @@ int dsi_connector_get_modes(struct drm_connector *connector, void *data,
		}
		m->width_mm = connector->display_info.width_mm;
		m->height_mm = connector->display_info.height_mm;

		if (display->cmdline_timing != NO_OVERRIDE) {
			/* get the preferred mode from dsi display mode */
			if (modes[i].is_preferred)
				m->type |= DRM_MODE_TYPE_PREFERRED;
		} else if (i == 0) {
			/* set the first mode in list as preferred */
		if (i == 0)
			m->type |= DRM_MODE_TYPE_PREFERRED;
		}
		drm_mode_probed_add(connector, m);
	}

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

#ifndef _DSI_DRM_H_
@@ -15,6 +15,8 @@

#include "dsi_display.h"

#define NO_OVERRIDE -1

struct dsi_bridge {
	struct drm_bridge base;
	u32 id;