Skip to content
  • Julius Werner's avatar
    cros_ec: Change EC interface to be fully object-oriented · 3c697995
    Julius Werner authored
    
    
    Depthcharge's current cros_ec code doesn't really match the
    object-oriented one-instance-per-device design of its other drivers.
    Instead, it is a singleton design with hardcoded support for only up to
    one additional chip by passing devidx=1 to certain functions. In
    addition, the vboot callback implementations for EC software sync are
    tightly interwoven with the cros_ec driver.
    
    This patch changes that code to be more in line with depthcharge's other
    drivers. EC and PD chips are represented as separate objects (sharing
    the same bus object), and the connection to vboot callbacks is
    abstracted in a VbootEcOps superclass. This is intended to make it
    easier to hook up other embedded controllers that don't run the Chrome
    EC embedded OS to vboot's software sync mechanism, such as the ANX7688
    used on Elm. (This is intended to be the first step. We may or may not
    decide that it makes sense to also make changes to vboot code and the
    callback interface later.)
    
    Also try to clean up namespacing a bit (cros_ec_... only for exported
    functions), only export functions that are really needed by other files,
    and remove some unused code.
    
    BUG=chrome-os-partner:52434
    TEST=FAFT on Oak. Manually triggered software sync both after cold
    reboot and when the EC was already in RW.
    
    Change-Id: I6666c4382ef40d1211995101c97a52346963fa4a
    Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
    Reviewed-on: https://chromium-review.googlesource.com/341542
    
    
    Reviewed-by: default avatarAaron Durbin <adurbin@chromium.org>
    3c697995