#
a3ff7e71 |
| 15-Oct-2024 |
Shawn McCarney <shawnmm@us.ibm.com> |
I2CInterface: Add process call methods
Add C++ methods to perform the following SMBus commands: * Process Call * Block Write-Block Read Process Call
For Block Write-Block Read Process Call, impleme
I2CInterface: Add process call methods
Add C++ methods to perform the following SMBus commands: * Process Call * Block Write-Block Read Process Call
For Block Write-Block Read Process Call, implement support for writes up to 255 bytes. SMBus 2.0 supported a maximum of 32 bytes, and SMBus 3.0 supports a maximum of 255 bytes. The current Linux SMBus function only supports 32 byte writes. Provide an alternate implementation using the lower level I2C_RDWR ioctl() to support up to 255 bytes.
Tested: * Verified Process Call worked correctly * Verified Block Write-Block Read Process Call worked correctly * When using SMBus function * When using I2C_RDWR ioctl() * Tested error cases * See complete test plan at https://gist.github.com/smccarney/96eda4c7c11fe4f89e4491c768f76047
Change-Id: Icc1ba840741b1e26a50fe32bad8b2181a01dbb24 Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
show more ...
|
#
f5402197 |
| 16-Aug-2024 |
Patrick Williams <patrick@stwcx.xyz> |
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda forma
clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: I7b90380845efee6bf6a1fe342a793d71aa9ff181 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
show more ...
|
#
770de580 |
| 05-Nov-2021 |
Shawn McCarney <shawnmm@us.ibm.com> |
Add retry support to I2CInterface Enhance the I2CInterface class hierarchy to support retrying failed I2C operations. Add an optional parameter to i2c::create() to specify the m
Add retry support to I2CInterface Enhance the I2CInterface class hierarchy to support retrying failed I2C operations. Add an optional parameter to i2c::create() to specify the maximum number of retries to perform for an I2C operation. Default to 0 retries so that existing code will not be affected. Testing: * Tested each modified function * When I2C operation succeeds * When I2C operation fails * When no retries are done * When retries are done * When retried operation succeeds * When retried operation fails * See complete test plan at https://gist.github.com/smccarney/8d203a40d9984402ac495dc3d689c12d Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com> Change-Id: I2b0e782e5caaafa9908ef5625687377b959b38ff
show more ...
|
#
8429e884 |
| 13-Dec-2020 |
Lei YU <yulei.sh@bytedance.com> |
i2c: Initialize variable ret The varialbe `ret` in some functions is not initialized and cause the build warning and treated as error: error: 'ret' may be used uninitialized
i2c: Initialize variable ret The varialbe `ret` in some functions is not initialized and cause the build warning and treated as error: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] Fixes openbmc/phosphor-power#3. Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: Ica6b1af434736f6fd96a1bbb9e511bf1c8fb1d7a
show more ...
|
#
d1bc4cec |
| 13-Dec-2019 |
Brandon Wyman <bjwyman@gmail.com> |
Update .clang-format to latest version from docs Signed-off-by: Brandon Wyman <bjwyman@gmail.com> Change-Id: Ie6e7f43e7554429704dca86b21320c90aed18791
|
#
38ed88d6 |
| 11-Dec-2019 |
Shawn McCarney <shawnmm@us.ibm.com> |
i2c: Cache adapter functionality Enhance the I2CDevice class to cache the I2C adapter functionality value. The adapter functionality value should not change while the device interfa
i2c: Cache adapter functionality Enhance the I2CDevice class to cache the I2C adapter functionality value. The adapter functionality value should not change while the device interface is open. Caching the functionality value will reduce the number of ioctl() calls by 50% when doing long sequences of I2C operations. Tested: * Verified adapter functionality value is cached * Verified read() method works on a Witherspoon * Verified close() method discards the cached functionality value Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com> Change-Id: I2b17d91ae4e21aaf52cd4cec9eddb5aab7be37e5
show more ...
|
#
d45a9a6d |
| 10-Dec-2019 |
Shawn McCarney <shawnmm@us.ibm.com> |
i2c: Support explicit open/close and re-open Add the ability to explicitly open and close the I2CInterface/I2CDevice. Also add support to re-open the I2CInterface/I2CDevice after it was
i2c: Support explicit open/close and re-open Add the ability to explicitly open and close the I2CInterface/I2CDevice. Also add support to re-open the I2CInterface/I2CDevice after it was closed. This support is needed for use cases like the following: * I2C device information (bus and address) is parsed from a configuration file at standby. However, an I2C connection to the device should not be opened yet. The device may not have power until the system has been booted. Additionally, if the device is a FRU, it could be replaced (remove + add) while at standby, leading to communication errors. * The device is sometimes bound to a device driver. The I2C connection should only be open during the time periods when the device driver is not bound. Tested: * Verified create() function with default value of OPEN, explicit value of OPEN, and explicit value of CLOSED. * Verified device interface can be explicitly opened, closed, and re-opened. * Verified read() and write() functions still work when device interface is open. * Verified open() fails with appropriate error if already open. * Verified read() fails with appropriate error if not open. * Verified write() fails with appropriate error if not open. * Verified close() fails with appropriate error if not open. Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com> Change-Id: I0182966f0b0614eac0de69eb95d960035f9d0426
show more ...
|
#
1d103428 |
| 29-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Add i2c block transaction support The previous code always uses SMBus block read/write. On some PSU (e.g. FP5280G2's PSU) the I2C block read/write is required, so add that suppo
i2c: Add i2c block transaction support The previous code always uses SMBus block read/write. On some PSU (e.g. FP5280G2's PSU) the I2C block read/write is required, so add that support. Specifically, add a Mode enum class and add the parameter for block read/write to indicate whether SMBus or I2C block read/write is to be called. Tested: Verify the code works on FP5280G2 with I2C block write. Note: Currently there is no case for I2C block read, so that function is not tested. Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I5f77ffe6900d14f3703dae7241799a7b37c5a726
show more ...
|
#
34fb8bda |
| 07-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Implement write function Implement I2CDevice::write() by invoking i2c_smbus_write_xxx() APIs. The code is referenced from i2c-tools' i2cset.c: https://github.com/ev3dev/i2
i2c: Implement write function Implement I2CDevice::write() by invoking i2c_smbus_write_xxx() APIs. The code is referenced from i2c-tools' i2cset.c: https://github.com/ev3dev/i2c-tools/blob/ev3dev-stretch/tools/i2cset.c Tested: Verify on Witherspoon that it writes the PSU unlock upgrade command and boot flag successfully. Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I9fb014c787ef3ebb2f7793a0d012b1d652ef069f
show more ...
|
#
92e89eb5 |
| 06-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Implement read function Implement I2CDevice::read() by invoking i2c_smbus_read_xxx() APIs. The code is referenced from i2c-tools' i2cget.c: https://github.com/ev3dev/i2c-t
i2c: Implement read function Implement I2CDevice::read() by invoking i2c_smbus_read_xxx() APIs. The code is referenced from i2c-tools' i2cget.c: https://github.com/ev3dev/i2c-tools/blob/ev3dev-stretch/tools/i2cget.c Tested: Verify on Witherspoon that it reads the PSU ppgrade mode status register (1 byte) and CRC16 register (2 bytes) correctly. Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I8759b6a35229f81120acf77f08429f7f79458b8b
show more ...
|
#
9af82a5c |
| 06-Nov-2019 |
Lei YU <mine260309@gmail.com> |
i2c: Implement open and close Implement open() and close() function, and invoke open() on creating I2CDevice, and invoke close() in destructor. Tested: Manually write test codet
i2c: Implement open and close Implement open() and close() function, and invoke open() on creating I2CDevice, and invoke close() in destructor. Tested: Manually write test codet and run on Witherspoon that it opens and closes the i2c device correctly. Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: I709fcc80474a4a0cef067748a78256ceb76430a5
show more ...
|
#
ab1327c3 |
| 04-Nov-2019 |
Lei YU <mine260309@gmail.com> |
tools: Initially add i2c tool and mock The power-utils will invoke i2c get/set commands to the i2c device for PSU code update. Create a separated i2c tool because it is logically sta
tools: Initially add i2c tool and mock The power-utils will invoke i2c get/set commands to the i2c device for PSU code update. Create a separated i2c tool because it is logically standalone and could be shared for other utils. Also add an I2CInterface and its mock to make it easier to test when developing i2c related operations. Signed-off-by: Lei YU <mine260309@gmail.com> Change-Id: If5383547e6d84c0a79610e2d2d6f2fa8ee9dc061
show more ...
|