From: Jerome Anand <jerome.anand@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: tiwai@suse.de, broonie@opensource.wolfsonmicro.com
Subject: [RFC PATCH v2 5/8] drm/i915: Add support for audio driver notifications
Date: Sat, 1 Oct 2016 05:52:39 +0530 [thread overview]
Message-ID: <20161001002242.31025-6-jerome.anand@intel.com> (raw)
In-Reply-To: <20161001002242.31025-1-jerome.anand@intel.com>
Notifiations like mode change, hot plug and edid to
the audio driver are added. This is inturn used by the
audio driver for its functionality.
A new interface file capturing the notifications needed by the
audio driver is added
Signed-off-by: Jerome Anand <jerome.anand@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 3 +++
drivers/gpu/drm/i915/intel_audio.c | 8 ++++++
drivers/gpu/drm/i915/intel_hdmi.c | 18 ++++++++++++-
drivers/gpu/drm/i915/intel_lpe_audio.c | 49 ++++++++++++++++++++++++++++++++++
include/drm/intel_lpe_audio.h | 1 +
5 files changed, 78 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 399a8ee..51a6d71 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3597,6 +3597,9 @@ int intel_lpe_audio_setup(struct drm_i915_private *dev_priv);
void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
int intel_lpe_audio_detect(struct drm_i915_private *dev_priv);
+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
+ void *eld, int port, int tmds_clk_speed,
+ bool connected);
/* intel_i2c.c */
extern int intel_setup_gmbus(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index 9583f43..61a9a98 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -24,6 +24,7 @@
#include <linux/kernel.h>
#include <linux/component.h>
#include <drm/i915_component.h>
+#include <drm/intel_lpe_audio.h>
#include "intel_drv.h"
#include <drm/drmP.h>
@@ -528,6 +529,10 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
(int) port, (int) pipe);
+
+ if (IS_LPE_AUDIO_ENABLED(dev_priv))
+ intel_lpe_audio_notify(dev_priv, connector->eld, port,
+ crtc->config->port_clock, true);
}
/**
@@ -561,6 +566,9 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
(int) port, (int) pipe);
+
+ if (IS_LPE_AUDIO_ENABLED(dev_priv))
+ intel_lpe_audio_notify(dev_priv, NULL, port, 0, true);
}
/**
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 8d46f58..0e20788 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -36,6 +36,7 @@
#include <drm/drm_edid.h>
#include "intel_drv.h"
#include <drm/i915_drm.h>
+#include <drm/intel_lpe_audio.h>
#include "i915_drv.h"
static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)
@@ -1501,9 +1502,24 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
status = connector_status_connected;
- } else
+
+ i915_enable_hdmi_audio_int(dev_priv);
+
+ if (IS_LPE_AUDIO_ENABLED(dev_priv))
+ intel_lpe_audio_notify(dev_priv,
+ connector->eld, 0,
+ 0, true);
+ } else {
status = connector_status_disconnected;
+ i915_disable_hdmi_audio_int(dev_priv);
+
+ if (IS_LPE_AUDIO_ENABLED(dev_priv))
+ intel_lpe_audio_notify(dev_priv,
+ NULL, 0,
+ 0, false);
+ }
+
intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
return status;
diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
index acfe22f..28266e4 100644
--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
@@ -355,3 +355,52 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
}
+
+
+/**
+ * intel_lpe_audio_notify() - notify lpe audio event
+ * audio driver and i915
+ * @dev_priv: the i915 drm device private data
+ * @eld : ELD data
+ * @port: port id
+ * @tmds_clk_speed: tmds clock frequency in Hz
+ * @connected: hdmi connected/disconnected
+ *
+ * Notify lpe audio driver of eld change.
+ */
+void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
+ void *eld, int port, int tmds_clk_speed,
+ bool connected)
+{
+ unsigned long irq_flags;
+
+ if (IS_LPE_AUDIO_ENABLED(dev_priv)) {
+ struct intel_hdmi_lpe_audio_pdata *pdata = dev_get_platdata(
+ &(dev_priv->lpe_audio.platdev->dev));
+
+ if (pdata) {
+ spin_lock_irqsave(&pdata->lpe_audio_slock,
+ irq_flags);
+
+ if (eld != NULL) {
+ memcpy(pdata->eld.eld_data, eld,
+ HDMI_MAX_ELD_BYTES);
+ pdata->eld.port_id = port;
+
+ if (tmds_clk_speed)
+ pdata->tmds_clock_speed =
+ tmds_clk_speed;
+ }
+ pdata->hdmi_connected = connected;
+ if (pdata->notify_audio_lpe)
+ pdata->notify_audio_lpe(
+ (eld != NULL) ? &pdata->eld : NULL);
+ else
+ pdata->notify_pending = true;
+
+ spin_unlock_irqrestore(&pdata->lpe_audio_slock,
+ irq_flags);
+ } else
+ DRM_DEBUG_DRIVER("no audio notification\n");
+ }
+}
diff --git a/include/drm/intel_lpe_audio.h b/include/drm/intel_lpe_audio.h
index a64c449..952de05 100644
--- a/include/drm/intel_lpe_audio.h
+++ b/include/drm/intel_lpe_audio.h
@@ -25,6 +25,7 @@
#define _INTEL_LPE_AUDIO_H_
#include <linux/types.h>
+#include <linux/spinlock_types.h>
#define HDMI_MAX_ELD_BYTES 128
--
2.9.3
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-10-12 16:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-01 0:22 [RFC PATCH v2 0/8] Add support for Legacy Hdmi audio Jerome Anand
2016-10-01 0:22 ` [RFC PATCH v2 1/8] drm/i915: setup bridge for HDMI LPE audio driver Jerome Anand
2016-10-11 9:15 ` Ville Syrjälä
2016-10-13 19:38 ` Pierre-Louis Bossart
2016-10-14 9:10 ` Ville Syrjälä
2016-10-14 13:50 ` Jani Nikula
2016-10-17 6:46 ` Daniel Vetter
2016-10-01 0:22 ` [RFC PATCH v2 2/8] ALSA: add shell for Intel " Jerome Anand
2016-10-01 0:22 ` [RFC PATCH v2 3/8] ALSA: Add support for hdmi " Jerome Anand
2016-10-01 0:22 ` [RFC PATCH v2 4/8] drm/i915: Add support for enabling/disabling hdmi audio interrupts Jerome Anand
2016-10-11 9:18 ` Ville Syrjälä
2016-10-13 19:41 ` Pierre-Louis Bossart
2016-10-01 0:22 ` Jerome Anand [this message]
2016-10-01 0:22 ` [RFC PATCH v2 6/8] hdmi_audio: Improve position reporting Using a hw register to calculate sub-period position reports Jerome Anand
2016-10-01 0:22 ` [RFC PATCH v2 7/8] hdmi_audio: Fixup some monitor Jerome Anand
2016-10-01 0:22 ` [RFC PATCH v2 8/8] hdmi_audio: continue audio playback even when display resolution changes Jerome Anand
2016-10-12 18:49 ` ✗ Fi.CI.BAT: warning for Add support for Legacy Hdmi audio Patchwork
2016-10-12 18:59 ` Saarinen, Jani
2016-11-03 23:01 ` [RFC PATCH v2 0/8] " Daniel Vetter
2016-11-07 6:42 ` Pierre-Louis Bossart
2016-11-09 13:19 ` Mark Brown
2016-11-10 16:35 ` Pierre-Louis Bossart
2016-11-11 15:14 ` Mark Brown
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=20161001002242.31025-6-jerome.anand@intel.com \
--to=jerome.anand@intel.com \
--cc=broonie@opensource.wolfsonmicro.com \
--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 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.