Re: [Intel-gfx] [alsa-devel] [PATCH V2 1/7] drm/i915: setup bridge for HDMI LPE audio driver

2017-01-06 Thread Anand, Jerome


> -Original Message-
> From: Pierre-Louis Bossart [mailto:pierre-louis.boss...@linux.intel.com]
> Sent: Saturday, January 7, 2017 1:43 AM
> To: Anand, Jerome ; intel-
> g...@lists.freedesktop.org; alsa-de...@alsa-project.org
> Cc: ti...@suse.de; broo...@kernel.org; Ughreja, Rakesh A
> ; ville.syrj...@linux.intel.com
> Subject: Re: [alsa-devel] [PATCH V2 1/7] drm/i915: setup bridge for HDMI LPE
> audio driver
> 
> Thanks for the update Jerome. Looks like you missed a couple of agreed
> comments from the last round?
> 

Thanks Pierre for the quick feedback. I though I replied to some of the 
Comments previously.

> On 1/6/17 7:21 PM, Jerome Anand wrote:
> > Enable support for HDMI LPE audio mode on Baytrail and Cherrytrail
> > when HDaudio controller is not detected
> >
> > Setup minimum required resources during i915_driver_load:
> > 1. Create a platform device to share MMIO/IRQ resources 2. Make the
> > platform device child of i915 device for runtime PM.
> > 3. Create IRQ chip to forward HDMI LPE audio irqs.
> >
> > HDMI LPE audio driver (a standalone sound driver) probes the LPE audio
> > device and creates a new sound card.
> >
> > Signed-off-by: Pierre-Louis Bossart
> > 
> > Signed-off-by: Jerome Anand 
> > ---
> >  Documentation/gpu/i915.rst |   9 +
> >  drivers/gpu/drm/i915/Makefile  |   3 +
> >  drivers/gpu/drm/i915/i915_drv.c|   8 +-
> >  drivers/gpu/drm/i915/i915_drv.h|  15 ++
> >  drivers/gpu/drm/i915/i915_irq.c|  16 ++
> >  drivers/gpu/drm/i915/i915_reg.h|   3 +
> >  drivers/gpu/drm/i915/intel_lpe_audio.c | 355
> +
> >  include/drm/intel_lpe_audio.h  |  45 +
> >  8 files changed, 452 insertions(+), 2 deletions(-)  create mode
> > 100644 drivers/gpu/drm/i915/intel_lpe_audio.c
> >  create mode 100644 include/drm/intel_lpe_audio.h
> >
> > diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
> > index 104296d..bd9b767 100644
> > --- a/Documentation/gpu/i915.rst
> > +++ b/Documentation/gpu/i915.rst
> > @@ -225,6 +225,15 @@ Display PLLs
> >  .. kernel-doc:: drivers/gpu/drm/i915/intel_dpll_mgr.h
> > :internal:
> >
> > +intel hdmi lpe audio support
> > +
> > +
> > +.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
> > +   :doc:  LPE Audio integration for HDMI or DP playback
> > +
> > +.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
> > +   :internal:
> > +
> >  Memory Management and Command Submission
> > 
> >
> > diff --git a/drivers/gpu/drm/i915/Makefile
> > b/drivers/gpu/drm/i915/Makefile index 5196509..2bca239 100644
> > --- a/drivers/gpu/drm/i915/Makefile
> > +++ b/drivers/gpu/drm/i915/Makefile
> > @@ -127,6 +127,9 @@ i915-y += intel_gvt.o  include $(src)/gvt/Makefile
> > endif
> >
> > +# LPE Audio for VLV and CHT
> > +i915-y += intel_lpe_audio.o
> > +
> >  obj-$(CONFIG_DRM_I915) += i915.o
> >
> >  CFLAGS_i915_trace_points.o := -I$(src) diff --git
> > a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 4d22b4b..70d728b 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1131,7 +1131,8 @@ static void i915_driver_register(struct
> drm_i915_private *dev_priv)
> > if (IS_GEN5(dev_priv))
> > intel_gpu_ips_init(dev_priv);
> >
> > -   i915_audio_component_init(dev_priv);
> > +   if (intel_lpe_audio_init(dev_priv) < 0)
> > +   i915_audio_component_init(dev_priv);
> >
> > /*
> >  * Some ports require correctly set-up hpd registers for detection
> > to @@ -1149,7 +1150,10 @@ static void i915_driver_register(struct
> drm_i915_private *dev_priv)
> >   */
> >  static void i915_driver_unregister(struct drm_i915_private *dev_priv)
> > {
> > -   i915_audio_component_cleanup(dev_priv);
> > +   if (HAS_LPE_AUDIO(dev_priv))
> > +   intel_lpe_audio_teardown(dev_priv);
> > +   else
> > +   i915_audio_component_cleanup(dev_priv);
> >
> > intel_gpu_ips_teardown();
> > acpi_video_unregister();
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h
> > b/drivers/gpu/drm/i915/i915_drv.h index 7b43662..2f8165e 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -2460,6 +2460,12 @@ struct drm_i915_private {
> > /* Used to save the pipe-to-encoder mapping for audio */
> > struct intel_encoder *av_enc_map[I915_MAX_PIPES];
> >
> > +   /* necessary resource sharing with HDMI LPE audio driver. */
> > +   struct {
> > +   struct platform_device *platdev;
> > +   int irq;
> > +   } lpe_audio;
> > +
> > /*
> >  * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your
> patch
> >  * will be rejected. Instead look for a better place.
> > @@ -2859,6 +2865,8 @@ intel_info(const struct drm_i915_private
> > 

Re: [Intel-gfx] [alsa-devel] [PATCH V2 1/7] drm/i915: setup bridge for HDMI LPE audio driver

2017-01-06 Thread Pierre-Louis Bossart
Thanks for the update Jerome. Looks like you missed a couple of agreed 
comments from the last round?


On 1/6/17 7:21 PM, Jerome Anand wrote:

Enable support for HDMI LPE audio mode on Baytrail and
Cherrytrail when HDaudio controller is not detected

Setup minimum required resources during i915_driver_load:
1. Create a platform device to share MMIO/IRQ resources
2. Make the platform device child of i915 device for runtime PM.
3. Create IRQ chip to forward HDMI LPE audio irqs.

HDMI LPE audio driver (a standalone sound driver) probes the
LPE audio device and creates a new sound card.

Signed-off-by: Pierre-Louis Bossart 
Signed-off-by: Jerome Anand 
---
 Documentation/gpu/i915.rst |   9 +
 drivers/gpu/drm/i915/Makefile  |   3 +
 drivers/gpu/drm/i915/i915_drv.c|   8 +-
 drivers/gpu/drm/i915/i915_drv.h|  15 ++
 drivers/gpu/drm/i915/i915_irq.c|  16 ++
 drivers/gpu/drm/i915/i915_reg.h|   3 +
 drivers/gpu/drm/i915/intel_lpe_audio.c | 355 +
 include/drm/intel_lpe_audio.h  |  45 +
 8 files changed, 452 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lpe_audio.c
 create mode 100644 include/drm/intel_lpe_audio.h

diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
index 104296d..bd9b767 100644
--- a/Documentation/gpu/i915.rst
+++ b/Documentation/gpu/i915.rst
@@ -225,6 +225,15 @@ Display PLLs
 .. kernel-doc:: drivers/gpu/drm/i915/intel_dpll_mgr.h
:internal:

+intel hdmi lpe audio support
+
+
+.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
+   :doc:  LPE Audio integration for HDMI or DP playback
+
+.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
+   :internal:
+
 Memory Management and Command Submission
 

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 5196509..2bca239 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -127,6 +127,9 @@ i915-y += intel_gvt.o
 include $(src)/gvt/Makefile
 endif

+# LPE Audio for VLV and CHT
+i915-y += intel_lpe_audio.o
+
 obj-$(CONFIG_DRM_I915) += i915.o

 CFLAGS_i915_trace_points.o := -I$(src)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4d22b4b..70d728b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1131,7 +1131,8 @@ static void i915_driver_register(struct drm_i915_private 
*dev_priv)
if (IS_GEN5(dev_priv))
intel_gpu_ips_init(dev_priv);

-   i915_audio_component_init(dev_priv);
+   if (intel_lpe_audio_init(dev_priv) < 0)
+   i915_audio_component_init(dev_priv);

/*
 * Some ports require correctly set-up hpd registers for detection to
@@ -1149,7 +1150,10 @@ static void i915_driver_register(struct drm_i915_private 
*dev_priv)
  */
 static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 {
-   i915_audio_component_cleanup(dev_priv);
+   if (HAS_LPE_AUDIO(dev_priv))
+   intel_lpe_audio_teardown(dev_priv);
+   else
+   i915_audio_component_cleanup(dev_priv);

intel_gpu_ips_teardown();
acpi_video_unregister();
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 7b43662..2f8165e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2460,6 +2460,12 @@ struct drm_i915_private {
/* Used to save the pipe-to-encoder mapping for audio */
struct intel_encoder *av_enc_map[I915_MAX_PIPES];

+   /* necessary resource sharing with HDMI LPE audio driver. */
+   struct {
+   struct platform_device *platdev;
+   int irq;
+   } lpe_audio;
+
/*
 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
 * will be rejected. Instead look for a better place.
@@ -2859,6 +2865,8 @@ intel_info(const struct drm_i915_private *dev_priv)

 #define HAS_POOLED_EU(dev_priv)((dev_priv)->info.has_pooled_eu)

+#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->lpe_audio.platdev != NULL)
+
 #define INTEL_PCH_DEVICE_ID_MASK   0xff00
 #define INTEL_PCH_IBX_DEVICE_ID_TYPE   0x3b00
 #define INTEL_PCH_CPT_DEVICE_ID_TYPE   0x1c00
@@ -3620,6 +3628,13 @@ extern int i915_restore_state(struct drm_i915_private 
*dev_priv);
 void i915_setup_sysfs(struct drm_i915_private *dev_priv);
 void i915_teardown_sysfs(struct drm_i915_private *dev_priv);

+/* i915_lpe_audio.c */
+int  intel_lpe_audio_init(struct drm_i915_private *dev_priv);
+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);
+
 /*