Skip to content

Commit

Permalink
drm/exynos: added manager object to connector
Browse files Browse the repository at this point in the history
connector contains some contents for display controller so the connector also
should be able to access controller through manager.

Signed-off-by: Inki Dae <[email protected]>
Signed-off-by: Seung-Woo Kim <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
  • Loading branch information
daeinki committed Nov 15, 2011
1 parent 8b58dfe commit adb6b15
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
38 changes: 31 additions & 7 deletions drivers/gpu/drm/exynos/exynos_drm_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

struct exynos_drm_connector {
struct drm_connector drm_connector;
uint32_t encoder_id;
struct exynos_drm_manager *manager;
};

/* convert exynos_video_timings to drm_display_mode */
Expand Down Expand Up @@ -99,8 +101,9 @@ convert_to_video_timing(struct fb_videomode *timing,

static int exynos_drm_connector_get_modes(struct drm_connector *connector)
{
struct exynos_drm_manager *manager =
exynos_drm_get_manager(connector->encoder);
struct exynos_drm_connector *exynos_connector =
to_exynos_connector(connector);
struct exynos_drm_manager *manager = exynos_connector->manager;
struct exynos_drm_display *display = manager->display;
unsigned int count;

Expand Down Expand Up @@ -169,8 +172,9 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
static int exynos_drm_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct exynos_drm_manager *manager =
exynos_drm_get_manager(connector->encoder);
struct exynos_drm_connector *exynos_connector =
to_exynos_connector(connector);
struct exynos_drm_manager *manager = exynos_connector->manager;
struct exynos_drm_display *display = manager->display;
struct fb_videomode timing;
int ret = MODE_BAD;
Expand All @@ -188,9 +192,25 @@ static int exynos_drm_connector_mode_valid(struct drm_connector *connector,

struct drm_encoder *exynos_drm_best_encoder(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
struct exynos_drm_connector *exynos_connector =
to_exynos_connector(connector);
struct drm_mode_object *obj;
struct drm_encoder *encoder;

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

return connector->encoder;
obj = drm_mode_object_find(dev, exynos_connector->encoder_id,
DRM_MODE_OBJECT_ENCODER);
if (!obj) {
DRM_DEBUG_KMS("Unknown ENCODER ID %d\n",
exynos_connector->encoder_id);
return NULL;
}

encoder = obj_to_encoder(obj);

return encoder;
}

static struct drm_connector_helper_funcs exynos_connector_helper_funcs = {
Expand All @@ -203,8 +223,9 @@ static struct drm_connector_helper_funcs exynos_connector_helper_funcs = {
static enum drm_connector_status
exynos_drm_connector_detect(struct drm_connector *connector, bool force)
{
struct exynos_drm_manager *manager =
exynos_drm_get_manager(connector->encoder);
struct exynos_drm_connector *exynos_connector =
to_exynos_connector(connector);
struct exynos_drm_manager *manager = exynos_connector->manager;
struct exynos_drm_display *display = manager->display;
enum drm_connector_status status = connector_status_disconnected;

Expand Down Expand Up @@ -276,7 +297,10 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev,
if (err)
goto err_connector;

exynos_connector->encoder_id = encoder->base.id;
exynos_connector->manager = manager;
connector->encoder = encoder;

err = drm_mode_connector_attach_encoder(connector, encoder);
if (err) {
DRM_ERROR("failed to attach a connector to a encoder\n");
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/exynos/exynos_drm_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode)

list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
if (connector->encoder == encoder) {
struct exynos_drm_display *display = manager->display;
struct exynos_drm_display *display =
manager->display;

if (display && display->power_on)
display->power_on(manager->dev, mode);
Expand Down

0 comments on commit adb6b15

Please sign in to comment.