diff options
author | Hans de Goede <hdegoede@redhat.com> | 2019-04-16 22:07:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-04-19 14:23:34 +0200 |
commit | 6258db14d78c6991bcdd56f576788b3b2e16cc3f (patch) | |
tree | dadc428484d17485359a53e35a30e7f0aa472edc /drivers/usb/typec | |
parent | 7893f9e1c26d1f9ea02622902ee671de45ad377b (diff) | |
download | linux-stable-6258db14d78c6991bcdd56f576788b3b2e16cc3f.tar.gz linux-stable-6258db14d78c6991bcdd56f576788b3b2e16cc3f.tar.bz2 linux-stable-6258db14d78c6991bcdd56f576788b3b2e16cc3f.zip |
usb: typec: fusb302: Implement start_toggling for all port-types
When in single-role port mode, we must start single-role toggling to
get an interrupt when a device / cable gets plugged into the port.
This commit modifies the fusb302 start_toggling implementation to
start toggling for all port-types, so that connection-detection works
on single-role ports too.
Fixes: ea3b4d5523bc("usb: typec: fusb302: Resolve fixed power role ...")
Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec')
-rw-r--r-- | drivers/usb/typec/tcpm/fusb302.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c index 6f274f4dd210..b102a15ff958 100644 --- a/drivers/usb/typec/tcpm/fusb302.c +++ b/drivers/usb/typec/tcpm/fusb302.c @@ -882,10 +882,20 @@ static int tcpm_start_toggling(struct tcpc_dev *dev, { struct fusb302_chip *chip = container_of(dev, struct fusb302_chip, tcpc_dev); + enum toggling_mode mode = TOGGLING_MODE_OFF; int ret = 0; - if (port_type != TYPEC_PORT_DRP) - return -EOPNOTSUPP; + switch (port_type) { + case TYPEC_PORT_SRC: + mode = TOGGLING_MODE_SRC; + break; + case TYPEC_PORT_SNK: + mode = TOGGLING_MODE_SNK; + break; + case TYPEC_PORT_DRP: + mode = TOGGLING_MODE_DRP; + break; + } mutex_lock(&chip->lock); ret = fusb302_set_src_current(chip, cc_src_current[cc]); @@ -894,7 +904,7 @@ static int tcpm_start_toggling(struct tcpc_dev *dev, typec_cc_status_name[cc], ret); goto done; } - ret = fusb302_set_toggling(chip, TOGGLING_MODE_DRP); + ret = fusb302_set_toggling(chip, mode); if (ret < 0) { fusb302_log(chip, "unable to start drp toggling, ret=%d", ret); |