fwupd/plugins/ccgx
Richard Hughes 40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00
..
ccgx-ids.quirk Simplify the quirk file format 2021-03-03 08:30:34 +00:00
ccgx.quirk Simplify the quirk file format 2021-03-03 08:30:34 +00:00
fu-ccgx-common.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-common.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-dmc-common.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-dmc-common.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-dmc-device.c Allow using a per-device global percentage completion 2021-09-13 14:28:15 +01:00
fu-ccgx-dmc-device.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-dmc-firmware.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-dmc-firmware.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-firmware.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-firmware.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-hid-device.c Allow using a per-device global percentage completion 2021-09-13 14:28:15 +01:00
fu-ccgx-hid-device.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-hpi-common.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-hpi-common.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-ccgx-hpi-device.c Allow using a per-device global percentage completion 2021-09-13 14:28:15 +01:00
fu-ccgx-hpi-device.h trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-plugin-ccgx.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
fu-self-test.c trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
meson.build Allow objects to deserialize to XML 2021-03-15 12:07:30 +00:00
README.md trivial: update markdown for pre-commit style 2021-07-18 14:42:47 -05:00

Cypress

Introduction

This plugin can flash firmware on Cypress CCGx USB-C controller family of devices used in docks.

Supported Protocols

This plugin supports the following protocol IDs:

  • com.cypress.ccgx
  • com.cypress.ccgx.dmc

Device Flash

There are four kinds of flash layout. Single image firmware is not currently supported in this plugin.

Symmetric Firmware

In symmetric firmware topology, FW1 and FW2 are both primary (main) firmware with identical sizes and functionality. We can only update FW1 from FW2 or FW2 from FW1. This does mean we need to update just one time as booting from either firmware slot gives a fully functional device.

After updating the "other" firmware we can just use CY_PD_DEVICE_RESET_CMD_SIG to reboot into the new firmware, and no further action is required.

Asymmetric Firmware

In asymmetric firmware topology, FW1 is backup and FW2 is primary (main) firmware with different firmware sizes. The backup firmware may not support all dock functionality.

To update primary, we thus need to update twice:

Case 1: FW2 is running

  • Update FW1 -> Jump to backup FW CY_PD_JUMP_TO_ALT_FW_CMD_SIG -> reboot
  • Update FW2 -> Reset device CY_PD_DEVICE_RESET_CMD_SIG -> reboot -> FW2

Case 2: FW1 is running (recovery case)

  • Update FW2 -> Reset device CY_PD_DEVICE_RESET_CMD_SIG -> reboot -> FW2

The CY_PD_JUMP_TO_ALT_FW_CMD_SIG command is allowed only in asymmetric FW, but CY_PD_DEVICE_RESET_CMD_SIG is allowed in both asymmetric FW and symmetric FW.

DMC(Dock Management Controller) Composite Firmware

In composite firmware topology, a single firmware image contains metadata and firmware images of multiple devices including DMC itself in a dock system.

Firmware Format

There are two kinds of firmware format.

Cyacd firmware format

The daemon will decompress the cabinet archive and extract several firmware blobs in cyacd file format. See https://community.cypress.com/docs/DOC-10562 for more details.

DMC composite firmware format

The daemon will decompress the cabinet archive and extract several firmware blobs in a combined image file format. See 4.4.1 Single Composite (Combined) Dock Image at https://www.cypress.com/file/387471/download for more details.

GUID Generation

These devices use the standard USB DeviceInstanceId values, e.g.

  • USB\VID_1234&PID_5678

Devices also have additional instance IDs which corresponds to the silicon ID, application ID and device mode, e.g.

  • USB\VID_1234&PID_5678&SID_9ABC
  • USB\VID_1234&PID_5678&SID_9ABC&APP_DEF1
  • USB\VID_1234&PID_5678&SID_9ABC&APP_DEF1&MODE_FW2

Update Behavior

The device usually presents in runtime HID mode, but on detach re-enumerates with with a DMC or HPI interface. On attach the device again re-enumerates back to the runtime HID mode.

For this reason the REPLUG_MATCH_GUID internal device flag is used so that the DMC/HPI and runtime modes are treated as the same device.

Vendor ID Security

The vendor ID is set from the USB vendor, for example set to USB:0x04B4

External Interface Access

This plugin requires read/write access to /dev/bus/usb.