Skip to content

Commit

Permalink
drm/exynos: fix struct for operation callback functions to driver name
Browse files Browse the repository at this point in the history
The mixer driver and hdmi driver have each operation callback functions
and they is registered to hdmi common driver. Their struct names in hdmi
common driver include display, manager and overlay. It confuses to
appear whose operation and two driver cannot register same operation
callback functions at the same time. Use their struct names to driver
name.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
  • Loading branch information
Joonyoung Shim authored and Inki Dae committed Apr 12, 2012
1 parent a2ee151 commit 578b606
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 79 deletions.
92 changes: 39 additions & 53 deletions drivers/gpu/drm/exynos/exynos_drm_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,29 @@
struct drm_hdmi_context, subdrv);

/* these callback points shoud be set by specific drivers. */
static struct exynos_hdmi_display_ops *hdmi_display_ops;
static struct exynos_hdmi_manager_ops *hdmi_manager_ops;
static struct exynos_hdmi_overlay_ops *hdmi_overlay_ops;
static struct exynos_hdmi_ops *hdmi_ops;
static struct exynos_mixer_ops *mixer_ops;

struct drm_hdmi_context {
struct exynos_drm_subdrv subdrv;
struct exynos_drm_hdmi_context *hdmi_ctx;
struct exynos_drm_hdmi_context *mixer_ctx;
};

void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops
*display_ops)
void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops)
{
DRM_DEBUG_KMS("%s\n", __FILE__);

if (display_ops)
hdmi_display_ops = display_ops;
if (ops)
hdmi_ops = ops;
}

void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops
*manager_ops)
void exynos_mixer_ops_register(struct exynos_mixer_ops *ops)
{
DRM_DEBUG_KMS("%s\n", __FILE__);

if (manager_ops)
hdmi_manager_ops = manager_ops;
}

void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops
*overlay_ops)
{
DRM_DEBUG_KMS("%s\n", __FILE__);

if (overlay_ops)
hdmi_overlay_ops = overlay_ops;
if (ops)
mixer_ops = ops;
}

static bool drm_hdmi_is_connected(struct device *dev)
Expand All @@ -73,8 +61,8 @@ static bool drm_hdmi_is_connected(struct device *dev)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_display_ops && hdmi_display_ops->is_connected)
return hdmi_display_ops->is_connected(ctx->hdmi_ctx->ctx);
if (hdmi_ops && hdmi_ops->is_connected)
return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx);

return false;
}
Expand All @@ -86,9 +74,9 @@ static int drm_hdmi_get_edid(struct device *dev,

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_display_ops && hdmi_display_ops->get_edid)
return hdmi_display_ops->get_edid(ctx->hdmi_ctx->ctx,
connector, edid, len);
if (hdmi_ops && hdmi_ops->get_edid)
return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid,
len);

return 0;
}
Expand All @@ -99,9 +87,8 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_display_ops && hdmi_display_ops->check_timing)
return hdmi_display_ops->check_timing(ctx->hdmi_ctx->ctx,
timing);
if (hdmi_ops && hdmi_ops->check_timing)
return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing);

return 0;
}
Expand All @@ -112,8 +99,8 @@ static int drm_hdmi_power_on(struct device *dev, int mode)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_display_ops && hdmi_display_ops->power_on)
return hdmi_display_ops->power_on(ctx->hdmi_ctx->ctx, mode);
if (hdmi_ops && hdmi_ops->power_on)
return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode);

return 0;
}
Expand All @@ -134,9 +121,9 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_overlay_ops && hdmi_overlay_ops->enable_vblank)
return hdmi_overlay_ops->enable_vblank(ctx->mixer_ctx->ctx,
manager->pipe);
if (mixer_ops && mixer_ops->enable_vblank)
return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx,
manager->pipe);

return 0;
}
Expand All @@ -147,8 +134,8 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_overlay_ops && hdmi_overlay_ops->disable_vblank)
return hdmi_overlay_ops->disable_vblank(ctx->mixer_ctx->ctx);
if (mixer_ops && mixer_ops->disable_vblank)
return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx);
}

static void drm_hdmi_mode_fixup(struct device *subdrv_dev,
Expand All @@ -160,9 +147,9 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev,

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_manager_ops && hdmi_manager_ops->mode_fixup)
hdmi_manager_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector,
mode, adjusted_mode);
if (hdmi_ops && hdmi_ops->mode_fixup)
hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode,
adjusted_mode);
}

static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode)
Expand All @@ -171,8 +158,8 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_manager_ops && hdmi_manager_ops->mode_set)
hdmi_manager_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
if (hdmi_ops && hdmi_ops->mode_set)
hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode);
}

static void drm_hdmi_get_max_resol(struct device *subdrv_dev,
Expand All @@ -182,9 +169,8 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev,

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_manager_ops && hdmi_manager_ops->get_max_resol)
hdmi_manager_ops->get_max_resol(ctx->hdmi_ctx->ctx, width,
height);
if (hdmi_ops && hdmi_ops->get_max_resol)
hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height);
}

static void drm_hdmi_commit(struct device *subdrv_dev)
Expand All @@ -193,8 +179,8 @@ static void drm_hdmi_commit(struct device *subdrv_dev)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_manager_ops && hdmi_manager_ops->commit)
hdmi_manager_ops->commit(ctx->hdmi_ctx->ctx);
if (hdmi_ops && hdmi_ops->commit)
hdmi_ops->commit(ctx->hdmi_ctx->ctx);
}

static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)
Expand All @@ -209,8 +195,8 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode)
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
if (hdmi_manager_ops && hdmi_manager_ops->disable)
hdmi_manager_ops->disable(ctx->hdmi_ctx->ctx);
if (hdmi_ops && hdmi_ops->disable)
hdmi_ops->disable(ctx->hdmi_ctx->ctx);
break;
default:
DRM_DEBUG_KMS("unkown dps mode: %d\n", mode);
Expand All @@ -235,8 +221,8 @@ static void drm_mixer_mode_set(struct device *subdrv_dev,

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_overlay_ops && hdmi_overlay_ops->win_mode_set)
hdmi_overlay_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
if (mixer_ops && mixer_ops->win_mode_set)
mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay);
}

static void drm_mixer_commit(struct device *subdrv_dev, int zpos)
Expand All @@ -245,8 +231,8 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_overlay_ops && hdmi_overlay_ops->win_commit)
hdmi_overlay_ops->win_commit(ctx->mixer_ctx->ctx, zpos);
if (mixer_ops && mixer_ops->win_commit)
mixer_ops->win_commit(ctx->mixer_ctx->ctx, zpos);
}

static void drm_mixer_disable(struct device *subdrv_dev, int zpos)
Expand All @@ -255,8 +241,8 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos)

DRM_DEBUG_KMS("%s\n", __FILE__);

if (hdmi_overlay_ops && hdmi_overlay_ops->win_disable)
hdmi_overlay_ops->win_disable(ctx->mixer_ctx->ctx, zpos);
if (mixer_ops && mixer_ops->win_disable)
mixer_ops->win_disable(ctx->mixer_ctx->ctx, zpos);
}

static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = {
Expand Down
23 changes: 9 additions & 14 deletions drivers/gpu/drm/exynos/exynos_drm_hdmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ struct exynos_drm_hdmi_context {
void *ctx;
};

struct exynos_hdmi_display_ops {
struct exynos_hdmi_ops {
/* display */
bool (*is_connected)(void *ctx);
int (*get_edid)(void *ctx, struct drm_connector *connector,
u8 *edid, int len);
int (*check_timing)(void *ctx, void *timing);
int (*power_on)(void *ctx, int mode);
};

struct exynos_hdmi_manager_ops {
/* manager */
void (*mode_fixup)(void *ctx, struct drm_connector *connector,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
Expand All @@ -57,22 +57,17 @@ struct exynos_hdmi_manager_ops {
void (*disable)(void *ctx);
};

struct exynos_hdmi_overlay_ops {
struct exynos_mixer_ops {
/* manager */
int (*enable_vblank)(void *ctx, int pipe);
void (*disable_vblank)(void *ctx);

/* overlay */
void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay);
void (*win_commit)(void *ctx, int zpos);
void (*win_disable)(void *ctx, int zpos);
};

extern struct platform_driver hdmi_driver;
extern struct platform_driver mixer_driver;

void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops
*display_ops);
void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops
*manager_ops);
void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops
*overlay_ops);

void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops);
void exynos_mixer_ops_register(struct exynos_mixer_ops *ops);
#endif
19 changes: 9 additions & 10 deletions drivers/gpu/drm/exynos/exynos_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,13 +1311,6 @@ static int hdmi_display_power_on(void *ctx, int mode)
return 0;
}

static struct exynos_hdmi_display_ops display_ops = {
.is_connected = hdmi_is_connected,
.get_edid = hdmi_get_edid,
.check_timing = hdmi_check_timing,
.power_on = hdmi_display_power_on,
};

static void hdmi_set_acr(u32 freq, u8 *acr)
{
u32 n, cts;
Expand Down Expand Up @@ -1995,7 +1988,14 @@ static void hdmi_disable(void *ctx)
}
}

static struct exynos_hdmi_manager_ops manager_ops = {
static struct exynos_hdmi_ops hdmi_ops = {
/* display */
.is_connected = hdmi_is_connected,
.get_edid = hdmi_get_edid,
.check_timing = hdmi_check_timing,
.power_on = hdmi_display_power_on,

/* manager */
.mode_fixup = hdmi_mode_fixup,
.mode_set = hdmi_mode_set,
.get_max_resol = hdmi_get_max_resol,
Expand Down Expand Up @@ -2321,8 +2321,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
hdata->irq = res->start;

/* register specific callbacks to common hdmi. */
exynos_drm_display_ops_register(&display_ops);
exynos_drm_manager_ops_register(&manager_ops);
exynos_hdmi_ops_register(&hdmi_ops);

hdmi_resource_poweron(hdata);

Expand Down
7 changes: 5 additions & 2 deletions drivers/gpu/drm/exynos/exynos_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,12 @@ static void mixer_win_disable(void *ctx, int zpos)
spin_unlock_irqrestore(&res->reg_slock, flags);
}

static struct exynos_hdmi_overlay_ops overlay_ops = {
static struct exynos_mixer_ops mixer_ops = {
/* manager */
.enable_vblank = mixer_enable_vblank,
.disable_vblank = mixer_disable_vblank,

/* overlay */
.win_mode_set = mixer_win_mode_set,
.win_commit = mixer_win_commit,
.win_disable = mixer_win_disable,
Expand Down Expand Up @@ -1071,7 +1074,7 @@ static int __devinit mixer_probe(struct platform_device *pdev)
goto fail;

/* register specific callback point to common hdmi. */
exynos_drm_overlay_ops_register(&overlay_ops);
exynos_mixer_ops_register(&mixer_ops);

mixer_resource_poweron(ctx);

Expand Down

0 comments on commit 578b606

Please sign in to comment.