From patchwork Sat Oct 1 00:22:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Anand X-Patchwork-Id: 9373535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE68F60487 for ; Wed, 12 Oct 2016 16:26:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF23A28F36 for ; Wed, 12 Oct 2016 16:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3CFE292DA; Wed, 12 Oct 2016 16:26:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7379028F36 for ; Wed, 12 Oct 2016 16:26:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C490F6E8AB; Wed, 12 Oct 2016 16:26:48 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id F335C6E8AA for ; Wed, 12 Oct 2016 16:26:46 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 12 Oct 2016 09:26:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,336,1473145200"; d="scan'208";a="771818843" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by FMSMGA003.fm.intel.com with SMTP; 12 Oct 2016 09:26:46 -0700 Received: by stinkbox (sSMTP sendmail emulation); Wed, 12 Oct 2016 19:26:44 +0300 Resent-From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Resent-Date: Wed, 12 Oct 2016 19:26:44 +0300 Resent-Message-ID: <20161012162644.GG4329@intel.com> Resent-To: intel-gfx@lists.freedesktop.org X-Original-To: ville.syrjala@linux.intel.com Delivered-To: ville.syrjala@linux.intel.com Received: from linux.intel.com [10.54.29.200] by localhost with IMAP (fetchmail-6.3.26) for (single-drop); Fri, 30 Sep 2016 15:27:37 +0300 (EEST) Received: from jerome-ubuntu.iind.intel.com (jerome-ubuntu.iind.intel.com [10.223.84.52]) by linux.intel.com (Postfix) with ESMTP id 871A66A4082; Fri, 30 Sep 2016 05:20:28 -0700 (PDT) Received: by jerome-ubuntu.iind.intel.com (Postfix, from userid 1000) id 679FCBC6DBC; Sat, 1 Oct 2016 05:52:43 +0530 (IST) From: Jerome Anand To: intel-gfx@lists.freedesktop.org Date: Sat, 1 Oct 2016 05:52:39 +0530 Message-Id: <20161001002242.31025-6-jerome.anand@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161001002242.31025-1-jerome.anand@intel.com> References: <20161001002242.31025-1-jerome.anand@intel.com> Cc: tiwai@suse.de, broonie@opensource.wolfsonmicro.com Subject: [Intel-gfx] [RFC PATCH v2 5/8] drm/i915: Add support for audio driver notifications X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include #include +#include #include "intel_drv.h" #include @@ -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 #include "intel_drv.h" #include +#include #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 +#include #define HDMI_MAX_ELD_BYTES 128