public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jerome Anand <jerome.anand@intel.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
	intel-gfx@lists.freedesktop.org, broonie@kernel.org,
	rakesh.a.ughreja@intel.com
Subject: Re: [RFC PATCH v3 2/7] drm/i915: Add support for audio driver notifications
Date: Thu, 24 Nov 2016 15:32:40 +0200	[thread overview]
Message-ID: <20161124133240.GR31595@intel.com> (raw)
In-Reply-To: <20161124235548.16440-3-jerome.anand@intel.com>

On Fri, Nov 25, 2016 at 05:25:43AM +0530, Jerome Anand wrote:
> 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: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 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      |  1 +
>  drivers/gpu/drm/i915/intel_lpe_audio.c | 49 ++++++++++++++++++++++++++++++++++
>  include/drm/intel_lpe_audio.h          |  1 +
>  5 files changed, 62 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 2a79048..33bc44c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -3561,6 +3561,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);
>  bool 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 1c509f7..55a6831 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>
> @@ -627,6 +628,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 (HAS_LPE_AUDIO(dev_priv))
> +		intel_lpe_audio_notify(dev_priv, connector->eld, port,
> +			crtc_state->port_clock, true);
>  }
>  
>  /**
> @@ -660,6 +665,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 (HAS_LPE_AUDIO(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 fb88e32..02d50e3 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)
> diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
> index 5335fc6..93f83cb 100644
> --- a/drivers/gpu/drm/i915/intel_lpe_audio.c
> +++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
> @@ -367,3 +367,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 (HAS_LPE_AUDIO(dev_priv)) {
> +		struct intel_hdmi_lpe_audio_pdata *pdata = dev_get_platdata(
> +			&(dev_priv->lpe_audio.platdev->dev));
> +
> +		if (pdata) {

How could the !pdata case happen? If it can't we shouldn't cater for it.

> +			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)

Why the if?

> +					pdata->tmds_clock_speed =
> +						tmds_clk_speed;
> +			}
> +			pdata->hdmi_connected = connected;

Also can't really see much need for this. Any one of the port/tmds
clock/eld should be sufficient.

> +			if (pdata->notify_audio_lpe)
> +				pdata->notify_audio_lpe(
> +					(eld != NULL) ? &pdata->eld : NULL);
> +			else
> +				pdata->notify_pending = true;

Still not sure why the "pending" thing is useful. Can't the audio driver
just do its thing (whatever it is) unconditionally?

When disabling just clear the port to INVALID, eld to zero, and tmds
clock to 0, and it should all be fine no?

> +
> +			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

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-11-24 13:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161124235548.16440-1-jerome.anand@intel.com>
     [not found] ` <20161124235548.16440-2-jerome.anand@intel.com>
2016-11-24 13:31   ` [RFC PATCH v3 1/7] drm/i915: setup bridge for HDMI LPE audio driver Ville Syrjälä
2016-11-25  5:42     ` Anand, Jerome
2016-11-25 10:18       ` Ville Syrjälä
2016-11-25 10:52       ` Jani Nikula
2016-11-28  1:50         ` Anand, Jerome
2016-11-28  8:06           ` Jani Nikula
2016-11-27 18:20     ` [alsa-devel] " Pierre-Louis Bossart
2016-11-28 13:43       ` Ville Syrjälä
     [not found] ` <20161124235548.16440-3-jerome.anand@intel.com>
2016-11-24 13:32   ` Ville Syrjälä [this message]
2016-11-25  5:51     ` [RFC PATCH v3 2/7] drm/i915: Add support for audio driver notifications Anand, Jerome
2016-11-28 14:00       ` Ville Syrjälä
2016-11-28 16:50         ` Anand, Jerome
2016-11-28 17:01           ` Ville Syrjälä
2016-11-28 19:13             ` Pierre-Louis Bossart
2016-11-28 19:30               ` Ville Syrjälä
2016-11-28 21:56                 ` Pierre-Louis Bossart
2016-11-29  8:27                   ` Takashi Iwai
2016-11-29 16:22                     ` Anand, Jerome

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=20161124133240.GR31595@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jerome.anand@intel.com \
    --cc=rakesh.a.ughreja@intel.com \
    --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