Fix alert handling and ACK_CC_CI

The chip address read during ARA will tell you which port actually
alerted. Instead of reading all ports, only read the ports that actually
alerted and notify the OPM. This also fixes ACK_CC_CI on RTS by setting
the port correctly and also clearing RTK bits (which we don't care about
for UCSI).

BUG=b:319124783
TEST=Run um_ppm with several hotplug events; verify mask is cleared.

Change-Id: I631a69bf93c5024b6cfa97a86f06ba2cb073fed3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/usb/um_ppm/+/5187826
Reviewed-by: Jameson Thies <jthies@google.com>
Tested-by: Abhishek Pandit-Subedi <abhishekpandit@google.com>
13 files changed
tree: 8efeab28d575a26b562bd2da861619d1526b984c
  1. include/
  2. test/
  3. .gitignore
  4. LICENSE
  5. main.c
  6. Makefile
  7. platform_usermode.c
  8. ppm_common.c
  9. ppm_common.h
  10. README.md
  11. rts5453.c
  12. rts5453.h
  13. rts5453_usermode.c
  14. smbus_usermode.c
  15. smbus_usermode.h
  16. um_ppm_chardev.c
  17. um_ppm_chardev.h
README.md

Usermode PPM implementation

Usermode UCSI PPM implementation for evaluation and testing usage. Try using this with the ucsi_um_test kernel driver.

Setup

For usermode implementations, we use libi2c and libgpiod to provide an smbus implementation. You will need the right libraries to build:

sudo apt-get install libi2c-dev libgpiod-dev

Architecture

┌─────────┐
│OPM      │
│kernel or│
│cli      │
└────┬────┘
     │
     │
     ▼          ┌───────────┐
 ┌────────┐     │ PD Driver │
 │        ├────►│           │
 │  PPM   │     ├───────────┤
 │        │     │           │
 └────────┘     │ I2C Driver│
                └───────────┘

The usermode ppm implementation consists of the PPM task, the PD driver and the I2C driver backing it. The OPM will either be a CLI (for locally triggering some functionality) or the ucsi_um_test kernel module.