Skip to content

Commit 46d196e

Browse files
jeromeantiwai
authored andcommitted
drm/i915: Add support for audio driver notifications
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 <[email protected]> Signed-off-by: Jerome Anand <[email protected]> Acked-by: Jani Nikula <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent eef5732 commit 46d196e

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,8 @@ void i915_teardown_sysfs(struct drm_i915_private *dev_priv);
34003400
int intel_lpe_audio_init(struct drm_i915_private *dev_priv);
34013401
void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
34023402
void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
3403+
void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
3404+
void *eld, int port, int tmds_clk_speed);
34033405

34043406
/* intel_i2c.c */
34053407
extern int intel_setup_gmbus(struct drm_device *dev);

drivers/gpu/drm/i915/intel_audio.c

Lines changed: 6 additions & 0 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>
@@ -630,6 +631,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
630631
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
631632
acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
632633
(int) port, (int) pipe);
634+
635+
intel_lpe_audio_notify(dev_priv, connector->eld, port,
636+
crtc_state->port_clock);
633637
}
634638

635639
/**
@@ -663,6 +667,8 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
663667
if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
664668
acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
665669
(int) port, (int) pipe);
670+
671+
intel_lpe_audio_notify(dev_priv, NULL, port, 0);
666672
}
667673

668674
/**

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)

drivers/gpu/drm/i915/intel_lpe_audio.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,52 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
319319

320320
irq_free_desc(dev_priv->lpe_audio.irq);
321321
}
322+
323+
324+
/**
325+
* intel_lpe_audio_notify() - notify lpe audio event
326+
* audio driver and i915
327+
* @dev_priv: the i915 drm device private data
328+
* @eld : ELD data
329+
* @port: port id
330+
* @tmds_clk_speed: tmds clock frequency in Hz
331+
*
332+
* Notify lpe audio driver of eld change.
333+
*/
334+
void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
335+
void *eld, int port, int tmds_clk_speed)
336+
{
337+
unsigned long irq_flags;
338+
struct intel_hdmi_lpe_audio_pdata *pdata = NULL;
339+
340+
if (!HAS_LPE_AUDIO(dev_priv))
341+
return;
342+
343+
pdata = dev_get_platdata(
344+
&(dev_priv->lpe_audio.platdev->dev));
345+
346+
spin_lock_irqsave(&pdata->lpe_audio_slock, irq_flags);
347+
348+
if (eld != NULL) {
349+
memcpy(pdata->eld.eld_data, eld,
350+
HDMI_MAX_ELD_BYTES);
351+
pdata->eld.port_id = port;
352+
pdata->hdmi_connected = true;
353+
354+
if (tmds_clk_speed)
355+
pdata->tmds_clock_speed = tmds_clk_speed;
356+
} else {
357+
memset(pdata->eld.eld_data, 0,
358+
HDMI_MAX_ELD_BYTES);
359+
pdata->hdmi_connected = false;
360+
}
361+
362+
if (pdata->notify_audio_lpe)
363+
pdata->notify_audio_lpe(
364+
(eld != NULL) ? &pdata->eld : NULL);
365+
else
366+
pdata->notify_pending = true;
367+
368+
spin_unlock_irqrestore(&pdata->lpe_audio_slock,
369+
irq_flags);
370+
}

0 commit comments

Comments
 (0)