* small bit of common i2c / ddc white space cleanup
* small bit of tracing cleanup * no functional change git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42794 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#define READ_RETRIES 4 // number of retries to read ddc data
|
#define READ_RETRIES 4 // number of retries to read ddc data
|
||||||
|
|
||||||
|
|
||||||
#define TRACE_DDC
|
#define TRACE_DDC
|
||||||
#ifdef TRACE_DDC
|
#ifdef TRACE_DDC
|
||||||
extern void _sPrintf(const char* format, ...);
|
extern void _sPrintf(const char* format, ...);
|
||||||
@@ -28,7 +27,6 @@ extern void _sPrintf(const char* format, ...);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//! Verify checksum of DDC data.
|
//! Verify checksum of DDC data.
|
||||||
static status_t
|
static status_t
|
||||||
verify_checksum(const uint8 *data, size_t len)
|
verify_checksum(const uint8 *data, size_t len)
|
||||||
@@ -43,12 +41,12 @@ verify_checksum(const uint8 *data, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (allOr == 0) {
|
if (allOr == 0) {
|
||||||
TRACE("verify_checksum() DDC information contains zeros only\n");
|
TRACE("%s: DDC information contains zeros only\n", __func__);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sum != 0) {
|
if (sum != 0) {
|
||||||
TRACE("verify_checksum() Checksum error in DDC information\n");
|
TRACE("%s: Checksum error in DDC information\n", __func__);
|
||||||
return B_IO_ERROR;
|
return B_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,14 +70,14 @@ ddc2_read(const i2c_bus *bus, int start, uint8 *buffer, size_t length)
|
|||||||
start < 0x100 ? 1 : 2, buffer, length);
|
start < 0x100 ? 1 : 2, buffer, length);
|
||||||
|
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
TRACE("ddc2_read(): DDC information read failure\n");
|
TRACE("%s: DDC information read failure\n", __func__);
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
status = verify_checksum(buffer, length);
|
status = verify_checksum(buffer, length);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
dprintf("DDC checksum incorrect!\n");
|
dprintf("%s: DDC checksum incorrect!\n", __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +157,7 @@ ddc2_read_edid1(const i2c_bus *bus, edid1_info *edid,
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (raw.version.version != 1 || raw.version.revision > 4) {
|
if (raw.version.version != 1 || raw.version.revision > 4) {
|
||||||
TRACE("ddc2_read_edid1() EDID version or revision out of range\n");
|
TRACE("%s: EDID version or revision out of range\n", __func__);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,8 +107,10 @@ wait_for_clk(const i2c_bus *bus, bigtime_t timeout)
|
|||||||
if (clk != 0)
|
if (clk != 0)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
if (system_time() - startTime > timeout)
|
if (system_time() - startTime > timeout) {
|
||||||
|
TRACE("%s: Timeout waiting on clock (r)\n");
|
||||||
return B_TIMEOUT;
|
return B_TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
spin(bus->timing.r);
|
spin(bus->timing.r);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user