[Intel-gfx] [PATCH 7/7] drm/i915: Add lspcon hpd handler
Shashank Sharma
shashank.sharma at intel.com
Tue Mar 22 14:25:08 UTC 2016
This patch adds a new hpd handler for lspcon.
As lspcon has its own way of reading EDID and detecting
the device, it wont be efficient to use the existing hpd
functions to handle the hot_plug scenarios. This new function
reads the EDID and checks the status of the sink device.
Signed-off-by: Shashank Sharma <shashank.sharma at intel.com>
---
drivers/gpu/drm/i915/intel_lspcon.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
index 6ef320b..0c064b9 100644
--- a/drivers/gpu/drm/i915/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/intel_lspcon.c
@@ -278,6 +278,38 @@ bool lspcon_device_init(struct intel_lspcon *lspcon)
return true;
}
+enum irqreturn
+lspcon_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
+{
+ struct drm_device *dev = intel_dig_port->base.base.dev;
+ struct intel_encoder *intel_encoder = &intel_dig_port->base;
+ struct intel_connector *intel_connector;
+ bool changed = false;
+
+ mutex_lock(&dev->mode_config.mutex);
+ if (intel_encoder->hot_plug)
+ intel_encoder->hot_plug(intel_encoder);
+
+ for_each_intel_connector(dev, intel_connector) {
+ if (intel_connector->encoder == intel_encoder) {
+ struct drm_connector *connector =
+ &intel_connector->base;
+
+ DRM_DEBUG_DRIVER("Hptplug: Connector %s (pin %i).\n",
+ connector->name, intel_encoder->hpd_pin);
+ if (intel_hpd_irq_event(dev, connector))
+ changed = true;
+ }
+ }
+ mutex_unlock(&dev->mode_config.mutex);
+
+ if (changed) {
+ DRM_DEBUG_DRIVER("Sending event for change\n");
+ drm_kms_helper_hotplug_event(dev);
+ }
+ return IRQ_HANDLED;
+}
+
static int lspcon_get_edid_over_aux(void *data,
u8 *buf, unsigned int block, size_t len)
{
@@ -516,6 +548,9 @@ void intel_lspcon_init_connector(struct intel_digital_port *intel_dig_port)
intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
i915_debugfs_connector_add(connector);
+ /* HPD handler */
+ intel_dig_port->hpd_pulse = lspcon_hpd_pulse;
+
/* init DP */
if (intel_dp_init_minimum(intel_dig_port, intel_connector)) {
DRM_ERROR("DP init for LSPCON failed\n");
--
1.9.1
More information about the Intel-gfx
mailing list