Commit bb7704d6 authored by Sean Paul's avatar Sean Paul Committed by Inki Dae

drm/exynos: Pass exynos_drm_manager in manager ops instead of dev

This patch changes the manager ops callbacks from accepting the subdrv
device pointer to taking a pointer to the manager. This will allow us
to move closer to decoupling manager/display from subdrv, and subsequently
decoupling the crtc/plane from the encoder.
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 4551789f
...@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector, ...@@ -198,7 +198,7 @@ static int exynos_drm_connector_fill_modes(struct drm_connector *connector,
* resolution then get max width and height from that driver. * resolution then get max width and height from that driver.
*/ */
if (ops && ops->get_max_resol) if (ops && ops->get_max_resol)
ops->get_max_resol(manager->dev, &width, &height); ops->get_max_resol(manager, &width, &height);
return drm_helper_probe_single_connector_modes(connector, width, return drm_helper_probe_single_connector_modes(connector, width,
height); height);
......
...@@ -161,27 +161,28 @@ struct exynos_drm_display_ops { ...@@ -161,27 +161,28 @@ struct exynos_drm_display_ops {
* @win_enable: enable hardware specific overlay. * @win_enable: enable hardware specific overlay.
* @win_disable: disable hardware specific overlay. * @win_disable: disable hardware specific overlay.
*/ */
struct exynos_drm_manager;
struct exynos_drm_manager_ops { struct exynos_drm_manager_ops {
int (*initialize)(struct device *subdrv_dev, int (*initialize)(struct exynos_drm_manager *mgr,
struct drm_device *drm_dev); struct drm_device *drm_dev);
void (*dpms)(struct device *subdrv_dev, int mode); void (*dpms)(struct exynos_drm_manager *mgr, int mode);
void (*apply)(struct device *subdrv_dev); void (*apply)(struct exynos_drm_manager *mgr);
void (*mode_fixup)(struct device *subdrv_dev, void (*mode_fixup)(struct exynos_drm_manager *mgr,
struct drm_connector *connector, struct drm_connector *connector,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode); struct drm_display_mode *adjusted_mode);
void (*mode_set)(struct device *subdrv_dev, void *mode); void (*mode_set)(struct exynos_drm_manager *mgr, void *mode);
void (*get_max_resol)(struct device *subdrv_dev, unsigned int *width, void (*get_max_resol)(struct exynos_drm_manager *mgr,
unsigned int *height); unsigned int *width, unsigned int *height);
void (*commit)(struct device *subdrv_dev); void (*commit)(struct exynos_drm_manager *mgr);
int (*enable_vblank)(struct device *subdrv_dev); int (*enable_vblank)(struct exynos_drm_manager *mgr);
void (*disable_vblank)(struct device *subdrv_dev); void (*disable_vblank)(struct exynos_drm_manager *mgr);
void (*wait_for_vblank)(struct device *subdrv_dev); void (*wait_for_vblank)(struct exynos_drm_manager *mgr);
void (*win_mode_set)(struct device *subdrv_dev, void (*win_mode_set)(struct exynos_drm_manager *mgr,
struct exynos_drm_overlay *overlay); struct exynos_drm_overlay *overlay);
void (*win_commit)(struct device *subdrv_dev, int zpos); void (*win_commit)(struct exynos_drm_manager *mgr, int zpos);
void (*win_enable)(struct device *subdrv_dev, int zpos); void (*win_enable)(struct exynos_drm_manager *mgr, int zpos);
void (*win_disable)(struct device *subdrv_dev, int zpos); void (*win_disable)(struct exynos_drm_manager *mgr, int zpos);
}; };
/* /*
...@@ -197,12 +198,14 @@ struct exynos_drm_manager_ops { ...@@ -197,12 +198,14 @@ struct exynos_drm_manager_ops {
* these callbacks should be set by specific drivers such fimd * these callbacks should be set by specific drivers such fimd
* or hdmi driver and are used to control display devices such as * or hdmi driver and are used to control display devices such as
* analog tv, digital tv and lcd panel and also get timing data for them. * analog tv, digital tv and lcd panel and also get timing data for them.
* @ctx: A pointer to the manager's implementation specific context
*/ */
struct exynos_drm_manager { struct exynos_drm_manager {
struct device *dev; struct device *dev;
int pipe; int pipe;
struct exynos_drm_manager_ops *ops; struct exynos_drm_manager_ops *ops;
struct exynos_drm_display_ops *display_ops; struct exynos_drm_display_ops *display_ops;
void *ctx;
}; };
struct exynos_drm_g2d_private { struct exynos_drm_g2d_private {
......
...@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) ...@@ -74,7 +74,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)
case DRM_MODE_DPMS_ON: case DRM_MODE_DPMS_ON:
if (manager_ops && manager_ops->apply) if (manager_ops && manager_ops->apply)
if (!exynos_encoder->updated) if (!exynos_encoder->updated)
manager_ops->apply(manager->dev); manager_ops->apply(manager);
exynos_drm_connector_power(encoder, mode); exynos_drm_connector_power(encoder, mode);
exynos_encoder->dpms = mode; exynos_encoder->dpms = mode;
...@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, ...@@ -107,7 +107,7 @@ exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder,
list_for_each_entry(connector, &dev->mode_config.connector_list, head) { list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder == encoder) if (connector->encoder == encoder)
if (manager_ops && manager_ops->mode_fixup) if (manager_ops && manager_ops->mode_fixup)
manager_ops->mode_fixup(manager->dev, connector, manager_ops->mode_fixup(manager, connector,
mode, adjusted_mode); mode, adjusted_mode);
} }
...@@ -175,8 +175,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, ...@@ -175,8 +175,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder,
manager_ops = manager->ops; manager_ops = manager->ops;
if (manager_ops && manager_ops->mode_set) if (manager_ops && manager_ops->mode_set)
manager_ops->mode_set(manager->dev, manager_ops->mode_set(manager, adjusted_mode);
adjusted_mode);
exynos_encoder->old_crtc = encoder->crtc; exynos_encoder->old_crtc = encoder->crtc;
} }
...@@ -195,7 +194,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) ...@@ -195,7 +194,7 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
struct exynos_drm_manager_ops *manager_ops = manager->ops; struct exynos_drm_manager_ops *manager_ops = manager->ops;
if (manager_ops && manager_ops->commit) if (manager_ops && manager_ops->commit)
manager_ops->commit(manager->dev); manager_ops->commit(manager);
/* /*
* this will avoid one issue that overlay data is updated to * this will avoid one issue that overlay data is updated to
...@@ -233,7 +232,7 @@ void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb) ...@@ -233,7 +232,7 @@ void exynos_drm_encoder_complete_scanout(struct drm_framebuffer *fb)
* real hardware. * real hardware.
*/ */
if (ops->wait_for_vblank) if (ops->wait_for_vblank)
ops->wait_for_vblank(exynos_encoder->manager->dev); ops->wait_for_vblank(exynos_encoder->manager);
} }
} }
...@@ -341,7 +340,7 @@ exynos_drm_encoder_create(struct drm_device *dev, ...@@ -341,7 +340,7 @@ exynos_drm_encoder_create(struct drm_device *dev,
drm_encoder_helper_add(encoder, &exynos_encoder_helper_funcs); drm_encoder_helper_add(encoder, &exynos_encoder_helper_funcs);
if (manager->ops && manager->ops->initialize) { if (manager->ops && manager->ops->initialize) {
ret = manager->ops->initialize(manager->dev, dev); ret = manager->ops->initialize(manager, dev);
if (ret) { if (ret) {
DRM_ERROR("Manager initialize failed %d\n", ret); DRM_ERROR("Manager initialize failed %d\n", ret);
goto error; goto error;
...@@ -408,7 +407,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data) ...@@ -408,7 +407,7 @@ void exynos_drm_enable_vblank(struct drm_encoder *encoder, void *data)
return; return;
if (manager_ops->enable_vblank) if (manager_ops->enable_vblank)
manager_ops->enable_vblank(manager->dev); manager_ops->enable_vblank(manager);
} }
void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data) void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)
...@@ -422,7 +421,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data) ...@@ -422,7 +421,7 @@ void exynos_drm_disable_vblank(struct drm_encoder *encoder, void *data)
return; return;
if (manager_ops->disable_vblank) if (manager_ops->disable_vblank)
manager_ops->disable_vblank(manager->dev); manager_ops->disable_vblank(manager);
} }
void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
...@@ -433,7 +432,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) ...@@ -433,7 +432,7 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data)
int mode = *(int *)data; int mode = *(int *)data;
if (manager_ops && manager_ops->dpms) if (manager_ops && manager_ops->dpms)
manager_ops->dpms(manager->dev, mode); manager_ops->dpms(manager, mode);
/* /*
* if this condition is ok then it means that the crtc is already * if this condition is ok then it means that the crtc is already
...@@ -467,7 +466,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data) ...@@ -467,7 +466,7 @@ void exynos_drm_encoder_plane_mode_set(struct drm_encoder *encoder, void *data)
struct exynos_drm_overlay *overlay = data; struct exynos_drm_overlay *overlay = data;
if (manager_ops && manager_ops->win_mode_set) if (manager_ops && manager_ops->win_mode_set)
manager_ops->win_mode_set(manager->dev, overlay); manager_ops->win_mode_set(manager, overlay);
} }
void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data) void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data)
...@@ -481,7 +480,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data) ...@@ -481,7 +480,7 @@ void exynos_drm_encoder_plane_commit(struct drm_encoder *encoder, void *data)
zpos = *(int *)data; zpos = *(int *)data;
if (manager_ops && manager_ops->win_commit) if (manager_ops && manager_ops->win_commit)
manager_ops->win_commit(manager->dev, zpos); manager_ops->win_commit(manager, zpos);
} }
void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data)
...@@ -495,7 +494,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data) ...@@ -495,7 +494,7 @@ void exynos_drm_encoder_plane_enable(struct drm_encoder *encoder, void *data)
zpos = *(int *)data; zpos = *(int *)data;
if (manager_ops && manager_ops->win_enable) if (manager_ops && manager_ops->win_enable)
manager_ops->win_enable(manager->dev, zpos); manager_ops->win_enable(manager, zpos);
} }
void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
...@@ -509,5 +508,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data) ...@@ -509,5 +508,5 @@ void exynos_drm_encoder_plane_disable(struct drm_encoder *encoder, void *data)
zpos = *(int *)data; zpos = *(int *)data;
if (manager_ops && manager_ops->win_disable) if (manager_ops && manager_ops->win_disable)
manager_ops->win_disable(manager->dev, zpos); manager_ops->win_disable(manager, zpos);
} }
This diff is collapsed.
...@@ -129,11 +129,9 @@ static struct edid *drm_hdmi_get_edid(struct device *dev, ...@@ -129,11 +129,9 @@ static struct edid *drm_hdmi_get_edid(struct device *dev,
return NULL; return NULL;
} }
static int drm_hdmi_check_mode_ctx(struct drm_hdmi_context *ctx,
static int drm_hdmi_check_mode(struct device *dev,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct drm_hdmi_context *ctx = to_context(dev);
int ret = 0; int ret = 0;
/* /*
...@@ -153,6 +151,14 @@ static int drm_hdmi_check_mode(struct device *dev, ...@@ -153,6 +151,14 @@ static int drm_hdmi_check_mode(struct device *dev,
return 0; return 0;
} }
static int drm_hdmi_check_mode(struct device *dev,
struct drm_display_mode *mode)
{
struct drm_hdmi_context *ctx = to_context(dev);
return drm_hdmi_check_mode_ctx(ctx, mode);
}
static int drm_hdmi_power_on(struct device *dev, int mode) static int drm_hdmi_power_on(struct device *dev, int mode)
{ {
struct drm_hdmi_context *ctx = to_context(dev); struct drm_hdmi_context *ctx = to_context(dev);
...@@ -172,9 +178,9 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = { ...@@ -172,9 +178,9 @@ static struct exynos_drm_display_ops drm_hdmi_display_ops = {
.power_on = drm_hdmi_power_on, .power_on = drm_hdmi_power_on,
}; };
static int drm_hdmi_enable_vblank(struct device *subdrv_dev) static int drm_hdmi_enable_vblank(struct exynos_drm_manager *mgr)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct exynos_drm_manager *manager = subdrv->manager; struct exynos_drm_manager *manager = subdrv->manager;
...@@ -185,33 +191,34 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) ...@@ -185,33 +191,34 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)
return 0; return 0;
} }
static void drm_hdmi_disable_vblank(struct device *subdrv_dev) static void drm_hdmi_disable_vblank(struct exynos_drm_manager *mgr)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (mixer_ops && mixer_ops->disable_vblank) if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
} }
static void drm_hdmi_wait_for_vblank(struct device *subdrv_dev) static void drm_hdmi_wait_for_vblank(struct exynos_drm_manager *mgr)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (mixer_ops && mixer_ops->wait_for_vblank) if (mixer_ops && mixer_ops->wait_for_vblank)
mixer_ops->wait_for_vblank(ctx->mixer_ctx->ctx); mixer_ops->wait_for_vblank(ctx->mixer_ctx->ctx);
} }
static void drm_hdmi_mode_fixup(struct device *subdrv_dev, static void drm_hdmi_mode_fixup(struct exynos_drm_manager *mgr,
struct drm_connector *connector, struct drm_connector *connector,
const struct drm_display_mode *mode, const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode) struct drm_display_mode *adjusted_mode)
{ {
struct drm_hdmi_context *ctx = mgr->ctx;
struct drm_display_mode *m; struct drm_display_mode *m;
int mode_ok; int mode_ok;
drm_mode_set_crtcinfo(adjusted_mode, 0); drm_mode_set_crtcinfo(adjusted_mode, 0);
mode_ok = drm_hdmi_check_mode(subdrv_dev, adjusted_mode); mode_ok = drm_hdmi_check_mode_ctx(ctx, adjusted_mode);
/* just return if user desired mode exists. */ /* just return if user desired mode exists. */
if (mode_ok == 0) if (mode_ok == 0)
...@@ -222,7 +229,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, ...@@ -222,7 +229,7 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev,
* to adjusted_mode. * to adjusted_mode.
*/ */
list_for_each_entry(m, &connector->modes, head) { list_for_each_entry(m, &connector->modes, head) {
mode_ok = drm_hdmi_check_mode(subdrv_dev, m); mode_ok = drm_hdmi_check_mode_ctx(ctx, m);
if (mode_ok == 0) { if (mode_ok == 0) {
struct drm_mode_object base; struct drm_mode_object base;
...@@ -245,35 +252,34 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, ...@@ -245,35 +252,34 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev,
} }
} }
static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) static void drm_hdmi_mode_set(struct exynos_drm_manager *mgr, void *mode)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (hdmi_ops && hdmi_ops->mode_set) if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
} }
static void drm_hdmi_get_max_resol(struct device *subdrv_dev, static void drm_hdmi_get_max_resol(struct exynos_drm_manager *mgr,
unsigned int *width, unsigned int *height) unsigned int *width, unsigned int *height)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (hdmi_ops && hdmi_ops->get_max_resol) if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height); hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height);
} }
static void drm_hdmi_commit(struct device *subdrv_dev) static void drm_hdmi_commit(struct exynos_drm_manager *mgr)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (hdmi_ops && hdmi_ops->commit) if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx); hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} }
static int drm_hdmi_mgr_initialize(struct device *subdrv_dev, static int drm_hdmi_mgr_initialize(struct exynos_drm_manager *mgr, struct drm_device *drm_dev)
struct drm_device *drm_dev)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
int ret = 0; int ret = 0;
if (mixer_ops && mixer_ops->initialize) if (mixer_ops && mixer_ops->initialize)
...@@ -285,9 +291,9 @@ static int drm_hdmi_mgr_initialize(struct device *subdrv_dev, ...@@ -285,9 +291,9 @@ static int drm_hdmi_mgr_initialize(struct device *subdrv_dev,
return ret; return ret;
} }
static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) static void drm_hdmi_dpms(struct exynos_drm_manager *mgr, int mode)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (mixer_ops && mixer_ops->dpms) if (mixer_ops && mixer_ops->dpms)
mixer_ops->dpms(ctx->mixer_ctx->ctx, mode); mixer_ops->dpms(ctx->mixer_ctx->ctx, mode);
...@@ -296,9 +302,9 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) ...@@ -296,9 +302,9 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)
hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode); hdmi_ops->dpms(ctx->hdmi_ctx->ctx, mode);
} }
static void drm_hdmi_apply(struct device *subdrv_dev) static void drm_hdmi_apply(struct exynos_drm_manager *mgr)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
int i; int i;
for (i = 0; i < MIXER_WIN_NR; i++) { for (i = 0; i < MIXER_WIN_NR; i++) {
...@@ -312,18 +318,18 @@ static void drm_hdmi_apply(struct device *subdrv_dev) ...@@ -312,18 +318,18 @@ static void drm_hdmi_apply(struct device *subdrv_dev)
hdmi_ops->commit(ctx->hdmi_ctx->ctx); hdmi_ops->commit(ctx->hdmi_ctx->ctx);
} }
static void drm_mixer_win_mode_set(struct device *subdrv_dev, static void drm_mixer_win_mode_set(struct exynos_drm_manager *mgr,
struct exynos_drm_overlay *overlay) struct exynos_drm_overlay *overlay)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
if (mixer_ops && mixer_ops->win_mode_set) if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
} }
static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos) static void drm_mixer_win_commit(struct exynos_drm_manager *mgr, int zpos)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
int win = (zpos == DEFAULT_ZPOS) ? MIXER_DEFAULT_WIN : zpos; int win = (zpos == DEFAULT_ZPOS) ? MIXER_DEFAULT_WIN : zpos;
if (win < 0 || win >= MIXER_WIN_NR) { if (win < 0 || win >= MIXER_WIN_NR) {
...@@ -337,9 +343,9 @@ static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos) ...@@ -337,9 +343,9 @@ static void drm_mixer_win_commit(struct device *subdrv_dev, int zpos)
ctx->enabled[win] = true; ctx->enabled[win] = true;
} }
static void drm_mixer_win_disable(struct device *subdrv_dev, int zpos) static void drm_mixer_win_disable(struct exynos_drm_manager *mgr, int zpos)
{ {
struct drm_hdmi_context *ctx = to_context(subdrv_dev); struct drm_hdmi_context *ctx = mgr->ctx;
int win = (zpos == DEFAULT_ZPOS) ? MIXER_DEFAULT_WIN : zpos; int win = (zpos == DEFAULT_ZPOS) ? MIXER_DEFAULT_WIN : zpos;
if (win < 0 || win >= MIXER_WIN_NR) { if (win < 0 || win >= MIXER_WIN_NR) {
...@@ -425,6 +431,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev) ...@@ -425,6 +431,8 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev)
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
hdmi_manager.ctx = ctx;
subdrv = &ctx->subdrv; subdrv = &ctx->subdrv;
subdrv->dev = dev; subdrv->dev = dev;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* vidi has totally three virtual windows. */ /* vidi has totally three virtual windows. */
#define WINDOWS_NR 3 #define WINDOWS_NR 3
#define get_vidi_context(dev) platform_get_drvdata(to_platform_device(dev)) #define get_vidi_mgr(dev) platform_get_drvdata(to_platform_device(dev))
struct vidi_win_data { struct vidi_win_data {
unsigned int offset_x; unsigned int offset_x;
...@@ -87,7 +87,8 @@ static const char fake_edid_info[] = { ...@@ -87,7 +87,8 @@ static const char fake_edid_info[] = {
static bool vidi_display_is_connected(struct device *dev) static bool vidi_display_is_connected(struct device *dev)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct exynos_drm_manager *mgr = get_vidi_mgr(dev);
struct vidi_context *ctx = mgr->ctx;
/* /*
* connection request would come from user side * connection request would come from user side
...@@ -99,7 +100,8 @@ static bool vidi_display_is_connected(struct device *dev) ...@@ -99,7 +100,8 @@ static bool vidi_display_is_connected(struct device *dev)
static struct edid *vidi_get_edid(struct device *dev, static struct edid *vidi_get_edid(struct device *dev,
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct exynos_drm_manager *mgr = get_vidi_mgr(dev);
struct vidi_context *ctx = mgr->ctx;
struct edid *edid; struct edid *edid;
/* /*
...@@ -150,9 +152,9 @@ static struct exynos_drm_display_ops vidi_display_ops = { ...@@ -150,9 +152,9 @@ static struct exynos_drm_display_ops vidi_display_ops = {
.power_on = vidi_display_power_on, .power_on = vidi_display_power_on,
}; };
static void vidi_dpms(struct device *subdrv_dev, int mode) static void vidi_dpms(struct exynos_drm_manager *mgr, int mode)
{ {
struct vidi_context *ctx = get_vidi_context(subdrv_dev); struct vidi_context *ctx = mgr->ctx;
DRM_DEBUG_KMS("%d\n", mode); DRM_DEBUG_KMS("%d\n", mode);
...@@ -175,10 +177,9 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) ...@@ -175,10 +177,9 @@ static void vidi_dpms(struct device *subdrv_dev, int mode)
mutex_unlock(&ctx->lock); mutex_unlock(&ctx->lock);
} }
static void vidi_apply(struct device *subdrv_dev) static void vidi_apply(struct exynos_drm_manager *mgr)
{ {
struct vidi_context *ctx = get_vidi_context(subdrv_dev); struct vidi_context *ctx = mgr->ctx;
struct exynos_drm_manager *mgr = ctx->subdrv.manager;
struct exynos_drm_manager_ops *mgr_ops = mgr->ops; struct exynos_drm_manager_ops *mgr_ops = mgr->ops;
struct vidi_win_data *win_data; struct vidi_win_data *win_data;
int i; int i;
...@@ -186,24 +187,24 @@ static void vidi_apply(struct device *subdrv_dev) ...@@ -186,24 +187,24 @@ static void vidi_apply(struct device *subdrv_dev)
for (i = 0; i < WINDOWS_NR; i++) { for (i = 0; i < WINDOWS_NR; i++) {
win_data = &ctx->win_data[i]; win_data = &ctx->win_data[i];
if (win_data->enabled && (mgr_ops && mgr_ops->win_commit)) if (win_data->enabled && (mgr_ops && mgr_ops->win_commit))
mgr_ops->win_commit(subdrv_dev, i); mgr_ops->win_commit(mgr, i);
} }
if (mgr_ops && mgr_ops->commit) if (mgr_ops && mgr_ops->commit)
mgr_ops->commit(subdrv_dev); mgr_ops->commit(mgr);
} }
static void vidi_commit(struct device *dev) static void vidi_commit(struct exynos_drm_manager *mgr)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct vidi_context *ctx = mgr->ctx;
if (ctx->suspended) if (ctx->suspended)
return; return;
} }
static int vidi_enable_vblank(struct device *dev) static int vidi_enable_vblank(struct exynos_drm_manager *mgr)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct vidi_context *ctx = mgr->ctx;
if (ctx->suspended) if (ctx->suspended)
return -EPERM; return -EPERM;
...@@ -223,9 +224,9 @@ static int vidi_enable_vblank(struct device *dev) ...@@ -223,9 +224,9 @@ static int vidi_enable_vblank(struct device *dev)
return 0; return 0;
} }
static void vidi_disable_vblank(struct device *dev) static void vidi_disable_vblank(struct exynos_drm_manager *mgr)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct vidi_context *ctx = mgr->ctx;
if (ctx->suspended) if (ctx->suspended)
return; return;
...@@ -234,16 +235,16 @@ static void vidi_disable_vblank(struct device *dev) ...@@ -234,16 +235,16 @@ static void vidi_disable_vblank(struct device *dev)
ctx->vblank_on = false; ctx->vblank_on = false;
} }
static void vidi_win_mode_set(struct device *dev, static void vidi_win_mode_set(struct exynos_drm_manager *mgr,
struct exynos_drm_overlay *overlay) struct exynos_drm_overlay *overlay)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct vidi_context *ctx = mgr->ctx;
struct vidi_win_data *win_data; struct vidi_win_data *win_data;
int win; int win;
unsigned long offset; unsigned long offset;
if (!overlay) { if (!overlay) {
dev_err(dev, "overlay is NULL\n"); DRM_ERROR("overlay is NULL\n");
return; return;
} }
...@@ -287,9 +288,9 @@ static void vidi_win_mode_set(struct device *dev, ...@@ -287,9 +288,9 @@ static void vidi_win_mode_set(struct device *dev,
overlay->fb_width, overlay->crtc_width); overlay->fb_width, overlay->crtc_width);
} }
static void vidi_win_commit(struct device *dev, int zpos) static void vidi_win_commit(struct exynos_drm_manager *mgr, int zpos)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct vidi_context *ctx = mgr->ctx;
struct vidi_win_data *win_data; struct vidi_win_data *win_data;
int win = zpos; int win = zpos;
...@@ -312,9 +313,9 @@ static void vidi_win_commit(struct device *dev, int zpos) ...@@ -312,9 +313,9 @@ static void vidi_win_commit(struct device *dev, int zpos)
schedule_work(&ctx->work); schedule_work(&ctx->work);
} }
static void vidi_win_disable(struct device *dev, int zpos) static void vidi_win_disable(struct exynos_drm_manager *mgr, int zpos)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct vidi_context *ctx = mgr->ctx;
struct vidi_win_data *win_data; struct vidi_win_data *win_data;
int win = zpos; int win = zpos;
...@@ -401,19 +402,23 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev) ...@@ -401,19 +402,23 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)
/* TODO. */ /* TODO. */
} }
static int vidi_power_on(struct vidi_context *ctx, bool enable) static int vidi_power_on(struct exynos_drm_manager *mgr, bool enable)
{ {
struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct vidi_context *ctx = mgr->ctx;
struct device *dev = subdrv->dev;
DRM_DEBUG_KMS("%s\n", __FILE__);
if (enable != false && enable != true)
return -EINVAL;
if (enable) { if (enable) {
ctx->suspended = false; ctx->suspended = false;
/* if vblank was enabled status, enable it again. */ /* if vblank was enabled status, enable it again. */
if (test_and_clear_bit(0, &ctx->irq_flags)) if (test_and_clear_bit(0, &ctx->irq_flags))
vidi_enable_vblank(dev); vidi_enable_vblank(mgr);
vidi_apply(dev); vidi_apply(mgr);
} else { } else {
ctx->suspended = true; ctx->suspended = true;
} }
...@@ -425,7 +430,8 @@ static int vidi_show_connection(struct device *dev, ...@@ -425,7 +430,8 @@ static int vidi_show_connection(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int rc; int rc;
struct vidi_context *ctx = get_vidi_context(dev); struct exynos_drm_manager *mgr = get_vidi_mgr(dev);
struct vidi_context *ctx = mgr->ctx;
mutex_lock(&ctx->lock); mutex_lock(&ctx->lock);
...@@ -440,7 +446,8 @@ static int vidi_store_connection(struct device *dev, ...@@ -440,7 +446,8 @@ static int vidi_store_connection(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t len) const char *buf, size_t len)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct exynos_drm_manager *mgr = get_vidi_mgr(dev);
struct vidi_context *ctx = mgr->ctx;
int ret; int ret;
ret = kstrtoint(buf, 0, &ctx->connected); ret = kstrtoint(buf, 0, &ctx->connected);
...@@ -495,7 +502,7 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, ...@@ -495,7 +502,7 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
display_ops = manager->display_ops; display_ops = manager->display_ops;
if (display_ops->type == EXYNOS_DISPLAY_TYPE_VIDI) { if (display_ops->type == EXYNOS_DISPLAY_TYPE_VIDI) {
ctx = get_vidi_context(manager->dev); ctx = manager->ctx;
break; break;
} }
} }
...@@ -554,6 +561,8 @@ static int vidi_probe(struct platform_device *pdev) ...@@ -554,6 +561,8 @@ static int vidi_probe(struct platform_device *pdev)
INIT_WORK(&ctx->work, vidi_fake_vblank_handler); INIT_WORK(&ctx->work, vidi_fake_vblank_handler);
vidi_manager.ctx = ctx;
subdrv = &ctx->subdrv; subdrv = &ctx->subdrv;
subdrv->dev = dev; subdrv->dev = dev;
subdrv->manager = &vidi_manager; subdrv->manager = &vidi_manager;
...@@ -562,7 +571,7 @@ static int vidi_probe(struct platform_device *pdev) ...@@ -562,7 +571,7 @@ static int vidi_probe(struct platform_device *pdev)
mutex_init(&ctx->lock); mutex_init(&ctx->lock);
platform_set_drvdata(pdev, ctx); platform_set_drvdata(pdev, &vidi_manager);
ret = device_create_file(dev, &dev_attr_connection); ret = device_create_file(dev, &dev_attr_connection);
if (ret < 0) if (ret < 0)
...@@ -590,16 +599,16 @@ static int vidi_remove(struct platform_device *pdev) ...@@ -590,16 +599,16 @@ static int vidi_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int vidi_suspend(struct device *dev) static int vidi_suspend(struct device *dev)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct exynos_drm_manager *mgr = get_vidi_mgr(dev);
return vidi_power_on(ctx, false); return vidi_power_on(mgr, false);
} }
static int vidi_resume(struct device *dev) static int vidi_resume(struct device *dev)
{ {
struct vidi_context *ctx = get_vidi_context(dev); struct exynos_drm_manager *mgr = get_vidi_mgr(dev);
return vidi_power_on(ctx, true); return vidi_power_on(mgr, true);
} }
#endif #endif
......
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