diff mbox series

[11/22] drm/i915/audio: Use u32* for ELD

Message ID 20221011170011.17198-12-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: ELD precompute and readout | expand

Commit Message

Ville Syrjälä Oct. 11, 2022, 5 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make the eld pointer u32* so we don't have to do super
ugly casting in the code itself.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_audio.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

Comments

Jani Nikula Oct. 12, 2022, 2:42 p.m. UTC | #1
On Tue, 11 Oct 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make the eld pointer u32* so we don't have to do super
> ugly casting in the code itself.
>
> Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
> Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index d2f9c4c29061..9f64f52f895f 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -332,7 +332,7 @@ static void g4x_audio_codec_enable(struct intel_encoder *encoder,
>  {
>  	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
>  	struct drm_connector *connector = conn_state->connector;
> -	const u8 *eld = connector->eld;
> +	const u32 *eld = (const u32 *)connector->eld;
>  	int eld_buffer_size, len, i;
>  	u32 tmp;
>  
> @@ -341,11 +341,10 @@ static void g4x_audio_codec_enable(struct intel_encoder *encoder,
>  	intel_de_write(i915, G4X_AUD_CNTL_ST, tmp);
>  
>  	eld_buffer_size = g4x_eld_buffer_size(i915);
> -	len = min(drm_eld_size(eld) / 4, eld_buffer_size);
> +	len = min(drm_eld_size(connector->eld) / 4, eld_buffer_size);
>  
>  	for (i = 0; i < len; i++)
> -		intel_de_write(i915, G4X_HDMIW_HDMIEDID,
> -			       *((const u32 *)eld + i));
> +		intel_de_write(i915, G4X_HDMIW_HDMIEDID, eld[i]);
>  	for (; i < eld_buffer_size; i++)
>  		intel_de_write(i915, G4X_HDMIW_HDMIEDID, 0);
>  
> @@ -612,7 +611,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder,
>  	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
>  	struct drm_connector *connector = conn_state->connector;
>  	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
> -	const u8 *eld = connector->eld;
> +	const u32 *eld = (const u32 *)connector->eld;
>  	int eld_buffer_size, len, i;
>  	u32 tmp;
>  
> @@ -641,11 +640,10 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder,
>  	intel_de_write(i915, HSW_AUD_DIP_ELD_CTRL(cpu_transcoder), tmp);
>  
>  	eld_buffer_size = hsw_eld_buffer_size(i915, cpu_transcoder);
> -	len = min(drm_eld_size(eld) / 4, eld_buffer_size);
> +	len = min(drm_eld_size(connector->eld) / 4, eld_buffer_size);
>  
>  	for (i = 0; i < len; i++)
> -		intel_de_write(i915, HSW_AUD_EDID_DATA(cpu_transcoder),
> -			       *((const u32 *)eld + i));
> +		intel_de_write(i915, HSW_AUD_EDID_DATA(cpu_transcoder), eld[i]);
>  	for (; i < eld_buffer_size; i++)
>  		intel_de_write(i915, HSW_AUD_EDID_DATA(cpu_transcoder), 0);
>  
> @@ -746,9 +744,9 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder,
>  	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
>  	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
>  	struct drm_connector *connector = conn_state->connector;
> +	const u32 *eld = (const u32 *)connector->eld;
>  	enum pipe pipe = crtc->pipe;
>  	enum port port = encoder->port;
> -	const u8 *eld = connector->eld;
>  	int eld_buffer_size, len, i;
>  	struct ilk_audio_regs regs;
>  	u32 tmp;
> @@ -778,11 +776,10 @@ static void ilk_audio_codec_enable(struct intel_encoder *encoder,
>  	intel_de_write(i915, regs.aud_cntl_st, tmp);
>  
>  	eld_buffer_size = ilk_eld_buffer_size(i915, pipe);
> -	len = min(drm_eld_size(eld) / 4, eld_buffer_size);
> +	len = min(drm_eld_size(connector->eld) / 4, eld_buffer_size);
>  
>  	for (i = 0; i < len; i++)
> -		intel_de_write(i915, regs.hdmiw_hdmiedid,
> -			       *((const u32 *)eld + i));
> +		intel_de_write(i915, regs.hdmiw_hdmiedid, eld[i]);
>  	for (; i < eld_buffer_size; i++)
>  		intel_de_write(i915, regs.hdmiw_hdmiedid, 0);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
index d2f9c4c29061..9f64f52f895f 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -332,7 +332,7 @@  static void g4x_audio_codec_enable(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct drm_connector *connector = conn_state->connector;
-	const u8 *eld = connector->eld;
+	const u32 *eld = (const u32 *)connector->eld;
 	int eld_buffer_size, len, i;
 	u32 tmp;
 
@@ -341,11 +341,10 @@  static void g4x_audio_codec_enable(struct intel_encoder *encoder,
 	intel_de_write(i915, G4X_AUD_CNTL_ST, tmp);
 
 	eld_buffer_size = g4x_eld_buffer_size(i915);
-	len = min(drm_eld_size(eld) / 4, eld_buffer_size);
+	len = min(drm_eld_size(connector->eld) / 4, eld_buffer_size);
 
 	for (i = 0; i < len; i++)
-		intel_de_write(i915, G4X_HDMIW_HDMIEDID,
-			       *((const u32 *)eld + i));
+		intel_de_write(i915, G4X_HDMIW_HDMIEDID, eld[i]);
 	for (; i < eld_buffer_size; i++)
 		intel_de_write(i915, G4X_HDMIW_HDMIEDID, 0);
 
@@ -612,7 +611,7 @@  static void hsw_audio_codec_enable(struct intel_encoder *encoder,
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct drm_connector *connector = conn_state->connector;
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
-	const u8 *eld = connector->eld;
+	const u32 *eld = (const u32 *)connector->eld;
 	int eld_buffer_size, len, i;
 	u32 tmp;
 
@@ -641,11 +640,10 @@  static void hsw_audio_codec_enable(struct intel_encoder *encoder,
 	intel_de_write(i915, HSW_AUD_DIP_ELD_CTRL(cpu_transcoder), tmp);
 
 	eld_buffer_size = hsw_eld_buffer_size(i915, cpu_transcoder);
-	len = min(drm_eld_size(eld) / 4, eld_buffer_size);
+	len = min(drm_eld_size(connector->eld) / 4, eld_buffer_size);
 
 	for (i = 0; i < len; i++)
-		intel_de_write(i915, HSW_AUD_EDID_DATA(cpu_transcoder),
-			       *((const u32 *)eld + i));
+		intel_de_write(i915, HSW_AUD_EDID_DATA(cpu_transcoder), eld[i]);
 	for (; i < eld_buffer_size; i++)
 		intel_de_write(i915, HSW_AUD_EDID_DATA(cpu_transcoder), 0);
 
@@ -746,9 +744,9 @@  static void ilk_audio_codec_enable(struct intel_encoder *encoder,
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 	struct drm_connector *connector = conn_state->connector;
+	const u32 *eld = (const u32 *)connector->eld;
 	enum pipe pipe = crtc->pipe;
 	enum port port = encoder->port;
-	const u8 *eld = connector->eld;
 	int eld_buffer_size, len, i;
 	struct ilk_audio_regs regs;
 	u32 tmp;
@@ -778,11 +776,10 @@  static void ilk_audio_codec_enable(struct intel_encoder *encoder,
 	intel_de_write(i915, regs.aud_cntl_st, tmp);
 
 	eld_buffer_size = ilk_eld_buffer_size(i915, pipe);
-	len = min(drm_eld_size(eld) / 4, eld_buffer_size);
+	len = min(drm_eld_size(connector->eld) / 4, eld_buffer_size);
 
 	for (i = 0; i < len; i++)
-		intel_de_write(i915, regs.hdmiw_hdmiedid,
-			       *((const u32 *)eld + i));
+		intel_de_write(i915, regs.hdmiw_hdmiedid, eld[i]);
 	for (; i < eld_buffer_size; i++)
 		intel_de_write(i915, regs.hdmiw_hdmiedid, 0);