Skip to content

Commit fc0e23f

Browse files
committed
Merge branch 'for-next' into for-linus
2 parents af67716 + 3bb9eca commit fc0e23f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3399
-395
lines changed

Documentation/gpu/i915.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ High Definition Audio
144144
.. kernel-doc:: include/drm/i915_component.h
145145
:internal:
146146

147+
Intel HDMI LPE Audio Support
148+
----------------------------
149+
150+
.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
151+
:doc: LPE Audio integration for HDMI or DP playback
152+
153+
.. kernel-doc:: drivers/gpu/drm/i915/intel_lpe_audio.c
154+
:internal:
155+
147156
Panel Self Refresh PSR (PSR/SRD)
148157
--------------------------------
149158

drivers/gpu/drm/i915/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ i915-y += intel_gvt.o
122122
include $(src)/gvt/Makefile
123123
endif
124124

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

127130
CFLAGS_i915_trace_points.o := -I$(src)

drivers/gpu/drm/i915/i915_drv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
11381138
if (IS_GEN5(dev_priv))
11391139
intel_gpu_ips_init(dev_priv);
11401140

1141-
i915_audio_component_init(dev_priv);
1141+
intel_audio_init(dev_priv);
11421142

11431143
/*
11441144
* Some ports require correctly set-up hpd registers for detection to
@@ -1156,7 +1156,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
11561156
*/
11571157
static void i915_driver_unregister(struct drm_i915_private *dev_priv)
11581158
{
1159-
i915_audio_component_cleanup(dev_priv);
1159+
intel_audio_deinit(dev_priv);
11601160

11611161
intel_gpu_ips_teardown();
11621162
acpi_video_unregister();

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,12 @@ struct drm_i915_private {
21402140
/* Used to save the pipe-to-encoder mapping for audio */
21412141
struct intel_encoder *av_enc_map[I915_MAX_PIPES];
21422142

2143+
/* necessary resource sharing with HDMI LPE audio driver. */
2144+
struct {
2145+
struct platform_device *platdev;
2146+
int irq;
2147+
} lpe_audio;
2148+
21432149
/*
21442150
* NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
21452151
* will be rejected. Instead look for a better place.
@@ -3387,6 +3393,14 @@ extern int i915_restore_state(struct drm_device *dev);
33873393
void i915_setup_sysfs(struct drm_i915_private *dev_priv);
33883394
void i915_teardown_sysfs(struct drm_i915_private *dev_priv);
33893395

3396+
/* intel_lpe_audio.c */
3397+
int intel_lpe_audio_init(struct drm_i915_private *dev_priv);
3398+
void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
3399+
void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
3400+
void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
3401+
void *eld, int port, int pipe, int tmds_clk_speed,
3402+
bool dp_output, int link_rate);
3403+
33903404
/* intel_i2c.c */
33913405
extern int intel_setup_gmbus(struct drm_device *dev);
33923406
extern void intel_teardown_gmbus(struct drm_device *dev);

drivers/gpu/drm/i915/i915_irq.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,10 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
18931893
* signalled in iir */
18941894
valleyview_pipestat_irq_ack(dev_priv, iir, pipe_stats);
18951895

1896+
if (iir & (I915_LPE_PIPE_A_INTERRUPT |
1897+
I915_LPE_PIPE_B_INTERRUPT))
1898+
intel_lpe_audio_irq_handler(dev_priv);
1899+
18961900
/*
18971901
* VLV_IIR is single buffered, and reflects the level
18981902
* from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last.
@@ -1973,6 +1977,11 @@ static irqreturn_t cherryview_irq_handler(int irq, void *arg)
19731977
* signalled in iir */
19741978
valleyview_pipestat_irq_ack(dev_priv, iir, pipe_stats);
19751979

1980+
if (iir & (I915_LPE_PIPE_A_INTERRUPT |
1981+
I915_LPE_PIPE_B_INTERRUPT |
1982+
I915_LPE_PIPE_C_INTERRUPT))
1983+
intel_lpe_audio_irq_handler(dev_priv);
1984+
19761985
/*
19771986
* VLV_IIR is single buffered, and reflects the level
19781987
* from PIPESTAT/PORT_HOTPLUG_STAT, hence clear it last.
@@ -2914,6 +2923,7 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)
29142923
u32 pipestat_mask;
29152924
u32 enable_mask;
29162925
enum pipe pipe;
2926+
u32 val;
29172927

29182928
pipestat_mask = PLANE_FLIP_DONE_INT_STATUS_VLV |
29192929
PIPE_CRC_DONE_INTERRUPT_STATUS;
@@ -2930,6 +2940,12 @@ static void vlv_display_irq_postinstall(struct drm_i915_private *dev_priv)
29302940

29312941
WARN_ON(dev_priv->irq_mask != ~0);
29322942

2943+
val = (I915_LPE_PIPE_A_INTERRUPT |
2944+
I915_LPE_PIPE_B_INTERRUPT |
2945+
I915_LPE_PIPE_C_INTERRUPT);
2946+
2947+
enable_mask |= val;
2948+
29332949
dev_priv->irq_mask = ~enable_mask;
29342950

29352951
GEN5_IRQ_INIT(VLV_, dev_priv->irq_mask, enable_mask);

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,6 +2058,22 @@ enum skl_disp_power_wells {
20582058
#define I915_ASLE_INTERRUPT (1<<0)
20592059
#define I915_BSD_USER_INTERRUPT (1<<25)
20602060

2061+
#define I915_HDMI_LPE_AUDIO_BASE (VLV_DISPLAY_BASE + 0x65000)
2062+
#define I915_HDMI_LPE_AUDIO_SIZE 0x1000
2063+
2064+
/* DisplayPort Audio w/ LPE */
2065+
#define VLV_AUD_CHICKEN_BIT_REG _MMIO(VLV_DISPLAY_BASE + 0x62F38)
2066+
#define VLV_CHICKEN_BIT_DBG_ENABLE (1 << 0)
2067+
2068+
#define _VLV_AUD_PORT_EN_B_DBG (VLV_DISPLAY_BASE + 0x62F20)
2069+
#define _VLV_AUD_PORT_EN_C_DBG (VLV_DISPLAY_BASE + 0x62F30)
2070+
#define _VLV_AUD_PORT_EN_D_DBG (VLV_DISPLAY_BASE + 0x62F34)
2071+
#define VLV_AUD_PORT_EN_DBG(port) _MMIO_PORT3((port) - PORT_B, \
2072+
_VLV_AUD_PORT_EN_B_DBG, \
2073+
_VLV_AUD_PORT_EN_C_DBG, \
2074+
_VLV_AUD_PORT_EN_D_DBG)
2075+
#define VLV_AMP_MUTE (1 << 1)
2076+
20612077
#define GEN6_BSD_RNCID _MMIO(0x12198)
20622078

20632079
#define GEN7_FF_THREAD_MODE _MMIO(0x20a0)

drivers/gpu/drm/i915/intel_audio.c

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/kernel.h>
2525
#include <linux/component.h>
2626
#include <drm/i915_component.h>
27+
#include <drm/intel_lpe_audio.h>
2728
#include "intel_drv.h"
2829

2930
#include <drm/drmP.h>
@@ -623,13 +624,28 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
623624
dev_priv->av_enc_map[pipe] = intel_encoder;
624625
mutex_unlock(&dev_priv->av_mutex);
625626

626-
/* audio drivers expect pipe = -1 to indicate Non-MST cases */
627-
if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
628-
pipe = -1;
629-
630-
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
627+
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
628+
/* audio drivers expect pipe = -1 to indicate Non-MST cases */
629+
if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
630+
pipe = -1;
631631
acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
632632
(int) port, (int) pipe);
633+
}
634+
635+
switch (intel_encoder->type) {
636+
case INTEL_OUTPUT_HDMI:
637+
intel_lpe_audio_notify(dev_priv, connector->eld, port, pipe,
638+
crtc_state->port_clock,
639+
false, 0);
640+
break;
641+
case INTEL_OUTPUT_DP:
642+
intel_lpe_audio_notify(dev_priv, connector->eld, port, pipe,
643+
adjusted_mode->crtc_clock,
644+
true, crtc_state->port_clock);
645+
break;
646+
default:
647+
break;
648+
}
633649
}
634650

635651
/**
@@ -656,13 +672,15 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
656672
dev_priv->av_enc_map[pipe] = NULL;
657673
mutex_unlock(&dev_priv->av_mutex);
658674

659-
/* audio drivers expect pipe = -1 to indicate Non-MST cases */
660-
if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
661-
pipe = -1;
662-
663-
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
675+
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
676+
/* audio drivers expect pipe = -1 to indicate Non-MST cases */
677+
if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
678+
pipe = -1;
664679
acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
665680
(int) port, (int) pipe);
681+
}
682+
683+
intel_lpe_audio_notify(dev_priv, NULL, port, pipe, 0, false, 0);
666684
}
667685

668686
/**
@@ -931,3 +949,28 @@ void i915_audio_component_cleanup(struct drm_i915_private *dev_priv)
931949
component_del(dev_priv->drm.dev, &i915_audio_component_bind_ops);
932950
dev_priv->audio_component_registered = false;
933951
}
952+
953+
/**
954+
* intel_audio_init() - Initialize the audio driver either using
955+
* component framework or using lpe audio bridge
956+
* @dev_priv: the i915 drm device private data
957+
*
958+
*/
959+
void intel_audio_init(struct drm_i915_private *dev_priv)
960+
{
961+
if (intel_lpe_audio_init(dev_priv) < 0)
962+
i915_audio_component_init(dev_priv);
963+
}
964+
965+
/**
966+
* intel_audio_deinit() - deinitialize the audio driver
967+
* @dev_priv: the i915 drm device private data
968+
*
969+
*/
970+
void intel_audio_deinit(struct drm_i915_private *dev_priv)
971+
{
972+
if ((dev_priv)->lpe_audio.platdev != NULL)
973+
intel_lpe_audio_teardown(dev_priv);
974+
else
975+
i915_audio_component_cleanup(dev_priv);
976+
}

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,8 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,
11961196
void intel_audio_codec_disable(struct intel_encoder *encoder);
11971197
void i915_audio_component_init(struct drm_i915_private *dev_priv);
11981198
void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
1199+
void intel_audio_init(struct drm_i915_private *dev_priv);
1200+
void intel_audio_deinit(struct drm_i915_private *dev_priv);
11991201

12001202
/* intel_display.c */
12011203
enum transcoder intel_crtc_pch_transcoder(struct intel_crtc *crtc);

drivers/gpu/drm/i915/intel_hdmi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <drm/drm_edid.h>
3737
#include "intel_drv.h"
3838
#include <drm/i915_drm.h>
39+
#include <drm/intel_lpe_audio.h>
3940
#include "i915_drv.h"
4041

4142
static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)

0 commit comments

Comments
 (0)