Commit 4551789f authored by Sean Paul's avatar Sean Paul Committed by Inki Dae

drm/exynos: hdmi: Implement initialize op for hdmi

This patch implements the initialize callback in the hdmi and mixer
manager. This allows us to get rid of drm_dev in the drm_hdmi level and
track it in the mixer and hdmi drivers. This is one of the things
holding back the complete removal of the drm_hdmi layer.
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 40c8ab4b
...@@ -97,6 +97,18 @@ void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) ...@@ -97,6 +97,18 @@ void exynos_mixer_ops_register(struct exynos_mixer_ops *ops)
mixer_ops = ops; mixer_ops = ops;
} }
static int drm_hdmi_display_initialize(struct device *dev,
struct drm_device *drm_dev)
{
struct drm_hdmi_context *ctx = to_context(dev);
if (hdmi_ops && hdmi_ops->initialize)
return hdmi_ops->initialize(ctx->hdmi_ctx->ctx, drm_dev);
return 0;
}
static bool drm_hdmi_is_connected(struct device *dev) static bool drm_hdmi_is_connected(struct device *dev)
{ {
struct drm_hdmi_context *ctx = to_context(dev); struct drm_hdmi_context *ctx = to_context(dev);
...@@ -153,6 +165,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode) ...@@ -153,6 +165,7 @@ static int drm_hdmi_power_on(struct device *dev, int mode)
static struct exynos_drm_display_ops drm_hdmi_display_ops = { static struct exynos_drm_display_ops drm_hdmi_display_ops = {
.type = EXYNOS_DISPLAY_TYPE_HDMI, .type = EXYNOS_DISPLAY_TYPE_HDMI,
.initialize = drm_hdmi_display_initialize,
.is_connected = drm_hdmi_is_connected, .is_connected = drm_hdmi_is_connected,
.get_edid = drm_hdmi_get_edid, .get_edid = drm_hdmi_get_edid,
.check_mode = drm_hdmi_check_mode, .check_mode = drm_hdmi_check_mode,
...@@ -257,6 +270,21 @@ static void drm_hdmi_commit(struct device *subdrv_dev) ...@@ -257,6 +270,21 @@ static void drm_hdmi_commit(struct device *subdrv_dev)
hdmi_ops->commit(ctx->hdmi_ctx->ctx); hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} }
static int drm_hdmi_mgr_initialize(struct device *subdrv_dev,
struct drm_device *drm_dev)
{
struct drm_hdmi_context *ctx = to_context(subdrv_dev);
int ret = 0;
if (mixer_ops && mixer_ops->initialize)
ret = mixer_ops->initialize(ctx->mixer_ctx->ctx, drm_dev);
if (mixer_ops->iommu_on)
mixer_ops->iommu_on(ctx->mixer_ctx->ctx, true);
return ret;
}
static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = to_context(subdrv_dev);
...@@ -326,6 +354,7 @@ static void drm_mixer_win_disable(struct device *subdrv_dev, int zpos) ...@@ -326,6 +354,7 @@ static void drm_mixer_win_disable(struct device *subdrv_dev, int zpos)
} }
static struct exynos_drm_manager_ops drm_hdmi_manager_ops = { static struct exynos_drm_manager_ops drm_hdmi_manager_ops = {
.initialize = drm_hdmi_mgr_initialize,
.dpms = drm_hdmi_dpms, .dpms = drm_hdmi_dpms,
.apply = drm_hdmi_apply, .apply = drm_hdmi_apply,
.enable_vblank = drm_hdmi_enable_vblank, .enable_vblank = drm_hdmi_enable_vblank,
...@@ -372,12 +401,6 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev, ...@@ -372,12 +401,6 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev,
ctx->hdmi_ctx = hdmi_ctx; ctx->hdmi_ctx = hdmi_ctx;
ctx->mixer_ctx = mixer_ctx; ctx->mixer_ctx = mixer_ctx;
ctx->hdmi_ctx->drm_dev = drm_dev;
ctx->mixer_ctx->drm_dev = drm_dev;
if (mixer_ops->iommu_on)
mixer_ops->iommu_on(ctx->mixer_ctx->ctx, true);
return 0; return 0;
} }
......
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
* this context should be hdmi_context or mixer_context. * this context should be hdmi_context or mixer_context.
*/ */
struct exynos_drm_hdmi_context { struct exynos_drm_hdmi_context {
struct drm_device *drm_dev;
void *ctx; void *ctx;
}; };
struct exynos_hdmi_ops { struct exynos_hdmi_ops {
/* display */ /* display */
int (*initialize)(void *ctx, struct drm_device *drm_dev);
bool (*is_connected)(void *ctx); bool (*is_connected)(void *ctx);
struct edid *(*get_edid)(void *ctx, struct edid *(*get_edid)(void *ctx,
struct drm_connector *connector); struct drm_connector *connector);
...@@ -45,6 +45,7 @@ struct exynos_hdmi_ops { ...@@ -45,6 +45,7 @@ struct exynos_hdmi_ops {
struct exynos_mixer_ops { struct exynos_mixer_ops {
/* manager */ /* manager */
int (*initialize)(void *ctx, struct drm_device *drm_dev);
int (*iommu_on)(void *ctx, bool enable); int (*iommu_on)(void *ctx, bool enable);
int (*enable_vblank)(void *ctx, int pipe); int (*enable_vblank)(void *ctx, int pipe);
void (*disable_vblank)(void *ctx); void (*disable_vblank)(void *ctx);
......
...@@ -792,6 +792,15 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, ...@@ -792,6 +792,15 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,
} }
} }
static int hdmi_initialize(void *ctx, struct drm_device *drm_dev)
{
struct hdmi_context *hdata = ctx;
hdata->drm_dev = drm_dev;
return 0;
}
static bool hdmi_is_connected(void *ctx) static bool hdmi_is_connected(void *ctx)
{ {
struct hdmi_context *hdata = ctx; struct hdmi_context *hdata = ctx;
...@@ -1799,6 +1808,7 @@ static void hdmi_dpms(void *ctx, int mode) ...@@ -1799,6 +1808,7 @@ static void hdmi_dpms(void *ctx, int mode)
static struct exynos_hdmi_ops hdmi_ops = { static struct exynos_hdmi_ops hdmi_ops = {
/* display */ /* display */
.initialize = hdmi_initialize,
.is_connected = hdmi_is_connected, .is_connected = hdmi_is_connected,
.get_edid = hdmi_get_edid, .get_edid = hdmi_get_edid,
.check_mode = hdmi_check_mode, .check_mode = hdmi_check_mode,
...@@ -1819,8 +1829,8 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg) ...@@ -1819,8 +1829,8 @@ static irqreturn_t hdmi_irq_thread(int irq, void *arg)
hdata->hpd = gpio_get_value(hdata->hpd_gpio); hdata->hpd = gpio_get_value(hdata->hpd_gpio);
mutex_unlock(&hdata->hdmi_mutex); mutex_unlock(&hdata->hdmi_mutex);
if (ctx->drm_dev) if (hdata->drm_dev)
drm_helper_hpd_irq_event(ctx->drm_dev); drm_helper_hpd_irq_event(hdata->drm_dev);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -2078,8 +2088,8 @@ static int hdmi_suspend(struct device *dev) ...@@ -2078,8 +2088,8 @@ static int hdmi_suspend(struct device *dev)
disable_irq(hdata->irq); disable_irq(hdata->irq);
hdata->hpd = false; hdata->hpd = false;
if (ctx->drm_dev) if (hdata->drm_dev)
drm_helper_hpd_irq_event(ctx->drm_dev); drm_helper_hpd_irq_event(hdata->drm_dev);
if (pm_runtime_suspended(dev)) { if (pm_runtime_suspended(dev)) {
DRM_DEBUG_KMS("Already suspended\n"); DRM_DEBUG_KMS("Already suspended\n");
......
This diff is collapsed.
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