Message ID | 20181012183818.12230-1-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915/lspcon: Fix Parade LSPCON scrambling fail | expand |
Regards Shashank On 10/13/2018 12:08 AM, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > The Parade LSPCON on KBL NUCs forgets to turn off scrambling/bit clock > rate when switching from a mode that needs them to a mode that does > not. This manifests as a "no signal" on my TV when I try to go from > 4k to 1080p for example. Resetting the SCDC register bits with > i2cset is sufficient to restore the picture to the screen. > > Here's the OUI/fw revision for the LSPCON chip in question: > DP branch: OUI 00-1c-f8 dev-ID 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0000 > > Asking users to poke at SCDC with i2cset is a bit much, so > let's work around this in the driver. We don't need to go all > out here and compute whether scrambling is needed or not as > LSPCON will do that itself. If scrambling is actually > required LSPCON does not forget to enable it. > > Cc: Shashank Sharma <shashank.sharma@intel.com> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/i915/intel_ddi.c | 52 ++++++++++++++++++++++++++++--- > drivers/gpu/drm/i915/intel_drv.h | 1 + > drivers/gpu/drm/i915/intel_hdmi.c | 5 ++- > 3 files changed, 51 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > index 47960c92cbbf..ef502fc9add1 100644 > --- a/drivers/gpu/drm/i915/intel_ddi.c > +++ b/drivers/gpu/drm/i915/intel_ddi.c > @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, > intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); > } > > +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, > + const struct intel_crtc_state *crtc_state, > + const struct drm_connector_state *conn_state) > +{ > + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > + > + intel_ddi_pre_enable(encoder, crtc_state, conn_state); > + > + /* > + * Parade LSPCON forgets to turn off scrambling/bit clock rate > + * when switching from a mode that needs them to a mode that > + * does not. > + */ > + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, > + &intel_dp->aux.ddc, false, false); > +} > + > static void intel_disable_ddi_buf(struct intel_encoder *encoder) > { > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, > old_crtc_state, old_conn_state); > } > > +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, > + const struct intel_crtc_state *old_crtc_state, > + const struct drm_connector_state *old_conn_state) > +{ > + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > + > + /* > + * Parade LSPCON forgets to turn off scrambling/bit clock rate > + * when switching from a mode that needs them to a mode that > + * does not. > + */ > + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, > + &intel_dp->aux.ddc, false, false); > + > + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); > +} Few thoughts: - Would it make more sense to move these 2 functions to intel_lspcon.c ? - And then add a lspcon->vendor == VENDOR_PARADE check, so that we will run the code only when needed. - Also, we should check if scrambling is enabled, there might be a case where we are driving a HDMI 2.0 display (scrambling->supported = 1) but current mode is 1080 P. - Shashank > + > void intel_ddi_fdi_post_disable(struct intel_encoder *encoder, > const struct intel_crtc_state *old_crtc_state, > const struct drm_connector_state *old_conn_state) > @@ -3146,9 +3180,11 @@ static void intel_enable_ddi_hdmi(struct intel_encoder *encoder, > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); > struct drm_connector *connector = conn_state->connector; > + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, > + dig_port->hdmi.ddc_bus); > enum port port = encoder->port; > > - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, > + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, > crtc_state->hdmi_high_tmds_clock_ratio, > crtc_state->hdmi_scrambling)) > DRM_ERROR("[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n", > @@ -3243,13 +3279,17 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, > const struct intel_crtc_state *old_crtc_state, > const struct drm_connector_state *old_conn_state) > { > + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > struct drm_connector *connector = old_conn_state->connector; > + struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); > + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, > + dig_port->hdmi.ddc_bus); > > if (old_crtc_state->has_audio) > intel_audio_codec_disable(encoder, > old_crtc_state, old_conn_state); > > - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, > + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, > false, false)) > DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Failed to reset sink scrambling/TMDS bit clock ratio\n", > connector->base.id, connector->name); > @@ -3862,17 +3902,21 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) > } > > if (init_lspcon) { > - if (lspcon_init(intel_dig_port)) > + if (lspcon_init(intel_dig_port)) { > /* TODO: handle hdmi info frame part */ > DRM_DEBUG_KMS("LSPCON init success on port %c\n", > port_name(port)); > - else > + > + intel_encoder->pre_enable = intel_ddi_pre_enable_lspcon; > + intel_encoder->post_disable = intel_ddi_post_disable_lspcon; > + } else { > /* > * LSPCON init faied, but DP init was success, so > * lets try to drive as DP++ port. > */ > DRM_ERROR("LSPCON init failed on port %c\n", > port_name(port)); > + } > } > > return; > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index e321fc698ae1..d0a06fcc80c0 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -1866,6 +1866,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, > struct drm_connector_state *conn_state); > bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, > struct drm_connector *connector, > + struct i2c_adapter *adapter, > bool high_tmds_clock_ratio, > bool scrambling); > void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > index 2c53efc463e6..bf6f571b674b 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -2114,6 +2114,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c > * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup > * @encoder: intel_encoder > * @connector: drm_connector > + * @adapter: i2c adapter for the ddc bus > * @high_tmds_clock_ratio = bool to indicate if the function needs to set > * or reset the high tmds clock ratio for scrambling > * @scrambling: bool to Indicate if the function needs to set or reset > @@ -2130,15 +2131,13 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c > */ > bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, > struct drm_connector *connector, > + struct i2c_adapter *adapter, > bool high_tmds_clock_ratio, > bool scrambling) > { > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > - struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); > struct drm_scrambling *sink_scrambling = > &connector->display_info.hdmi.scdc.scrambling; > - struct i2c_adapter *adapter = > - intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); > > if (!sink_scrambling->supported) > return true;
On Sat, Oct 13, 2018 at 12:26:57AM +0530, Sharma, Shashank wrote: > Regards > > Shashank > > > On 10/13/2018 12:08 AM, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > The Parade LSPCON on KBL NUCs forgets to turn off scrambling/bit clock > > rate when switching from a mode that needs them to a mode that does > > not. This manifests as a "no signal" on my TV when I try to go from > > 4k to 1080p for example. Resetting the SCDC register bits with > > i2cset is sufficient to restore the picture to the screen. > > > > Here's the OUI/fw revision for the LSPCON chip in question: > > DP branch: OUI 00-1c-f8 dev-ID 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0000 > > > > Asking users to poke at SCDC with i2cset is a bit much, so > > let's work around this in the driver. We don't need to go all > > out here and compute whether scrambling is needed or not as > > LSPCON will do that itself. If scrambling is actually > > required LSPCON does not forget to enable it. > > > > Cc: Shashank Sharma <shashank.sharma@intel.com> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/i915/intel_ddi.c | 52 ++++++++++++++++++++++++++++--- > > drivers/gpu/drm/i915/intel_drv.h | 1 + > > drivers/gpu/drm/i915/intel_hdmi.c | 5 ++- > > 3 files changed, 51 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > > index 47960c92cbbf..ef502fc9add1 100644 > > --- a/drivers/gpu/drm/i915/intel_ddi.c > > +++ b/drivers/gpu/drm/i915/intel_ddi.c > > @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, > > intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); > > } > > > > +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, > > + const struct intel_crtc_state *crtc_state, > > + const struct drm_connector_state *conn_state) > > +{ > > + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > > + > > + intel_ddi_pre_enable(encoder, crtc_state, conn_state); > > + > > + /* > > + * Parade LSPCON forgets to turn off scrambling/bit clock rate > > + * when switching from a mode that needs them to a mode that > > + * does not. > > + */ > > + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, > > + &intel_dp->aux.ddc, false, false); > > +} > > + > > static void intel_disable_ddi_buf(struct intel_encoder *encoder) > > { > > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > > @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, > > old_crtc_state, old_conn_state); > > } > > > > +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, > > + const struct intel_crtc_state *old_crtc_state, > > + const struct drm_connector_state *old_conn_state) > > +{ > > + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > > + > > + /* > > + * Parade LSPCON forgets to turn off scrambling/bit clock rate > > + * when switching from a mode that needs them to a mode that > > + * does not. > > + */ > > + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, > > + &intel_dp->aux.ddc, false, false); > > + > > + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); > > +} > Few thoughts: > - Would it make more sense to move these 2 functions to intel_lspcon.c ? Would require more non-statics. But I guess it might be nice to attempt isolating it as much as possible. > - And then add a lspcon->vendor == VENDOR_PARADE check, so that we will > run the code only when needed. Maybe. The ->vendor thing isn't in yet, and we'd have to backport it as well. Is it big? Also at this time I have no idea whether Megachips LSPCON is similarly bugged. Would need to find one and test it. > - Also, we should check if scrambling is enabled, there might be a case > where we are driving a HDMI 2.0 display (scrambling->supported = 1) but > current mode is 1080 P. As explained in the commit message this is not needed. And currently we have no idea whether LSPCON will enable scrambling or not. Adding code to determine that would mean second guessing what LSPCON will do. I don't see any benefit in doing that. > > - Shashank > > + > > void intel_ddi_fdi_post_disable(struct intel_encoder *encoder, > > const struct intel_crtc_state *old_crtc_state, > > const struct drm_connector_state *old_conn_state) > > @@ -3146,9 +3180,11 @@ static void intel_enable_ddi_hdmi(struct intel_encoder *encoder, > > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > > struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); > > struct drm_connector *connector = conn_state->connector; > > + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, > > + dig_port->hdmi.ddc_bus); > > enum port port = encoder->port; > > > > - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, > > + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, > > crtc_state->hdmi_high_tmds_clock_ratio, > > crtc_state->hdmi_scrambling)) > > DRM_ERROR("[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n", > > @@ -3243,13 +3279,17 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, > > const struct intel_crtc_state *old_crtc_state, > > const struct drm_connector_state *old_conn_state) > > { > > + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > > struct drm_connector *connector = old_conn_state->connector; > > + struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); > > + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, > > + dig_port->hdmi.ddc_bus); > > > > if (old_crtc_state->has_audio) > > intel_audio_codec_disable(encoder, > > old_crtc_state, old_conn_state); > > > > - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, > > + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, > > false, false)) > > DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Failed to reset sink scrambling/TMDS bit clock ratio\n", > > connector->base.id, connector->name); > > @@ -3862,17 +3902,21 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) > > } > > > > if (init_lspcon) { > > - if (lspcon_init(intel_dig_port)) > > + if (lspcon_init(intel_dig_port)) { > > /* TODO: handle hdmi info frame part */ > > DRM_DEBUG_KMS("LSPCON init success on port %c\n", > > port_name(port)); > > - else > > + > > + intel_encoder->pre_enable = intel_ddi_pre_enable_lspcon; > > + intel_encoder->post_disable = intel_ddi_post_disable_lspcon; > > + } else { > > /* > > * LSPCON init faied, but DP init was success, so > > * lets try to drive as DP++ port. > > */ > > DRM_ERROR("LSPCON init failed on port %c\n", > > port_name(port)); > > + } > > } > > > > return; > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > > index e321fc698ae1..d0a06fcc80c0 100644 > > --- a/drivers/gpu/drm/i915/intel_drv.h > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > @@ -1866,6 +1866,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, > > struct drm_connector_state *conn_state); > > bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, > > struct drm_connector *connector, > > + struct i2c_adapter *adapter, > > bool high_tmds_clock_ratio, > > bool scrambling); > > void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > > index 2c53efc463e6..bf6f571b674b 100644 > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > @@ -2114,6 +2114,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c > > * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup > > * @encoder: intel_encoder > > * @connector: drm_connector > > + * @adapter: i2c adapter for the ddc bus > > * @high_tmds_clock_ratio = bool to indicate if the function needs to set > > * or reset the high tmds clock ratio for scrambling > > * @scrambling: bool to Indicate if the function needs to set or reset > > @@ -2130,15 +2131,13 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c > > */ > > bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, > > struct drm_connector *connector, > > + struct i2c_adapter *adapter, > > bool high_tmds_clock_ratio, > > bool scrambling) > > { > > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > > - struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); > > struct drm_scrambling *sink_scrambling = > > &connector->display_info.hdmi.scdc.scrambling; > > - struct i2c_adapter *adapter = > > - intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); > > > > if (!sink_scrambling->supported) > > return true;
On Fri, Oct 12, 2018 at 10:17:57PM +0300, Ville Syrjälä wrote: > On Sat, Oct 13, 2018 at 12:26:57AM +0530, Sharma, Shashank wrote: > > Regards > > > > Shashank > > > > > > On 10/13/2018 12:08 AM, Ville Syrjala wrote: > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > The Parade LSPCON on KBL NUCs forgets to turn off scrambling/bit clock > > > rate when switching from a mode that needs them to a mode that does > > > not. This manifests as a "no signal" on my TV when I try to go from > > > 4k to 1080p for example. Resetting the SCDC register bits with > > > i2cset is sufficient to restore the picture to the screen. > > > > > > Here's the OUI/fw revision for the LSPCON chip in question: > > > DP branch: OUI 00-1c-f8 dev-ID 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0000 > > > > > > Asking users to poke at SCDC with i2cset is a bit much, so > > > let's work around this in the driver. We don't need to go all > > > out here and compute whether scrambling is needed or not as > > > LSPCON will do that itself. If scrambling is actually > > > required LSPCON does not forget to enable it. > > > > > > Cc: Shashank Sharma <shashank.sharma@intel.com> > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > --- > > > drivers/gpu/drm/i915/intel_ddi.c | 52 ++++++++++++++++++++++++++++--- > > > drivers/gpu/drm/i915/intel_drv.h | 1 + > > > drivers/gpu/drm/i915/intel_hdmi.c | 5 ++- > > > 3 files changed, 51 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > > > index 47960c92cbbf..ef502fc9add1 100644 > > > --- a/drivers/gpu/drm/i915/intel_ddi.c > > > +++ b/drivers/gpu/drm/i915/intel_ddi.c > > > @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, > > > intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); > > > } > > > > > > +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, > > > + const struct intel_crtc_state *crtc_state, > > > + const struct drm_connector_state *conn_state) > > > +{ > > > + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > > > + > > > + intel_ddi_pre_enable(encoder, crtc_state, conn_state); > > > + > > > + /* > > > + * Parade LSPCON forgets to turn off scrambling/bit clock rate > > > + * when switching from a mode that needs them to a mode that > > > + * does not. > > > + */ > > > + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, > > > + &intel_dp->aux.ddc, false, false); > > > +} > > > + > > > static void intel_disable_ddi_buf(struct intel_encoder *encoder) > > > { > > > struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > > > @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, > > > old_crtc_state, old_conn_state); > > > } > > > > > > +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, > > > + const struct intel_crtc_state *old_crtc_state, > > > + const struct drm_connector_state *old_conn_state) > > > +{ > > > + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > > > + > > > + /* > > > + * Parade LSPCON forgets to turn off scrambling/bit clock rate > > > + * when switching from a mode that needs them to a mode that > > > + * does not. > > > + */ > > > + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, > > > + &intel_dp->aux.ddc, false, false); > > > + > > > + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); > > > +} > > Few thoughts: > > - Would it make more sense to move these 2 functions to intel_lspcon.c ? > > Would require more non-statics. But I guess it might be nice to attempt > isolating it as much as possible. > > > - And then add a lspcon->vendor == VENDOR_PARADE check, so that we will > > run the code only when needed. > > Maybe. The ->vendor thing isn't in yet, and we'd have to backport it > as well. Is it big? > > Also at this time I have no idea whether Megachips LSPCON is similarly > bugged. Would need to find one and test it. Oh, and another open question is what happens if one of these chips is in a DP->HDMI 2.0 dongle. In that case we might end up needing the same workaround in the normal DP codepath as well :(
Hi Ville,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.19-rc7 next-20181012]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-lspcon-Fix-Parade-LSPCON-scrambling-fail/20181013-044614
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x005-201840 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/gpu//drm/i915/intel_hdmi.c: In function 'intel_hdmi_handle_sink_scrambling':
>> drivers/gpu//drm/i915/intel_hdmi.c:2144:27: error: unused variable 'dev_priv' [-Werror=unused-variable]
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
^~~~~~~~
Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
Cyclomatic Complexity 4 include/linux/string.h:memcpy
Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
Cyclomatic Complexity 3 include/linux/ktime.h:ktime_compare
Cyclomatic Complexity 1 include/linux/ktime.h:ktime_after
Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
Cyclomatic Complexity 1 include/drm/drm_modeset_helper_vtables.h:drm_connector_helper_add
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_utils.h:yesno
Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_display.h:port_identifier
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.h:to_i915
Cyclomatic Complexity 1 drivers/gpu//drm/i915/i915_drv.h:intel_info
Cyclomatic Complexity 2 drivers/gpu//drm/i915/i915_drv.h:intel_gmbus_is_forced_bit
Cyclomatic Complexity 1 include/media/cec-notifier.h:cec_notifier_phys_addr_invalidate
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_get_crtc_for_pipe
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:intel_attached_encoder
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:intel_encoder_is_dig_port
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_drv.h:enc_to_dig_port
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:hdmi_to_dig_port
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_drv.h:intel_wait_for_vblank
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_drv.h:intel_wait_for_vblank_if_active
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_to_dev
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:g4x_infoframe_enabled
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:hsw_infoframe_enabled
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:hdmi_sink_is_deep_color
Cyclomatic Complexity 12 drivers/gpu//drm/i915/intel_hdmi.c:gcp_default_phase_possible
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:vlv_enable_hdmi
Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_source_max_tmds_clock
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:hdmi_port_clock_limit
Cyclomatic Complexity 8 drivers/gpu//drm/i915/intel_hdmi.c:hdmi_port_clock_valid
Cyclomatic Complexity 23 drivers/gpu//drm/i915/intel_hdmi.c:hdmi_deep_color_possible
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_ycbcr420_config
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:cpt_infoframe_enabled
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:assert_hdmi_port_disabled
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:g4x_infoframe_index
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:g4x_infoframe_enable
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:assert_hdmi_transcoder_func_disabled
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:hsw_dip_data_reg
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:hsw_infoframe_enable
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:hsw_write_infoframe
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:g4x_write_infoframe
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:chv_port_to_ddc_pin
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:bxt_port_to_ddc_pin
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:cnp_port_to_ddc_pin
Cyclomatic Complexity 8 drivers/gpu//drm/i915/intel_hdmi.c:icl_port_to_ddc_pin
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:g4x_port_to_ddc_pin
Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_ddc_pin
Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_set_gcp_infoframe
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_write_infoframe
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_set_spd_infoframe
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_set_hdmi_infoframe
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:cpt_write_infoframe
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:ibx_infoframe_enabled
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:ibx_write_infoframe
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:vlv_infoframe_enabled
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:vlv_write_infoframe
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_toggle_signalling
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read_v_prime_part
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read_ksv_fifo
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read_ksv_ready
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read_ri_prime
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_check_link
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_repeater_present
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read_bstatus
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_read_bksv
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_write
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_hdcp_write_an_aksv
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_get_modes
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_add_properties
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_enable_hdmi_audio
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:vlv_hdmi_post_disable
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:chv_hdmi_post_pll_disable
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:chv_hdmi_post_disable
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:pch_disable_hdmi
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:enc_to_intel_hdmi
Cyclomatic Complexity 27 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_compute_config
Cyclomatic Complexity 4 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_set_avi_infoframe
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:cpt_set_infoframes
Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_hdmi.c:ibx_set_infoframes
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:hsw_set_infoframes
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:g4x_set_infoframes
Cyclomatic Complexity 7 drivers/gpu//drm/i915/intel_hdmi.c:vlv_set_infoframes
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:intel_attached_hdmi
Cyclomatic Complexity 13 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_mode_valid
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_destroy
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_unset_edid
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_dp_dual_mode_detect
Cyclomatic Complexity 6 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_set_edid
Cyclomatic Complexity 2 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_force
Cyclomatic Complexity 5 drivers/gpu//drm/i915/intel_hdmi.c:intel_hdmi_detect
Cyclomatic Complexity 3 drivers/gpu//drm/i915/intel_hdmi.c:g4x_enable_hdmi
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:vlv_hdmi_pre_enable
Cyclomatic Complexity 1 drivers/gpu//drm/i915/intel_hdmi.c:chv_hdmi_pre_enable
vim +/dev_priv +2144 drivers/gpu//drm/i915/intel_hdmi.c
55b7d6e8c Chris Wilson 2010-09-19 2118
159536378 Shashank Sharma 2017-03-13 2119 /*
159536378 Shashank Sharma 2017-03-13 2120 * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup
159536378 Shashank Sharma 2017-03-13 2121 * @encoder: intel_encoder
159536378 Shashank Sharma 2017-03-13 2122 * @connector: drm_connector
98706eef6 Ville Syrjälä 2018-10-12 2123 * @adapter: i2c adapter for the ddc bus
159536378 Shashank Sharma 2017-03-13 2124 * @high_tmds_clock_ratio = bool to indicate if the function needs to set
159536378 Shashank Sharma 2017-03-13 2125 * or reset the high tmds clock ratio for scrambling
159536378 Shashank Sharma 2017-03-13 2126 * @scrambling: bool to Indicate if the function needs to set or reset
159536378 Shashank Sharma 2017-03-13 2127 * sink scrambling
159536378 Shashank Sharma 2017-03-13 2128 *
159536378 Shashank Sharma 2017-03-13 2129 * This function handles scrambling on HDMI 2.0 capable sinks.
159536378 Shashank Sharma 2017-03-13 2130 * If required clock rate is > 340 Mhz && scrambling is supported by sink
159536378 Shashank Sharma 2017-03-13 2131 * it enables scrambling. This should be called before enabling the HDMI
159536378 Shashank Sharma 2017-03-13 2132 * 2.0 port, as the sink can choose to disable the scrambling if it doesn't
159536378 Shashank Sharma 2017-03-13 2133 * detect a scrambled clock within 100 ms.
277ab5abc Ville Syrjälä 2018-03-22 2134 *
277ab5abc Ville Syrjälä 2018-03-22 2135 * Returns:
277ab5abc Ville Syrjälä 2018-03-22 2136 * True on success, false on failure.
159536378 Shashank Sharma 2017-03-13 2137 */
277ab5abc Ville Syrjälä 2018-03-22 2138 bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
159536378 Shashank Sharma 2017-03-13 2139 struct drm_connector *connector,
98706eef6 Ville Syrjälä 2018-10-12 2140 struct i2c_adapter *adapter,
159536378 Shashank Sharma 2017-03-13 2141 bool high_tmds_clock_ratio,
159536378 Shashank Sharma 2017-03-13 2142 bool scrambling)
159536378 Shashank Sharma 2017-03-13 2143 {
277ab5abc Ville Syrjälä 2018-03-22 @2144 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
159536378 Shashank Sharma 2017-03-13 2145 struct drm_scrambling *sink_scrambling =
159536378 Shashank Sharma 2017-03-13 2146 &connector->display_info.hdmi.scdc.scrambling;
159536378 Shashank Sharma 2017-03-13 2147
159536378 Shashank Sharma 2017-03-13 2148 if (!sink_scrambling->supported)
277ab5abc Ville Syrjälä 2018-03-22 2149 return true;
159536378 Shashank Sharma 2017-03-13 2150
277ab5abc Ville Syrjälä 2018-03-22 2151 DRM_DEBUG_KMS("[CONNECTOR:%d:%s] scrambling=%s, TMDS bit clock ratio=1/%d\n",
277ab5abc Ville Syrjälä 2018-03-22 2152 connector->base.id, connector->name,
277ab5abc Ville Syrjälä 2018-03-22 2153 yesno(scrambling), high_tmds_clock_ratio ? 40 : 10);
159536378 Shashank Sharma 2017-03-13 2154
277ab5abc Ville Syrjälä 2018-03-22 2155 /* Set TMDS bit clock ratio to 1/40 or 1/10, and enable/disable scrambling */
277ab5abc Ville Syrjälä 2018-03-22 2156 return drm_scdc_set_high_tmds_clock_ratio(adapter,
277ab5abc Ville Syrjälä 2018-03-22 2157 high_tmds_clock_ratio) &&
277ab5abc Ville Syrjälä 2018-03-22 2158 drm_scdc_set_scrambling(adapter, scrambling);
159536378 Shashank Sharma 2017-03-13 2159 }
159536378 Shashank Sharma 2017-03-13 2160
:::::: The code at line 2144 was first introduced by commit
:::::: 277ab5abc68df2f6f8fac7a46e50105b6648f432 drm/i915: Don't spew errors when resetting HDMI scrambling/bit clock ratio fails
:::::: TO: Ville Syrjälä <ville.syrjala@linux.intel.com>
:::::: CC: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Regards Shashank On 10/13/2018 12:47 AM, Ville Syrjälä wrote: > On Sat, Oct 13, 2018 at 12:26:57AM +0530, Sharma, Shashank wrote: >> Regards >> >> Shashank >> >> >> On 10/13/2018 12:08 AM, Ville Syrjala wrote: >>> From: Ville Syrjälä <ville.syrjala@linux.intel.com> >>> >>> The Parade LSPCON on KBL NUCs forgets to turn off scrambling/bit clock >>> rate when switching from a mode that needs them to a mode that does >>> not. This manifests as a "no signal" on my TV when I try to go from >>> 4k to 1080p for example. Resetting the SCDC register bits with >>> i2cset is sufficient to restore the picture to the screen. >>> >>> Here's the OUI/fw revision for the LSPCON chip in question: >>> DP branch: OUI 00-1c-f8 dev-ID 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0000 >>> >>> Asking users to poke at SCDC with i2cset is a bit much, so >>> let's work around this in the driver. We don't need to go all >>> out here and compute whether scrambling is needed or not as >>> LSPCON will do that itself. If scrambling is actually >>> required LSPCON does not forget to enable it. >>> >>> Cc: Shashank Sharma <shashank.sharma@intel.com> >>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> >>> --- >>> drivers/gpu/drm/i915/intel_ddi.c | 52 ++++++++++++++++++++++++++++--- >>> drivers/gpu/drm/i915/intel_drv.h | 1 + >>> drivers/gpu/drm/i915/intel_hdmi.c | 5 ++- >>> 3 files changed, 51 insertions(+), 7 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c >>> index 47960c92cbbf..ef502fc9add1 100644 >>> --- a/drivers/gpu/drm/i915/intel_ddi.c >>> +++ b/drivers/gpu/drm/i915/intel_ddi.c >>> @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, >>> intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); >>> } >>> >>> +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, >>> + const struct intel_crtc_state *crtc_state, >>> + const struct drm_connector_state *conn_state) >>> +{ >>> + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); >>> + >>> + intel_ddi_pre_enable(encoder, crtc_state, conn_state); >>> + >>> + /* >>> + * Parade LSPCON forgets to turn off scrambling/bit clock rate >>> + * when switching from a mode that needs them to a mode that >>> + * does not. >>> + */ >>> + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, >>> + &intel_dp->aux.ddc, false, false); >>> +} >>> + >>> static void intel_disable_ddi_buf(struct intel_encoder *encoder) >>> { >>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); >>> @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, >>> old_crtc_state, old_conn_state); >>> } >>> >>> +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, >>> + const struct intel_crtc_state *old_crtc_state, >>> + const struct drm_connector_state *old_conn_state) >>> +{ >>> + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); >>> + >>> + /* >>> + * Parade LSPCON forgets to turn off scrambling/bit clock rate >>> + * when switching from a mode that needs them to a mode that >>> + * does not. >>> + */ >>> + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, >>> + &intel_dp->aux.ddc, false, false); >>> + >>> + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); >>> +} >> Few thoughts: >> - Would it make more sense to move these 2 functions to intel_lspcon.c ? > Would require more non-statics. But I guess it might be nice to attempt > isolating it as much as possible. > >> - And then add a lspcon->vendor == VENDOR_PARADE check, so that we will >> run the code only when needed. > Maybe. The ->vendor thing isn't in yet, and we'd have to backport it > as well. Is it big? The LSPCON patches are merged now, we can directly use the vendor check now. > Also at this time I have no idea whether Megachips LSPCON is similarly > bugged. Would need to find one and test it. That would be best, we will have to do that anyways for compliance issues sooner or later :-) >> - Also, we should check if scrambling is enabled, there might be a case >> where we are driving a HDMI 2.0 display (scrambling->supported = 1) but >> current mode is 1080 P. > As explained in the commit message this is not needed. And currently we > have no idea whether LSPCON will enable scrambling or not. Adding code > to determine that would mean second guessing what LSPCON will do. I > don't see any benefit in doing that. Humm, I guess this can be determined with few checks, and HDMI spec mendates: - clock above 340Mhz ? LSPCON must enable scrambling - clock below 340Mhz && monitor supports scrambling below 340Mhz ? LSPCON should enable scrambling : LSPCON mustn't enable scrambling. This will make sure that we are doing what's recommended by spec. - Shashank >> - Shashank >>> + >>> void intel_ddi_fdi_post_disable(struct intel_encoder *encoder, >>> const struct intel_crtc_state *old_crtc_state, >>> const struct drm_connector_state *old_conn_state) >>> @@ -3146,9 +3180,11 @@ static void intel_enable_ddi_hdmi(struct intel_encoder *encoder, >>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); >>> struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); >>> struct drm_connector *connector = conn_state->connector; >>> + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, >>> + dig_port->hdmi.ddc_bus); >>> enum port port = encoder->port; >>> >>> - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, >>> + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, >>> crtc_state->hdmi_high_tmds_clock_ratio, >>> crtc_state->hdmi_scrambling)) >>> DRM_ERROR("[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n", >>> @@ -3243,13 +3279,17 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, >>> const struct intel_crtc_state *old_crtc_state, >>> const struct drm_connector_state *old_conn_state) >>> { >>> + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); >>> struct drm_connector *connector = old_conn_state->connector; >>> + struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); >>> + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, >>> + dig_port->hdmi.ddc_bus); >>> >>> if (old_crtc_state->has_audio) >>> intel_audio_codec_disable(encoder, >>> old_crtc_state, old_conn_state); >>> >>> - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, >>> + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, >>> false, false)) >>> DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Failed to reset sink scrambling/TMDS bit clock ratio\n", >>> connector->base.id, connector->name); >>> @@ -3862,17 +3902,21 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) >>> } >>> >>> if (init_lspcon) { >>> - if (lspcon_init(intel_dig_port)) >>> + if (lspcon_init(intel_dig_port)) { >>> /* TODO: handle hdmi info frame part */ >>> DRM_DEBUG_KMS("LSPCON init success on port %c\n", >>> port_name(port)); >>> - else >>> + >>> + intel_encoder->pre_enable = intel_ddi_pre_enable_lspcon; >>> + intel_encoder->post_disable = intel_ddi_post_disable_lspcon; >>> + } else { >>> /* >>> * LSPCON init faied, but DP init was success, so >>> * lets try to drive as DP++ port. >>> */ >>> DRM_ERROR("LSPCON init failed on port %c\n", >>> port_name(port)); >>> + } >>> } >>> >>> return; >>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h >>> index e321fc698ae1..d0a06fcc80c0 100644 >>> --- a/drivers/gpu/drm/i915/intel_drv.h >>> +++ b/drivers/gpu/drm/i915/intel_drv.h >>> @@ -1866,6 +1866,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, >>> struct drm_connector_state *conn_state); >>> bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, >>> struct drm_connector *connector, >>> + struct i2c_adapter *adapter, >>> bool high_tmds_clock_ratio, >>> bool scrambling); >>> void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); >>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c >>> index 2c53efc463e6..bf6f571b674b 100644 >>> --- a/drivers/gpu/drm/i915/intel_hdmi.c >>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c >>> @@ -2114,6 +2114,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c >>> * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup >>> * @encoder: intel_encoder >>> * @connector: drm_connector >>> + * @adapter: i2c adapter for the ddc bus >>> * @high_tmds_clock_ratio = bool to indicate if the function needs to set >>> * or reset the high tmds clock ratio for scrambling >>> * @scrambling: bool to Indicate if the function needs to set or reset >>> @@ -2130,15 +2131,13 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c >>> */ >>> bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, >>> struct drm_connector *connector, >>> + struct i2c_adapter *adapter, >>> bool high_tmds_clock_ratio, >>> bool scrambling) >>> { >>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); >>> - struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); >>> struct drm_scrambling *sink_scrambling = >>> &connector->display_info.hdmi.scdc.scrambling; >>> - struct i2c_adapter *adapter = >>> - intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); >>> >>> if (!sink_scrambling->supported) >>> return true;
Regards Shashank On 10/13/2018 12:58 AM, Ville Syrjälä wrote: > On Fri, Oct 12, 2018 at 10:17:57PM +0300, Ville Syrjälä wrote: >> On Sat, Oct 13, 2018 at 12:26:57AM +0530, Sharma, Shashank wrote: >>> Regards >>> >>> Shashank >>> >>> >>> On 10/13/2018 12:08 AM, Ville Syrjala wrote: >>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com> >>>> >>>> The Parade LSPCON on KBL NUCs forgets to turn off scrambling/bit clock >>>> rate when switching from a mode that needs them to a mode that does >>>> not. This manifests as a "no signal" on my TV when I try to go from >>>> 4k to 1080p for example. Resetting the SCDC register bits with >>>> i2cset is sufficient to restore the picture to the screen. >>>> >>>> Here's the OUI/fw revision for the LSPCON chip in question: >>>> DP branch: OUI 00-1c-f8 dev-ID 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0000 >>>> >>>> Asking users to poke at SCDC with i2cset is a bit much, so >>>> let's work around this in the driver. We don't need to go all >>>> out here and compute whether scrambling is needed or not as >>>> LSPCON will do that itself. If scrambling is actually >>>> required LSPCON does not forget to enable it. >>>> >>>> Cc: Shashank Sharma <shashank.sharma@intel.com> >>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> >>>> --- >>>> drivers/gpu/drm/i915/intel_ddi.c | 52 ++++++++++++++++++++++++++++--- >>>> drivers/gpu/drm/i915/intel_drv.h | 1 + >>>> drivers/gpu/drm/i915/intel_hdmi.c | 5 ++- >>>> 3 files changed, 51 insertions(+), 7 deletions(-) >>>> >>>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c >>>> index 47960c92cbbf..ef502fc9add1 100644 >>>> --- a/drivers/gpu/drm/i915/intel_ddi.c >>>> +++ b/drivers/gpu/drm/i915/intel_ddi.c >>>> @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, >>>> intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); >>>> } >>>> >>>> +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, >>>> + const struct intel_crtc_state *crtc_state, >>>> + const struct drm_connector_state *conn_state) >>>> +{ >>>> + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); >>>> + >>>> + intel_ddi_pre_enable(encoder, crtc_state, conn_state); >>>> + >>>> + /* >>>> + * Parade LSPCON forgets to turn off scrambling/bit clock rate >>>> + * when switching from a mode that needs them to a mode that >>>> + * does not. >>>> + */ >>>> + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, >>>> + &intel_dp->aux.ddc, false, false); >>>> +} >>>> + >>>> static void intel_disable_ddi_buf(struct intel_encoder *encoder) >>>> { >>>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); >>>> @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, >>>> old_crtc_state, old_conn_state); >>>> } >>>> >>>> +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, >>>> + const struct intel_crtc_state *old_crtc_state, >>>> + const struct drm_connector_state *old_conn_state) >>>> +{ >>>> + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); >>>> + >>>> + /* >>>> + * Parade LSPCON forgets to turn off scrambling/bit clock rate >>>> + * when switching from a mode that needs them to a mode that >>>> + * does not. >>>> + */ >>>> + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, >>>> + &intel_dp->aux.ddc, false, false); >>>> + >>>> + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); >>>> +} >>> Few thoughts: >>> - Would it make more sense to move these 2 functions to intel_lspcon.c ? >> Would require more non-statics. But I guess it might be nice to attempt >> isolating it as much as possible. >> >>> - And then add a lspcon->vendor == VENDOR_PARADE check, so that we will >>> run the code only when needed. >> Maybe. The ->vendor thing isn't in yet, and we'd have to backport it >> as well. Is it big? >> >> Also at this time I have no idea whether Megachips LSPCON is similarly >> bugged. Would need to find one and test it. > Oh, and another open question is what happens if one of these chips is > in a DP->HDMI 2.0 dongle. In that case we might end up needing the same > workaround in the normal DP codepath as well :( > You are right, that would be a LSPCON in a dongle configuration (this one is motherboard down configuration), which we are not officially supporting yet. That might come with its own complexity. I think we already have a BZ for such a Parade dongle adapter. - Shashank
On Tue, Oct 16, 2018 at 08:22:26AM +0530, Sharma, Shashank wrote: > Regards > > Shashank > > > On 10/13/2018 12:47 AM, Ville Syrjälä wrote: > > On Sat, Oct 13, 2018 at 12:26:57AM +0530, Sharma, Shashank wrote: > >> Regards > >> > >> Shashank > >> > >> > >> On 10/13/2018 12:08 AM, Ville Syrjala wrote: > >>> From: Ville Syrjälä <ville.syrjala@linux.intel.com> > >>> > >>> The Parade LSPCON on KBL NUCs forgets to turn off scrambling/bit clock > >>> rate when switching from a mode that needs them to a mode that does > >>> not. This manifests as a "no signal" on my TV when I try to go from > >>> 4k to 1080p for example. Resetting the SCDC register bits with > >>> i2cset is sufficient to restore the picture to the screen. > >>> > >>> Here's the OUI/fw revision for the LSPCON chip in question: > >>> DP branch: OUI 00-1c-f8 dev-ID 175IB0 HW-rev 1.0 SW-rev 7.32 quirks 0x0000 > >>> > >>> Asking users to poke at SCDC with i2cset is a bit much, so > >>> let's work around this in the driver. We don't need to go all > >>> out here and compute whether scrambling is needed or not as > >>> LSPCON will do that itself. If scrambling is actually > >>> required LSPCON does not forget to enable it. > >>> > >>> Cc: Shashank Sharma <shashank.sharma@intel.com> > >>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > >>> --- > >>> drivers/gpu/drm/i915/intel_ddi.c | 52 ++++++++++++++++++++++++++++--- > >>> drivers/gpu/drm/i915/intel_drv.h | 1 + > >>> drivers/gpu/drm/i915/intel_hdmi.c | 5 ++- > >>> 3 files changed, 51 insertions(+), 7 deletions(-) > >>> > >>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > >>> index 47960c92cbbf..ef502fc9add1 100644 > >>> --- a/drivers/gpu/drm/i915/intel_ddi.c > >>> +++ b/drivers/gpu/drm/i915/intel_ddi.c > >>> @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, > >>> intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); > >>> } > >>> > >>> +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, > >>> + const struct intel_crtc_state *crtc_state, > >>> + const struct drm_connector_state *conn_state) > >>> +{ > >>> + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > >>> + > >>> + intel_ddi_pre_enable(encoder, crtc_state, conn_state); > >>> + > >>> + /* > >>> + * Parade LSPCON forgets to turn off scrambling/bit clock rate > >>> + * when switching from a mode that needs them to a mode that > >>> + * does not. > >>> + */ > >>> + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, > >>> + &intel_dp->aux.ddc, false, false); > >>> +} > >>> + > >>> static void intel_disable_ddi_buf(struct intel_encoder *encoder) > >>> { > >>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > >>> @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, > >>> old_crtc_state, old_conn_state); > >>> } > >>> > >>> +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, > >>> + const struct intel_crtc_state *old_crtc_state, > >>> + const struct drm_connector_state *old_conn_state) > >>> +{ > >>> + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); > >>> + > >>> + /* > >>> + * Parade LSPCON forgets to turn off scrambling/bit clock rate > >>> + * when switching from a mode that needs them to a mode that > >>> + * does not. > >>> + */ > >>> + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, > >>> + &intel_dp->aux.ddc, false, false); > >>> + > >>> + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); > >>> +} > >> Few thoughts: > >> - Would it make more sense to move these 2 functions to intel_lspcon.c ? > > Would require more non-statics. But I guess it might be nice to attempt > > isolating it as much as possible. > > > >> - And then add a lspcon->vendor == VENDOR_PARADE check, so that we will > >> run the code only when needed. > > Maybe. The ->vendor thing isn't in yet, and we'd have to backport it > > as well. Is it big? > The LSPCON patches are merged now, we can directly use the vendor check > now. > > Also at this time I have no idea whether Megachips LSPCON is similarly > > bugged. Would need to find one and test it. > That would be best, we will have to do that anyways for compliance > issues sooner or later :-) > >> - Also, we should check if scrambling is enabled, there might be a case > >> where we are driving a HDMI 2.0 display (scrambling->supported = 1) but > >> current mode is 1080 P. > > As explained in the commit message this is not needed. And currently we > > have no idea whether LSPCON will enable scrambling or not. Adding code > > to determine that would mean second guessing what LSPCON will do. I > > don't see any benefit in doing that. > Humm, I guess this can be determined with few checks, and HDMI spec > mendates: > - clock above 340Mhz ? LSPCON must enable scrambling > - clock below 340Mhz && monitor supports scrambling below 340Mhz ? > LSPCON should enable scrambling : LSPCON mustn't enable scrambling. Which means we have to guess as to which clock LSPCON will choose. Ie. just another guess that we can get wrong at which point the bug will be back. This patch has no such achilles heel. > > This will make sure that we are doing what's recommended by spec. > > - Shashank > >> - Shashank > >>> + > >>> void intel_ddi_fdi_post_disable(struct intel_encoder *encoder, > >>> const struct intel_crtc_state *old_crtc_state, > >>> const struct drm_connector_state *old_conn_state) > >>> @@ -3146,9 +3180,11 @@ static void intel_enable_ddi_hdmi(struct intel_encoder *encoder, > >>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > >>> struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); > >>> struct drm_connector *connector = conn_state->connector; > >>> + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, > >>> + dig_port->hdmi.ddc_bus); > >>> enum port port = encoder->port; > >>> > >>> - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, > >>> + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, > >>> crtc_state->hdmi_high_tmds_clock_ratio, > >>> crtc_state->hdmi_scrambling)) > >>> DRM_ERROR("[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n", > >>> @@ -3243,13 +3279,17 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, > >>> const struct intel_crtc_state *old_crtc_state, > >>> const struct drm_connector_state *old_conn_state) > >>> { > >>> + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > >>> struct drm_connector *connector = old_conn_state->connector; > >>> + struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); > >>> + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, > >>> + dig_port->hdmi.ddc_bus); > >>> > >>> if (old_crtc_state->has_audio) > >>> intel_audio_codec_disable(encoder, > >>> old_crtc_state, old_conn_state); > >>> > >>> - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, > >>> + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, > >>> false, false)) > >>> DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Failed to reset sink scrambling/TMDS bit clock ratio\n", > >>> connector->base.id, connector->name); > >>> @@ -3862,17 +3902,21 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) > >>> } > >>> > >>> if (init_lspcon) { > >>> - if (lspcon_init(intel_dig_port)) > >>> + if (lspcon_init(intel_dig_port)) { > >>> /* TODO: handle hdmi info frame part */ > >>> DRM_DEBUG_KMS("LSPCON init success on port %c\n", > >>> port_name(port)); > >>> - else > >>> + > >>> + intel_encoder->pre_enable = intel_ddi_pre_enable_lspcon; > >>> + intel_encoder->post_disable = intel_ddi_post_disable_lspcon; > >>> + } else { > >>> /* > >>> * LSPCON init faied, but DP init was success, so > >>> * lets try to drive as DP++ port. > >>> */ > >>> DRM_ERROR("LSPCON init failed on port %c\n", > >>> port_name(port)); > >>> + } > >>> } > >>> > >>> return; > >>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > >>> index e321fc698ae1..d0a06fcc80c0 100644 > >>> --- a/drivers/gpu/drm/i915/intel_drv.h > >>> +++ b/drivers/gpu/drm/i915/intel_drv.h > >>> @@ -1866,6 +1866,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, > >>> struct drm_connector_state *conn_state); > >>> bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, > >>> struct drm_connector *connector, > >>> + struct i2c_adapter *adapter, > >>> bool high_tmds_clock_ratio, > >>> bool scrambling); > >>> void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); > >>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > >>> index 2c53efc463e6..bf6f571b674b 100644 > >>> --- a/drivers/gpu/drm/i915/intel_hdmi.c > >>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c > >>> @@ -2114,6 +2114,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c > >>> * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup > >>> * @encoder: intel_encoder > >>> * @connector: drm_connector > >>> + * @adapter: i2c adapter for the ddc bus > >>> * @high_tmds_clock_ratio = bool to indicate if the function needs to set > >>> * or reset the high tmds clock ratio for scrambling > >>> * @scrambling: bool to Indicate if the function needs to set or reset > >>> @@ -2130,15 +2131,13 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c > >>> */ > >>> bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, > >>> struct drm_connector *connector, > >>> + struct i2c_adapter *adapter, > >>> bool high_tmds_clock_ratio, > >>> bool scrambling) > >>> { > >>> struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); > >>> - struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); > >>> struct drm_scrambling *sink_scrambling = > >>> &connector->display_info.hdmi.scdc.scrambling; > >>> - struct i2c_adapter *adapter = > >>> - intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); > >>> > >>> if (!sink_scrambling->supported) > >>> return true;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 47960c92cbbf..ef502fc9add1 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -2984,6 +2984,23 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder, intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state); } +static void intel_ddi_pre_enable_lspcon(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) +{ + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); + + intel_ddi_pre_enable(encoder, crtc_state, conn_state); + + /* + * Parade LSPCON forgets to turn off scrambling/bit clock rate + * when switching from a mode that needs them to a mode that + * does not. + */ + intel_hdmi_handle_sink_scrambling(encoder, conn_state->connector, + &intel_dp->aux.ddc, false, false); +} + static void intel_disable_ddi_buf(struct intel_encoder *encoder) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); @@ -3086,6 +3103,23 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder, old_crtc_state, old_conn_state); } +static void intel_ddi_post_disable_lspcon(struct intel_encoder *encoder, + const struct intel_crtc_state *old_crtc_state, + const struct drm_connector_state *old_conn_state) +{ + struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base); + + /* + * Parade LSPCON forgets to turn off scrambling/bit clock rate + * when switching from a mode that needs them to a mode that + * does not. + */ + intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector, + &intel_dp->aux.ddc, false, false); + + intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state); +} + void intel_ddi_fdi_post_disable(struct intel_encoder *encoder, const struct intel_crtc_state *old_crtc_state, const struct drm_connector_state *old_conn_state) @@ -3146,9 +3180,11 @@ static void intel_enable_ddi_hdmi(struct intel_encoder *encoder, struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); struct drm_connector *connector = conn_state->connector; + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, + dig_port->hdmi.ddc_bus); enum port port = encoder->port; - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, crtc_state->hdmi_high_tmds_clock_ratio, crtc_state->hdmi_scrambling)) DRM_ERROR("[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n", @@ -3243,13 +3279,17 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, const struct intel_crtc_state *old_crtc_state, const struct drm_connector_state *old_conn_state) { + struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct drm_connector *connector = old_conn_state->connector; + struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base); + struct i2c_adapter *adapter = intel_gmbus_get_adapter(dev_priv, + dig_port->hdmi.ddc_bus); if (old_crtc_state->has_audio) intel_audio_codec_disable(encoder, old_crtc_state, old_conn_state); - if (!intel_hdmi_handle_sink_scrambling(encoder, connector, + if (!intel_hdmi_handle_sink_scrambling(encoder, connector, adapter, false, false)) DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Failed to reset sink scrambling/TMDS bit clock ratio\n", connector->base.id, connector->name); @@ -3862,17 +3902,21 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) } if (init_lspcon) { - if (lspcon_init(intel_dig_port)) + if (lspcon_init(intel_dig_port)) { /* TODO: handle hdmi info frame part */ DRM_DEBUG_KMS("LSPCON init success on port %c\n", port_name(port)); - else + + intel_encoder->pre_enable = intel_ddi_pre_enable_lspcon; + intel_encoder->post_disable = intel_ddi_post_disable_lspcon; + } else { /* * LSPCON init faied, but DP init was success, so * lets try to drive as DP++ port. */ DRM_ERROR("LSPCON init failed on port %c\n", port_name(port)); + } } return; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index e321fc698ae1..d0a06fcc80c0 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1866,6 +1866,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, struct drm_connector_state *conn_state); bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, struct drm_connector *connector, + struct i2c_adapter *adapter, bool high_tmds_clock_ratio, bool scrambling); void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 2c53efc463e6..bf6f571b674b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -2114,6 +2114,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup * @encoder: intel_encoder * @connector: drm_connector + * @adapter: i2c adapter for the ddc bus * @high_tmds_clock_ratio = bool to indicate if the function needs to set * or reset the high tmds clock ratio for scrambling * @scrambling: bool to Indicate if the function needs to set or reset @@ -2130,15 +2131,13 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c */ bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder, struct drm_connector *connector, + struct i2c_adapter *adapter, bool high_tmds_clock_ratio, bool scrambling) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); - struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); struct drm_scrambling *sink_scrambling = &connector->display_info.hdmi.scdc.scrambling; - struct i2c_adapter *adapter = - intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus); if (!sink_scrambling->supported) return true;