[haiku-commits] haiku: hrev49399 - src/add-ons/accelerants/radeon_hd headers/private/graphics/common

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 14 Jul 2015 06:27:18 +0200 (CEST)

hrev49399 adds 9 changesets to branch 'master'
old head: 6031dea0cb44f6a3e512f35ded22dfb02b0ae753
new head: 991710be3915397f9baaaf599860cb945ab60a8d
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=991710be3915+%5E6031dea0cb44

----------------------------------------------------------------------------

9816a89ade7d: radeon_hd: Move to a unified dp aux transaction function.

* Leverage a single common dp aux message struct.
* Likely lots of obvious bugs that need fixed still.
* Untested.

9cfe6f909d41: radeon_hd: Fix missing TRACE connector id

8a5884f561e8: radeon_hd: Improve aux transaction tracing

8611df9d0b4c: radeon_hd: Move i2c to dp aux transaction function.

* WIP: EDID version 255.255 found

7ea1ad1028f8: radeon_hd: Fix dp aux request / response shifts

408e616e058e: radeon_hd: Sanitize dp_aux messages before use

80a0d0da5a8f: radeon_hd: Fix missing subtraction of MOT in case.

* DP i2c edid byte-bang working again

f1b29809bd97: radeon_hd: Fix missing DP link status request flag

991710be3915: radeon_hd: Reduce DisplayPort Tracing

[ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

5 files changed, 217 insertions(+), 219 deletions(-)
headers/private/graphics/common/dp_raw.h | 28 +-
src/add-ons/accelerants/radeon_hd/display.cpp | 2 +-
.../accelerants/radeon_hd/displayport.cpp | 391 +++++++++----------
src/add-ons/accelerants/radeon_hd/displayport.h | 5 +-
src/add-ons/accelerants/radeon_hd/pll.cpp | 10 +

############################################################################

Commit: 9816a89ade7d73bb1aa1d813b876e0d5076aa22b
URL: http://cgit.haiku-os.org/haiku/commit/?id=9816a89ade7d
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Wed Jul 8 05:13:58 2015 UTC

radeon_hd: Move to a unified dp aux transaction function.

* Leverage a single common dp aux message struct.
* Likely lots of obvious bugs that need fixed still.
* Untested.

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index 7b7c42a..f510a6b 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -133,65 +133,63 @@ dp_aux_speak(uint32 connectorIndex, uint8* send, int
sendBytes,


status_t
-dp_aux_write(uint32 connectorIndex, uint16 address,
- uint8* send, uint8 sendBytes, uint8 delay)
+dp_aux_transaction(uint32 connectorIndex, dp_aux_msg* message)
{
- uint8 auxMessage[20];
- int auxMessageBytes = sendBytes + 4;
-
- if (sendBytes > 16) {
- ERROR("%s: Too many bytes! (%" B_PRIu8 ")\n", __func__,
sendBytes);
- return -1;
+ uint8 delay = 0;
+ if (message == NULL) {
+ ERROR("%s: DP message is invalid!\n", __func__);
+ return B_ERROR;
}

- auxMessage[0] = address;
- auxMessage[1] = address >> 8;
- auxMessage[2] = AUX_NATIVE_WRITE << 4;
- auxMessage[3] = (auxMessageBytes << 4) | (sendBytes - 1);
- memcpy(&auxMessage[4], send, sendBytes);
-
- uint8 retry;
- for (retry = 0; retry < 7; retry++) {
- uint8 ack;
- status_t result = dp_aux_speak(connectorIndex, auxMessage,
- auxMessageBytes, NULL, 0, delay, &ack);
+ if (message->buffer == NULL) {
+ ERROR("%s: DP message uninitalized buffer!\n", __func__);
+ return B_ERROR;
+ }

- if (result == B_BUSY)
- continue;
- else if (result != B_OK)
- return result;
+ uint8 transactionSize = 4;

- ack >>= 4;
- if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
- return B_OK;
- else if ((ack & AUX_NATIVE_REPLY_MASK) ==
AUX_NATIVE_REPLY_DEFER)
- snooze(400);
- else
- return B_IO_ERROR;
+ switch(message->request) {
+ case AUX_NATIVE_WRITE:
+ case AUX_I2C_WRITE:
+ transactionSize += message->size;
+ break;
}

- ERROR("%s: IO Error. %" B_PRIu8 " attempts\n", __func__, retry);
- return B_IO_ERROR;
-}
-
+ if (transactionSize > 20) {
+ ERROR("%s: Too many bytes! (%" B_PRIu8 ")\n", __func__,
+ transactionSize);
+ return B_ERROR;
+ }

-status_t
-dp_aux_read(uint32 connectorIndex, uint16 address,
- uint8* recv, int recvBytes, uint8 delay)
-{
- uint8 auxMessage[4];
- int auxMessageBytes = 4;
+ uint8 auxMessage[20];
+ auxMessage[0] = message->address & 0xff;
+ auxMessage[1] = message->address >> 8;
+ auxMessage[2] = message->request << 4;
+ auxMessage[3] = message->size ? (message->size - 1) : 0;

- auxMessage[0] = address;
- auxMessage[1] = address >> 8;
- auxMessage[2] = AUX_NATIVE_READ << 4;
- auxMessage[3] = (auxMessageBytes << 4) | (recvBytes - 1);
+ if (message->size == 0)
+ auxMessage[3] |= 3 << 4;
+ else
+ auxMessage[3] |= transactionSize << 4;

uint8 retry;
for (retry = 0; retry < 7; retry++) {
uint8 ack;
- status_t result = dp_aux_speak(connectorIndex, auxMessage,
- auxMessageBytes, recv, recvBytes, delay, &ack);
+ status_t result = B_ERROR;
+ switch(message->request) {
+ case AUX_NATIVE_WRITE:
+ case AUX_I2C_WRITE:
+ memcpy(&auxMessage[4], message->buffer,
message->size);
+ result = dp_aux_speak(connectorIndex,
auxMessage,
+ transactionSize, NULL, 0, delay, &ack);
+ break;
+ case AUX_NATIVE_READ:
+ case AUX_I2C_READ:
+ result = dp_aux_speak(connectorIndex,
auxMessage,
+ transactionSize,
(uint8*)message->buffer, message->size,
+ delay, &ack);
+ break;
+ }

if (result == B_BUSY)
continue;
@@ -199,6 +197,7 @@ dp_aux_read(uint32 connectorIndex, uint16 address,
return result;

ack >>= 4;
+ message->reply = ack;
if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
return B_OK;
else if ((ack & AUX_NATIVE_REPLY_MASK) ==
AUX_NATIVE_REPLY_DEFER)
@@ -215,7 +214,13 @@ dp_aux_read(uint32 connectorIndex, uint16 address,
void
dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8 value)
{
- status_t result = dp_aux_write(connectorIndex, address, &value, 1, 0);
+ dp_aux_msg message;
+ message.address = address;
+ message.buffer = &value;
+ message.request = AUX_NATIVE_WRITE;
+ message.size = 1;
+
+ status_t result = dp_aux_transaction(connectorIndex, &message);
if (result != B_OK) {
ERROR("%s: error on DisplayPort aux write (0x%" B_PRIx32 ")\n",
__func__, result);
@@ -226,14 +231,21 @@ dpcd_reg_write(uint32 connectorIndex, uint16 address,
uint8 value)
uint8
dpcd_reg_read(uint32 connectorIndex, uint16 address)
{
- uint8 value = 0;
- status_t result = dp_aux_read(connectorIndex, address, &value, 1, 0);
+ // TODO: Review dpcd response size response[3]?
+ uint8 response;
+
+ dp_aux_msg message;
+ message.address = address;
+ message.request = AUX_NATIVE_READ;
+ message.buffer = &response;
+
+ status_t result = dp_aux_transaction(connectorIndex, &message);
if (result != B_OK) {
ERROR("%s: error on DisplayPort aux read (0x%" B_PRIx32 ")\n",
__func__, result);
}

- return value;
+ return response;
}


@@ -241,6 +253,7 @@ status_t
dp_aux_get_i2c_byte(uint32 connectorIndex, uint16 address, uint8* data,
bool start, bool stop)
{
+ // TODO: Leverage dp_aux_transaction
uint8 auxMessage[5];
int auxMessageBytes = 4; // 4 for read

@@ -319,6 +332,7 @@ status_t
dp_aux_set_i2c_byte(uint32 connectorIndex, uint16 address, uint8* data,
bool start, bool stop)
{
+ // TODO: Leverage dp_aux_transaction
uint8 auxMessage[5];
int auxMessageBytes = 5; // 5 for write

@@ -495,25 +509,30 @@ dp_setup_connectors()
uint32 auxPin = gGPIOInfo[i2cPinIndex]->hwPin;
dpInfo->auxPin = auxPin;

- uint8 auxMessage[DP_DPCD_SIZE];
+ dp_aux_msg message;
+ message.address = DP_DPCD_REV;
+ message.request = AUX_NATIVE_READ;
+ // TODO: validate
+ message.size = DP_DPCD_SIZE;
+ message.buffer = dpInfo->config;

- status_t result = dp_aux_read(index, DP_DPCD_REV, auxMessage,
- DP_DPCD_SIZE, 0);
+ status_t result = dp_aux_transaction(index, &message);

if (result == B_OK) {
dpInfo->valid = true;
- memcpy(dpInfo->config, auxMessage, DP_DPCD_SIZE);
TRACE("%s: connector(%" B_PRIu32 "): successful read of
DPCD\n",
__func__, index);
} else {
TRACE("%s: connector(%" B_PRIu32 "): failed read of
DPCD\n",
__func__, index);
}
+ /*
TRACE("%s: DPCD is ", __func__);
- uint32 position;
- for (position = 0; position < DP_DPCD_SIZE; position++)
- _sPrintf("%02x ", auxMessage[position]);
+ uint32 position;
+ for (position = 0; position < message.size; position++)
+ _sPrintf("%02x ", message.buffer + position);
_sPrintf("\n");
+ */
}
}

@@ -522,8 +541,13 @@ bool
dp_get_link_status(uint32 connectorIndex)
{
dp_info* dp = &gConnector[connectorIndex]->dpInfo;
- status_t result = dp_aux_read(connectorIndex, DP_LANE_STATUS_0_1,
- dp->linkStatus, DP_LINK_STATUS_SIZE, 100);
+ dp_aux_msg message;
+ message.address = DP_LANE_STATUS_0_1;
+ message.size = DP_LINK_STATUS_SIZE;
+ message.buffer = dp->linkStatus;
+
+ // TODO: Delay 100? Newer AMD code doesn't care about link status
+ status_t result = dp_aux_transaction(connectorIndex, &message);

if (result != B_OK) {
ERROR("%s: DisplayPort link status failed\n", __func__);
@@ -589,9 +613,13 @@ dp_update_vs_emph(uint32 connectorIndex)
transmitter_dig_setup(connectorIndex, dp->linkRate, 0,
dp->trainingSet[0], ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH);

- // Set vs and emph on the sink
- dp_aux_write(connectorIndex, DP_TRAIN_LANE0,
- dp->trainingSet, dp->laneCount, 0);
+ dp_aux_msg message;
+ message.request = AUX_NATIVE_WRITE;
+ message.address = DP_TRAIN_LANE0;
+ message.buffer = dp->trainingSet;
+ message.size = dp->laneCount;
+ // TODO: Review laneCount as it sounds strange.
+ dp_aux_transaction(connectorIndex, &message);
}


diff --git a/src/add-ons/accelerants/radeon_hd/displayport.h
b/src/add-ons/accelerants/radeon_hd/displayport.h
index ddb7c7c..d9cb956 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.h
+++ b/src/add-ons/accelerants/radeon_hd/displayport.h
@@ -27,10 +27,7 @@ uint8 dpcd_reg_read(uint32 connectorIndex, uint16 address);
void dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8 value);

// Communication over DisplayPort AUX channel
-status_t dp_aux_write(uint32 connectorIndex, uint16 address, uint8* send,
- uint8 sendBytes, uint8 delay);
-status_t dp_aux_read(uint32 connectorIndex, uint16 address, uint8* recv,
- int recvBytes, uint8 delay);
+status_t dp_aux_transaction(uint32 connectorIndex, dp_aux_msg* message);

status_t dp_aux_set_i2c_byte(uint32 connectorIndex, uint16 address,
uint8* data, bool start, bool stop);
diff --git a/src/add-ons/accelerants/radeon_hd/pll.cpp
b/src/add-ons/accelerants/radeon_hd/pll.cpp
index 8ad82ab..9c2db30 100644
--- a/src/add-ons/accelerants/radeon_hd/pll.cpp
+++ b/src/add-ons/accelerants/radeon_hd/pll.cpp
@@ -586,6 +586,11 @@ pll_setup_flags(pll_info* pll, uint8 crtcID)
}


+/**
+ * pll_adjust - Ask AtomBIOS if it wants to make adjustments to our pll
+ *
+ * Returns B_OK on successful execution.
+ */
status_t
pll_adjust(pll_info* pll, display_mode* mode, uint8 crtcID)
{
@@ -732,6 +737,11 @@ pll_adjust(pll_info* pll, display_mode* mode, uint8 crtcID)
}


+/*
+ * pll_set - Calculate and set a pll on the crtc provided based on the mode.
+ *
+ * Returns B_OK on successful execution
+ */
status_t
pll_set(display_mode* mode, uint8 crtcID)
{

############################################################################

Commit: 9cfe6f909d41656a852a2ba358eae8fa6224d5c1
URL: http://cgit.haiku-os.org/haiku/commit/?id=9cfe6f909d41
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Thu Jul 9 03:27:31 2015 UTC

radeon_hd: Fix missing TRACE connector id

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp
b/src/add-ons/accelerants/radeon_hd/display.cpp
index 2a160d7..5555756 100644
--- a/src/add-ons/accelerants/radeon_hd/display.cpp
+++ b/src/add-ons/accelerants/radeon_hd/display.cpp
@@ -283,7 +283,7 @@ detect_displays()

if (gDisplay[displayIndex]->attached) {
TRACE("%s: connector(%" B_PRIu32 "): Found
DisplayPort EDID!\n",
- __func__);
+ __func__, id);
}
}


############################################################################

Commit: 8a5884f561e88131d58e53b4d7a7d091ba13659c
URL: http://cgit.haiku-os.org/haiku/commit/?id=8a5884f561e8
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Thu Jul 9 04:19:01 2015 UTC

radeon_hd: Improve aux transaction tracing

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index f510a6b..e651c03 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -200,9 +200,10 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
message->reply = ack;
if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
return B_OK;
- else if ((ack & AUX_NATIVE_REPLY_MASK) ==
AUX_NATIVE_REPLY_DEFER)
+ else if ((ack & AUX_NATIVE_REPLY_MASK) ==
AUX_NATIVE_REPLY_DEFER) {
+ TRACE("%s: aux reply defer received. Snoozing.\n",
__func__);
snooze(400);
- else
+ } else
return B_IO_ERROR;
}

@@ -225,6 +226,7 @@ dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8
value)
ERROR("%s: error on DisplayPort aux write (0x%" B_PRIx32 ")\n",
__func__, result);
}
+ TRACE("%s: aux message reply: 0x%" B_PRIx8 "\n", __func__,
message.reply);
}


@@ -245,6 +247,8 @@ dpcd_reg_read(uint32 connectorIndex, uint16 address)
__func__, result);
}

+ TRACE("%s: aux message reply: 0x%" B_PRIx8 "\n", __func__,
message.reply);
+
return response;
}

@@ -739,7 +743,7 @@ dp_set_tp(uint32 connectorIndex, int trainingPattern)

/* set training pattern on the source */
if (info.dceMajor >= 4 || !dp->trainingUseEncoder) {
- TRACE("%s: Training with encoder...", __func__);
+ TRACE("%s: Training with encoder...\n", __func__);
switch (trainingPattern) {
case DP_TRAIN_PATTERN_1:
rawTrainingPattern =
ATOM_ENCODER_CMD_DP_LINK_TRAINING_PATTERN1;
@@ -753,7 +757,7 @@ dp_set_tp(uint32 connectorIndex, int trainingPattern)
}
encoder_dig_setup(connectorIndex, pll->pixelClock,
rawTrainingPattern);
} else {
- TRACE("%s: Training with encoder service...", __func__);
+ TRACE("%s: Training with encoder service...\n", __func__);
switch (trainingPattern) {
case DP_TRAIN_PATTERN_1:
rawTrainingPattern = 0;

############################################################################

Commit: 8611df9d0b4c5ebda93c6a430c370828584565ce
URL: http://cgit.haiku-os.org/haiku/commit/?id=8611df9d0b4c
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Mon Jul 13 05:43:38 2015 UTC

radeon_hd: Move i2c to dp aux transaction function.

* WIP: EDID version 255.255 found

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index e651c03..ea5484a 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011-2013, Haiku, Inc. All Rights Reserved.
+ * Copyright 2011-2015, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -31,7 +31,7 @@
#define ERROR(x...) _sPrintf("radeon_hd: " x)


-static status_t
+static ssize_t
dp_aux_speak(uint32 connectorIndex, uint8* send, int sendBytes,
uint8* recv, int recvBytes, uint8 delay, uint8* ack)
{
@@ -53,11 +53,11 @@ dp_aux_speak(uint32 connectorIndex, uint8* send, int
sendBytes,
union auxChannelTransaction args;
memset(&args, 0, sizeof(args));

- args.v1.lpAuxRequest = B_HOST_TO_LENDIAN_INT16(0 + 4);
- args.v1.lpDataOut = B_HOST_TO_LENDIAN_INT16(16 + 4);
- args.v1.ucDataOutLen = 0;
- args.v1.ucChannelID = dpInfo->auxPin;
- args.v1.ucDelay = delay / 10;
+ args.v2.lpAuxRequest = B_HOST_TO_LENDIAN_INT16(0 + 4);
+ args.v2.lpDataOut = B_HOST_TO_LENDIAN_INT16(16 + 4);
+ args.v2.ucDataOutLen = 0;
+ args.v2.ucChannelID = dpInfo->auxPin;
+ args.v2.ucDelay = delay / 10;

uint16 hpdPinIndex = gConnector[connectorIndex]->hpdPinIndex;
if (info.dceMajor >= 4
@@ -105,17 +105,17 @@ dp_aux_speak(uint32 connectorIndex, uint8* send, int
sendBytes,

atom_execute_table(gAtomContext, index, (uint32*)&args);

- *ack = args.v1.ucReplyStatus;
+ *ack = args.v2.ucReplyStatus;

- switch (args.v1.ucReplyStatus) {
+ switch (args.v2.ucReplyStatus) {
case 1:
- ERROR("%s: dp_aux_ch timeout!\n", __func__);
+ ERROR("%s: dp_aux channel timeout!\n", __func__);
return B_TIMED_OUT;
case 2:
- ERROR("%s: dp_aux_ch flags not zero!\n", __func__);
+ ERROR("%s: dp_aux channel flags not zero!\n", __func__);
return B_BUSY;
case 3:
- ERROR("%s: dp_aux_ch error!\n", __func__);
+ ERROR("%s: dp_aux channel error!\n", __func__);
return B_IO_ERROR;
}

@@ -128,7 +128,7 @@ dp_aux_speak(uint32 connectorIndex, uint8* send, int
sendBytes,
if (recv && recvBytes)
memcpy(recv, base + 16, recvLength);

- return B_OK;
+ return recvLength;
}


@@ -141,8 +141,9 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
return B_ERROR;
}

- if (message->buffer == NULL) {
- ERROR("%s: DP message uninitalized buffer!\n", __func__);
+ if (message->size > 16) {
+ ERROR("%s: Too many bytes! (%" B_PRIuSIZE ")\n", __func__,
+ message->size);
return B_ERROR;
}

@@ -151,16 +152,14 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
switch(message->request) {
case AUX_NATIVE_WRITE:
case AUX_I2C_WRITE:
+ if (message->buffer == NULL) {
+ ERROR("%s: DP message uninitalized buffer!\n",
__func__);
+ return B_ERROR;
+ }
transactionSize += message->size;
break;
}

- if (transactionSize > 20) {
- ERROR("%s: Too many bytes! (%" B_PRIu8 ")\n", __func__,
- transactionSize);
- return B_ERROR;
- }
-
uint8 auxMessage[20];
auxMessage[0] = message->address & 0xff;
auxMessage[1] = message->address >> 8;
@@ -175,11 +174,11 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
uint8 retry;
for (retry = 0; retry < 7; retry++) {
uint8 ack;
- status_t result = B_ERROR;
- switch(message->request) {
+ ssize_t result = B_ERROR;
+ switch(message->request & ~AUX_I2C_MOT) {
case AUX_NATIVE_WRITE:
case AUX_I2C_WRITE:
- memcpy(&auxMessage[4], message->buffer,
message->size);
+ memcpy(auxMessage + 4, message->buffer,
message->size);
result = dp_aux_speak(connectorIndex,
auxMessage,
transactionSize, NULL, 0, delay, &ack);
break;
@@ -189,22 +188,32 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
transactionSize,
(uint8*)message->buffer, message->size,
delay, &ack);
break;
+ default:
+ ERROR("%s: Unknown dp_aux_msg request!\n",
__func__);
+ return B_ERROR;
}

+ TRACE("%s: dp_aux_speak result: %" B_PRIdSSIZE "\n", __func__,
result);
+
if (result == B_BUSY)
continue;
- else if (result != B_OK)
+ else if (result < B_OK)
return result;

ack >>= 4;
message->reply = ack;
- if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
- return B_OK;
- else if ((ack & AUX_NATIVE_REPLY_MASK) ==
AUX_NATIVE_REPLY_DEFER) {
- TRACE("%s: aux reply defer received. Snoozing.\n",
__func__);
- snooze(400);
- } else
- return B_IO_ERROR;
+ switch(message->reply & AUX_NATIVE_REPLY_MASK) {
+ case AUX_NATIVE_REPLY_ACK:
+ return B_OK;
+ case AUX_NATIVE_REPLY_DEFER:
+ TRACE("%s: aux reply defer received.
Snoozing.\n", __func__);
+ snooze(400);
+ break;
+ default:
+ TRACE("%s: aux invalid native reply: 0x%02x\n",
__func__,
+ message->reply);
+ return B_IO_ERROR;
+ }
}

ERROR("%s: IO Error. %" B_PRIu8 " attempts\n", __func__, retry);
@@ -215,6 +224,9 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
void
dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8 value)
{
+ TRACE("%s: connector(%" B_PRId32 "): 0x%" B_PRIx16 " -> 0x%" B_PRIx8
"\n",
+ __func__, connectorIndex, address, value);
+
dp_aux_msg message;
message.address = address;
message.buffer = &value;
@@ -233,13 +245,16 @@ dpcd_reg_write(uint32 connectorIndex, uint16 address,
uint8 value)
uint8
dpcd_reg_read(uint32 connectorIndex, uint16 address)
{
- // TODO: Review dpcd response size response[3]?
- uint8 response;
+ TRACE("%s: connector(%" B_PRId32 "): read 0x%" B_PRIx16 ".\n",
+ __func__, connectorIndex, address);
+
+ uint8 response[3];

dp_aux_msg message;
message.address = address;
- message.request = AUX_NATIVE_READ;
message.buffer = &response;
+ message.request = AUX_NATIVE_READ;
+ message.size = 1;

status_t result = dp_aux_transaction(connectorIndex, &message);
if (result != B_OK) {
@@ -249,7 +264,7 @@ dpcd_reg_read(uint32 connectorIndex, uint16 address)

TRACE("%s: aux message reply: 0x%" B_PRIx8 "\n", __func__,
message.reply);

- return response;
+ return response[0];
}


@@ -257,77 +272,46 @@ status_t
dp_aux_get_i2c_byte(uint32 connectorIndex, uint16 address, uint8* data,
bool start, bool stop)
{
- // TODO: Leverage dp_aux_transaction
- uint8 auxMessage[5];
- int auxMessageBytes = 4; // 4 for read
-
- /* Set up the command byte */
- auxMessage[2] = AUX_I2C_READ << 4;
- if (stop == false)
- auxMessage[2] |= AUX_I2C_MOT << 4;
-
- auxMessage[0] = address;
- auxMessage[1] = address >> 8;
-
- auxMessage[3] = auxMessageBytes << 4;
-
- /* special case for sending the START or STOP */
- if (start || stop) {
- auxMessage[3] = 3 << 4;
- auxMessageBytes = 4;
+ uint8 reply[3];
+ dp_aux_msg message;
+ message.address = address;
+ message.buffer = reply;
+ message.request = AUX_I2C_READ;
+ message.size = 1;
+ if (stop == false) {
+ // Remove Middle-Of-Transmission on final transaction
+ message.request |= AUX_I2C_MOT;
+ }
+ if (stop || start) {
+ // Bare address packet
+ message.buffer = NULL;
+ message.size = 0;
}

- int retry;
- for (retry = 0; retry < 4; retry++) {
- uint8 ack;
- uint8 reply[2];
- int replyBytes = 1;
-
- status_t result = dp_aux_speak(connectorIndex, auxMessage,
- auxMessageBytes, reply, replyBytes, 0, &ack);
- if (result == B_BUSY)
- continue;
- else if (result != B_OK) {
- ERROR("%s: aux_ch speak failed 0x%" B_PRIx32 "\n",
__func__, result);
- return B_ERROR;
- }
-
- switch (ack & AUX_NATIVE_REPLY_MASK) {
- case AUX_NATIVE_REPLY_ACK:
- // I2C-over-AUX Reply field is only valid for
AUX_ACK
- break;
- case AUX_NATIVE_REPLY_NACK:
- TRACE("%s: aux_ch native nack\n", __func__);
- return B_IO_ERROR;
- case AUX_NATIVE_REPLY_DEFER:
- TRACE("%s: aux_ch native defer\n", __func__);
- snooze(400);
- continue;
- default:
- TRACE("%s: aux_ch invalid native reply:
0x%02x\n",
- __func__, ack);
- return B_ERROR;
+ for (int attempt = 0; attempt < 7; attempt++) {
+ status_t result = dp_aux_transaction(connectorIndex, &message);
+ if (result != B_OK) {
+ ERROR("%s: aux_ch transaction failed!\n", __func__);
+ return result;
}

- switch (ack & AUX_I2C_REPLY_MASK) {
+ switch (message.reply & AUX_I2C_REPLY_MASK) {
case AUX_I2C_REPLY_ACK:
*data = reply[0];
return B_OK;
case AUX_I2C_REPLY_NACK:
- TRACE("%s: aux_i2c nack\n", __func__);
+ TRACE("%s: aux i2c nack\n", __func__);
return B_IO_ERROR;
case AUX_I2C_REPLY_DEFER:
- TRACE("%s: aux_i2c defer\n", __func__);
+ TRACE("%s: aux i2c defer\n", __func__);
snooze(400);
break;
default:
- TRACE("%s: aux_i2c invalid native reply:
0x%02x\n",
- __func__, ack);
+ TRACE("%s: aux invalid I2C reply: 0x%02x\n",
+ __func__, message.reply);
return B_ERROR;
}
}
-
- TRACE("%s: aux i2c too many retries, giving up.\n", __func__);
return B_ERROR;
}

@@ -336,79 +320,40 @@ status_t
dp_aux_set_i2c_byte(uint32 connectorIndex, uint16 address, uint8* data,
bool start, bool stop)
{
- // TODO: Leverage dp_aux_transaction
- uint8 auxMessage[5];
- int auxMessageBytes = 5; // 5 for write
-
- /* Set up the command byte */
- auxMessage[2] = AUX_I2C_WRITE << 4;
+ dp_aux_msg message;
+ message.address = address;
+ message.buffer = data;
+ message.request = AUX_I2C_WRITE;
if (stop == false)
- auxMessage[2] |= AUX_I2C_MOT << 4;
-
- auxMessage[0] = address;
- auxMessage[1] = address >> 8;
-
- auxMessage[3] = auxMessageBytes << 4;
- auxMessage[4] = *data;
-
- /* special case for sending the START or STOP */
- if (start || stop) {
- auxMessage[3] = 3 << 4;
- auxMessageBytes = 4;
- }
-
- int retry;
- for (retry = 0; retry < 4; retry++) {
- uint8 ack;
- uint8 reply[2];
- int replyBytes = 1;
-
- status_t result = dp_aux_speak(connectorIndex, auxMessage,
- auxMessageBytes, reply, replyBytes, 0, &ack);
- if (result == B_BUSY)
- continue;
- else if (result != B_OK) {
- ERROR("%s: aux_ch speak failed 0x%" B_PRIx32 "\n",
__func__, result);
- return B_ERROR;
- }
+ message.request |= AUX_I2C_MOT;
+ message.size = 1;
+ if (stop || start)
+ message.size = 0;

- switch (ack & AUX_NATIVE_REPLY_MASK) {
- case AUX_NATIVE_REPLY_ACK:
- // I2C-over-AUX Reply field is only valid for
AUX_ACK
- break;
- case AUX_NATIVE_REPLY_NACK:
- TRACE("%s: aux_ch native nack\n", __func__);
- return B_IO_ERROR;
- case AUX_NATIVE_REPLY_DEFER:
- TRACE("%s: aux_ch native defer\n", __func__);
- snooze(400);
- continue;
- default:
- TRACE("%s: aux_ch invalid native reply:
0x%02x\n",
- __func__, ack);
- return B_ERROR;
+ for (int attempt = 0; attempt < 7; attempt++) {
+ status_t result = dp_aux_transaction(connectorIndex, &message);
+ if (result != B_OK) {
+ ERROR("%s: aux_ch transaction failed!\n", __func__);
+ return result;
}
-
- switch (ack & AUX_I2C_REPLY_MASK) {
+ switch (message.reply & AUX_I2C_REPLY_MASK) {
case AUX_I2C_REPLY_ACK:
- // Success!
return B_OK;
case AUX_I2C_REPLY_NACK:
- TRACE("%s: aux_i2c nack\n", __func__);
+ ERROR("%s: aux i2c nack\n", __func__);
return B_IO_ERROR;
case AUX_I2C_REPLY_DEFER:
- TRACE("%s: aux_i2c defer\n", __func__);
+ TRACE("%s: aux i2c defer\n", __func__);
snooze(400);
break;
default:
- TRACE("%s: aux_i2c invalid native reply:
0x%02x\n",
- __func__, ack);
- return B_ERROR;
+ ERROR("%s: aux invalid I2C reply: 0x%02x\n",
__func__,
+ message.reply);
+ return B_IO_ERROR;
}
}

- TRACE("%s: aux i2c too many retries, giving up.\n", __func__);
- return B_OK;
+ return B_ERROR;
}


@@ -1046,10 +991,10 @@ ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info*
edid)
dp_aux_get_i2c_byte(connectorIndex, 0x50, rdata, true, false);
dp_aux_get_i2c_byte(connectorIndex, 0x50, rdata, false, false);
dp_aux_get_i2c_byte(connectorIndex, 0x50, rdata, false, true);
+
dp_aux_set_i2c_byte(connectorIndex, 0x50, &sdata, true, false);
dp_aux_set_i2c_byte(connectorIndex, 0x50, &sdata, false, false);
dp_aux_get_i2c_byte(connectorIndex, 0x50, rdata, true, false);
-
for (uint32 i = 0; i < sizeof(raw); i++) {
status_t result = dp_aux_get_i2c_byte(connectorIndex, 0x50,
rdata++, false, false);
@@ -1062,6 +1007,9 @@ ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info*
edid)
}
dp_aux_get_i2c_byte(connectorIndex, 0x50, &sdata, false, true);

+ TRACE("%s: EDID version %" B_PRIu8 ".%" B_PRIu8 "\n", __func__,
+ raw.version.version, raw.version.revision);
+
if (raw.version.version != 1 || raw.version.revision > 4) {
ERROR("%s: EDID version or revision out of range\n", __func__);
return false;

############################################################################

Commit: 7ea1ad1028f83622dca241cb385cf47a100a1b24
URL: http://cgit.haiku-os.org/haiku/commit/?id=7ea1ad1028f8
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Tue Jul 14 00:50:06 2015 UTC

radeon_hd: Fix dp aux request / response shifts

----------------------------------------------------------------------------

diff --git a/headers/private/graphics/common/dp_raw.h
b/headers/private/graphics/common/dp_raw.h
index 2acd909..bad7fea 100644
--- a/headers/private/graphics/common/dp_raw.h
+++ b/headers/private/graphics/common/dp_raw.h
@@ -12,21 +12,21 @@
/* ****************************************************** */
/* *** AUX Channel Communications *** */
// Native AUX Communications
-#define AUX_NATIVE_WRITE (8 << 0)
-#define AUX_NATIVE_READ (9 << 0)
-#define AUX_NATIVE_REPLY_ACK (0 << 4)
-#define AUX_NATIVE_REPLY_NACK (1 << 4)
-#define AUX_NATIVE_REPLY_DEFER (2 << 4)
-#define AUX_NATIVE_REPLY_MASK (3 << 4)
+#define DP_AUX_NATIVE_WRITE 0x8
+#define DP_AUX_NATIVE_READ 0x9
+#define DP_AUX_NATIVE_REPLY_ACK (0x0 << 0)
+#define DP_AUX_NATIVE_REPLY_NACK (0x1 << 0)
+#define DP_AUX_NATIVE_REPLY_DEFER (0x2 << 0)
+#define DP_AUX_NATIVE_REPLY_MASK (0x3 << 0)
// AUX i2c Communications
-#define AUX_I2C_WRITE (0 << 0)
-#define AUX_I2C_READ (1 << 0)
-#define AUX_I2C_STATUS (2 << 0)
-#define AUX_I2C_MOT (4 << 0)
-#define AUX_I2C_REPLY_ACK (0 << 6)
-#define AUX_I2C_REPLY_NACK (1 << 6)
-#define AUX_I2C_REPLY_DEFER (2 << 6)
-#define AUX_I2C_REPLY_MASK (3 << 6)
+#define DP_AUX_I2C_WRITE 0x0
+#define DP_AUX_I2C_READ 0x1
+#define DP_AUX_I2C_STATUS 0x2
+#define DP_AUX_I2C_MOT 0x4
+#define DP_AUX_I2C_REPLY_ACK (0x0 << 2)
+#define DP_AUX_I2C_REPLY_NACK (0x1 << 2)
+#define DP_AUX_I2C_REPLY_DEFER (0x2 << 2)
+#define DP_AUX_I2C_REPLY_MASK (0x3 << 2)


/* ****************************************************** */
diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index ea5484a..a5d4ee3 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -150,8 +150,8 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
uint8 transactionSize = 4;

switch(message->request) {
- case AUX_NATIVE_WRITE:
- case AUX_I2C_WRITE:
+ case DP_AUX_NATIVE_WRITE:
+ case DP_AUX_I2C_WRITE:
if (message->buffer == NULL) {
ERROR("%s: DP message uninitalized buffer!\n",
__func__);
return B_ERROR;
@@ -175,15 +175,15 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
for (retry = 0; retry < 7; retry++) {
uint8 ack;
ssize_t result = B_ERROR;
- switch(message->request & ~AUX_I2C_MOT) {
- case AUX_NATIVE_WRITE:
- case AUX_I2C_WRITE:
+ switch(message->request & ~DP_AUX_I2C_MOT) {
+ case DP_AUX_NATIVE_WRITE:
+ case DP_AUX_I2C_WRITE:
memcpy(auxMessage + 4, message->buffer,
message->size);
result = dp_aux_speak(connectorIndex,
auxMessage,
transactionSize, NULL, 0, delay, &ack);
break;
- case AUX_NATIVE_READ:
- case AUX_I2C_READ:
+ case DP_AUX_NATIVE_READ:
+ case DP_AUX_I2C_READ:
result = dp_aux_speak(connectorIndex,
auxMessage,
transactionSize,
(uint8*)message->buffer, message->size,
delay, &ack);
@@ -202,10 +202,10 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)

ack >>= 4;
message->reply = ack;
- switch(message->reply & AUX_NATIVE_REPLY_MASK) {
- case AUX_NATIVE_REPLY_ACK:
+ switch(message->reply & DP_AUX_NATIVE_REPLY_MASK) {
+ case DP_AUX_NATIVE_REPLY_ACK:
return B_OK;
- case AUX_NATIVE_REPLY_DEFER:
+ case DP_AUX_NATIVE_REPLY_DEFER:
TRACE("%s: aux reply defer received.
Snoozing.\n", __func__);
snooze(400);
break;
@@ -230,7 +230,7 @@ dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8
value)
dp_aux_msg message;
message.address = address;
message.buffer = &value;
- message.request = AUX_NATIVE_WRITE;
+ message.request = DP_AUX_NATIVE_WRITE;
message.size = 1;

status_t result = dp_aux_transaction(connectorIndex, &message);
@@ -253,7 +253,7 @@ dpcd_reg_read(uint32 connectorIndex, uint16 address)
dp_aux_msg message;
message.address = address;
message.buffer = &response;
- message.request = AUX_NATIVE_READ;
+ message.request = DP_AUX_NATIVE_READ;
message.size = 1;

status_t result = dp_aux_transaction(connectorIndex, &message);
@@ -276,11 +276,11 @@ dp_aux_get_i2c_byte(uint32 connectorIndex, uint16
address, uint8* data,
dp_aux_msg message;
message.address = address;
message.buffer = reply;
- message.request = AUX_I2C_READ;
+ message.request = DP_AUX_I2C_READ;
message.size = 1;
if (stop == false) {
// Remove Middle-Of-Transmission on final transaction
- message.request |= AUX_I2C_MOT;
+ message.request |= DP_AUX_I2C_MOT;
}
if (stop || start) {
// Bare address packet
@@ -295,14 +295,14 @@ dp_aux_get_i2c_byte(uint32 connectorIndex, uint16
address, uint8* data,
return result;
}

- switch (message.reply & AUX_I2C_REPLY_MASK) {
- case AUX_I2C_REPLY_ACK:
+ switch (message.reply & DP_AUX_I2C_REPLY_MASK) {
+ case DP_AUX_I2C_REPLY_ACK:
*data = reply[0];
return B_OK;
- case AUX_I2C_REPLY_NACK:
+ case DP_AUX_I2C_REPLY_NACK:
TRACE("%s: aux i2c nack\n", __func__);
return B_IO_ERROR;
- case AUX_I2C_REPLY_DEFER:
+ case DP_AUX_I2C_REPLY_DEFER:
TRACE("%s: aux i2c defer\n", __func__);
snooze(400);
break;
@@ -323,9 +323,9 @@ dp_aux_set_i2c_byte(uint32 connectorIndex, uint16 address,
uint8* data,
dp_aux_msg message;
message.address = address;
message.buffer = data;
- message.request = AUX_I2C_WRITE;
+ message.request = DP_AUX_I2C_WRITE;
if (stop == false)
- message.request |= AUX_I2C_MOT;
+ message.request |= DP_AUX_I2C_MOT;
message.size = 1;
if (stop || start)
message.size = 0;
@@ -336,13 +336,13 @@ dp_aux_set_i2c_byte(uint32 connectorIndex, uint16
address, uint8* data,
ERROR("%s: aux_ch transaction failed!\n", __func__);
return result;
}
- switch (message.reply & AUX_I2C_REPLY_MASK) {
- case AUX_I2C_REPLY_ACK:
+ switch (message.reply & DP_AUX_I2C_REPLY_MASK) {
+ case DP_AUX_I2C_REPLY_ACK:
return B_OK;
- case AUX_I2C_REPLY_NACK:
+ case DP_AUX_I2C_REPLY_NACK:
ERROR("%s: aux i2c nack\n", __func__);
return B_IO_ERROR;
- case AUX_I2C_REPLY_DEFER:
+ case DP_AUX_I2C_REPLY_DEFER:
TRACE("%s: aux i2c defer\n", __func__);
snooze(400);
break;
@@ -460,7 +460,7 @@ dp_setup_connectors()

dp_aux_msg message;
message.address = DP_DPCD_REV;
- message.request = AUX_NATIVE_READ;
+ message.request = DP_AUX_NATIVE_READ;
// TODO: validate
message.size = DP_DPCD_SIZE;
message.buffer = dpInfo->config;
@@ -563,7 +563,7 @@ dp_update_vs_emph(uint32 connectorIndex)
dp->trainingSet[0], ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH);

dp_aux_msg message;
- message.request = AUX_NATIVE_WRITE;
+ message.request = DP_AUX_NATIVE_WRITE;
message.address = DP_TRAIN_LANE0;
message.buffer = dp->trainingSet;
message.size = dp->laneCount;

############################################################################

Commit: 408e616e058e0fc406b88bea10e51eb8a3da4265
URL: http://cgit.haiku-os.org/haiku/commit/?id=408e616e058e
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Tue Jul 14 02:44:12 2015 UTC

radeon_hd: Sanitize dp_aux messages before use

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index a5d4ee3..a24753f 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -228,6 +228,8 @@ dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8
value)
__func__, connectorIndex, address, value);

dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.address = address;
message.buffer = &value;
message.request = DP_AUX_NATIVE_WRITE;
@@ -251,6 +253,8 @@ dpcd_reg_read(uint32 connectorIndex, uint16 address)
uint8 response[3];

dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.address = address;
message.buffer = &response;
message.request = DP_AUX_NATIVE_READ;
@@ -274,6 +278,8 @@ dp_aux_get_i2c_byte(uint32 connectorIndex, uint16 address,
uint8* data,
{
uint8 reply[3];
dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.address = address;
message.buffer = reply;
message.request = DP_AUX_I2C_READ;
@@ -321,6 +327,8 @@ dp_aux_set_i2c_byte(uint32 connectorIndex, uint16 address,
uint8* data,
bool start, bool stop)
{
dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.address = address;
message.buffer = data;
message.request = DP_AUX_I2C_WRITE;
@@ -459,6 +467,8 @@ dp_setup_connectors()
dpInfo->auxPin = auxPin;

dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.address = DP_DPCD_REV;
message.request = DP_AUX_NATIVE_READ;
// TODO: validate
@@ -490,7 +500,10 @@ bool
dp_get_link_status(uint32 connectorIndex)
{
dp_info* dp = &gConnector[connectorIndex]->dpInfo;
+
dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.address = DP_LANE_STATUS_0_1;
message.size = DP_LINK_STATUS_SIZE;
message.buffer = dp->linkStatus;
@@ -563,6 +576,8 @@ dp_update_vs_emph(uint32 connectorIndex)
dp->trainingSet[0], ATOM_TRANSMITTER_ACTION_SETUP_VSEMPH);

dp_aux_msg message;
+ memset(&message, 0, sizeof(message));
+
message.request = DP_AUX_NATIVE_WRITE;
message.address = DP_TRAIN_LANE0;
message.buffer = dp->trainingSet;

############################################################################

Commit: 80a0d0da5a8f9e1d3c068494e11cce9b0aa0799a
URL: http://cgit.haiku-os.org/haiku/commit/?id=80a0d0da5a8f
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Tue Jul 14 03:58:05 2015 UTC

radeon_hd: Fix missing subtraction of MOT in case.

* DP i2c edid byte-bang working again

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index a24753f..f7c0867 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -149,17 +149,19 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)

uint8 transactionSize = 4;

- switch(message->request) {
+ switch(message->request & ~DP_AUX_I2C_MOT) {
case DP_AUX_NATIVE_WRITE:
case DP_AUX_I2C_WRITE:
- if (message->buffer == NULL) {
- ERROR("%s: DP message uninitalized buffer!\n",
__func__);
- return B_ERROR;
- }
transactionSize += message->size;
break;
}

+ // If not bare address, check for buffer
+ if (message->size > 0 && message->buffer == NULL) {
+ ERROR("%s: DP message uninitalized buffer!\n", __func__);
+ return B_ERROR;
+ }
+
uint8 auxMessage[20];
auxMessage[0] = message->address & 0xff;
auxMessage[1] = message->address >> 8;
@@ -332,11 +334,13 @@ dp_aux_set_i2c_byte(uint32 connectorIndex, uint16
address, uint8* data,
message.address = address;
message.buffer = data;
message.request = DP_AUX_I2C_WRITE;
+ message.size = 1;
if (stop == false)
message.request |= DP_AUX_I2C_MOT;
- message.size = 1;
- if (stop || start)
+ if (stop || start) {
+ message.buffer = NULL;
message.size = 0;
+ }

for (int attempt = 0; attempt < 7; attempt++) {
status_t result = dp_aux_transaction(connectorIndex, &message);
@@ -1010,6 +1014,7 @@ ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info*
edid)
dp_aux_set_i2c_byte(connectorIndex, 0x50, &sdata, true, false);
dp_aux_set_i2c_byte(connectorIndex, 0x50, &sdata, false, false);
dp_aux_get_i2c_byte(connectorIndex, 0x50, rdata, true, false);
+
for (uint32 i = 0; i < sizeof(raw); i++) {
status_t result = dp_aux_get_i2c_byte(connectorIndex, 0x50,
rdata++, false, false);

############################################################################

Commit: f1b29809bd97c4bedc1564d87ece9354d120f46a
URL: http://cgit.haiku-os.org/haiku/commit/?id=f1b29809bd97
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Tue Jul 14 04:05:04 2015 UTC

radeon_hd: Fix missing DP link status request flag

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index f7c0867..ab34fde 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -508,6 +508,7 @@ dp_get_link_status(uint32 connectorIndex)
dp_aux_msg message;
memset(&message, 0, sizeof(message));

+ message.request = DP_AUX_NATIVE_READ;
message.address = DP_LANE_STATUS_0_1;
message.size = DP_LINK_STATUS_SIZE;
message.buffer = dp->linkStatus;

############################################################################

Revision: hrev49399
Commit: 991710be3915397f9baaaf599860cb945ab60a8d
URL: http://cgit.haiku-os.org/haiku/commit/?id=991710be3915
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Tue Jul 14 04:10:06 2015 UTC

radeon_hd: Reduce DisplayPort Tracing

----------------------------------------------------------------------------

diff --git a/src/add-ons/accelerants/radeon_hd/displayport.cpp
b/src/add-ons/accelerants/radeon_hd/displayport.cpp
index ab34fde..99bfa93 100644
--- a/src/add-ons/accelerants/radeon_hd/displayport.cpp
+++ b/src/add-ons/accelerants/radeon_hd/displayport.cpp
@@ -195,8 +195,6 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
return B_ERROR;
}

- TRACE("%s: dp_aux_speak result: %" B_PRIdSSIZE "\n", __func__,
result);
-
if (result == B_BUSY)
continue;
else if (result < B_OK)
@@ -226,9 +224,8 @@ dp_aux_transaction(uint32 connectorIndex, dp_aux_msg*
message)
void
dpcd_reg_write(uint32 connectorIndex, uint16 address, uint8 value)
{
- TRACE("%s: connector(%" B_PRId32 "): 0x%" B_PRIx16 " -> 0x%" B_PRIx8
"\n",
- __func__, connectorIndex, address, value);
-
+ //TRACE("%s: connector(%" B_PRId32 "): 0x%" B_PRIx16 " -> 0x%" B_PRIx8
"\n",
+ // __func__, connectorIndex, address, value);
dp_aux_msg message;
memset(&message, 0, sizeof(message));

@@ -242,16 +239,14 @@ dpcd_reg_write(uint32 connectorIndex, uint16 address,
uint8 value)
ERROR("%s: error on DisplayPort aux write (0x%" B_PRIx32 ")\n",
__func__, result);
}
- TRACE("%s: aux message reply: 0x%" B_PRIx8 "\n", __func__,
message.reply);
}


uint8
dpcd_reg_read(uint32 connectorIndex, uint16 address)
{
- TRACE("%s: connector(%" B_PRId32 "): read 0x%" B_PRIx16 ".\n",
- __func__, connectorIndex, address);
-
+ //TRACE("%s: connector(%" B_PRId32 "): read 0x%" B_PRIx16 ".\n",
+ // __func__, connectorIndex, address);
uint8 response[3];

dp_aux_msg message;
@@ -268,8 +263,6 @@ dpcd_reg_read(uint32 connectorIndex, uint16 address)
__func__, result);
}

- TRACE("%s: aux message reply: 0x%" B_PRIx8 "\n", __func__,
message.reply);
-
return response[0];
}

@@ -1028,9 +1021,6 @@ ddc2_dp_read_edid1(uint32 connectorIndex, edid1_info*
edid)
}
dp_aux_get_i2c_byte(connectorIndex, 0x50, &sdata, false, true);

- TRACE("%s: EDID version %" B_PRIu8 ".%" B_PRIu8 "\n", __func__,
- raw.version.version, raw.version.revision);
-
if (raw.version.version != 1 || raw.version.revision > 4) {
ERROR("%s: EDID version or revision out of range\n", __func__);
return false;


Other related posts:

  • » [haiku-commits] haiku: hrev49399 - src/add-ons/accelerants/radeon_hd headers/private/graphics/common - kallisti5