Extract PPM implementation out of pd driver

The PD driver should only contain implementation specific to that PD
hardware and a PPM driver should handle all the PPM states instead. This
will make it easier to write tests to validate the PPM state machine.

BUG=b:303919041

Change-Id: I331f2cc706ee8a683c9426c1b972919accf6d5f5
8 files changed
tree: 77979ded44aad236c2bbd561ac2cbeba989d43f5
  1. include/
  2. LICENSE
  3. main.c
  4. Makefile
  5. platform_usermode.c
  6. ppm_common.c
  7. ppm_common.h
  8. README.md
  9. rts5453.c
  10. rts5453.h
  11. smbus_usermode.c
  12. smbus_usermode.h
  13. um_ppm_chardev.c
  14. 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.