Commit 4be1c12c authored by Jani Nikula's avatar Jani Nikula

drm/i915: move and split audio under display.audio and display.funcs

Move display audio related members under drm_i915_private display
sub-struct.

Split audio funcs to display.funcs to follow the same pattern as all the
other display functions.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarArun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/51c0b966963a8b47efe3a431e0ce106bdd5269c5.1661346845.git.jani.nikula@intel.com
parent 6c77055a
This diff is collapsed.
......@@ -10,11 +10,14 @@
#include <linux/types.h>
#include <linux/wait.h>
#include "intel_display.h"
#include "intel_dmc.h"
#include "intel_gmbus.h"
struct drm_i915_private;
struct i915_audio_component;
struct intel_atomic_state;
struct intel_audio_funcs;
struct intel_cdclk_funcs;
struct intel_color_funcs;
struct intel_crtc;
......@@ -57,6 +60,25 @@ struct intel_wm_funcs {
int (*compute_global_watermarks)(struct intel_atomic_state *state);
};
struct intel_audio {
/* hda/i915 audio component */
struct i915_audio_component *component;
bool component_registered;
/* mutex for audio/video sync */
struct mutex mutex;
int power_refcount;
u32 freq_cntrl;
/* Used to save the pipe-to-encoder mapping for audio */
struct intel_encoder *encoder_map[I915_MAX_PIPES];
/* necessary resource sharing with HDMI LPE audio driver. */
struct {
struct platform_device *platdev;
int irq;
} lpe;
};
struct intel_display {
/* Display functions */
struct {
......@@ -80,6 +102,9 @@ struct intel_display {
/* Display internal color functions */
const struct intel_color_funcs *color;
/* Display internal audio functions */
const struct intel_audio_funcs *audio;
} funcs;
/* Grouping using anonymous structs. Keep sorted. */
......@@ -109,6 +134,7 @@ struct intel_display {
} pps;
/* Grouping using named structs. Keep sorted. */
struct intel_audio audio;
struct intel_dmc dmc;
};
......
......@@ -75,7 +75,7 @@
#include "intel_lpe_audio.h"
#include "intel_pci_config.h"
#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->audio.lpe.platdev != NULL)
#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->display.audio.lpe.platdev != NULL)
static struct platform_device *
lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
......@@ -97,7 +97,7 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
return ERR_PTR(-ENOMEM);
}
rsc[0].start = rsc[0].end = dev_priv->audio.lpe.irq;
rsc[0].start = rsc[0].end = dev_priv->display.audio.lpe.irq;
rsc[0].flags = IORESOURCE_IRQ;
rsc[0].name = "hdmi-lpe-audio-irq";
......@@ -149,7 +149,7 @@ static void lpe_audio_platdev_destroy(struct drm_i915_private *dev_priv)
* than us fiddle with its internals.
*/
platform_device_unregister(dev_priv->audio.lpe.platdev);
platform_device_unregister(dev_priv->display.audio.lpe.platdev);
}
static void lpe_audio_irq_unmask(struct irq_data *d)
......@@ -168,7 +168,7 @@ static struct irq_chip lpe_audio_irqchip = {
static int lpe_audio_irq_init(struct drm_i915_private *dev_priv)
{
int irq = dev_priv->audio.lpe.irq;
int irq = dev_priv->display.audio.lpe.irq;
drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv));
irq_set_chip_and_handler_name(irq,
......@@ -205,15 +205,15 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv)
{
int ret;
dev_priv->audio.lpe.irq = irq_alloc_desc(0);
if (dev_priv->audio.lpe.irq < 0) {
dev_priv->display.audio.lpe.irq = irq_alloc_desc(0);
if (dev_priv->display.audio.lpe.irq < 0) {
drm_err(&dev_priv->drm, "Failed to allocate IRQ desc: %d\n",
dev_priv->audio.lpe.irq);
ret = dev_priv->audio.lpe.irq;
dev_priv->display.audio.lpe.irq);
ret = dev_priv->display.audio.lpe.irq;
goto err;
}
drm_dbg(&dev_priv->drm, "irq = %d\n", dev_priv->audio.lpe.irq);
drm_dbg(&dev_priv->drm, "irq = %d\n", dev_priv->display.audio.lpe.irq);
ret = lpe_audio_irq_init(dev_priv);
......@@ -224,10 +224,10 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv)
goto err_free_irq;
}
dev_priv->audio.lpe.platdev = lpe_audio_platdev_create(dev_priv);
dev_priv->display.audio.lpe.platdev = lpe_audio_platdev_create(dev_priv);
if (IS_ERR(dev_priv->audio.lpe.platdev)) {
ret = PTR_ERR(dev_priv->audio.lpe.platdev);
if (IS_ERR(dev_priv->display.audio.lpe.platdev)) {
ret = PTR_ERR(dev_priv->display.audio.lpe.platdev);
drm_err(&dev_priv->drm,
"Failed to create lpe audio platform device: %d\n",
ret);
......@@ -242,10 +242,10 @@ static int lpe_audio_setup(struct drm_i915_private *dev_priv)
return 0;
err_free_irq:
irq_free_desc(dev_priv->audio.lpe.irq);
irq_free_desc(dev_priv->display.audio.lpe.irq);
err:
dev_priv->audio.lpe.irq = -1;
dev_priv->audio.lpe.platdev = NULL;
dev_priv->display.audio.lpe.irq = -1;
dev_priv->display.audio.lpe.platdev = NULL;
return ret;
}
......@@ -263,7 +263,7 @@ void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv)
if (!HAS_LPE_AUDIO(dev_priv))
return;
ret = generic_handle_irq(dev_priv->audio.lpe.irq);
ret = generic_handle_irq(dev_priv->display.audio.lpe.irq);
if (ret)
drm_err_ratelimited(&dev_priv->drm,
"error handling LPE audio irq: %d\n", ret);
......@@ -304,10 +304,10 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
lpe_audio_platdev_destroy(dev_priv);
irq_free_desc(dev_priv->audio.lpe.irq);
irq_free_desc(dev_priv->display.audio.lpe.irq);
dev_priv->audio.lpe.irq = -1;
dev_priv->audio.lpe.platdev = NULL;
dev_priv->display.audio.lpe.irq = -1;
dev_priv->display.audio.lpe.platdev = NULL;
}
/**
......@@ -334,7 +334,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
if (!HAS_LPE_AUDIO(dev_priv))
return;
pdata = dev_get_platdata(&dev_priv->audio.lpe.platdev->dev);
pdata = dev_get_platdata(&dev_priv->display.audio.lpe.platdev->dev);
ppdata = &pdata->port[port - PORT_B];
spin_lock_irqsave(&pdata->lpe_audio_slock, irqflags);
......@@ -362,7 +362,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
}
if (pdata->notify_audio_lpe)
pdata->notify_audio_lpe(dev_priv->audio.lpe.platdev, port - PORT_B);
pdata->notify_audio_lpe(dev_priv->display.audio.lpe.platdev, port - PORT_B);
spin_unlock_irqrestore(&pdata->lpe_audio_slock, irqflags);
}
......@@ -335,7 +335,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
mutex_init(&dev_priv->sb_lock);
cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE);
mutex_init(&dev_priv->audio.mutex);
mutex_init(&dev_priv->display.audio.mutex);
mutex_init(&dev_priv->wm.wm_mutex);
mutex_init(&dev_priv->display.pps.mutex);
mutex_init(&dev_priv->hdcp_comp_mutex);
......
......@@ -79,7 +79,6 @@ struct dpll;
struct drm_i915_clock_gating_funcs;
struct drm_i915_gem_object;
struct drm_i915_private;
struct intel_audio_funcs;
struct intel_cdclk_config;
struct intel_cdclk_state;
struct intel_cdclk_vals;
......@@ -307,29 +306,6 @@ struct i915_selftest_stash {
struct ida mock_region_instances;
};
/* intel_audio.c private */
struct intel_audio_private {
/* Display internal audio functions */
const struct intel_audio_funcs *funcs;
/* hda/i915 audio component */
struct i915_audio_component *component;
bool component_registered;
/* mutex for audio/video sync */
struct mutex mutex;
int power_refcount;
u32 freq_cntrl;
/* Used to save the pipe-to-encoder mapping for audio */
struct intel_encoder *encoder_map[I915_MAX_PIPES];
/* necessary resource sharing with HDMI LPE audio driver. */
struct {
struct platform_device *platdev;
int irq;
} lpe;
};
struct drm_i915_private {
struct drm_device drm;
......@@ -675,8 +651,6 @@ struct drm_i915_private {
bool ipc_enabled;
struct intel_audio_private audio;
struct i915_pmu pmu;
struct i915_drm_clients clients;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment