Commit 1c3eced3 authored by Jani Nikula's avatar Jani Nikula

drm/i915/audio: constify ELD pointers

The hooks aren't supposed to modify the ELD, so use const pointer. As a
drive-by fix, use drm_eld_size() to log ELD size.
Suggested-by: default avatarVille Syrjala <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180619124437.10982-1-jani.nikula@intel.com
parent ad193bc6
...@@ -213,7 +213,7 @@ static bool intel_eld_uptodate(struct drm_connector *connector, ...@@ -213,7 +213,7 @@ static bool intel_eld_uptodate(struct drm_connector *connector,
i915_reg_t reg_edid) i915_reg_t reg_edid)
{ {
struct drm_i915_private *dev_priv = to_i915(connector->dev); struct drm_i915_private *dev_priv = to_i915(connector->dev);
u8 *eld = connector->eld; const u8 *eld = connector->eld;
u32 tmp; u32 tmp;
int i; int i;
...@@ -228,7 +228,7 @@ static bool intel_eld_uptodate(struct drm_connector *connector, ...@@ -228,7 +228,7 @@ static bool intel_eld_uptodate(struct drm_connector *connector,
I915_WRITE(reg_elda, tmp); I915_WRITE(reg_elda, tmp);
for (i = 0; i < drm_eld_size(eld) / 4; i++) for (i = 0; i < drm_eld_size(eld) / 4; i++)
if (I915_READ(reg_edid) != *((u32 *)eld + i)) if (I915_READ(reg_edid) != *((const u32 *)eld + i))
return false; return false;
return true; return true;
...@@ -261,12 +261,12 @@ static void g4x_audio_codec_enable(struct intel_encoder *encoder, ...@@ -261,12 +261,12 @@ static void g4x_audio_codec_enable(struct intel_encoder *encoder,
{ {
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct drm_connector *connector = conn_state->connector; struct drm_connector *connector = conn_state->connector;
u8 *eld = connector->eld; const u8 *eld = connector->eld;
u32 eldv; u32 eldv;
u32 tmp; u32 tmp;
int len, i; int len, i;
DRM_DEBUG_KMS("Enable audio codec, %u bytes ELD\n", eld[2]); DRM_DEBUG_KMS("Enable audio codec, %u bytes ELD\n", drm_eld_size(eld));
tmp = I915_READ(G4X_AUD_VID_DID); tmp = I915_READ(G4X_AUD_VID_DID);
if (tmp == INTEL_AUDIO_DEVBLC || tmp == INTEL_AUDIO_DEVCL) if (tmp == INTEL_AUDIO_DEVBLC || tmp == INTEL_AUDIO_DEVCL)
...@@ -288,7 +288,7 @@ static void g4x_audio_codec_enable(struct intel_encoder *encoder, ...@@ -288,7 +288,7 @@ static void g4x_audio_codec_enable(struct intel_encoder *encoder,
len = min(drm_eld_size(eld) / 4, len); len = min(drm_eld_size(eld) / 4, len);
DRM_DEBUG_DRIVER("ELD size %d\n", len); DRM_DEBUG_DRIVER("ELD size %d\n", len);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
I915_WRITE(G4X_HDMIW_HDMIEDID, *((u32 *)eld + i)); I915_WRITE(G4X_HDMIW_HDMIEDID, *((const u32 *)eld + i));
tmp = I915_READ(G4X_AUD_CNTL_ST); tmp = I915_READ(G4X_AUD_CNTL_ST);
tmp |= eldv; tmp |= eldv;
...@@ -466,7 +466,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder, ...@@ -466,7 +466,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder,
/* Up to 84 bytes of hw ELD buffer */ /* Up to 84 bytes of hw ELD buffer */
len = min(drm_eld_size(eld), 84); len = min(drm_eld_size(eld), 84);
for (i = 0; i < len / 4; i++) for (i = 0; i < len / 4; i++)
I915_WRITE(HSW_AUD_EDID_DATA(pipe), *((u32 *)eld + i)); I915_WRITE(HSW_AUD_EDID_DATA(pipe), *((const u32 *)eld + i));
/* ELD valid */ /* ELD valid */
tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
...@@ -534,7 +534,7 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder, ...@@ -534,7 +534,7 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder,
struct drm_connector *connector = conn_state->connector; struct drm_connector *connector = conn_state->connector;
enum pipe pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
enum port port = encoder->port; enum port port = encoder->port;
u8 *eld = connector->eld; const u8 *eld = connector->eld;
u32 tmp, eldv; u32 tmp, eldv;
int len, i; int len, i;
i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2; i915_reg_t hdmiw_hdmiedid, aud_config, aud_cntl_st, aud_cntrl_st2;
...@@ -585,7 +585,7 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder, ...@@ -585,7 +585,7 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder,
/* Up to 84 bytes of hw ELD buffer */ /* Up to 84 bytes of hw ELD buffer */
len = min(drm_eld_size(eld), 84); len = min(drm_eld_size(eld), 84);
for (i = 0; i < len / 4; i++) for (i = 0; i < len / 4; i++)
I915_WRITE(hdmiw_hdmiedid, *((u32 *)eld + i)); I915_WRITE(hdmiw_hdmiedid, *((const u32 *)eld + i));
/* ELD valid */ /* ELD valid */
tmp = I915_READ(aud_cntrl_st2); tmp = I915_READ(aud_cntrl_st2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment