radeon: don't do full edid for detection purposes

main
Dave Airlie 2008-09-18 10:13:30 +10:00
parent 8f23d4a44c
commit 0e384803c5
4 changed files with 46 additions and 16 deletions

View File

@ -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) 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 radeon_connector *radeon_connector = to_radeon_connector(connector);
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_encoder_helper_funcs *encoder_funcs; struct drm_encoder_helper_funcs *encoder_funcs;
bool ret;
radeon_i2c_do_lock(radeon_connector, 1); 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); radeon_i2c_do_lock(radeon_connector, 0);
if (edid) { if (ret)
kfree(edid);
return connector_status_connected; return connector_status_connected;
}
/* if EDID fails to a load detect */ /* if EDID fails to a load detect */
encoder = radeon_best_single_encoder(connector); 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) 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 radeon_connector *radeon_connector = to_radeon_connector(connector);
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_encoder_helper_funcs *encoder_funcs; struct drm_encoder_helper_funcs *encoder_funcs;
struct drm_mode_object *obj; struct drm_mode_object *obj;
int i; int i;
enum drm_connector_status ret; enum drm_connector_status ret;
bool dret;
radeon_i2c_do_lock(radeon_connector, 1); 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); radeon_i2c_do_lock(radeon_connector, 0);
if (edid) { if (dret)
/* if the monitor is digital - set the bits */
if (edid->digital)
radeon_connector->use_digital = 1;
else
radeon_connector->use_digital = 0;
kfree(edid);
return connector_status_connected; return connector_status_connected;
}
for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
if (connector->encoder_ids[i] == 0) if (connector->encoder_ids[i] == 0)

View File

@ -31,6 +31,7 @@
#include <asm/div64.h> #include <asm/div64.h>
#include "drm_crtc_helper.h" #include "drm_crtc_helper.h"
#include "drm_edid.h"
int radeon_ddc_dump(struct drm_connector *connector); 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); edid = drm_get_edid(&radeon_connector->base, &radeon_connector->ddc_bus->adapter);
radeon_i2c_do_lock(radeon_connector, 0); radeon_i2c_do_lock(radeon_connector, 0);
if (edid) { 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); drm_mode_connector_update_edid_property(&radeon_connector->base, edid);
ret = drm_add_edid_modes(&radeon_connector->base, edid); ret = drm_add_edid_modes(&radeon_connector->base, edid);
kfree(edid); kfree(edid);

View File

@ -27,6 +27,38 @@
#include "radeon_drm.h" #include "radeon_drm.h"
#include "radeon_drv.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) 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; 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; return NULL;
} }

View File

@ -247,6 +247,7 @@ extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
struct radeon_i2c_bus_rec *rec, struct radeon_i2c_bus_rec *rec,
const char *name); const char *name);
extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); 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 int radeon_ddc_get_modes(struct radeon_connector *radeon_connector);
extern struct drm_connector *radeon_connector_add(struct drm_device *dev, int bios_index); extern struct drm_connector *radeon_connector_add(struct drm_device *dev, int bios_index);