drm/radeon/kms: store sink type in atom dig connector
authorAlex Deucher <alexdeucher@gmail.com>
Mon, 23 Nov 2009 23:02:35 +0000 (18:02 -0500)
committerDave Airlie <airlied@redhat.com>
Tue, 8 Dec 2009 00:22:42 +0000 (10:22 +1000)
This will be used laster when the encoder and transmitters
are set up.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/atombios_dp.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/radeon/radeon_mode.h

index fc5a2df4544bcc434eb838fd995b7fd2cd3e6ae8..e761fefaacb167c7159ceb066e2057ab507ffa46 100644 (file)
@@ -78,8 +78,8 @@ bool radeon_process_aux_ch(struct radeon_i2c_chan *chan, u8 *req_bytes,
        return true;
 }
 
-int radeon_dp_encoder_service(struct radeon_device *rdev, int action, int dp_clock,
-                             uint8_t ucconfig, uint8_t lane_num)
+static u8 radeon_dp_encoder_service(struct radeon_device *rdev, int action, int dp_clock,
+                                   uint8_t ucconfig, uint8_t lane_num)
 {
        DP_ENCODER_SERVICE_PARAMETERS args;
        int index = GetIndexIntoMasterTable(COMMAND, DPEncoderService);
@@ -95,7 +95,7 @@ int radeon_dp_encoder_service(struct radeon_device *rdev, int action, int dp_clo
        return args.ucStatus;
 }
 
-int radeon_dp_getsinktype(struct radeon_connector *radeon_connector)
+u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector)
 {
        struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
        struct drm_device *dev = radeon_connector->base.dev;
index 98634ce5ba104fe753d9adbaa3595027078070ae..b51e38386cc0ee09fd752aabbdbce6871480fcb9 100644 (file)
@@ -908,13 +908,9 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
 static enum drm_connector_status radeon_dp_detect(struct drm_connector *connector)
 {
        struct radeon_connector *radeon_connector = to_radeon_connector(connector);
-       struct drm_encoder *encoder = NULL;
-       struct drm_encoder_helper_funcs *encoder_funcs;
-       struct drm_mode_object *obj;
-       int i;
        enum drm_connector_status ret = connector_status_disconnected;
-       int sink_type;
-       bool dret;
+       struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
+       u8 sink_type;
 
        if (radeon_connector->edid) {
                kfree(radeon_connector->edid);
@@ -924,8 +920,17 @@ static enum drm_connector_status radeon_dp_detect(struct drm_connector *connecto
        sink_type = radeon_dp_getsinktype(radeon_connector);
        if (sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
                radeon_dp_getdpcd(radeon_connector);
+               radeon_dig_connector->dp_sink_type = sink_type;
                ret = connector_status_connected;
+       } else {
+               radeon_i2c_do_lock(radeon_connector->ddc_bus, 1);
+               if (radeon_ddc_probe(radeon_connector)) {
+                       radeon_dig_connector->dp_sink_type = sink_type;
+                       ret = connector_status_connected;
+               }
+               radeon_i2c_do_lock(radeon_connector->ddc_bus, 0);
        }
+
        return ret;
 }
 
index 1964afb94dbcebc88ffe81124d1f84ef26582fa4..338d0af1851016858a6bda2ced6c306745daa038 100644 (file)
@@ -339,8 +339,10 @@ struct radeon_encoder {
 struct radeon_connector_atom_dig {
        uint32_t igp_lane_info;
        bool linkb;
+       /* displayport */
        struct radeon_i2c_chan *dp_i2c_bus;
        u8 dpcd[8];
+       u8 dp_sink_type;
 };
 
 struct radeon_connector {
@@ -364,7 +366,7 @@ struct radeon_framebuffer {
        struct drm_gem_object *obj;
 };
 
-extern int radeon_dp_getsinktype(struct radeon_connector *radeon_connector);
+extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector);
 extern void radeon_dp_getdpcd(struct radeon_connector *radeon_connector);
 extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
                                uint8_t write_byte, uint8_t *read_byte);