• Hans de Goede's avatar
    usb: typec: tcpm: Notify the tcpc to start connection-detection for SRPs · 7893f9e1
    Hans de Goede authored
    Some tcpc device-drivers need to explicitly be told to watch for connection
    events, otherwise the tcpc will not generate any TCPM_CC_EVENTs and devices
    being plugged into the Type-C port will not be noticed.
    
    For dual-role ports tcpm_start_drp_toggling() is used to tell the tcpc to
    watch for connection events. Sofar we lack a similar callback to the tcpc
    for single-role ports. With some tcpc-s such as the fusb302 this means
    no TCPM_CC_EVENTs will be generated when the port is configured as a
    single-role port.
    
    This commit renames start_drp_toggling to start_toggling and since the
    device-properties are parsed by the tcpm-core, adds a port_type parameter
    to the start_toggling callback so that the tcpc_dev driver knows the
    port-type and can act accordingly when it starts toggling.
    
    The new start_toggling callback now always gets called if defined, instead
    of only being called for DRP ports.
    
    To avoid this causing undesirable functional changes all existing
    start_drp_toggling implementations are not only renamed to start_toggling,
    but also get a port_type check added and return -EOPNOTSUPP when port_type
    is not DRP.
    
    Fixes: ea3b4d55("usb: typec: fusb302: Resolve fixed power role ...")
    Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
    Tested-by: default avatarAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7893f9e1
tcpm.c 121 KB