Skip to content

Commit

Permalink
radeon_hd: Properly and consistently pick HPD ID
Browse files Browse the repository at this point in the history
  • Loading branch information
kallisti5 committed Jul 15, 2015
1 parent 8512a55 commit 1b69f33
Show file tree
Hide file tree
Showing 8 changed files with 20,777 additions and 48 deletions.
7,648 changes: 7,648 additions & 0 deletions headers/private/graphics/radeon_hd/car_reg.h

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions headers/private/graphics/radeon_hd/radeon_hd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5,703 changes: 5,703 additions & 0 deletions headers/private/graphics/radeon_hd/sea_reg.h

Large diffs are not rendered by default.

7,350 changes: 7,350 additions & 0 deletions headers/private/graphics/radeon_hd/vol_reg.h

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions src/add-ons/accelerants/radeon_hd/connector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions src/add-ons/accelerants/radeon_hd/connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
41 changes: 2 additions & 39 deletions src/add-ons/accelerants/radeon_hd/displayport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand All @@ -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);

Expand Down
10 changes: 8 additions & 2 deletions src/add-ons/accelerants/radeon_hd/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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__);
Expand Down

0 comments on commit 1b69f33

Please sign in to comment.