Support errors from the PPM

The PPM may want to intercept and return errors without going to the LPM
(for example if there are command specific and state related errors). In
such cases, add support for returning a PPM error status without going
to the LPM. Also fixed a bunch of cases where we were returning errors
in CCI but not returning error statuses from PPM.

BUG=b:319124783
TEST=Loaded kernel driver with um_ppm; still needs unit tests

Change-Id: I761c5d50ef20d239e034c1ae28c775eb0da6ddb0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/usb/um_ppm/+/5194043
Tested-by: Abhishek Pandit-Subedi <abhishekpandit@google.com>
Reviewed-by: Pavan Holla <pholla@google.com>
3 files changed
tree: 9b23713d1b803215bdecc937b8f821f2f118359d
  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.