8000 Expose bus configuration values in IORegistry by ben9923 · Pull Request #425 · VoodooI2C/VoodooI2C · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Expose bus configuration values in IORegistry #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ IOReturn VoodooI2CControllerDriver::getBusConfig() {
return kIOReturnSuccess;
}

IOReturn VoodooI2CControllerDriver::setBusConfigProperties() {
OSDictionary* properties = OSDictionary::withCapacity(5);
if (!properties)
return kIOReturnNoMemory;

setOSDictionaryNumber(properties, "SS_HCNT", bus_device.acpi_config.ss_hcnt);
setOSDictionaryNumber(properties, "SS_LCNT", bus_device.acpi_config.ss_lcnt);
setOSDictionaryNumber(properties, "FS_HCNT", bus_device.acpi_config.fs_hcnt);
setOSDictionaryNumber(properties, "FS_LCNT", bus_device.acpi_config.fs_lcnt);
setOSDictionaryNumber(properties, "SDA_HOLD", bus_device.acpi_config.sda_hold);

setProperty("BusConfig", properties);
OSSafeReleaseNULL(properties);

return kIOReturnSuccess;
}

void VoodooI2CControllerDriver::handleAbortI2C() {
IOLog("%s::%s I2C Transaction error details\n", getName(), bus_device.name);

Expand Down Expand Up @@ -458,6 +475,8 @@ bool VoodooI2CControllerDriver::start(IOService* provider) {
IOLog("%s::%s Got bus configuration values\n", getName(), bus_device.name);
}

setBusConfigProperties();

bus_device.functionality = I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_I2C_BLOCK;
bus_device.bus_config = DW_IC_CON_MASTER | DW_IC_CON_SLAVE_DISABLE | DW_IC_CON_RESTART_EN | DW_IC_CON_SPEED_FAST;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ class EXPORT VoodooI2CControllerDriver : public IOService {

IOReturn getBusConfig();

/* Set bus configuration values in the IORegistry.
*
* @return *kIOReturnSuccess* if setting succeeded, *kIOReturnNoMemory* on allocation failure.
*/

IOReturn setBusConfigProperties();

/* Prints an error message when the bus reports a transaction error */

void handleAbortI2C();
Expand Down
0