]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/gpu/drm/radeon/radeon_atombios.c
Merge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-fixes
[mv-sheeva.git] / drivers / gpu / drm / radeon / radeon_atombios.c
index 10673ae59cfa10ee8e408de3a9f84e54e2cab7ed..61141981880d7d03908a9a582f0d5a0a9951d2b3 100644 (file)
 
 /* from radeon_encoder.c */
 extern uint32_t
-radeon_get_encoder_id(struct drm_device *dev, uint32_t supported_device,
-                     uint8_t dac);
+radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device,
+                       uint8_t dac);
 extern void radeon_link_encoder_connector(struct drm_device *dev);
 extern void
-radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id,
+radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_enum,
                        uint32_t supported_device);
 
 /* from radeon_connector.c */
@@ -46,13 +46,14 @@ radeon_add_atom_connector(struct drm_device *dev,
                          uint32_t supported_device,
                          int connector_type,
                          struct radeon_i2c_bus_rec *i2c_bus,
-                         bool linkb, uint32_t igp_lane_info,
+                         uint32_t igp_lane_info,
                          uint16_t connector_object_id,
-                         struct radeon_hpd *hpd);
+                         struct radeon_hpd *hpd,
+                         struct radeon_router *router);
 
 /* from radeon_legacy_encoder.c */
 extern void
-radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id,
+radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_enum,
                          uint32_t supported_device);
 
 union atom_supported_devices {
@@ -114,7 +115,8 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
 
                                i2c.i2c_id = gpio->sucI2cId.ucAccess;
 
-                               i2c.valid = true;
+                               if (i2c.mask_clk_reg)
+                                       i2c.valid = true;
                                break;
                        }
                }
@@ -123,6 +125,66 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
        return i2c;
 }
 
+void radeon_atombios_i2c_init(struct radeon_device *rdev)
+{
+       struct atom_context *ctx = rdev->mode_info.atom_context;
+       ATOM_GPIO_I2C_ASSIGMENT *gpio;
+       struct radeon_i2c_bus_rec i2c;
+       int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info);
+       struct _ATOM_GPIO_I2C_INFO *i2c_info;
+       uint16_t data_offset, size;
+       int i, num_indices;
+       char stmp[32];
+
+       memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec));
+
+       if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) {
+               i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset);
+
+               num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) /
+                       sizeof(ATOM_GPIO_I2C_ASSIGMENT);
+
+               for (i = 0; i < num_indices; i++) {
+                       gpio = &i2c_info->asGPIO_Info[i];
+                       i2c.valid = false;
+                       i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
+                       i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
+                       i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4;
+                       i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4;
+                       i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4;
+                       i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4;
+                       i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4;
+                       i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4;
+                       i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift);
+                       i2c.mask_data_mask = (1 << gpio->ucDataMaskShift);
+                       i2c.en_clk_mask = (1 << gpio->ucClkEnShift);
+                       i2c.en_data_mask = (1 << gpio->ucDataEnShift);
+                       i2c.y_clk_mask = (1 << gpio->ucClkY_Shift);
+                       i2c.y_data_mask = (1 << gpio->ucDataY_Shift);
+                       i2c.a_clk_mask = (1 << gpio->ucClkA_Shift);
+                       i2c.a_data_mask = (1 << gpio->ucDataA_Shift);
+
+                       if (gpio->sucI2cId.sbfAccess.bfHW_Capable)
+                               i2c.hw_capable = true;
+                       else
+                               i2c.hw_capable = false;
+
+                       if (gpio->sucI2cId.ucAccess == 0xa0)
+                               i2c.mm_i2c = true;
+                       else
+                               i2c.mm_i2c = false;
+
+                       i2c.i2c_id = gpio->sucI2cId.ucAccess;
+
+                       if (i2c.mask_clk_reg) {
+                               i2c.valid = true;
+                               sprintf(stmp, "0x%x", i2c.i2c_id);
+                               rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp);
+                       }
+               }
+       }
+}
+
 static inline struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rdev,
                                                        u8 id)
 {
@@ -164,6 +226,8 @@ static struct radeon_hpd radeon_atom_get_hpd_info_from_gpio(struct radeon_device
        struct radeon_hpd hpd;
        u32 reg;
 
+       memset(&hpd, 0, sizeof(struct radeon_hpd));
+
        if (ASIC_IS_DCE4(rdev))
                reg = EVERGREEN_DC_GPIO_HPD_A;
        else
@@ -206,6 +270,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
                                     uint16_t *line_mux,
                                     struct radeon_hpd *hpd)
 {
+       struct radeon_device *rdev = dev->dev_private;
 
        /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
        if ((dev->pdev->device == 0x791e) &&
@@ -308,13 +373,22 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
                }
        }
 
-       /* Acer laptop reports DVI-D as DVI-I */
+       /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */
        if ((dev->pdev->device == 0x95c4) &&
            (dev->pdev->subsystem_vendor == 0x1025) &&
            (dev->pdev->subsystem_device == 0x013c)) {
+               struct radeon_gpio_rec gpio;
+
                if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
-                   (supported_device == ATOM_DEVICE_DFP1_SUPPORT))
+                   (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
+                       gpio = radeon_lookup_gpio(rdev, 6);
+                       *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
                        *connector_type = DRM_MODE_CONNECTOR_DVID;
+               } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
+                          (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
+                       gpio = radeon_lookup_gpio(rdev, 7);
+                       *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
+               }
        }
 
        /* XFX Pine Group device rv730 reports no VGA DDC lines
@@ -399,13 +473,14 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
        u16 size, data_offset;
        u8 frev, crev;
        ATOM_CONNECTOR_OBJECT_TABLE *con_obj;
+       ATOM_OBJECT_TABLE *router_obj;
        ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj;
        ATOM_OBJECT_HEADER *obj_header;
-       int i, j, path_size, device_support;
+       int i, j, k, path_size, device_support;
        int connector_type;
        u16 igp_lane_info, conn_id, connector_object_id;
-       bool linkb;
        struct radeon_i2c_bus_rec ddc_bus;
+       struct radeon_router router;
        struct radeon_gpio_rec gpio;
        struct radeon_hpd hpd;
 
@@ -415,6 +490,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
        if (crev < 2)
                return false;
 
+       router.valid = false;
+
        obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset);
        path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *)
            (ctx->bios + data_offset +
@@ -422,6 +499,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
        con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *)
            (ctx->bios + data_offset +
             le16_to_cpu(obj_header->usConnectorObjectTableOffset));
+       router_obj = (ATOM_OBJECT_TABLE *)
+               (ctx->bios + data_offset +
+                le16_to_cpu(obj_header->usRouterObjectTableOffset));
        device_support = le16_to_cpu(obj_header->usDeviceSupport);
 
        path_size = 0;
@@ -431,7 +511,7 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
                addr += path_size;
                path = (ATOM_DISPLAY_OBJECT_PATH *) addr;
                path_size += le16_to_cpu(path->usSize);
-               linkb = false;
+
                if (device_support & le16_to_cpu(path->usDeviceTag)) {
                        uint8_t con_obj_id, con_obj_num, con_obj_type;
 
@@ -508,33 +588,83 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
                        if (connector_type == DRM_MODE_CONNECTOR_Unknown)
                                continue;
 
-                       for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2);
-                            j++) {
-                               uint8_t enc_obj_id, enc_obj_num, enc_obj_type;
+                       for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); j++) {
+                               uint8_t grph_obj_id, grph_obj_num, grph_obj_type;
 
-                               enc_obj_id =
+                               grph_obj_id =
                                    (le16_to_cpu(path->usGraphicObjIds[j]) &
                                     OBJECT_ID_MASK) >> OBJECT_ID_SHIFT;
-                               enc_obj_num =
+                               grph_obj_num =
                                    (le16_to_cpu(path->usGraphicObjIds[j]) &
                                     ENUM_ID_MASK) >> ENUM_ID_SHIFT;
-                               enc_obj_type =
+                               grph_obj_type =
                                    (le16_to_cpu(path->usGraphicObjIds[j]) &
                                     OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT;
 
-                               /* FIXME: add support for router objects */
-                               if (enc_obj_type == GRAPH_OBJECT_TYPE_ENCODER) {
-                                       if (enc_obj_num == 2)
-                                               linkb = true;
-                                       else
-                                               linkb = false;
+                               if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) {
+                                       u16 encoder_obj = le16_to_cpu(path->usGraphicObjIds[j]);
 
                                        radeon_add_atom_encoder(dev,
-                                                               enc_obj_id,
+                                                               encoder_obj,
                                                                le16_to_cpu
                                                                (path->
                                                                 usDeviceTag));
 
+                               } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) {
+                                       router.valid = false;
+                                       for (k = 0; k < router_obj->ucNumberOfObjects; k++) {
+                                               u16 router_obj_id = le16_to_cpu(router_obj->asObjects[j].usObjectID);
+                                               if (le16_to_cpu(path->usGraphicObjIds[j]) == router_obj_id) {
+                                                       ATOM_COMMON_RECORD_HEADER *record = (ATOM_COMMON_RECORD_HEADER *)
+                                                               (ctx->bios + data_offset +
+                                                                le16_to_cpu(router_obj->asObjects[k].usRecordOffset));
+                                                       ATOM_I2C_RECORD *i2c_record;
+                                                       ATOM_I2C_ID_CONFIG_ACCESS *i2c_config;
+                                                       ATOM_ROUTER_DDC_PATH_SELECT_RECORD *ddc_path;
+                                                       ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT *router_src_dst_table =
+                                                               (ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT *)
+                                                               (ctx->bios + data_offset +
+                                                                le16_to_cpu(router_obj->asObjects[k].usSrcDstTableOffset));
+                                                       int enum_id;
+
+                                                       router.router_id = router_obj_id;
+                                                       for (enum_id = 0; enum_id < router_src_dst_table->ucNumberOfDst;
+                                                            enum_id++) {
+                                                               if (le16_to_cpu(path->usConnObjectId) ==
+                                                                   le16_to_cpu(router_src_dst_table->usDstObjectID[enum_id]))
+                                                                       break;
+                                                       }
+
+                                                       while (record->ucRecordType > 0 &&
+                                                              record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
+                                                               switch (record->ucRecordType) {
+                                                               case ATOM_I2C_RECORD_TYPE:
+                                                                       i2c_record =
+                                                                               (ATOM_I2C_RECORD *)
+                                                                               record;
+                                                                       i2c_config =
+                                                                               (ATOM_I2C_ID_CONFIG_ACCESS *)
+                                                                               &i2c_record->sucI2cId;
+                                                                       router.i2c_info =
+                                                                               radeon_lookup_i2c_gpio(rdev,
+                                                                                                      i2c_config->
+                                                                                                      ucAccess);
+                                                                       router.i2c_addr = i2c_record->ucI2CAddr >> 1;
+                                                                       break;
+                                                               case ATOM_ROUTER_DDC_PATH_SELECT_RECORD_TYPE:
+                                                                       ddc_path = (ATOM_ROUTER_DDC_PATH_SELECT_RECORD *)
+                                                                               record;
+                                                                       router.valid = true;
+                                                                       router.mux_type = ddc_path->ucMuxType;
+                                                                       router.mux_control_pin = ddc_path->ucMuxControlPin;
+                                                                       router.mux_state = ddc_path->ucMuxState[enum_id];
+                                                                       break;
+                                                               }
+                                                               record = (ATOM_COMMON_RECORD_HEADER *)
+                                                                       ((char *)record + record->ucRecordSize);
+                                                       }
+                                               }
+                                       }
                                }
                        }
 
@@ -612,9 +742,10 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
                                                  le16_to_cpu(path->
                                                              usDeviceTag),
                                                  connector_type, &ddc_bus,
-                                                 linkb, igp_lane_info,
+                                                 igp_lane_info,
                                                  connector_object_id,
-                                                 &hpd);
+                                                 &hpd,
+                                                 &router);
 
                }
        }
@@ -691,6 +822,9 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
        int i, j, max_device;
        struct bios_connector *bios_connectors;
        size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE;
+       struct radeon_router router;
+
+       router.valid = false;
 
        bios_connectors = kzalloc(bc_size, GFP_KERNEL);
        if (!bios_connectors)
@@ -723,7 +857,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
                }
 
                if (i == ATOM_DEVICE_CV_INDEX) {
-                       DRM_DEBUG("Skipping Component Video\n");
+                       DRM_DEBUG_KMS("Skipping Component Video\n");
                        continue;
                }
 
@@ -797,13 +931,13 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
 
                if (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom)
                        radeon_add_atom_encoder(dev,
-                                               radeon_get_encoder_id(dev,
+                                               radeon_get_encoder_enum(dev,
                                                                      (1 << i),
                                                                      dac),
                                                (1 << i));
                else
                        radeon_add_legacy_encoder(dev,
-                                                 radeon_get_encoder_id(dev,
+                                                 radeon_get_encoder_enum(dev,
                                                                        (1 << i),
                                                                        dac),
                                                  (1 << i));
@@ -860,9 +994,10 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
                                                  bios_connectors[i].
                                                  connector_type,
                                                  &bios_connectors[i].ddc_bus,
-                                                 false, 0,
+                                                 0,
                                                  connector_object_id,
-                                                 &bios_connectors[i].hpd);
+                                                 &bios_connectors[i].hpd,
+                                                 &router);
                }
        }
 
@@ -1032,24 +1167,21 @@ bool radeon_atombios_sideport_present(struct radeon_device *rdev)
        u8 frev, crev;
        u16 data_offset;
 
+       /* sideport is AMD only */
+       if (rdev->family == CHIP_RS600)
+               return false;
+
        if (atom_parse_data_header(mode_info->atom_context, index, NULL,
                                   &frev, &crev, &data_offset)) {
                igp_info = (union igp_info *)(mode_info->atom_context->bios +
                                      data_offset);
                switch (crev) {
                case 1:
-                       /* AMD IGPS */
-                       if ((rdev->family == CHIP_RS690) ||
-                           (rdev->family == CHIP_RS740)) {
-                               if (igp_info->info.ulBootUpMemoryClock)
-                                       return true;
-                       } else {
-                               if (igp_info->info.ucMemoryType & 0xf0)
-                                       return true;
-                       }
+                       if (igp_info->info.ulBootUpMemoryClock)
+                               return true;
                        break;
                case 2:
-                       if (igp_info->info_2.ucMemoryType & 0x0f)
+                       if (igp_info->info_2.ulBootUpSidePortClock)
                                return true;
                        break;
                default:
@@ -1095,7 +1227,7 @@ bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder,
                            (tmds_info->asMiscInfo[i].
                             ucPLL_VoltageSwing & 0xf) << 16;
 
-                       DRM_DEBUG("TMDS PLL From ATOMBIOS %u %x\n",
+                       DRM_DEBUG_KMS("TMDS PLL From ATOMBIOS %u %x\n",
                                  tmds->tmds_pll[i].freq,
                                  tmds->tmds_pll[i].value);
 
@@ -1171,6 +1303,7 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
        union lvds_info *lvds_info;
        uint8_t frev, crev;
        struct radeon_encoder_atom_dig *lvds = NULL;
+       int encoder_enum = (encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT;
 
        if (atom_parse_data_header(mode_info->atom_context, index, NULL,
                                   &frev, &crev, &data_offset)) {
@@ -1234,6 +1367,12 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct
                }
 
                encoder->native_mode = lvds->native_mode;
+
+               if (encoder_enum == 2)
+                       lvds->linkb = true;
+               else
+                       lvds->linkb = false;
+
        }
        return lvds;
 }
@@ -1524,7 +1663,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                         thermal_controller_names[power_info->info.ucOverdriveThermalController],
                                         power_info->info.ucOverdriveControllerAddress >> 1);
                                i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine);
-                               rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
+                               rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
                                if (rdev->pm.i2c_bus) {
                                        struct i2c_board_info info = { };
                                        const char *name = thermal_controller_names[power_info->info.
@@ -1789,14 +1928,22 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                        }
 
                        /* add the i2c bus for thermal/fan chip */
-                       /* no support for internal controller yet */
                        if (controller->ucType > 0) {
-                               if ((controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) ||
-                                   (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) ||
-                                   (controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) {
+                               if (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) {
                                        DRM_INFO("Internal thermal controller %s fan control\n",
                                                 (controller->ucFanParameters &
                                                  ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
+                                       rdev->pm.int_thermal_type = THERMAL_TYPE_RV6XX;
+                               } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) {
+                                       DRM_INFO("Internal thermal controller %s fan control\n",
+                                                (controller->ucFanParameters &
+                                                 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
+                                       rdev->pm.int_thermal_type = THERMAL_TYPE_RV770;
+                               } else if (controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN) {
+                                       DRM_INFO("Internal thermal controller %s fan control\n",
+                                                (controller->ucFanParameters &
+                                                 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
+                                       rdev->pm.int_thermal_type = THERMAL_TYPE_EVERGREEN;
                                } else if ((controller->ucType ==
                                            ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) ||
                                           (controller->ucType ==
@@ -1809,7 +1956,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                 (controller->ucFanParameters &
                                                  ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
                                        i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine);
-                                       rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
+                                       rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
                                        if (rdev->pm.i2c_bus) {
                                                struct i2c_board_info info = { };
                                                const char *name = pp_lib_thermal_controller_names[controller->ucType];
@@ -1922,6 +2069,11 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                rdev->pm.power_state[state_index].type =
                                                        POWER_STATE_TYPE_PERFORMANCE;
                                                break;
+                                       case ATOM_PPLIB_CLASSIFICATION_UI_NONE:
+                                               if (misc2 & ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE)
+                                                       rdev->pm.power_state[state_index].type =
+                                                               POWER_STATE_TYPE_PERFORMANCE;
+                                               break;
                                        }
                                        rdev->pm.power_state[state_index].flags = 0;
                                        if (misc & ATOM_PPLIB_SINGLE_DISPLAY_ONLY)
@@ -2179,11 +2331,11 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("TV1 connected\n");
+                       DRM_DEBUG_KMS("TV1 connected\n");
                        bios_3_scratch |= ATOM_S3_TV1_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_TV1;
                } else {
-                       DRM_DEBUG("TV1 disconnected\n");
+                       DRM_DEBUG_KMS("TV1 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_TV1_MASK;
                        bios_3_scratch &= ~ATOM_S3_TV1_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_TV1;
@@ -2192,11 +2344,11 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("CV connected\n");
+                       DRM_DEBUG_KMS("CV connected\n");
                        bios_3_scratch |= ATOM_S3_CV_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_CV;
                } else {
-                       DRM_DEBUG("CV disconnected\n");
+                       DRM_DEBUG_KMS("CV disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_CV_MASK;
                        bios_3_scratch &= ~ATOM_S3_CV_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_CV;
@@ -2205,12 +2357,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_LCD1_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("LCD1 connected\n");
+                       DRM_DEBUG_KMS("LCD1 connected\n");
                        bios_0_scratch |= ATOM_S0_LCD1;
                        bios_3_scratch |= ATOM_S3_LCD1_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_LCD1;
                } else {
-                       DRM_DEBUG("LCD1 disconnected\n");
+                       DRM_DEBUG_KMS("LCD1 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_LCD1;
                        bios_3_scratch &= ~ATOM_S3_LCD1_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_LCD1;
@@ -2219,12 +2371,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("CRT1 connected\n");
+                       DRM_DEBUG_KMS("CRT1 connected\n");
                        bios_0_scratch |= ATOM_S0_CRT1_COLOR;
                        bios_3_scratch |= ATOM_S3_CRT1_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_CRT1;
                } else {
-                       DRM_DEBUG("CRT1 disconnected\n");
+                       DRM_DEBUG_KMS("CRT1 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_CRT1_MASK;
                        bios_3_scratch &= ~ATOM_S3_CRT1_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_CRT1;
@@ -2233,12 +2385,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("CRT2 connected\n");
+                       DRM_DEBUG_KMS("CRT2 connected\n");
                        bios_0_scratch |= ATOM_S0_CRT2_COLOR;
                        bios_3_scratch |= ATOM_S3_CRT2_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_CRT2;
                } else {
-                       DRM_DEBUG("CRT2 disconnected\n");
+                       DRM_DEBUG_KMS("CRT2 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_CRT2_MASK;
                        bios_3_scratch &= ~ATOM_S3_CRT2_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_CRT2;
@@ -2247,12 +2399,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_DFP1_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("DFP1 connected\n");
+                       DRM_DEBUG_KMS("DFP1 connected\n");
                        bios_0_scratch |= ATOM_S0_DFP1;
                        bios_3_scratch |= ATOM_S3_DFP1_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_DFP1;
                } else {
-                       DRM_DEBUG("DFP1 disconnected\n");
+                       DRM_DEBUG_KMS("DFP1 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_DFP1;
                        bios_3_scratch &= ~ATOM_S3_DFP1_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP1;
@@ -2261,12 +2413,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_DFP2_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("DFP2 connected\n");
+                       DRM_DEBUG_KMS("DFP2 connected\n");
                        bios_0_scratch |= ATOM_S0_DFP2;
                        bios_3_scratch |= ATOM_S3_DFP2_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_DFP2;
                } else {
-                       DRM_DEBUG("DFP2 disconnected\n");
+                       DRM_DEBUG_KMS("DFP2 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_DFP2;
                        bios_3_scratch &= ~ATOM_S3_DFP2_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP2;
@@ -2275,12 +2427,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_DFP3_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("DFP3 connected\n");
+                       DRM_DEBUG_KMS("DFP3 connected\n");
                        bios_0_scratch |= ATOM_S0_DFP3;
                        bios_3_scratch |= ATOM_S3_DFP3_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_DFP3;
                } else {
-                       DRM_DEBUG("DFP3 disconnected\n");
+                       DRM_DEBUG_KMS("DFP3 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_DFP3;
                        bios_3_scratch &= ~ATOM_S3_DFP3_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP3;
@@ -2289,12 +2441,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_DFP4_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("DFP4 connected\n");
+                       DRM_DEBUG_KMS("DFP4 connected\n");
                        bios_0_scratch |= ATOM_S0_DFP4;
                        bios_3_scratch |= ATOM_S3_DFP4_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_DFP4;
                } else {
-                       DRM_DEBUG("DFP4 disconnected\n");
+                       DRM_DEBUG_KMS("DFP4 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_DFP4;
                        bios_3_scratch &= ~ATOM_S3_DFP4_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP4;
@@ -2303,12 +2455,12 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
        if ((radeon_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) &&
            (radeon_connector->devices & ATOM_DEVICE_DFP5_SUPPORT)) {
                if (connected) {
-                       DRM_DEBUG("DFP5 connected\n");
+                       DRM_DEBUG_KMS("DFP5 connected\n");
                        bios_0_scratch |= ATOM_S0_DFP5;
                        bios_3_scratch |= ATOM_S3_DFP5_ACTIVE;
                        bios_6_scratch |= ATOM_S6_ACC_REQ_DFP5;
                } else {
-                       DRM_DEBUG("DFP5 disconnected\n");
+                       DRM_DEBUG_KMS("DFP5 disconnected\n");
                        bios_0_scratch &= ~ATOM_S0_DFP5;
                        bios_3_scratch &= ~ATOM_S3_DFP5_ACTIVE;
                        bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5;