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

Commit 980405d8 authored by Clarence Ip's avatar Clarence Ip
Browse files

drm/msm/sde: clear vbif errors before kickoff



Log and clear any vbif errors before each encoder kickoff.
This ensures that any reported errors are relevant to the
current commit cycle.

Change-Id: I8c1050acd5d6161d897b974968a5c55f69baed4d
Signed-off-by: default avatarClarence Ip <cip@codeaurora.org>
parent eb39cce1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "sde_color_processing.h"
#include "sde_encoder.h"
#include "sde_connector.h"
#include "sde_vbif.h"
#include "sde_power_handle.h"
#include "sde_core_perf.h"
#include "sde_trace.h"
@@ -2195,6 +2196,8 @@ void sde_crtc_commit_kickoff(struct drm_crtc *crtc)
		drm_atomic_crtc_for_each_plane(plane, crtc)
			sde_plane_kickoff(plane);

	sde_vbif_clear_errors(sde_kms);

	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
		if (encoder->crtc != crtc)
			continue;
+24 −0
Original line number Diff line number Diff line
@@ -33,11 +33,34 @@
#define VBIF_OUT_WR_LIM_CONF0		0x00D4
#define VBIF_OUT_AXI_AMEMTYPE_CONF0	0x0160
#define VBIF_OUT_AXI_AMEMTYPE_CONF1	0x0164
#define VBIF_XIN_PND_ERR		0x0190
#define VBIF_XIN_SRC_ERR		0x0194
#define VBIF_XIN_CLR_ERR		0x019C
#define VBIF_XIN_HALT_CTRL0		0x0200
#define VBIF_XIN_HALT_CTRL1		0x0204
#define VBIF_XINL_QOS_RP_REMAP_000	0x0550
#define VBIF_XINL_QOS_LVL_REMAP_000	0x0590

static void sde_hw_clear_errors(struct sde_hw_vbif *vbif,
		u32 *pnd_errors, u32 *src_errors)
{
	struct sde_hw_blk_reg_map *c;
	u32 pnd, src;

	if (!vbif)
		return;
	c = &vbif->hw;
	pnd = SDE_REG_READ(c, VBIF_XIN_PND_ERR);
	src = SDE_REG_READ(c, VBIF_XIN_SRC_ERR);

	if (pnd_errors)
		*pnd_errors = pnd;
	if (src_errors)
		*src_errors = src;

	SDE_REG_WRITE(c, VBIF_XIN_CLR_ERR, pnd | src);
}

static void sde_hw_set_mem_type(struct sde_hw_vbif *vbif,
		u32 xin_id, u32 value)
{
@@ -192,6 +215,7 @@ static void _setup_vbif_ops(struct sde_hw_vbif_ops *ops,
	if (test_bit(SDE_VBIF_QOS_REMAP, &cap))
		ops->set_qos_remap = sde_hw_set_qos_remap;
	ops->set_mem_type = sde_hw_set_mem_type;
	ops->clear_errors = sde_hw_clear_errors;
	ops->set_write_gather_en = sde_hw_set_write_gather_en;
}

+12 −0
Original line number Diff line number Diff line
@@ -81,6 +81,18 @@ struct sde_hw_vbif_ops {
	void (*set_mem_type)(struct sde_hw_vbif *vbif,
			u32 xin_id, u32 value);

	/**
	 * clear_errors - clear any vbif errors
	 *	This function clears any detected pending/source errors
	 *	on the VBIF interface, and optionally returns the detected
	 *	error mask(s).
	 * @vbif: vbif context driver
	 * @pnd_errors: pointer to pending error reporting variable
	 * @src_errors: pointer to source error reporting variable
	 */
	void (*clear_errors)(struct sde_hw_vbif *vbif,
		u32 *pnd_errors, u32 *src_errors);

	/**
	 * set_write_gather_en - set write_gather enable
	 * @vbif: vbif context driver
+23 −0
Original line number Diff line number Diff line
@@ -269,6 +269,29 @@ void sde_vbif_set_qos_remap(struct sde_kms *sde_kms,
		mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl, false);
}

void sde_vbif_clear_errors(struct sde_kms *sde_kms)
{
	struct sde_hw_vbif *vbif;
	u32 i, pnd, src;

	if (!sde_kms) {
		SDE_ERROR("invalid argument\n");
		return;
	}

	for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) {
		vbif = sde_kms->hw_vbif[i];
		if (vbif && vbif->ops.clear_errors) {
			vbif->ops.clear_errors(vbif, &pnd, &src);
			if (pnd || src) {
				SDE_EVT32(i, pnd, src);
				SDE_DEBUG("VBIF %d: pnd 0x%X, src 0x%X\n",
						vbif->idx - VBIF_0, pnd, src);
			}
		}
	}
}

void sde_vbif_init_memtypes(struct sde_kms *sde_kms)
{
	struct sde_hw_vbif *vbif;
+6 −0
Original line number Diff line number Diff line
@@ -66,6 +66,12 @@ void sde_vbif_set_ot_limit(struct sde_kms *sde_kms,
void sde_vbif_set_qos_remap(struct sde_kms *sde_kms,
		struct sde_vbif_set_qos_params *params);

/**
 * sde_vbif_clear_errors - clear any vbif errors
 * @sde_kms:	SDE handler
 */
void sde_vbif_clear_errors(struct sde_kms *sde_kms);

/**
 * sde_vbif_init_memtypes - initialize xin memory types for vbif
 * @sde_kms:	SDE handler