drm/i915: turn the eDP VDD on for any i2c transactions
Subsystems (2)
PATCH 1/3 drm/i915: turn the eDP VDD on for any i2c transactions
From: Paulo Zanoni <[email protected]>
If the eDP output is disabled, then we try to use /dev/i2c-X file to do i2c transations, we get a WARN from intel_dp_check_edp() saying we're trying to do AUX communication with the panel off. So this commit reorganizes the code so we enable the VDD at intel_dp_i2c_aux_ch() instead of just the callers inside i915.ko.
This fixes the i2c subtest from the pc8 test of intel-gpu-tools on machines that have eDP panels.
--- drivers/gpu/drm/i915/intel_dp.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +17 -12
@@ -623,6 +623,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,int reply_bytes;int ret; +ironlake_edp_panel_vdd_on (intel_dp);intel_dp_check_edp (intel_dp);/* Set up the command byte */ if (mode &MODE_I2C_READ )
@@ -665,7 +666,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, reply, reply_bytes);if (ret <0 ) {DRM_DEBUG_KMS ("aux_ch failed %d\n" , ret); -return ret; + goto out; }switch (reply[0 ] &AUX_NATIVE_REPLY_MASK ) {
@@ -676,7 +677,8 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,break ;case AUX_NATIVE_REPLY_NACK :DRM_DEBUG_KMS ("aux_ch native nack\n" ); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out;case AUX_NATIVE_REPLY_DEFER :/* * For now, just give more slack to branch devices. We
@@ -694,7 +696,8 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,default :DRM_ERROR ("aux_ch invalid native reply 0x%02x\n" , reply[0 ]); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out; }switch (reply[0 ] &AUX_I2C_REPLY_MASK ) {
@@ -702,22 +705,29 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,if (mode ==MODE_I2C_READ ) { *read_byte = reply[1 ]; } -return reply_bytes -1 ; + ret = reply_bytes -1 ; + goto out;case AUX_I2C_REPLY_NACK :DRM_DEBUG_KMS ("aux_i2c nack\n" ); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out;case AUX_I2C_REPLY_DEFER :DRM_DEBUG_KMS ("aux_i2c defer\n" );udelay (100 );break ;default :DRM_ERROR ("aux_i2c invalid reply 0x%02x\n" , reply[0 ]); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out; } }DRM_ERROR ("too many retries, giving up\n" ); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + +out: +ironlake_edp_panel_vdd_off (intel_dp, false); +return ret; } static int
@@ -739,9 +749,7 @@ intel_dp_i2c_init(struct intel_dp *intel_dp, intel_dp->adapter.algo_data = &intel_dp->algo; intel_dp->adapter.dev.parent = intel_connector->base.kdev; -ironlake_edp_panel_vdd_on (intel_dp); ret =i2c_dp_aux_add_bus (&intel_dp->adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return ret; }
@@ -3498,7 +3506,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,intel_dp_init_panel_power_sequencer_registers (dev, intel_dp, &power_seq); -ironlake_edp_panel_vdd_on (intel_dp); edid =drm_get_edid (connector, &intel_dp->adapter);if (edid) {if (drm_add_edid_modes (connector, edid)) {
@@ -3530,8 +3537,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, fixed_mode->type |=DRM_MODE_TYPE_PREFERRED ; } -ironlake_edp_panel_vdd_off (intel_dp, false); -intel_panel_init (&intel_connector->panel, fixed_mode);intel_panel_setup_backlight (connector);
Signature · 1 line
1.8.3.1
PATCH 2/3 drm/i915: reduce eDP VDD message verbose
From: Paulo Zanoni <[email protected]>
Now we only print messages when we actually enable VDD and when we actually disable VDD.
The changes in the last commit triggered a big number of messages while the driver was being initialized, and I thought we were toggling things on/off too many times, but that was not really true: we were just being too verbose.
--- drivers/gpu/drm/i915/intel_dp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +5 -5
@@ -1077,17 +1077,16 @@ void ironlake_edp_panel_vdd_on(struct intel_dp *intel_dp)if (!is_edp (intel_dp))return ; -DRM_DEBUG_KMS ("Turn eDP VDD on\n" );WARN (intel_dp->want_panel_vdd,"eDP VDD already requested on\n" ); intel_dp->want_panel_vdd = true; -if (ironlake_edp_have_panel_vdd (intel_dp)) { -DRM_DEBUG_KMS ("eDP VDD already on\n" ); +if (ironlake_edp_have_panel_vdd (intel_dp))return ; - } + +DRM_DEBUG_KMS ("Turning eDP VDD on\n" );if (!ironlake_edp_have_panel_power (intel_dp))ironlake_wait_panel_power_cycle (intel_dp);
@@ -1121,6 +1120,8 @@ static void ironlake_panel_vdd_off_sync(struct intel_dp *intel_dp)WARN_ON (!mutex_is_locked (&dev->mode_config.mutex));if (!intel_dp->want_panel_vdd &&ironlake_edp_have_panel_vdd (intel_dp)) { +DRM_DEBUG_KMS ("Turning eDP VDD off\n" ); + pp =ironlake_get_pp_control (intel_dp); pp &= ~EDP_FORCE_VDD ;
@@ -1153,7 +1154,6 @@ void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)if (!is_edp (intel_dp))return ; -DRM_DEBUG_KMS ("Turn eDP VDD off %d\n" , intel_dp->want_panel_vdd);WARN (!intel_dp->want_panel_vdd,"eDP VDD not forced on" ); intel_dp->want_panel_vdd = false;
Signature · 1 line
1.8.3.1
PATCH 3/3 drm/i915: cancel the panel VDD work when we do it manually
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
After I reorganized the panel VDD debug messages I was able to spot we were disabling it one extra time. The problem is that we're missing the call to cancel the delayed work in one of the instances where we manually call ironlake_panel_vdd_off_sync().
--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -1159,6 +1159,7 @@ void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) intel_dp->want_panel_vdd = false;if (sync) { +cancel_delayed_work_sync (&intel_dp->panel_vdd_work);ironlake_panel_vdd_off_sync (intel_dp); }else {/*
Signature · 1 line
1.8.3.1
Re: [PATCH 3/3] drm/i915: cancel the panel VDD work when we do it manually
Quoted 17 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
After I reorganized the panel VDD debug messages I was able to spot we were disabling it one extra time. The problem is that we're missing the call to cancel the delayed work in one of the instances where we manually call
ironlake_panel_vdd_off_sync().Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/intel_dp.c +0
-0
drivers/gpu/drm/i915/intel_dp.c void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) · line 1162
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0@@ -1159,6 +1159,7 @@ void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) intel_dp->want_panel_vdd = false;if (sync) { +cancel_delayed_work_sync (&intel_dp->panel_vdd_work);
This will deadlock since we hold the mode_config.mutex here, and the panel_vdd_work also needs that. I've merged the other two patches. -Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0ironlake_panel_vdd_off_sync (intel_dp); }else {/* Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Jani Nikula
maintainerRe: [PATCH 3/3] drm/i915: cancel the panel VDD work when we do it manually
Quoted 20 lines · Daniel Vetter
Quoted 19 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
After I reorganized the panel VDD debug messages I was able to spot we were disabling it one extra time. The problem is that we're missing the call to cancel the delayed work in one of the instances where we manually call
ironlake_panel_vdd_off_sync().Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -1159,6 +1159,7 @@ void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) intel_dp->want_panel_vdd = false;
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) · line 1162
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (sync) { +cancel_delayed_work_sync (&intel_dp->panel_vdd_work);This will deadlock since we hold the mode_config.mutex here, and the
panel_vdd_workalso needs that. I've merged the other two patches.
Ooof, reviewer facepalm.
So we are calling ironlake_panel_vdd_off_sync() twice in this path, but that shouldn't matter, as we have
if (!intel_dp->want_panel_vdd && ironlake_edp_have_panel_vdd(intel_dp))
in there, right? Paulo, is that what you're seeing, or something else?
BR,
Jani.
Quoted 21 lines
-Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0ironlake_panel_vdd_off_sync (intel_dp); }else {/* Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH 3/3] drm/i915: cancel the panel VDD work when we do it manually
2013/10/31 Jani Nikula <[email protected]>:
Quoted 21 lines · Daniel Vetter
Quoted 20 lines · Paulo Zanoni
Quoted 19 lines
From: Paulo Zanoni <[email protected]>
After I reorganized the panel VDD debug messages I was able to spot we were disabling it one extra time. The problem is that we're missing the call to cancel the delayed work in one of the instances where we manually call
ironlake_panel_vdd_off_sync().Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -1159,6 +1159,7 @@ void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) intel_dp->want_panel_vdd = false;
Quoted 7 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) · line 1162
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (sync) { +cancel_delayed_work_sync (&intel_dp->panel_vdd_work);This will deadlock since we hold the mode_config.mutex here, and the
panel_vdd_workalso needs that. I've merged the other two patches.Ooof, reviewer facepalm.
Actually it was a "developer facepalm" for messing with locks without lockdep enabled... I thought I had it enabled, but it seems I didn't have. Lockdep screams almost 100 lines complaining about my code. My bad.
Quoted 7 lines
So we are calling
ironlake_panel_vdd_off_sync()twice in this path, but that shouldn't matter, as we haveif (!intel_dp->want_panel_vdd &&
ironlake_edp_have_panel_vdd(intel_dp))in there, right? Paulo, is that what you're seeing, or something else?
Yeah, I kept investigating the code and reached the same conclusion, except for the fact that we were still printing "Turning eDP VDD off" twice without a "Turn eDP VDD on" in the middle. So I kept investigating and found we were using the wrong register (as I reported on IRC). I'll submit another patch soon.
Quoted 31 lines
BR,
Jani.Quoted 13 lines
-Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +0
-1ironlake_panel_vdd_off_sync (intel_dp); }else {/* -- 1.8.3.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxQuoted 8 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Jani Nikula, Intel Open Source Technology Center
Signature · 1 line
Paulo Zanoni
Re: [PATCH 3/3] drm/i915: cancel the panel VDD work when we do it manually
In reply to Jani NikulaQuoted 27 lines · Jani Nikula
Quoted 20 lines · Daniel Vetter
Quoted 19 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
After I reorganized the panel VDD debug messages I was able to spot we were disabling it one extra time. The problem is that we're missing the call to cancel the delayed work in one of the instances where we manually call
ironlake_panel_vdd_off_sync().Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/i915/intel_dp.c +0
-0@@ -1159,6 +1159,7 @@ void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) intel_dp->want_panel_vdd = false;Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c void ironlake_edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) · line 1162
Quoted 2 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (sync) { +cancel_delayed_work_sync (&intel_dp->panel_vdd_work);This will deadlock since we hold the mode_config.mutex here, and the
panel_vdd_workalso needs that. I've merged the other two patches.
Quoted 8 lines
Ooof, reviewer facepalm.
So we are calling
ironlake_panel_vdd_off_sync()twice in this path, but that shouldn't matter, as we haveif (!intel_dp->want_panel_vdd &&
ironlake_edp_have_panel_vdd(intel_dp))in there, right? Paulo, is that what you're seeing, or something else?
The work item should have a check for the actual vdd overwrite state and if it's off already silently do nothing. At least that should have been there once before ...
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
On the series,
Quoted 125 lines · Paulo Zanoni
From: Paulo Zanoni <[email protected]>
If the eDP output is disabled, then we try to use
/dev/i2c-Xfile to do i2c transations, we get a WARN fromintel_dp_check_edp()saying we're trying to do AUX communication with the panel off. So this commit reorganizes the code so we enable the VDD atintel_dp_i2c_aux_ch()instead of just the callers inside i915.ko.This fixes the i2c subtest from the pc8 test of intel-gpu-tools on machines that have eDP panels.
Signed-off-by Paulo Zanoni <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)drivers/gpu/drm/i915/intel_dp.c +17
-12@@ -623,6 +623,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,int reply_bytes;int ret; +ironlake_edp_panel_vdd_on (intel_dp);intel_dp_check_edp (intel_dp);/* Set up the command byte */ if (mode &MODE_I2C_READ )@@ -665,7 +666,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, reply, reply_bytes);if (ret <0 ) {DRM_DEBUG_KMS ("aux_ch failed %d\n" , ret); -return ret; + goto out; }switch (reply[0 ] &AUX_NATIVE_REPLY_MASK ) {@@ -676,7 +677,8 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,break ;case AUX_NATIVE_REPLY_NACK :DRM_DEBUG_KMS ("aux_ch native nack\n" ); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out;case AUX_NATIVE_REPLY_DEFER :/* * For now, just give more slack to branch devices. We @@ -694,7 +696,8 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,default :DRM_ERROR ("aux_ch invalid native reply 0x%02x\n" , reply[0 ]); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out; }switch (reply[0 ] &AUX_I2C_REPLY_MASK ) {@@ -702,22 +705,29 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,if (mode ==MODE_I2C_READ ) { *read_byte = reply[1 ]; } -return reply_bytes -1 ; + ret = reply_bytes -1 ; + goto out;case AUX_I2C_REPLY_NACK :DRM_DEBUG_KMS ("aux_i2c nack\n" ); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out;case AUX_I2C_REPLY_DEFER :DRM_DEBUG_KMS ("aux_i2c defer\n" );udelay (100 );break ;default :DRM_ERROR ("aux_i2c invalid reply 0x%02x\n" , reply[0 ]); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + goto out; } }DRM_ERROR ("too many retries, giving up\n" ); -return -EREMOTEIO ; + ret = -EREMOTEIO ; + +out: +ironlake_edp_panel_vdd_off (intel_dp, false); +return ret; } static int@@ -739,9 +749,7 @@ intel_dp_i2c_init(struct intel_dp *intel_dp, intel_dp->adapter.algo_data = &intel_dp->algo; intel_dp->adapter.dev.parent = intel_connector->base.kdev; -ironlake_edp_panel_vdd_on (intel_dp); ret =i2c_dp_aux_add_bus (&intel_dp->adapter); -ironlake_edp_panel_vdd_off (intel_dp, false);return ret; }@@ -3498,7 +3506,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,intel_dp_init_panel_power_sequencer_registers (dev, intel_dp, &power_seq); -ironlake_edp_panel_vdd_on (intel_dp); edid =drm_get_edid (connector, &intel_dp->adapter);if (edid) {if (drm_add_edid_modes (connector, edid)) {@@ -3530,8 +3537,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, fixed_mode->type |=DRM_MODE_TYPE_PREFERRED ; } -ironlake_edp_panel_vdd_off (intel_dp, false); -intel_panel_init (&intel_connector->panel, fixed_mode);intel_panel_setup_backlight (connector);Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center