Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: [PATCH v2 08/11] drm/i915: Clean up the LPE audio platform data
Date: Thu, 27 Apr 2017 19:02:27 +0300	[thread overview]
Message-ID: <20170427160231.13337-9-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20170427160231.13337-1-ville.syrjala@linux.intel.com>

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

Split the LPE audio platform data into a port specific
chunk and device specific chunk. Eventually we'll have
a port specific chunk for each port, 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.

v2: Organize per port instead of per pipe

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

diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
index 4c770d037f23..bdbc235141b5 100644
--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
@@ -111,7 +111,7 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
 	pinfo.size_data = sizeof(*pdata);
 	pinfo.dma_mask = DMA_BIT_MASK(32);
 
-	pdata->pipe = -1;
+	pdata->port.pipe = -1;
 	spin_lock_init(&pdata->lpe_audio_slock);
 
 	platdev = platform_device_register_full(&pinfo);
@@ -320,38 +320,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_port_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->port;
 
 	spin_lock_irqsave(&pdata->lpe_audio_slock, irq_flags);
 
 	audio_enable = I915_READ(VLV_AUD_PORT_EN_DBG(port));
 
-	pdata->eld.port_id = port;
+	ppdata->port = port;
 
 	if (eld != NULL) {
-		memcpy(pdata->eld.eld_data, eld,
-			HDMI_MAX_ELD_BYTES);
-		pdata->pipe = pipe;
-		pdata->ls_clock = ls_clock;
-		pdata->dp_output = dp_output;
+		memcpy(ppdata->eld, eld, HDMI_MAX_ELD_BYTES);
+		ppdata->pipe = pipe;
+		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->pipe = -1;
-		pdata->ls_clock = 0;
-		pdata->dp_output = false;
+		memset(ppdata->eld, 0, HDMI_MAX_ELD_BYTES);
+		ppdata->pipe = -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 9a5bdf5ad180..211f1cd61153 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 port_id;
-	unsigned char eld_data[HDMI_MAX_ELD_BYTES];
-};
-
-struct intel_hdmi_lpe_audio_pdata {
+struct intel_hdmi_lpe_audio_port_pdata {
+	u8 eld[HDMI_MAX_ELD_BYTES];
+	int port;
 	int pipe;
 	int ls_clock;
 	bool dp_output;
-	struct intel_hdmi_lpe_audio_eld eld;
+};
+
+struct intel_hdmi_lpe_audio_pdata {
+	struct intel_hdmi_lpe_audio_port_pdata port;
+
 	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 1a095189db83..c2b78621852e 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_port_pdata *ppdata = &pdata->port;
 
 	pm_runtime_get_sync(ctx->dev);
 	mutex_lock(&ctx->mutex);
-	if (pdata->pipe < 0) {
+	if (ppdata->pipe < 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__, eld->port_id, pdata->ls_clock);
+			__func__, ppdata->port, ppdata->ls_clock);
 
-		switch (pdata->pipe) {
+		switch (ppdata->pipe) {
 		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",
-				pdata->pipe);
+				ppdata->pipe);
 			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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-04-27 16:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27 16:02 [PATCH v2 00/11] drm/i915: LPE audio runtime PM and multipipe (v2) ville.syrjala
2017-04-27 16:02 ` [PATCH 01/11] drm/i915: Fix runtime PM for LPE audio ville.syrjala
2017-04-28  8:15   ` Takashi Iwai
2017-04-27 16:02 ` [PATCH 02/11] ALSA: x86: Clear the pdata.notify_lpe_audio pointer before teardown ville.syrjala
2017-04-28  8:16   ` Takashi Iwai
2017-04-27 16:02 ` [PATCH 03/11] drm/i915: Stop pretending to mask/unmask LPE audio interrupts ville.syrjala
2017-04-27 16:02 ` [PATCH v2 04/11] drm/i915: Remove the unused pending_notify from LPE platform data ville.syrjala
2017-04-27 16:02 ` [PATCH 05/11] drm/i915: Replace tmds_clock_speed and link_rate with just ls_clock ville.syrjala
2017-04-27 16:02 ` [PATCH v2 06/11] drm/i915: Remove hdmi_connected from LPE audio pdata ville.syrjala
2017-04-27 16:02 ` [PATCH 07/11] drm/i915: Reorganize intel_lpe_audio_notify() arguments ville.syrjala
2017-04-27 16:02 ` ville.syrjala [this message]
2017-04-27 16:02 ` [PATCH 09/11] ALSA: x86: Prepare LPE audio ctls for multiple PCMs ville.syrjala
2017-04-27 16:02 ` [PATCH v2 10/11] ALSA: x86: Split snd_intelhad into card and PCM specific structures ville.syrjala
2017-04-27 16:02 ` [PATCH v2 11/11] ALSA: x86: Register multiple PCM devices for the LPE audio card ville.syrjala
2017-04-28 19:46   ` [alsa-devel] " Pierre-Louis Bossart
2017-04-27 16:02 ` [PATCH alsa-lib] conf: Add multiple hdmi pcm definition for Intel LPE audio ville.syrjala
2017-04-27 16:21 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-04-28  8:41 ` [PATCH v2 00/11] drm/i915: LPE audio runtime PM and multipipe (v2) Takashi Iwai
2017-04-28 17:10   ` [alsa-devel] " Pierre-Louis Bossart
2017-04-28 19:37     ` Ville Syrjälä
2017-05-02  1:29       ` Pierre-Louis Bossart
2017-05-02 18:27         ` Ville Syrjälä
2017-05-02 20:15           ` Pierre-Louis Bossart
2017-05-02 20:44             ` Takashi Iwai
2017-05-03 13:39   ` Ville Syrjälä
2017-05-03 13:48     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170427160231.13337-9-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox