Commit b1c01f4d authored by Takashi Iwai's avatar Takashi Iwai

drm/i915: Pass platform device to LPE audio notifier

This allows the LPE HDMI driver to clean up its global variable
reference.

Also drop to pass the eld pointer because the connection status and
the ELD bytes can be retrieved from the attached pdata.
Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0843e043
...@@ -378,8 +378,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, ...@@ -378,8 +378,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
} }
if (pdata->notify_audio_lpe) if (pdata->notify_audio_lpe)
pdata->notify_audio_lpe( pdata->notify_audio_lpe(dev_priv->lpe_audio.platdev);
(eld != NULL) ? &pdata->eld : NULL);
else else
pdata->notify_pending = true; pdata->notify_pending = true;
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/spinlock_types.h> #include <linux/spinlock_types.h>
struct platform_device;
#define HDMI_MAX_ELD_BYTES 128 #define HDMI_MAX_ELD_BYTES 128
struct intel_hdmi_lpe_audio_eld { struct intel_hdmi_lpe_audio_eld {
...@@ -42,7 +44,7 @@ struct intel_hdmi_lpe_audio_pdata { ...@@ -42,7 +44,7 @@ struct intel_hdmi_lpe_audio_pdata {
bool dp_output; bool dp_output;
int link_rate; int link_rate;
struct intel_hdmi_lpe_audio_eld eld; struct intel_hdmi_lpe_audio_eld eld;
void (*notify_audio_lpe)(void *audio_ptr); void (*notify_audio_lpe)(struct platform_device *pdev);
spinlock_t lpe_audio_slock; spinlock_t lpe_audio_slock;
}; };
......
...@@ -439,15 +439,14 @@ static irqreturn_t display_pipe_interrupt_handler(int irq, void *dev_id) ...@@ -439,15 +439,14 @@ static irqreturn_t display_pipe_interrupt_handler(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void notify_audio_lpe(void *audio_ptr) static void notify_audio_lpe(struct platform_device *pdev)
{ {
struct hdmi_lpe_audio_ctx *ctx = get_hdmi_context(); struct hdmi_lpe_audio_ctx *ctx = platform_get_drvdata(pdev);
struct intel_hdmi_lpe_audio_pdata *pdata = hlpe_pdev->dev.platform_data; struct intel_hdmi_lpe_audio_pdata *pdata = pdev->dev.platform_data;
struct intel_hdmi_lpe_audio_eld *eld = audio_ptr;
if (pdata->hdmi_connected != true) { if (pdata->hdmi_connected != true) {
dev_dbg(&hlpe_pdev->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG\n", dev_dbg(&pdev->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG\n",
__func__); __func__);
if (hlpe_state == hdmi_connector_status_connected) { if (hlpe_state == hdmi_connector_status_connected) {
...@@ -458,10 +457,11 @@ static void notify_audio_lpe(void *audio_ptr) ...@@ -458,10 +457,11 @@ static void notify_audio_lpe(void *audio_ptr)
mid_hdmi_audio_signal_event( mid_hdmi_audio_signal_event(
HAD_EVENT_HOT_UNPLUG); HAD_EVENT_HOT_UNPLUG);
} else } else
dev_dbg(&hlpe_pdev->dev, "%s: Already Unplugged!\n", dev_dbg(&pdev->dev, "%s: Already Unplugged!\n",
__func__); __func__);
} else if (eld != NULL) { } else {
struct intel_hdmi_lpe_audio_eld *eld = &pdata->eld;
switch (eld->pipe_id) { switch (eld->pipe_id) {
case 0: case 0:
...@@ -474,7 +474,7 @@ static void notify_audio_lpe(void *audio_ptr) ...@@ -474,7 +474,7 @@ static void notify_audio_lpe(void *audio_ptr)
ctx->had_config_offset = AUDIO_HDMI_CONFIG_C; ctx->had_config_offset = AUDIO_HDMI_CONFIG_C;
break; break;
default: default:
dev_dbg(&hlpe_pdev->dev, "Invalid pipe %d\n", dev_dbg(&pdev->dev, "Invalid pipe %d\n",
eld->pipe_id); eld->pipe_id);
break; break;
} }
...@@ -485,7 +485,7 @@ static void notify_audio_lpe(void *audio_ptr) ...@@ -485,7 +485,7 @@ static void notify_audio_lpe(void *audio_ptr)
hlpe_state = hdmi_connector_status_connected; hlpe_state = hdmi_connector_status_connected;
dev_dbg(&hlpe_pdev->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n", dev_dbg(&pdev->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n",
__func__, eld->port_id, pdata->tmds_clock_speed); __func__, eld->port_id, pdata->tmds_clock_speed);
if (pdata->tmds_clock_speed) { if (pdata->tmds_clock_speed) {
...@@ -494,8 +494,7 @@ static void notify_audio_lpe(void *audio_ptr) ...@@ -494,8 +494,7 @@ static void notify_audio_lpe(void *audio_ptr)
ctx->link_rate = pdata->link_rate; ctx->link_rate = pdata->link_rate;
mid_hdmi_audio_signal_event(HAD_EVENT_MODE_CHANGING); mid_hdmi_audio_signal_event(HAD_EVENT_MODE_CHANGING);
} }
} else }
dev_dbg(&hlpe_pdev->dev, "%s: Event: NULL EDID!!\n", __func__);
} }
/** /**
...@@ -606,7 +605,7 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev) ...@@ -606,7 +605,7 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
if (pdata->notify_pending) { if (pdata->notify_pending) {
dev_dbg(&hlpe_pdev->dev, "%s: handle pending notification\n", __func__); dev_dbg(&hlpe_pdev->dev, "%s: handle pending notification\n", __func__);
notify_audio_lpe(&pdata->eld); notify_audio_lpe(pdev);
pdata->notify_pending = false; pdata->notify_pending = false;
} }
spin_unlock_irqrestore(&pdata->lpe_audio_slock, flag_irq); spin_unlock_irqrestore(&pdata->lpe_audio_slock, flag_irq);
......
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