Description
Is your enhancement proposal related to a problem? Please describe.
Many battery charging ICs have integrated USB power delivery detection. Meaning that they connect to D+/D- (and CC pins when using USB-C) of the USB port, in order to detect the power delivery capabilities of the connected USB port. These function are built into these ICs and can be configured or status read using I²C. An example we are using is the MP2722. It can detect the current capabilities of the USB port, as well as request higher than 5V voltages from the USB port. It also can act as a source, providing power from the battery.
Describe the solution you'd like
Extend the charger API for using these features. This would include adding some get/set properties, an API function for registering of a notification callback and some enums and struct for the get/set properties. These are e.g.
- result from the D+/D- detection (how much current the USB port can deliver)
- if the connected USB port is a sink or a source.
- If the connected USB port has high voltage capabilities
- If a USB-C to USB-C cable is used
Theses features are derived from the function of the MP2722. For other IC there may be other functionatilities.
Describe alternatives you've considered
I noticed that there USB Type-C Port Controller API here. Unfortunately, I do not know if it is a good practice two implement two device drivers (charger API and USB TCPC API) using one C file and how to do it.
Which way may be the best to use? May it be a good idea the extend the charger API with these features?