diff options
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_combios.c | 269 |
1 files changed, 139 insertions, 130 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_combios.c b/sys/dev/pci/drm/radeon/radeon_combios.c index 52a7b873f64..644fa440321 100644 --- a/sys/dev/pci/drm/radeon/radeon_combios.c +++ b/sys/dev/pci/drm/radeon/radeon_combios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_combios.c,v 1.10 2017/10/09 06:53:26 patrick Exp $ */ +/* $OpenBSD: radeon_combios.c,v 1.11 2017/10/09 09:30:26 patrick Exp $ */ /* * Copyright 2004 ATI Technologies Inc., Markham, Ontario * Copyright 2007-8 Advanced Micro Devices, Inc. @@ -419,12 +419,19 @@ radeon_bios_get_hardcoded_edid(struct radeon_device *rdev) return NULL; } -static void combios_setup_i2c_bus(struct radeon_device *rdev, - enum radeon_combios_ddc ddc, - u32 clk_mask, - u32 data_mask, - struct radeon_i2c_bus_rec *i2c) +#ifdef __clang__ +static inline struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, + enum radeon_combios_ddc ddc, + u32 clk_mask, + u32 data_mask) +#else +static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, + enum radeon_combios_ddc ddc, + u32 clk_mask, + u32 data_mask) +#endif { + struct radeon_i2c_bus_rec i2c; int ddc_line = 0; /* ddc id = mask reg @@ -497,65 +504,65 @@ static void combios_setup_i2c_bus(struct radeon_device *rdev, } if (ddc_line == RADEON_GPIOPAD_MASK) { - i2c->mask_clk_reg = RADEON_GPIOPAD_MASK; - i2c->mask_data_reg = RADEON_GPIOPAD_MASK; - i2c->a_clk_reg = RADEON_GPIOPAD_A; - i2c->a_data_reg = RADEON_GPIOPAD_A; - i2c->en_clk_reg = RADEON_GPIOPAD_EN; - i2c->en_data_reg = RADEON_GPIOPAD_EN; - i2c->y_clk_reg = RADEON_GPIOPAD_Y; - i2c->y_data_reg = RADEON_GPIOPAD_Y; + i2c.mask_clk_reg = RADEON_GPIOPAD_MASK; + i2c.mask_data_reg = RADEON_GPIOPAD_MASK; + i2c.a_clk_reg = RADEON_GPIOPAD_A; + i2c.a_data_reg = RADEON_GPIOPAD_A; + i2c.en_clk_reg = RADEON_GPIOPAD_EN; + i2c.en_data_reg = RADEON_GPIOPAD_EN; + i2c.y_clk_reg = RADEON_GPIOPAD_Y; + i2c.y_data_reg = RADEON_GPIOPAD_Y; } else if (ddc_line == RADEON_MDGPIO_MASK) { - i2c->mask_clk_reg = RADEON_MDGPIO_MASK; - i2c->mask_data_reg = RADEON_MDGPIO_MASK; - i2c->a_clk_reg = RADEON_MDGPIO_A; - i2c->a_data_reg = RADEON_MDGPIO_A; - i2c->en_clk_reg = RADEON_MDGPIO_EN; - i2c->en_data_reg = RADEON_MDGPIO_EN; - i2c->y_clk_reg = RADEON_MDGPIO_Y; - i2c->y_data_reg = RADEON_MDGPIO_Y; + i2c.mask_clk_reg = RADEON_MDGPIO_MASK; + i2c.mask_data_reg = RADEON_MDGPIO_MASK; + i2c.a_clk_reg = RADEON_MDGPIO_A; + i2c.a_data_reg = RADEON_MDGPIO_A; + i2c.en_clk_reg = RADEON_MDGPIO_EN; + i2c.en_data_reg = RADEON_MDGPIO_EN; + i2c.y_clk_reg = RADEON_MDGPIO_Y; + i2c.y_data_reg = RADEON_MDGPIO_Y; } else { - i2c->mask_clk_reg = ddc_line; - i2c->mask_data_reg = ddc_line; - i2c->a_clk_reg = ddc_line; - i2c->a_data_reg = ddc_line; - i2c->en_clk_reg = ddc_line; - i2c->en_data_reg = ddc_line; - i2c->y_clk_reg = ddc_line; - i2c->y_data_reg = ddc_line; + i2c.mask_clk_reg = ddc_line; + i2c.mask_data_reg = ddc_line; + i2c.a_clk_reg = ddc_line; + i2c.a_data_reg = ddc_line; + i2c.en_clk_reg = ddc_line; + i2c.en_data_reg = ddc_line; + i2c.y_clk_reg = ddc_line; + i2c.y_data_reg = ddc_line; } if (clk_mask && data_mask) { /* system specific masks */ - i2c->mask_clk_mask = clk_mask; - i2c->mask_data_mask = data_mask; - i2c->a_clk_mask = clk_mask; - i2c->a_data_mask = data_mask; - i2c->en_clk_mask = clk_mask; - i2c->en_data_mask = data_mask; - i2c->y_clk_mask = clk_mask; - i2c->y_data_mask = data_mask; + i2c.mask_clk_mask = clk_mask; + i2c.mask_data_mask = data_mask; + i2c.a_clk_mask = clk_mask; + i2c.a_data_mask = data_mask; + i2c.en_clk_mask = clk_mask; + i2c.en_data_mask = data_mask; + i2c.y_clk_mask = clk_mask; + i2c.y_data_mask = data_mask; } else if ((ddc_line == RADEON_GPIOPAD_MASK) || (ddc_line == RADEON_MDGPIO_MASK)) { /* default gpiopad masks */ - i2c->mask_clk_mask = (0x20 << 8); - i2c->mask_data_mask = 0x80; - i2c->a_clk_mask = (0x20 << 8); - i2c->a_data_mask = 0x80; - i2c->en_clk_mask = (0x20 << 8); - i2c->en_data_mask = 0x80; - i2c->y_clk_mask = (0x20 << 8); - i2c->y_data_mask = 0x80; + i2c.mask_clk_mask = (0x20 << 8); + i2c.mask_data_mask = 0x80; + i2c.a_clk_mask = (0x20 << 8); + i2c.a_data_mask = 0x80; + i2c.en_clk_mask = (0x20 << 8); + i2c.en_data_mask = 0x80; + i2c.y_clk_mask = (0x20 << 8); + i2c.y_data_mask = 0x80; } else { /* default masks for ddc pads */ - i2c->mask_clk_mask = RADEON_GPIO_MASK_1; - i2c->mask_data_mask = RADEON_GPIO_MASK_0; - i2c->a_clk_mask = RADEON_GPIO_A_1; - i2c->a_data_mask = RADEON_GPIO_A_0; - i2c->en_clk_mask = RADEON_GPIO_EN_1; - i2c->en_data_mask = RADEON_GPIO_EN_0; - i2c->y_clk_mask = RADEON_GPIO_Y_1; - i2c->y_data_mask = RADEON_GPIO_Y_0; + i2c.mask_clk_mask = RADEON_GPIO_MASK_1; + i2c.mask_data_mask = RADEON_GPIO_MASK_0; + i2c.a_clk_mask = RADEON_GPIO_A_1; + i2c.a_data_mask = RADEON_GPIO_A_0; + i2c.en_clk_mask = RADEON_GPIO_EN_1; + i2c.en_data_mask = RADEON_GPIO_EN_0; + i2c.y_clk_mask = RADEON_GPIO_Y_1; + i2c.y_data_mask = RADEON_GPIO_Y_0; } switch (rdev->family) { @@ -567,10 +574,10 @@ static void combios_setup_i2c_bus(struct radeon_device *rdev, case CHIP_RS300: switch (ddc_line) { case RADEON_GPIO_DVI_DDC: - i2c->hw_capable = true; + i2c.hw_capable = true; break; default: - i2c->hw_capable = false; + i2c.hw_capable = false; break; } break; @@ -578,10 +585,10 @@ static void combios_setup_i2c_bus(struct radeon_device *rdev, switch (ddc_line) { case RADEON_GPIO_DVI_DDC: case RADEON_GPIO_MONID: - i2c->hw_capable = true; + i2c.hw_capable = true; break; default: - i2c->hw_capable = false; + i2c.hw_capable = false; break; } break; @@ -591,10 +598,10 @@ static void combios_setup_i2c_bus(struct radeon_device *rdev, case RADEON_GPIO_VGA_DDC: case RADEON_GPIO_DVI_DDC: case RADEON_GPIO_CRT2_DDC: - i2c->hw_capable = true; + i2c.hw_capable = true; break; default: - i2c->hw_capable = false; + i2c.hw_capable = false; break; } break; @@ -603,10 +610,10 @@ static void combios_setup_i2c_bus(struct radeon_device *rdev, switch (ddc_line) { case RADEON_GPIO_VGA_DDC: case RADEON_GPIO_DVI_DDC: - i2c->hw_capable = true; + i2c.hw_capable = true; break; default: - i2c->hw_capable = false; + i2c.hw_capable = false; break; } break; @@ -617,32 +624,34 @@ static void combios_setup_i2c_bus(struct radeon_device *rdev, switch (ddc_line) { case RADEON_GPIO_VGA_DDC: case RADEON_GPIO_DVI_DDC: - i2c->hw_capable = true; + i2c.hw_capable = true; break; case RADEON_GPIO_MONID: /* hw i2c on RADEON_GPIO_MONID doesn't seem to work * reliably on some pre-r4xx hardware; not sure why. */ - i2c->hw_capable = false; + i2c.hw_capable = false; break; default: - i2c->hw_capable = false; + i2c.hw_capable = false; break; } break; default: - i2c->hw_capable = false; + i2c.hw_capable = false; break; } - i2c->mm_i2c = false; + i2c.mm_i2c = false; - i2c->i2c_id = ddc; - i2c->hpd = RADEON_HPD_NONE; + i2c.i2c_id = ddc; + i2c.hpd = RADEON_HPD_NONE; if (ddc_line) - i2c->valid = true; + i2c.valid = true; else - i2c->valid = false; + i2c.valid = false; + + return i2c; } static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct radeon_device *rdev) @@ -664,9 +673,8 @@ static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct r clk = RBIOS8(offset + 3 + (i * 5) + 3); data = RBIOS8(offset + 3 + (i * 5) + 4); /* gpiopad */ - combios_setup_i2c_bus(rdev, DDC_MONID, - (1 << clk), (1 << data), - &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_MONID, + (1 << clk), (1 << data)); break; } } @@ -691,10 +699,10 @@ void radeon_combios_i2c_init(struct radeon_device *rdev) */ /* 0x60 */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "DVI_DDC"); /* 0x64 */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "VGA_DDC"); /* mm i2c */ @@ -711,7 +719,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev) rdev->family == CHIP_RS400 || rdev->family == CHIP_RS480) { /* 0x68 */ - combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0, &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); /* gpiopad */ @@ -721,14 +729,14 @@ void radeon_combios_i2c_init(struct radeon_device *rdev) } else if ((rdev->family == CHIP_R200) || (rdev->family >= CHIP_R300)) { /* 0x68 */ - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); } else { /* 0x68 */ - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); /* 0x6c */ - combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0, &i2c); + i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "CRT2_DDC"); } } @@ -1390,7 +1398,7 @@ bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder, struct radeon_i2c_bus_rec i2c_bus; /* default for macs */ - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &i2c_bus); + i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); /* XXX some macs have duallink chips */ @@ -1418,7 +1426,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder tmds->i2c_bus = NULL; if (rdev->flags & RADEON_IS_IGP) { - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &i2c_bus); + i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); tmds->dvo_chip = DVO_SIL164; tmds->slave_addr = 0x70 >> 1; /* 7 bit addressing */ @@ -1437,7 +1445,7 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder i2c_bus.mm_i2c = true; i2c_bus.i2c_id = 0xa0; } else - combios_setup_i2c_bus(rdev, gpio, 0, 0, &i2c_bus); + i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 0); tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); } } @@ -1540,7 +1548,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) /* these are the most common settings */ if (rdev->flags & RADEON_SINGLE_CRTC) { /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1555,7 +1563,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) &hpd); } else if (rdev->flags & RADEON_IS_MOBILITY) { /* LVDS */ - combios_setup_i2c_bus(rdev, DDC_NONE_DETECTED, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_NONE_DETECTED, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1570,7 +1578,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) &hpd); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1585,7 +1593,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) &hpd); } else { /* DVI-I - tv dac, int tmds */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_1; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1606,7 +1614,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) &hpd); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1642,7 +1650,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (ibook)\n", rdev->mode_info.connector_table); /* LVDS */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1654,7 +1662,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_LVDS, &hpd); /* VGA - TV DAC */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1683,7 +1691,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (powerbook external tmds)\n", rdev->mode_info.connector_table); /* LVDS */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1695,7 +1703,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_LVDS, &hpd); /* DVI-I - primary dac, ext tmds */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_2; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1732,7 +1740,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", rdev->mode_info.connector_table); /* LVDS */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1744,7 +1752,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_LVDS, &hpd); /* DVI-I - primary dac, int tmds */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1780,7 +1788,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (powerbook vga)\n", rdev->mode_info.connector_table); /* LVDS */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1792,7 +1800,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_LVDS, &hpd); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1821,7 +1829,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (mini external tmds)\n", rdev->mode_info.connector_table); /* DVI-I - tv dac, ext tmds */ - combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); hpd.hpd = RADEON_HPD_2; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1858,7 +1866,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (mini internal tmds)\n", rdev->mode_info.connector_table); /* DVI-I - tv dac, int tmds */ - combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1894,7 +1902,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (imac g5 isight)\n", rdev->mode_info.connector_table); /* DVI-D - int tmds */ - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1906,7 +1914,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D, &hpd); /* VGA - tv dac */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1935,7 +1943,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (emac)\n", rdev->mode_info.connector_table); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1947,7 +1955,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_VGA, &hpd); /* VGA - tv dac */ - combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1976,7 +1984,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (rn50-power)\n", rdev->mode_info.connector_table); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -1987,7 +1995,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_MODE_CONNECTOR_VGA, &ddc_i2c, CONNECTOR_OBJECT_ID_VGA, &hpd); - combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2003,7 +2011,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (mac x800)\n", rdev->mode_info.connector_table); /* DVI - primary dac, internal tmds */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2022,7 +2030,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, &hpd); /* DVI - tv dac, dvo */ - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); hpd.hpd = RADEON_HPD_2; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2045,7 +2053,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (mac g5 9600)\n", rdev->mode_info.connector_table); /* DVI - tv dac, dvo */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2064,7 +2072,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, &hpd); /* ADC - primary dac, internal tmds */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_2; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2100,7 +2108,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (SAM440ep embedded board)\n", rdev->mode_info.connector_table); /* LVDS */ - combios_setup_i2c_bus(rdev, DDC_NONE_DETECTED, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_NONE_DETECTED, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2112,7 +2120,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_LVDS, &hpd); /* DVI-I - secondary dac, int tmds */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2131,7 +2139,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, &hpd); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2161,7 +2169,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) DRM_INFO("Connector Table: %d (mac g4 silver)\n", rdev->mode_info.connector_table); /* DVI-I - tv dac, int tmds */ - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_1; /* ??? */ radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2180,7 +2188,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, &hpd); /* VGA - primary dac */ - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_encoder(dev, radeon_get_encoder_enum(dev, @@ -2329,7 +2337,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) if (ddc_type == 5) ddc_i2c = radeon_combios_get_i2c_info_from_table(rdev); else - combios_setup_i2c_bus(rdev, ddc_type, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, ddc_type, 0, 0); switch (connector) { case CONNECTOR_PROPRIETARY_LEGACY: @@ -2507,7 +2515,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) 0), ATOM_DEVICE_DFP1_SUPPORT); - combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); hpd.hpd = RADEON_HPD_1; radeon_add_legacy_connector(dev, 0, @@ -2527,7 +2535,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) ATOM_DEVICE_CRT1_SUPPORT, 1), ATOM_DEVICE_CRT1_SUPPORT); - combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0, &ddc_i2c); + ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); hpd.hpd = RADEON_HPD_NONE; radeon_add_legacy_connector(dev, 0, @@ -2561,23 +2569,24 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) ddc_type = RBIOS8(lcd_ddc_info + 2); switch (ddc_type) { case DDC_LCD: - combios_setup_i2c_bus(rdev, - DDC_LCD, - RBIOS32(lcd_ddc_info + 3), - RBIOS32(lcd_ddc_info + 7), - &ddc_i2c); + ddc_i2c = + combios_setup_i2c_bus(rdev, + DDC_LCD, + RBIOS32(lcd_ddc_info + 3), + RBIOS32(lcd_ddc_info + 7)); radeon_i2c_add(rdev, &ddc_i2c, "LCD"); break; case DDC_GPIO: - combios_setup_i2c_bus(rdev, - DDC_GPIO, - RBIOS32(lcd_ddc_info + 3), - RBIOS32(lcd_ddc_info + 7), - &ddc_i2c); + ddc_i2c = + combios_setup_i2c_bus(rdev, + DDC_GPIO, + RBIOS32(lcd_ddc_info + 3), + RBIOS32(lcd_ddc_info + 7)); radeon_i2c_add(rdev, &ddc_i2c, "LCD"); break; default: - combios_setup_i2c_bus(rdev, ddc_type, 0, 0, &ddc_i2c); + ddc_i2c = + combios_setup_i2c_bus(rdev, ddc_type, 0, 0); break; } DRM_DEBUG_KMS("LCD DDC Info Table found!\n"); @@ -2691,9 +2700,9 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) i2c_bus.mm_i2c = true; i2c_bus.i2c_id = 0xa0; } else if (gpio == DDC_GPIO) - combios_setup_i2c_bus(rdev, gpio, 1 << clk_bit, 1 << data_bit, &i2c_bus); + i2c_bus = combios_setup_i2c_bus(rdev, gpio, 1 << clk_bit, 1 << data_bit); else - combios_setup_i2c_bus(rdev, gpio, 0, 0, &i2c_bus); + i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 0); rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); #ifdef notyet if (rdev->pm.i2c_bus) { @@ -2712,7 +2721,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) if ((dev->pdev->device == 0x4152) && (dev->pdev->subsystem_vendor == 0x1043) && (dev->pdev->subsystem_device == 0xc002)) { - combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0, &i2c_bus); + i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); #ifdef notyet if (rdev->pm.i2c_bus) { |