radeon_hd: Properly and consistently pick HPD ID

This commit is contained in:
Alexander von Gluck IV 2015-07-15 18:03:02 -05:00
parent 8512a55f41
commit 1b69f3394b
8 changed files with 20777 additions and 48 deletions
headers/private/graphics/radeon_hd
src/add-ons/accelerants/radeon_hd

File diff suppressed because it is too large Load Diff

@ -14,13 +14,16 @@
#include "radeon_reg.h"
//#include "r500_reg.h" // Not used atm
#include "avivo_reg.h"
#include "r600_reg.h"
#include "r700_reg.h"
#include "evergreen_reg.h"
#include "si_reg.h"
#include "ni_reg.h"
//#include "r500_reg.h" // Not used atm. DCE 0
#include "avivo_reg.h" // DCE 1
#include "r600_reg.h" // DCE 2
#include "r700_reg.h" // DCE 3
#include "evergreen_reg.h" // DCE 4
#include "ni_reg.h" // DCE 5
#include "si_reg.h" // DCE 6
#include "sea_reg.h" // DCE 8
#include "vol_reg.h" // DCE 10
#include "car_reg.h" // DCE 11
#include <Accelerant.h>
#include <Drivers.h>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -117,6 +117,60 @@ gpio_set_i2c_bit(void* cookie, int clock, int data)
}
uint16
connector_pick_atom_hpdid(uint32 connectorIndex)
{
radeon_shared_info &info = *gInfo->shared_info;
uint16 atomHPDID = 0xff;
uint16 hpdPinIndex = gConnector[connectorIndex]->hpdPinIndex;
if (info.dceMajor >= 4
&& gGPIOInfo[hpdPinIndex]->valid) {
// See mmDC_GPIO_HPD_A in drm for register value
uint32 targetReg = AVIVO_DC_GPIO_HPD_A;
if (info.dceMajor >= 12) {
ERROR("WARNING: CHECK NEW DCE mmDC_GPIO_HPD_A value!\n");
targetReg = CAR_mmDC_GPIO_HPD_A;
} else if (info.dceMajor >= 11)
targetReg = CAR_mmDC_GPIO_HPD_A;
else if (info.dceMajor >= 10)
targetReg = VOL_mmDC_GPIO_HPD_A;
else if (info.dceMajor >= 8)
targetReg = SEA_mmDC_GPIO_HPD_A;
else if (info.dceMajor >= 6)
targetReg = SI_DC_GPIO_HPD_A;
else if (info.dceMajor >= 4)
targetReg = EVERGREEN_DC_GPIO_HPD_A;
// You're drunk AMD, go home. (this makes no sense)
if (gGPIOInfo[hpdPinIndex]->hwReg == targetReg) {
switch(gGPIOInfo[hpdPinIndex]->hwMask) {
case (1 << 0):
atomHPDID = 0;
break;
case (1 << 8):
atomHPDID = 1;
break;
case (1 << 16):
atomHPDID = 2;
break;
case (1 << 24):
atomHPDID = 3;
break;
case (1 << 26):
atomHPDID = 4;
break;
case (1 << 28):
atomHPDID = 5;
break;
}
}
}
return atomHPDID;
}
bool
connector_read_edid(uint32 connectorIndex, edid1_info* edid)
{

@ -69,5 +69,7 @@ status_t connector_probe_legacy();
bool connector_is_dp(uint32 connectorIndex);
void debug_connectors();
uint16 connector_pick_atom_hpdid(uint32 connectorIndex);
#endif /* RADEON_HD_CONNECTOR_H */

@ -35,8 +35,6 @@ static ssize_t
dp_aux_speak(uint32 connectorIndex, uint8* send, int sendBytes,
uint8* recv, int recvBytes, uint8 delay, uint8* ack)
{
radeon_shared_info &info = *gInfo->shared_info;
dp_info* dpInfo = &gConnector[connectorIndex]->dpInfo;
if (dpInfo->auxPin == 0) {
ERROR("%s: cannot speak on invalid GPIO pin!\n", __func__);
@ -59,43 +57,8 @@ dp_aux_speak(uint32 connectorIndex, uint8* send, int sendBytes,
args.v2.ucChannelID = dpInfo->auxPin;
args.v2.ucDelay = delay / 10;
uint16 hpdPinIndex = gConnector[connectorIndex]->hpdPinIndex;
if (info.dceMajor >= 4
&& gGPIOInfo[hpdPinIndex]->valid) {
uint32 targetReg = EVERGREEN_DC_GPIO_HPD_A;
if (info.dceMajor >= 6)
targetReg = SI_DC_GPIO_HPD_A;
// You're drunk AMD, go home. (this makes no sense)
if (gGPIOInfo[hpdPinIndex]->hwReg == targetReg) {
switch(gGPIOInfo[hpdPinIndex]->hwMask) {
case (1 << 0):
args.v2.ucHPD_ID = 0;
break;
case (1 << 8):
args.v2.ucHPD_ID = 1;
break;
case (1 << 16):
args.v2.ucHPD_ID = 2;
break;
case (1 << 24):
args.v2.ucHPD_ID = 3;
break;
case (1 << 26):
args.v2.ucHPD_ID = 4;
break;
case (1 << 28):
args.v2.ucHPD_ID = 5;
break;
default:
args.v2.ucHPD_ID = 0xff;
break;
}
} else {
args.v2.ucHPD_ID = 0xff;
}
}
// Careful! This value differs in different atombios calls :-|
args.v2.ucHPD_ID = connector_pick_atom_hpdid(connectorIndex);
unsigned char* base = (unsigned char*)(gAtomContext->scratch + 1);

@ -637,6 +637,9 @@ encoder_dig_setup(uint32 connectorIndex, uint32 pixelClock, int command)
dualLink = true;
}
// Careful! The mapping of ucHPD_ID differs between atombios calls
uint16 hpdID = connector_pick_atom_hpdid(connectorIndex);
switch (tableMinor) {
case 1:
args.v1.ucAction = command;
@ -784,8 +787,11 @@ encoder_dig_setup(uint32 connectorIndex, uint32 pixelClock, int command)
args.v4.ucBitPerColor = PANEL_16BIT_PER_COLOR;
break;
}
// TODO: VVV RADEON_HPD_NONE?
args.v4.ucHPD_ID = 0;
if (hpdID == 0xff)
args.v4.ucHPD_ID = 0;
else
args.v4.ucHPD_ID = hpdID + 1;
break;
default:
ERROR("%s: unknown tableMinor!\n", __func__);