From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: [PATCH v2 6/6] drm/i915/dp: Fix duplication of DEVICE_SERVICE_IRQ handling
Date: Mon, 24 Sep 2018 15:45:28 -0700 [thread overview]
Message-ID: <20180924224528.4744-6-dhinakaran.pandiyan@intel.com> (raw)
In-Reply-To: <20180924224528.4744-1-dhinakaran.pandiyan@intel.com>
There are two copies of the same code called from long and short
pulse handlers.
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
drivers/gpu/drm/i915/intel_dp.c | 59 ++++++++++++---------------------
1 file changed, 22 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d6ea93e453a2..64c6158feb0b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4038,13 +4038,6 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
intel_dp->is_mst);
}
-static bool
-intel_dp_get_sink_irq(struct intel_dp *intel_dp, u8 *sink_irq_vector)
-{
- return drm_dp_dpcd_readb(&intel_dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR,
- sink_irq_vector) == 1;
-}
-
static bool
intel_dp_get_sink_irq_esi(struct intel_dp *intel_dp, u8 *sink_irq_vector)
{
@@ -4432,6 +4425,26 @@ static bool intel_dp_hotplug(struct intel_encoder *encoder,
return changed;
}
+static void intel_dp_check_service_irq(struct intel_dp *intel_dp)
+{
+ u8 val;
+
+ if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
+ return;
+
+ if (drm_dp_dpcd_readb(&intel_dp->aux,
+ DP_DEVICE_SERVICE_IRQ_VECTOR, &val) != 1 || !val)
+ return;
+
+ drm_dp_dpcd_writeb(&intel_dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR, val);
+
+ if (val & DP_AUTOMATED_TEST_REQUEST)
+ intel_dp_handle_test_request(intel_dp);
+
+ if (val & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ))
+ DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
+}
+
/*
* According to DP spec
* 5.1.2:
@@ -4449,7 +4462,6 @@ static bool
intel_dp_short_pulse(struct intel_dp *intel_dp)
{
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
- u8 sink_irq_vector = 0;
u8 old_sink_count = intel_dp->sink_count;
bool ret;
@@ -4472,20 +4484,7 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
return false;
}
- /* Try to read the source of the interrupt */
- if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
- intel_dp_get_sink_irq(intel_dp, &sink_irq_vector) &&
- sink_irq_vector != 0) {
- /* Clear interrupt source */
- drm_dp_dpcd_writeb(&intel_dp->aux,
- DP_DEVICE_SERVICE_IRQ_VECTOR,
- sink_irq_vector);
-
- if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
- intel_dp_handle_test_request(intel_dp);
- if (sink_irq_vector & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ))
- DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
- }
+ intel_dp_check_service_irq(intel_dp);
/* Handle CEC interrupts, if any */
drm_dp_cec_irq(&intel_dp->aux);
@@ -5020,7 +5019,6 @@ intel_dp_detect(struct drm_connector *connector,
struct intel_dp *intel_dp = intel_attached_dp(connector);
struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
int status;
- u8 sink_irq_vector = 0;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
connector->base.id, connector->name);
@@ -5103,20 +5101,7 @@ intel_dp_detect(struct drm_connector *connector,
to_intel_connector(connector)->detect_edid)
status = connector_status_connected;
- /* Try to read the source of the interrupt */
- if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
- intel_dp_get_sink_irq(intel_dp, &sink_irq_vector) &&
- sink_irq_vector != 0) {
- /* Clear interrupt source */
- drm_dp_dpcd_writeb(&intel_dp->aux,
- DP_DEVICE_SERVICE_IRQ_VECTOR,
- sink_irq_vector);
-
- if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
- intel_dp_handle_test_request(intel_dp);
- if (sink_irq_vector & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ))
- DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
- }
+ intel_dp_check_service_irq(intel_dp);
out:
if (status != connector_status_connected && !intel_dp->is_mst)
--
2.17.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-09-24 22:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-24 22:45 [PATCH v2 1/6] drm/i915/dp: Fix link retraining comment in intel_dp_long_pulse() Dhinakaran Pandiyan
2018-09-24 22:45 ` [PATCH v2 2/6] drm/i915/dp: Restrict link retrain workaround to external monitors Dhinakaran Pandiyan
2018-10-01 19:49 ` Rodrigo Vivi
2018-10-01 22:00 ` Dhinakaran Pandiyan
2018-10-02 0:30 ` Dhinakaran Pandiyan
2018-10-23 11:56 ` Jani Nikula
2018-10-24 10:49 ` Joonas Lahtinen
2018-10-01 22:30 ` Lyude Paul
2018-09-24 22:45 ` [PATCH v2 3/6] drm/i915/dp: Use a local variable for intel_encoder * Dhinakaran Pandiyan
2018-09-25 20:51 ` Souza, Jose
2018-09-24 22:45 ` [PATCH v2 4/6] drm/i915/dp: Do not grab crtc modeset lock in intel_dp_detect() Dhinakaran Pandiyan
2018-09-25 20:58 ` Souza, Jose
2018-09-26 2:54 ` [PATCH v3 " Dhinakaran Pandiyan
2018-10-01 19:48 ` Rodrigo Vivi
2018-10-01 20:10 ` Ville Syrjälä
2018-10-01 22:01 ` Dhinakaran Pandiyan
2018-10-01 23:22 ` Rodrigo Vivi
2018-09-24 22:45 ` [PATCH v2 5/6] drm/i915/dp: Kill intel_dp->detect_done flag Dhinakaran Pandiyan
2018-09-25 17:53 ` Ville Syrjälä
2018-09-26 2:31 ` Dhinakaran Pandiyan
2018-09-24 22:45 ` Dhinakaran Pandiyan [this message]
2018-09-25 21:01 ` [PATCH v2 6/6] drm/i915/dp: Fix duplication of DEVICE_SERVICE_IRQ handling Souza, Jose
2018-09-24 23:47 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v2,1/6] drm/i915/dp: Fix link retraining comment in intel_dp_long_pulse() Patchwork
2018-09-25 0:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-09-25 6:33 ` Patchwork
2018-09-26 2:08 ` [PATCH v3 4/6] drm/i915/dp: Do not grab crtc modeset lock in intel_dp_detect() Dhinakaran Pandiyan
2018-09-26 3:18 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v2,1/6] drm/i915/dp: Fix link retraining comment in intel_dp_long_pulse() (rev2) Patchwork
2018-09-26 3:41 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-26 4:32 ` ✓ Fi.CI.IGT: " Patchwork
2018-10-01 22:30 ` [PATCH v2 1/6] drm/i915/dp: Fix link retraining comment in intel_dp_long_pulse() Lyude Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180924224528.4744-6-dhinakaran.pandiyan@intel.com \
--to=dhinakaran.pandiyan@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox