Commit 344c3278 authored by Jani Nikula's avatar Jani Nikula
Browse files

drm/i915/debugfs: clean up LPSP capable

parent 3a5f9281
Loading
Loading
Loading
Loading
+17 −27
Original line number Diff line number Diff line
@@ -2224,14 +2224,12 @@ static int i915_psr_status_show(struct seq_file *m, void *data)
}
DEFINE_SHOW_ATTRIBUTE(i915_psr_status);

#define LPSP_CAPABLE(COND) (COND ? seq_puts(m, "LPSP: capable\n") : \
				seq_puts(m, "LPSP: incapable\n"))

static int i915_lpsp_capability_show(struct seq_file *m, void *data)
{
	struct drm_connector *connector = m->private;
	struct drm_i915_private *i915 = to_i915(connector->dev);
	struct intel_encoder *encoder;
	bool lpsp_capable = false;

	encoder = intel_attached_encoder(to_intel_connector(connector));
	if (!encoder)
@@ -2240,35 +2238,27 @@ static int i915_lpsp_capability_show(struct seq_file *m, void *data)
	if (connector->status != connector_status_connected)
		return -ENODEV;

	if (DISPLAY_VER(i915) >= 13) {
		LPSP_CAPABLE(encoder->port <= PORT_B);
		return 0;
	}

	switch (DISPLAY_VER(i915)) {
	case 12:
	if (DISPLAY_VER(i915) >= 13)
		lpsp_capable = encoder->port <= PORT_B;
	else if (DISPLAY_VER(i915) >= 12)
		/*
		 * Actually TGL can drive LPSP on port till DDI_C
		 * but there is no physical connected DDI_C on TGL sku's,
		 * even driver is not initilizing DDI_C port for gen12.
		 */
		LPSP_CAPABLE(encoder->port <= PORT_B);
		break;
	case 11:
		LPSP_CAPABLE(connector->connector_type == DRM_MODE_CONNECTOR_DSI ||
		lpsp_capable = encoder->port <= PORT_B;
	else if (DISPLAY_VER(i915) == 11)
		lpsp_capable = (connector->connector_type == DRM_MODE_CONNECTOR_DSI ||
				connector->connector_type == DRM_MODE_CONNECTOR_eDP);
		break;
	case 10:
	case 9:
		LPSP_CAPABLE(encoder->port == PORT_A &&
	else if (IS_DISPLAY_VER(i915, 9, 10))
		lpsp_capable = (encoder->port == PORT_A &&
				(connector->connector_type == DRM_MODE_CONNECTOR_DSI ||
				 connector->connector_type == DRM_MODE_CONNECTOR_eDP ||
				 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort));
		break;
	default:
		if (IS_HASWELL(i915) || IS_BROADWELL(i915))
			LPSP_CAPABLE(connector->connector_type == DRM_MODE_CONNECTOR_eDP);
	}
	else if (IS_HASWELL(i915) || IS_BROADWELL(i915))
		lpsp_capable = connector->connector_type == DRM_MODE_CONNECTOR_eDP;

	seq_printf(m, "LPSP: %s\n", lpsp_capable ? "capable" : "incapable");

	return 0;
}