Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend charger API with USB-C Power delivery features #74055

Open
VinFar opened this issue Jun 11, 2024 · 2 comments
Open

Extend charger API with USB-C Power delivery features #74055

VinFar opened this issue Jun 11, 2024 · 2 comments
Assignees
Labels
area: Charger Enhancement Changes/Updates/Additions to existing features

Comments

@VinFar
Copy link

VinFar commented Jun 11, 2024

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?

@VinFar VinFar added the Enhancement Changes/Updates/Additions to existing features label Jun 11, 2024
Copy link

Hi @VinFar! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

@rriveramcrus
Copy link
Contributor

Hello @VinFar, I feel the driver for the MPS part (and any other charger IC that offers integrated input source detection) should be an MFD.

There are various input source detection schemes out in the wild:

  • USB PD
  • USB BC1.2
  • Qualcomm Quick Charge
  • Mediatek Pump Express

I feel it would not be practical to maintain interfaces for these schemes in the charger_driver_api especially if there are dedicated APIs elsewhere in the tree.

The MAX20335 is a good example of a charger MFD as it is both a charger and a regulator.

A follow up question I have for you is, in the context of a MP2722 MFD driver, do you feel usb_type_c_port_controller_api and the charger_driver_api have everything you need to accomplish what you are trying to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Charger Enhancement Changes/Updates/Additions to existing features
Projects
None yet
Development

No branches or pull requests

3 participants