All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org, intel-gfx@lists.freedesktop.org
Cc: rakesh.a.ughreja@intel.com
Subject: [PATCH 7/7] drm/i915: Pass platform device to LPE audio notifier
Date: Tue, 31 Jan 2017 22:36:49 +0100	[thread overview]
Message-ID: <20170131213649.13689-8-tiwai@suse.de> (raw)
In-Reply-To: <20170131213649.13689-1-tiwai@suse.de>

This allows the LPE HDMI driver to clean up its global variable
reference.

Also drop to pass the eld pointer because the connection status and
the ELD bytes can be retrieved from the attached pdata.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/i915/intel_lpe_audio.c |  3 +--
 include/drm/intel_lpe_audio.h          |  4 +++-
 sound/x86/intel_hdmi_lpe_audio.c       | 23 +++++++++++------------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
index 2ca3c775c6b1..ef0e74830289 100644
--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
@@ -383,8 +383,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
 	}
 
 	if (pdata->notify_audio_lpe)
-		pdata->notify_audio_lpe(
-			(eld != NULL) ? &pdata->eld : NULL);
+		pdata->notify_audio_lpe(dev_priv->lpe_audio.platdev);
 	else
 		pdata->notify_pending = true;
 
diff --git a/include/drm/intel_lpe_audio.h b/include/drm/intel_lpe_audio.h
index 410128e4cd70..e9892b4c3af1 100644
--- a/include/drm/intel_lpe_audio.h
+++ b/include/drm/intel_lpe_audio.h
@@ -27,6 +27,8 @@
 #include <linux/types.h>
 #include <linux/spinlock_types.h>
 
+struct platform_device;
+
 #define HDMI_MAX_ELD_BYTES	128
 
 struct intel_hdmi_lpe_audio_eld {
@@ -42,7 +44,7 @@ struct intel_hdmi_lpe_audio_pdata {
 	bool dp_output;
 	int link_rate;
 	struct intel_hdmi_lpe_audio_eld eld;
-	void (*notify_audio_lpe)(void *audio_ptr);
+	void (*notify_audio_lpe)(struct platform_device *pdev);
 	spinlock_t lpe_audio_slock;
 };
 
diff --git a/sound/x86/intel_hdmi_lpe_audio.c b/sound/x86/intel_hdmi_lpe_audio.c
index 6d630f20bca8..3cb0f642575c 100644
--- a/sound/x86/intel_hdmi_lpe_audio.c
+++ b/sound/x86/intel_hdmi_lpe_audio.c
@@ -439,15 +439,14 @@ static irqreturn_t display_pipe_interrupt_handler(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void notify_audio_lpe(void *audio_ptr)
+static void notify_audio_lpe(struct platform_device *pdev)
 {
-	struct hdmi_lpe_audio_ctx *ctx = get_hdmi_context();
-	struct intel_hdmi_lpe_audio_pdata *pdata = hlpe_pdev->dev.platform_data;
-	struct intel_hdmi_lpe_audio_eld *eld = audio_ptr;
+	struct hdmi_lpe_audio_ctx *ctx = platform_get_drvdata(pdev);
+	struct intel_hdmi_lpe_audio_pdata *pdata = pdev->dev.platform_data;
 
 	if (pdata->hdmi_connected != true) {
 
-		dev_dbg(&hlpe_pdev->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG\n",
+		dev_dbg(&pdev->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG\n",
 			__func__);
 
 		if (hlpe_state == hdmi_connector_status_connected) {
@@ -458,10 +457,11 @@ static void notify_audio_lpe(void *audio_ptr)
 			mid_hdmi_audio_signal_event(
 				HAD_EVENT_HOT_UNPLUG);
 		} else
-			dev_dbg(&hlpe_pdev->dev, "%s: Already Unplugged!\n",
+			dev_dbg(&pdev->dev, "%s: Already Unplugged!\n",
 				__func__);
 
-	} else if (eld != NULL) {
+	} else {
+		struct intel_hdmi_lpe_audio_eld *eld = &pdata->eld;
 
 		switch (eld->pipe_id) {
 		case 0:
@@ -474,7 +474,7 @@ static void notify_audio_lpe(void *audio_ptr)
 			ctx->had_config_offset = AUDIO_HDMI_CONFIG_C;
 			break;
 		default:
-			dev_dbg(&hlpe_pdev->dev, "Invalid pipe %d\n",
+			dev_dbg(&pdev->dev, "Invalid pipe %d\n",
 				eld->pipe_id);
 			break;
 		}
@@ -485,7 +485,7 @@ static void notify_audio_lpe(void *audio_ptr)
 
 		hlpe_state = hdmi_connector_status_connected;
 
-		dev_dbg(&hlpe_pdev->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n",
+		dev_dbg(&pdev->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n",
 			__func__, eld->port_id,	pdata->tmds_clock_speed);
 
 		if (pdata->tmds_clock_speed) {
@@ -494,8 +494,7 @@ static void notify_audio_lpe(void *audio_ptr)
 			ctx->link_rate = pdata->link_rate;
 			mid_hdmi_audio_signal_event(HAD_EVENT_MODE_CHANGING);
 		}
-	} else
-		dev_dbg(&hlpe_pdev->dev, "%s: Event: NULL EDID!!\n", __func__);
+	}
 }
 
 /**
@@ -606,7 +605,7 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
 	if (pdata->notify_pending) {
 
 		dev_dbg(&hlpe_pdev->dev, "%s: handle pending notification\n", __func__);
-		notify_audio_lpe(&pdata->eld);
+		notify_audio_lpe(pdev);
 		pdata->notify_pending = false;
 	}
 	spin_unlock_irqrestore(&pdata->lpe_audio_slock, flag_irq);
-- 
2.11.0

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

  parent reply	other threads:[~2017-01-31 21:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31 21:36 [PATCH 0/7] DisplayPort audio support on Cherrytrail Takashi Iwai
2017-01-31 21:36 ` [PATCH 1/7] drm/i915: add DP support in LPE audio mode Takashi Iwai
2017-01-31 21:36 ` [PATCH 2/7] drm/i915: add DisplayPort amp unmute for " Takashi Iwai
2017-02-01 14:45   ` Ville Syrjälä
2017-02-01 14:53     ` Takashi Iwai
2017-02-01 15:11       ` Ville Syrjälä
2017-02-01 15:24         ` Takashi Iwai
2017-02-02  9:57   ` Takashi Iwai
2017-02-02 10:06     ` Ville Syrjälä
2017-02-02 10:13       ` Takashi Iwai
2017-01-31 21:36 ` [PATCH 3/7] drm/i915: Avoid MST pipe handling for LPE audio Takashi Iwai
2017-01-31 21:36 ` [PATCH 4/7] drm/i915: Pass pipe to LPE audio notification Takashi Iwai
2017-01-31 21:36 ` [PATCH 5/7] ALSA: x86: intel_hdmi: add definitions and logic for DP audio Takashi Iwai
2017-01-31 21:36 ` [PATCH 6/7] ALSA: x86: Use config base depending on the pipe Takashi Iwai
2017-01-31 21:36 ` Takashi Iwai [this message]
2017-01-31 22:24 ` ✓ Fi.CI.BAT: success for DisplayPort audio support on Cherrytrail Patchwork
2017-03-13  8:33 ` [PATCH 0/7] " Daniel Vetter
2017-03-31  6:29   ` Daniel Vetter
2017-03-31  6:40     ` 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=20170131213649.13689-8-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rakesh.a.ughreja@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.