drm/i915: setup bridge for HDMI LPE audio driver
Subsystems (4)
RFC PATCH v4 1/7 drm/i915: setup bridge for HDMI LPE audio driver
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 <[email protected]>
Signed-off-by Jerome Anand <[email protected]>
--- 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 | 27 +++ drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_lpe_audio.c | 363 +++++++++++++++++++++++++++++++++ include/drm/intel_lpe_audio.h | 45 ++++ 8 files changed, 471 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_lpe_audio.c create mode 100644 include/drm/intel_lpe_audio.h
Documentation/gpu/i915.rst +9 -0
@@ -213,6 +213,15 @@ Video BIOS Table (VBT) .. kernel-doc:: drivers/gpu/drm/i915/intel_vbt_defs.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 ========================================
drivers/gpu/drm/i915/Makefile +3 -0
@@ -126,6 +126,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)
drivers/gpu/drm/i915/i915_drv.c +6 -2
@@ -1144,7 +1144,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
@@ -1162,7 +1163,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 ();
drivers/gpu/drm/i915/i915_drv.h +15 -0
@@ -2284,6 +2284,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.
@@ -2773,6 +2779,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
@@ -3547,6 +3555,13 @@ extern int i915_restore_state(struct drm_device *dev);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); +/* intel_i2c.c */ extern int intel_setup_gmbus (struct drm_device *dev);extern void intel_teardown_gmbus (struct drm_device *dev);
drivers/gpu/drm/i915/i915_irq.c +27 -0
@@ -1894,6 +1894,14 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)valleyview_pipestat_irq_ack (dev_priv, iir, pipe_stats);/* +* LPE audio interrupts are only enabled on Baytrail and +* CherryView platforms without HDaudio +*/ +if (iir & (I915_LPE_PIPE_A_INTERRUPT | +I915_LPE_PIPE_B_INTERRUPT )) +intel_lpe_audio_irq_handler (dev_priv); + +/* * VLV_IIR is single buffered, and reflects the level * from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last. */
@@ -1974,6 +1982,15 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg)valleyview_pipestat_irq_ack (dev_priv, iir, pipe_stats);/* +* LPE audio interrupts are only enabled on Baytrail and +* CherryView platforms without HDaudio +*/ +if (iir & (I915_LPE_PIPE_A_INTERRUPT | +I915_LPE_PIPE_B_INTERRUPT | +I915_LPE_PIPE_C_INTERRUPT )) +intel_lpe_audio_irq_handler (dev_priv); + +/* * VLV_IIR is single buffered, and reflects the level * from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last. */
@@ -2914,6 +2931,7 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)u32 pipestat_mask;u32 enable_mask;enum pipe pipe; +u32 val; pipestat_mask =PLANE_FLIP_DONE_INT_STATUS_VLV |PIPE_CRC_DONE_INTERRUPT_STATUS ;
@@ -2930,6 +2948,15 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)WARN_ON (dev_priv->irq_mask != ~0 ); +/* add interrupt masks unconditially here, the actual unmask +* will take place only if the LPE_AUDIO mode is detected +*/ + val = (I915_LPE_PIPE_A_INTERRUPT | +I915_LPE_PIPE_B_INTERRUPT | +I915_LPE_PIPE_C_INTERRUPT ); + + enable_mask |= val; + dev_priv->irq_mask = ~enable_mask;GEN5_IRQ_INIT (VLV_ , dev_priv->irq_mask, enable_mask);
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -2395,6 +2395,9 @@ enum skl_disp_power_wells {#define I915_ASLE_INTERRUPT (1<<0)#define I915_BSD_USER_INTERRUPT (1<<25) +#define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000) +#define I915_HDMI_LPE_AUDIO_SIZE 0x1000 +#define GEN6_BSD_RNCID _MMIO(0x12198)#define GEN7_FF_THREAD_MODE _MMIO(0x20a0)
drivers/gpu/drm/i915/intel_lpe_audio.c new file +363 -0
363 lines not on this page · raw message
include/drm/intel_lpe_audio.h new file +45 -0
45 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx