[Intel-gfx] [PATCH 08/11] drm/i915: Clean up the LPE audio platform data

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Tue Apr 25 20:27:27 UTC 2017


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Split the LPE audio platform data into a pipe specific
chunk and device specific chunk. Eventually we'll have
a pipe specific chunk for each pipe, but for now we'll
stick to just one.

We'll also get rid of the intel_hdmi_lpe_audio_eld structure
which doesn't seem to have any real reason to exist.

Cc: Takashi Iwai <tiwai at suse.de>
Cc: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_lpe_audio.c | 29 ++++++++++++++---------------
 include/drm/intel_lpe_audio.h          | 15 ++++++++-------
 sound/x86/intel_hdmi_audio.c           | 19 +++++++++----------
 3 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
index d6aecf1d382b..a593fdf73171 100644
--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
@@ -319,37 +319,36 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
 			    const void *eld, int ls_clock, bool dp_output)
 {
 	unsigned long irq_flags;
-	struct intel_hdmi_lpe_audio_pdata *pdata = NULL;
+	struct intel_hdmi_lpe_audio_pdata *pdata;
+	struct intel_hdmi_lpe_audio_pipe_pdata *ppdata;
 	u32 audio_enable;
 
 	if (!HAS_LPE_AUDIO(dev_priv))
 		return;
 
-	pdata = dev_get_platdata(
-		&(dev_priv->lpe_audio.platdev->dev));
+	pdata = dev_get_platdata(&dev_priv->lpe_audio.platdev->dev);
+	ppdata = &pdata->pipe;
 
 	spin_lock_irqsave(&pdata->lpe_audio_slock, irq_flags);
 
 	audio_enable = I915_READ(VLV_AUD_PORT_EN_DBG(port));
 
+	pdata->pipe_id = pipe;
+
 	if (eld != NULL) {
-		memcpy(pdata->eld.eld_data, eld,
-			HDMI_MAX_ELD_BYTES);
-		pdata->eld.pipe_id = pipe;
-		pdata->port = port;
-		pdata->ls_clock = ls_clock;
-		pdata->dp_output = dp_output;
+		memcpy(ppdata->eld, eld, HDMI_MAX_ELD_BYTES);
+		ppdata->port = port;
+		ppdata->ls_clock = ls_clock;
+		ppdata->dp_output = dp_output;
 
 		/* Unmute the amp for both DP and HDMI */
 		I915_WRITE(VLV_AUD_PORT_EN_DBG(port),
 			   audio_enable & ~VLV_AMP_MUTE);
-
 	} else {
-		memset(pdata->eld.eld_data, 0,
-			HDMI_MAX_ELD_BYTES);
-		pdata->port = -1;
-		pdata->ls_clock = 0;
-		pdata->dp_output = false;
+		memset(ppdata->eld, 0, HDMI_MAX_ELD_BYTES);
+		ppdata->port = -1;
+		ppdata->ls_clock = 0;
+		ppdata->dp_output = false;
 
 		/* Mute the amp for both DP and HDMI */
 		I915_WRITE(VLV_AUD_PORT_EN_DBG(port),
diff --git a/include/drm/intel_lpe_audio.h b/include/drm/intel_lpe_audio.h
index 826d531c3ecc..26e569ad8683 100644
--- a/include/drm/intel_lpe_audio.h
+++ b/include/drm/intel_lpe_audio.h
@@ -31,16 +31,17 @@ struct platform_device;
 
 #define HDMI_MAX_ELD_BYTES	128
 
-struct intel_hdmi_lpe_audio_eld {
-	int pipe_id;
-	unsigned char eld_data[HDMI_MAX_ELD_BYTES];
-};
-
-struct intel_hdmi_lpe_audio_pdata {
+struct intel_hdmi_lpe_audio_pipe_pdata {
+	u8 eld[HDMI_MAX_ELD_BYTES];
 	int port;
 	int ls_clock;
 	bool dp_output;
-	struct intel_hdmi_lpe_audio_eld eld;
+};
+
+struct intel_hdmi_lpe_audio_pdata {
+	struct intel_hdmi_lpe_audio_pipe_pdata pipe;
+	int pipe_id;
+
 	void (*notify_audio_lpe)(struct platform_device *pdev);
 	spinlock_t lpe_audio_slock;
 };
diff --git a/sound/x86/intel_hdmi_audio.c b/sound/x86/intel_hdmi_audio.c
index 71f14a2a7fe4..bfb712444098 100644
--- a/sound/x86/intel_hdmi_audio.c
+++ b/sound/x86/intel_hdmi_audio.c
@@ -1556,21 +1556,20 @@ static void had_audio_wq(struct work_struct *work)
 	struct snd_intelhad *ctx =
 		container_of(work, struct snd_intelhad, hdmi_audio_wq);
 	struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data;
+	struct intel_hdmi_lpe_audio_pipe_pdata *ppdata = &pdata->pipe;
 
 	pm_runtime_get_sync(ctx->dev);
 	mutex_lock(&ctx->mutex);
-	if (pdata->port < 0) {
+	if (ppdata->port < 0) {
 		dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG\n",
 			__func__);
 		memset(ctx->eld, 0, sizeof(ctx->eld)); /* clear the old ELD */
 		had_process_hot_unplug(ctx);
 	} else {
-		struct intel_hdmi_lpe_audio_eld *eld = &pdata->eld;
-
 		dev_dbg(ctx->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n",
-			__func__, pdata->port, pdata->ls_clock);
+			__func__, ppdata->port, ppdata->ls_clock);
 
-		switch (eld->pipe_id) {
+		switch (pdata->pipe_id) {
 		case 0:
 			ctx->had_config_offset = AUDIO_HDMI_CONFIG_A;
 			break;
@@ -1582,18 +1581,18 @@ static void had_audio_wq(struct work_struct *work)
 			break;
 		default:
 			dev_dbg(ctx->dev, "Invalid pipe %d\n",
-				eld->pipe_id);
+				pdata->pipe_id);
 			break;
 		}
 
-		memcpy(ctx->eld, eld->eld_data, sizeof(ctx->eld));
+		memcpy(ctx->eld, ppdata->eld, sizeof(ctx->eld));
 
-		ctx->dp_output = pdata->dp_output;
+		ctx->dp_output = ppdata->dp_output;
 		if (ctx->dp_output) {
 			ctx->tmds_clock_speed = 0;
-			ctx->link_rate = pdata->ls_clock;
+			ctx->link_rate = ppdata->ls_clock;
 		} else {
-			ctx->tmds_clock_speed = pdata->ls_clock;
+			ctx->tmds_clock_speed = ppdata->ls_clock;
 			ctx->link_rate = 0;
 		}
 
-- 
2.10.2



More information about the Intel-gfx mailing list