From: Dave Airlie Date: Thu, 18 Sep 2008 00:13:30 +0000 (+1000) Subject: radeon: don't do full edid for detection purposes X-Git-Tag: submit/1.0/20121108.012404~642^2~75 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e384803c5f2528735e43b8d30f90ea82f6b3f47;p=profile%2Fivi%2Flibdrm.git radeon: don't do full edid for detection purposes --- diff --git a/linux-core/radeon_connectors.c b/linux-core/radeon_connectors.c index 5ce66d7..f217fe7 100644 --- a/linux-core/radeon_connectors.c +++ b/linux-core/radeon_connectors.c @@ -163,18 +163,16 @@ static int radeon_vga_mode_valid(struct drm_connector *connector, static enum drm_connector_status radeon_vga_detect(struct drm_connector *connector) { - struct edid *edid; struct radeon_connector *radeon_connector = to_radeon_connector(connector); struct drm_encoder *encoder; struct drm_encoder_helper_funcs *encoder_funcs; + bool ret; radeon_i2c_do_lock(radeon_connector, 1); - edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); + ret = radeon_ddc_probe(radeon_connector); radeon_i2c_do_lock(radeon_connector, 0); - if (edid) { - kfree(edid); + if (ret) return connector_status_connected; - } /* if EDID fails to a load detect */ encoder = radeon_best_single_encoder(connector); @@ -200,27 +198,19 @@ struct drm_connector_funcs radeon_vga_connector_funcs = { static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connector) { - struct edid *edid; struct radeon_connector *radeon_connector = to_radeon_connector(connector); struct drm_encoder *encoder; struct drm_encoder_helper_funcs *encoder_funcs; struct drm_mode_object *obj; int i; enum drm_connector_status ret; + bool dret; radeon_i2c_do_lock(radeon_connector, 1); - edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); + dret = radeon_ddc_probe(radeon_connector); radeon_i2c_do_lock(radeon_connector, 0); - if (edid) { - /* if the monitor is digital - set the bits */ - if (edid->digital) - radeon_connector->use_digital = 1; - else - radeon_connector->use_digital = 0; - - kfree(edid); + if (dret) return connector_status_connected; - } for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { if (connector->encoder_ids[i] == 0) diff --git a/linux-core/radeon_display.c b/linux-core/radeon_display.c index d105e1a..c532ef0 100644 --- a/linux-core/radeon_display.c +++ b/linux-core/radeon_display.c @@ -31,6 +31,7 @@ #include #include "drm_crtc_helper.h" +#include "drm_edid.h" int radeon_ddc_dump(struct drm_connector *connector); @@ -305,6 +306,11 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter); radeon_i2c_do_lock(radeon_connector, 0); if (edid) { + /* update digital bits here */ + if (edid->digital) + radeon_connector->use_digital = 1; + else + radeon_connector->use_digital = 0; drm_mode_connector_update_edid_property(&radeon_connector->base, edid); ret = drm_add_edid_modes(&radeon_connector->base, edid); kfree(edid); diff --git a/linux-core/radeon_i2c.c b/linux-core/radeon_i2c.c index 00fc7c0..94a485b 100644 --- a/linux-core/radeon_i2c.c +++ b/linux-core/radeon_i2c.c @@ -27,6 +27,38 @@ #include "radeon_drm.h" #include "radeon_drv.h" +/** + * radeon_ddc_probe + * + */ +bool radeon_ddc_probe(struct radeon_connector *radeon_connector) +{ + u8 out_buf[] = { 0x0, 0x0}; + u8 buf[2]; + int ret; + struct i2c_msg msgs[] = { + { + .addr = 0x50, + .flags = 0, + .len = 1, + .buf = out_buf, + }, + { + .addr = 0x50, + .flags = I2C_M_RD, + .len = 1, + .buf = buf, + } + }; + + ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); + if (ret == 2) + return true; + + return false; +} + + void radeon_i2c_do_lock(struct radeon_connector *radeon_connector, int lock_state) { struct drm_radeon_private *dev_priv = radeon_connector->base.dev->dev_private; @@ -161,3 +193,4 @@ struct drm_encoder *radeon_best_encoder(struct drm_connector *connector) { return NULL; } + diff --git a/linux-core/radeon_mode.h b/linux-core/radeon_mode.h index d7c60fa..e8a0106 100644 --- a/linux-core/radeon_mode.h +++ b/linux-core/radeon_mode.h @@ -247,6 +247,7 @@ extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, struct radeon_i2c_bus_rec *rec, const char *name); extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); +extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); extern struct drm_connector *radeon_connector_add(struct drm_device *dev, int bios_index);