Hi,

This moves the current ucsi driver from drivers/usb/misc/ucsi.c to the
new USB Type-C class (drivers/usb/typec/). That allows us to finally do
role swapping.

The driver is now split into core library part, and ACPI driver. That
should make it easy to add support for other interface methods (first
most likely being I2C) later if needed.


Changes since v3:
- Fill all structures with reserved fields so they align with the real world as
  suggested by Guenter
- Use brackets with the arguments used in the command macros, proposed by
  Guenter
- Fix a typo in trace printout of ucsi_log_connector_status().

Changes since v2:
- Fixed ucsi_cmd_str() and ucsi_ack_str() so they don't exceed the size of the
  array as suggested by Guenter.
- Add dependency on !CPU_BIG_ENDIAN

Changes since v1:
- Added separate flag from pending ACK. Some new platforms generate "command
  complete" event on top of the normal "ACK complete" event with ACK commands.
  In such cases the driver has to be able to basically ignore the command
  completion in case of ACK and only finish acknowledge routine when the actual
  ACK complete event is received. Otherwise a new command may be queued to the
  PPM before the previous has fully completed.
- Added an explanation why we are handling the PPM initialization in a work as
  suggested by Guenter.
- Fixed ucsi_reset_ppm() by removing possibility of returning -ETIMEDOUT in case
  of success right before the time expires. Suggested by Guenter.
- Replaced useless "goto err;" with "break;" in ucsi_run_command() as suggested
  by Guenter.
- Removed traceback in case of failure from ucsi_run_command() which is not
  necessary as suggested by Guenter.
- Highlighting the fact that the timeouts are in milliseconds by using _MS
  ending with the definition (UCSI_TIMEOUT_MS and UCSI_SWAP_TIMEOUT_MS) as
  suggested by Guenter.
- Including also <linux/bitops.h> in ucsi.h as suggested by Guenter.
- In ucsi_acpi.c, explicitly pointing out in the comment that we can not use
  devm_ioremap_resource() as suggested by Guenter.


Heikki Krogerus (2):
  usb: typec: Add support for UCSI interface
  usb: typec: ucsi: Add ACPI driver

 drivers/usb/misc/Kconfig                |  26 --
 drivers/usb/misc/Makefile               |   1 -
 drivers/usb/misc/ucsi.c                 | 478 -------------------
 drivers/usb/typec/Kconfig               |   2 +
 drivers/usb/typec/Makefile              |   1 +
 drivers/usb/typec/ucsi/Kconfig          |  39 ++
 drivers/usb/typec/ucsi/Makefile         |   9 +
 drivers/usb/typec/ucsi/debug.h          |  64 +++
 drivers/usb/typec/ucsi/trace.c          |   2 +
 drivers/usb/typec/ucsi/trace.h          | 143 ++++++
 drivers/usb/typec/ucsi/ucsi.c           | 790 ++++++++++++++++++++++++++++++++
 drivers/usb/{misc => typec/ucsi}/ucsi.h | 194 ++++++--
 drivers/usb/typec/ucsi/ucsi_acpi.c      | 158 +++++++
 13 files changed, 1365 insertions(+), 542 deletions(-)
 delete mode 100644 drivers/usb/misc/ucsi.c
 create mode 100644 drivers/usb/typec/ucsi/Kconfig
 create mode 100644 drivers/usb/typec/ucsi/Makefile
 create mode 100644 drivers/usb/typec/ucsi/debug.h
 create mode 100644 drivers/usb/typec/ucsi/trace.c
 create mode 100644 drivers/usb/typec/ucsi/trace.h
 create mode 100644 drivers/usb/typec/ucsi/ucsi.c
 rename drivers/usb/{misc => typec/ucsi}/ucsi.h (59%)
 create mode 100644 drivers/usb/typec/ucsi/ucsi_acpi.c

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to