diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/radeon_connectors.c | 22 | ||||
-rw-r--r-- | linux-core/radeon_display.c | 6 | ||||
-rw-r--r-- | linux-core/radeon_i2c.c | 33 | ||||
-rw-r--r-- | linux-core/radeon_mode.h | 1 |
4 files changed, 46 insertions, 16 deletions
diff --git a/linux-core/radeon_connectors.c b/linux-core/radeon_connectors.c index 5ce66d72..f217fe77 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 d105e1ae..c532ef0f 100644 --- a/linux-core/radeon_display.c +++ b/linux-core/radeon_display.c @@ -31,6 +31,7 @@ #include <asm/div64.h> #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 00fc7c0e..94a485ba 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 d7c60fa6..e8a0106e 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); |