usb: typec: pi3usb30532: Keep orientation when setting mux to safe mode
authorHans de Goede <hdegoede@redhat.com>
Fri, 22 Feb 2019 19:22:39 +0000 (20:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Mar 2019 14:00:34 +0000 (15:00 +0100)
Keep the orientation value when setting the mux to safe mode, this
fixes the orientation getting reset when switching alt-modes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/mux/pi3usb30532.c

index 64eb598..9294e85 100644 (file)
@@ -84,7 +84,8 @@ static int pi3usb30532_mux_set(struct typec_mux *mux, int state)
 
        switch (state) {
        case TYPEC_STATE_SAFE:
-               new_conf = PI3USB30532_CONF_OPEN;
+               new_conf = (new_conf & PI3USB30532_CONF_SWAP) |
+                          PI3USB30532_CONF_OPEN;
                break;
        case TYPEC_STATE_USB:
                new_conf = (new_conf & PI3USB30532_CONF_SWAP) |