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

Commit 9956996a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes If1798961,I90b59952 into dev/msm-4.14-display

* changes:
  drm/msm/dp: add debugfs node to set/get max pclk
  drm/msm/dp: fix reading of edid extension blocks
parents b71db171 e93096a4
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -371,11 +371,8 @@ static void dp_aux_transfer_helper(struct dp_aux_private *aux,
	bool i2c_read = input_msg->request &
		(DP_AUX_I2C_READ & DP_AUX_NATIVE_READ);

	if (!i2c_mot || !i2c_read || (input_msg->size == 0)) {
		/* reset the offset for all other transaction types */
		aux->offset = 0;
	if (!i2c_mot || !i2c_read || (input_msg->size == 0))
		return;
	}

	/*
	 * Sending the segment value and EDID offset will be performed
@@ -498,12 +495,6 @@ static ssize_t dp_aux_transfer_debug(struct drm_dp_aux *drm_aux,
		goto address_error;
	}

	if ((msg->size + aux->offset) > SZ_256) {
		pr_err("invalid edid access: offset=0x%x, size=0x%x\n",
				aux->offset, msg->size);
		goto address_error;
	}

	if (aux->native) {
		if (aux->read) {
			aux->dp_aux.reg = msg->address;
+80 −0
Original line number Diff line number Diff line
@@ -399,6 +399,72 @@ static ssize_t dp_debug_mst_mode_write(struct file *file,
	return len;
}

static ssize_t dp_debug_max_pclk_khz_write(struct file *file,
		const char __user *user_buff, size_t count, loff_t *ppos)
{
	struct dp_debug_private *debug = file->private_data;
	char buf[SZ_8];
	size_t len = 0;
	u32 max_pclk = 0;

	if (!debug)
		return -ENODEV;

	if (*ppos)
		return 0;

	len = min_t(size_t, count, SZ_8 - 1);
	if (copy_from_user(buf, user_buff, len))
		return 0;

	buf[len] = '\0';

	if (kstrtoint(buf, 10, &max_pclk) != 0)
		return 0;

	if (max_pclk > debug->parser->max_pclk_khz)
		pr_err("requested: %d, max_pclk_khz:%d\n", max_pclk,
				debug->parser->max_pclk_khz);
	else
		debug->dp_debug.max_pclk_khz = max_pclk;

	pr_debug("max_pclk_khz: %d\n", max_pclk);

	return len;
}

static ssize_t dp_debug_max_pclk_khz_read(struct file *file,
	char __user *user_buff, size_t count, loff_t *ppos)
{
	struct dp_debug_private *debug = file->private_data;
	char *buf;
	u32 len = 0;

	if (!debug)
		return -ENODEV;

	if (*ppos)
		return 0;

	buf = kzalloc(SZ_4K, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	len += snprintf(buf + len, (SZ_4K - len),
			"max_pclk_khz = %d, org: %d\n",
			debug->dp_debug.max_pclk_khz,
			debug->parser->max_pclk_khz);

	if (copy_to_user(user_buff, buf, len)) {
		kfree(buf);
		return -EFAULT;
	}

	*ppos += len;
	kfree(buf);
	return len;
}

static ssize_t dp_debug_mst_sideband_mode_write(struct file *file,
		const char __user *user_buff, size_t count, loff_t *ppos)
{
@@ -1154,6 +1220,12 @@ static const struct file_operations mst_sideband_mode_fops = {
	.write = dp_debug_mst_sideband_mode_write,
};

static const struct file_operations max_pclk_khz_fops = {
	.open = simple_open,
	.write = dp_debug_max_pclk_khz_write,
	.read = dp_debug_max_pclk_khz_read,
};

static int dp_debug_init(struct dp_debug *dp_debug)
{
	int rc = 0;
@@ -1309,6 +1381,14 @@ static int dp_debug_init(struct dp_debug *dp_debug)
		       DEBUG_NAME, rc);
	}

	file = debugfs_create_file("max_pclk_khz", 0644, dir,
			debug, &max_pclk_khz_fops);
	if (IS_ERR_OR_NULL(file)) {
		rc = PTR_ERR(file);
		pr_err("[%s] debugfs max_pclk_khz failed, rc=%d\n",
		       DEBUG_NAME, rc);
	}

	return 0;

error_remove_dir:
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
 * @hdisplay: used to filter out hdisplay value
 * @vrefresh: used to filter out vrefresh value
 * @tpg_state: specifies whether tpg feature is enabled
 * @max_pclk_khz: max pclk supported
 */
struct dp_debug {
	bool debug_en;
@@ -37,6 +38,7 @@ struct dp_debug {
	int hdisplay;
	int vrefresh;
	bool tpg_state;
	u32 max_pclk_khz;

	u8 *(*get_edid)(struct dp_debug *dp_debug);
};
+6 −1
Original line number Diff line number Diff line
@@ -564,8 +564,13 @@ static int dp_display_process_hpd_high(struct dp_display_private *dp)
	dp->link->process_request(dp->link);
	dp->panel->handle_sink_request(dp->panel);

	if (dp->debug->max_pclk_khz)
		dp->dp_display.max_pclk_khz = dp->debug->max_pclk_khz;
	else
		dp->dp_display.max_pclk_khz = dp->parser->max_pclk_khz;

	pr_debug("dp max_pclk_khz = %d\n", dp->dp_display.max_pclk_khz);

	dp_display_process_mst_hpd_high(dp);
notify:
	dp_display_send_hpd_notification(dp, true);