From patchwork Tue Feb 8 18:47:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 12739208 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 389632C9C for ; Tue, 8 Feb 2022 18:47:39 +0000 (UTC) Received: by mail-pf1-f172.google.com with SMTP id n32so20419252pfv.11 for ; Tue, 08 Feb 2022 10:47:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w3J0QKkr84VrudaJ3bhOXmAFtwa7Bv5tWoh+lneUqWM=; b=CXeTCXrzzT3Ml1fOtNTfQXwkPNlG/WSDsQlqTW/zEywRyF7j0hBThR0OpQtEw29wF5 THBzVhkjvzf2l/H5yqCg5ADcVm+vos7y8H4hYAEs2XS8GQg3Jz030Sp3iqyWbuQ1YXP8 mt/25TAsI7zRzLsWfDb8xb5cSyI2oeNpM6NyM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w3J0QKkr84VrudaJ3bhOXmAFtwa7Bv5tWoh+lneUqWM=; b=L9rys3yMdmkz5arp9tRCC+D892Bg7RHXCXbCxkWsjYRjkBnhrEBGEKaaF+VpEfnz5K noZ9vKPYddmw3wB7YVBjSQxl+9NN8cfpaAHzA4Y8FLZNIja7UVfsUrOfk5TygTjOF6U5 LqL5Fw8PZWdK+psyZYnY+DXynR1vMmS2p4SCOGK5Xtz0IsQYNy/Sdt6AJz7OX/EUBOyp 2WWnXGK82ZtcVTZo97nfskGaUjhgBVDOJN969Gd2N1sOK5r6ldhiZ3Z3T+vj5V08Naev KUQWJqbHYFr89jzyxuaqZ2IrrpuNLrqJYQpPpRF5zzP2CUlaqVgI3IlPZ5k4E5P6KZHl 7qUA== X-Gm-Message-State: AOAM531Hj/Df5GlBB7HDMaIOgiP5hL8LP9ETkCjT97WOHva0ORWKVp1C tIw/v9yAQm8Mmtc+WH0XqF24GQ== X-Google-Smtp-Source: ABdhPJytsqdO5d2kpVqJ9mIDwNDjF08hSxlxJZgO7iZIJNRCJ4lHvtHfAQZ7XFMm+yJ82HUdKUUH5Q== X-Received: by 2002:a63:61d3:: with SMTP id v202mr4607974pgb.193.1644346058707; Tue, 08 Feb 2022 10:47:38 -0800 (PST) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id gk15sm3594453pjb.3.2022.02.08.10.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 10:47:38 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: Prashant Malani , Benson Leung , chrome-platform@lists.linux.dev (open list:CHROMEOS EC USB TYPE-C DRIVER), Guenter Roeck Subject: [PATCH v2 1/4] platform/chrome: cros_ec_typec: Move mux flag checks Date: Tue, 8 Feb 2022 18:47:18 +0000 Message-Id: <20220208184721.1697194-2-pmalani@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208184721.1697194-1-pmalani@chromium.org> References: <20220208184721.1697194-1-pmalani@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move mux and role flag checks inside of cros_typec_configure_mux(), which is a more logical location for them. Signed-off-by: Prashant Malani Reviewed-by: Tzung-Bi Shih --- Changes in v2: - Removed unrelated "ret" variable initialization. drivers/platform/chrome/cros_ec_typec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index c6f17e3ef72d..58d08dd02f65 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -521,6 +521,13 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num, enum typec_orientation orientation; int ret; + /* No change needs to be made, let's exit early. */ + if (port->mux_flags == mux_flags && port->role == pd_ctrl->role) + return 0; + + port->mux_flags = mux_flags; + port->role = pd_ctrl->role; + if (mux_flags == USB_PD_MUX_NONE) { ret = cros_typec_usb_disconnect_state(port); goto mux_ack; @@ -983,13 +990,6 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num) return 0; } - /* No change needs to be made, let's exit early. */ - if (typec->ports[port_num]->mux_flags == mux_resp.flags && - typec->ports[port_num]->role == resp.role) - return 0; - - typec->ports[port_num]->mux_flags = mux_resp.flags; - typec->ports[port_num]->role = resp.role; ret = cros_typec_configure_mux(typec, port_num, mux_resp.flags, &resp); if (ret) dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); From patchwork Tue Feb 8 18:47:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 12739209 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C52502C9C for ; Tue, 8 Feb 2022 18:47:48 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id d187so20419749pfa.10 for ; Tue, 08 Feb 2022 10:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/3NuIwovuNz7GFfgDQq4eFqfd72S+Kgga4jDeLgjulM=; b=SzH2BGmudD3cz76o4hl70v9hFx3qos+SW+CF2fSdozabjfuEYin1BxdO3i1Sh3bz1k f0QnRL2Hg/FR+wrTeG2j/LIoVU+XsLkzJu1R0kwKk83N2TRU0H00ewQBTObfFOT07DKp b28EoLTtSO7N5TuA0VEV9OQpT/Dq7zIM1LSUE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/3NuIwovuNz7GFfgDQq4eFqfd72S+Kgga4jDeLgjulM=; b=5A7UsBMDSVjLyHBJHiwHPr7ug8Vi90Q7DtgUxsTYVbqUqvYEaORntA55AI71g9SA/K e0r5uK2wb0gZ7af4Nyse60J3R17kqm/8R1JRG0yG/tkn5VZeRXzosUb/Qn8zzpfE6Ps9 XsswFf67qpyy0IlQlMSeu9GIfQHbTIxVvTOAlBQvmi+Rck4SCRZRShAMb5M2FsHHWsZu Z9mw7iFJJQNiPHwI876p1CsDZ6Swwd4twLHAXQ3Shw0ehNELXXAH9Eza5G/nuBglKaW2 A87RxQ83AjYldOTVEMO1SSUQ97Ka/On4tQsbEV7XaYrOO3zhXPv9kFchbRJ+fpPKeRKR nH+A== X-Gm-Message-State: AOAM531SvL04enj1N5JaoU1M92YdzNXyfYb8hs/yElxxofDNU7J4KUHP bolIYVcpO1oA0mw+9a4HhW3PGQ== X-Google-Smtp-Source: ABdhPJyo4hczEo4QVG0QQbOtNVE621++a+UKKID1yceuZbTeFSoguE2vzqnQAoU7XAW46pwWfXOsPw== X-Received: by 2002:a63:8343:: with SMTP id h64mr4581287pge.566.1644346068314; Tue, 08 Feb 2022 10:47:48 -0800 (PST) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id gk15sm3594453pjb.3.2022.02.08.10.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 10:47:48 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: Prashant Malani , Benson Leung , chrome-platform@lists.linux.dev (open list:CHROMEOS EC USB TYPE-C DRIVER), Guenter Roeck Subject: [PATCH v2 2/4] platform/chrome: cros_ec_typec: Get mux state inside configure_mux Date: Tue, 8 Feb 2022 18:47:20 +0000 Message-Id: <20220208184721.1697194-3-pmalani@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208184721.1697194-1-pmalani@chromium.org> References: <20220208184721.1697194-1-pmalani@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move the function which gets current mux state inside the cros_typec_configure_mux() function. It is better to group those bits of functionality together, and it makes it easier to move around cros_typec_configure_mux() later. While we are doing this, also inline the cros_typec_get_mux_info() inside of cros_typec_configure_mux(). Signed-off-by: Prashant Malani Reviewed-by: Tzung-Bi Shih --- Changes in v2: - Changed "mux_resp" variable to "resp". drivers/platform/chrome/cros_ec_typec.c | 55 +++++++++++-------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 58d08dd02f65..3d34ece7f790 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -513,27 +513,38 @@ static int cros_typec_enable_usb4(struct cros_typec_data *typec, } static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num, - uint8_t mux_flags, struct ec_response_usb_pd_control_v2 *pd_ctrl) { struct cros_typec_port *port = typec->ports[port_num]; + struct ec_response_usb_pd_mux_info resp; + struct ec_params_usb_pd_mux_info req = { + .port = port_num, + }; struct ec_params_usb_pd_mux_ack mux_ack; enum typec_orientation orientation; int ret; + ret = cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_MUX_INFO, + &req, sizeof(req), &resp, sizeof(resp)); + if (ret < 0) { + dev_warn(typec->dev, "Failed to get mux info for port: %d, err = %d\n", + port_num, ret); + return ret; + } + /* No change needs to be made, let's exit early. */ - if (port->mux_flags == mux_flags && port->role == pd_ctrl->role) + if (port->mux_flags == resp.flags && port->role == pd_ctrl->role) return 0; - port->mux_flags = mux_flags; + port->mux_flags = resp.flags; port->role = pd_ctrl->role; - if (mux_flags == USB_PD_MUX_NONE) { + if (port->mux_flags == USB_PD_MUX_NONE) { ret = cros_typec_usb_disconnect_state(port); goto mux_ack; } - if (mux_flags & USB_PD_MUX_POLARITY_INVERTED) + if (port->mux_flags & USB_PD_MUX_POLARITY_INVERTED) orientation = TYPEC_ORIENTATION_REVERSE; else orientation = TYPEC_ORIENTATION_NORMAL; @@ -548,22 +559,22 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num, if (ret) return ret; - if (mux_flags & USB_PD_MUX_USB4_ENABLED) { + if (port->mux_flags & USB_PD_MUX_USB4_ENABLED) { ret = cros_typec_enable_usb4(typec, port_num, pd_ctrl); - } else if (mux_flags & USB_PD_MUX_TBT_COMPAT_ENABLED) { + } else if (port->mux_flags & USB_PD_MUX_TBT_COMPAT_ENABLED) { ret = cros_typec_enable_tbt(typec, port_num, pd_ctrl); - } else if (mux_flags & USB_PD_MUX_DP_ENABLED) { + } else if (port->mux_flags & USB_PD_MUX_DP_ENABLED) { ret = cros_typec_enable_dp(typec, port_num, pd_ctrl); - } else if (mux_flags & USB_PD_MUX_SAFE_MODE) { + } else if (port->mux_flags & USB_PD_MUX_SAFE_MODE) { ret = cros_typec_usb_safe_state(port); - } else if (mux_flags & USB_PD_MUX_USB_ENABLED) { + } else if (port->mux_flags & USB_PD_MUX_USB_ENABLED) { port->state.alt = NULL; port->state.mode = TYPEC_STATE_USB; ret = typec_mux_set(port->mux, &port->state); } else { dev_dbg(typec->dev, "Unrecognized mode requested, mux flags: %x\n", - mux_flags); + port->mux_flags); } mux_ack: @@ -638,17 +649,6 @@ static void cros_typec_set_port_params_v1(struct cros_typec_data *typec, } } -static int cros_typec_get_mux_info(struct cros_typec_data *typec, int port_num, - struct ec_response_usb_pd_mux_info *resp) -{ - struct ec_params_usb_pd_mux_info req = { - .port = port_num, - }; - - return cros_ec_command(typec->ec, 0, EC_CMD_USB_PD_MUX_INFO, &req, - sizeof(req), resp, sizeof(*resp)); -} - /* * Helper function to register partner/plug altmodes. */ @@ -946,7 +946,6 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num) { struct ec_params_usb_pd_control req; struct ec_response_usb_pd_control_v2 resp; - struct ec_response_usb_pd_mux_info mux_resp; int ret; if (port_num < 0 || port_num >= typec->num_ports) { @@ -982,15 +981,7 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num) cros_typec_handle_status(typec, port_num); /* Update the switches if they exist, according to requested state */ - ret = cros_typec_get_mux_info(typec, port_num, &mux_resp); - if (ret < 0) { - dev_warn(typec->dev, - "Failed to get mux info for port: %d, err = %d\n", - port_num, ret); - return 0; - } - - ret = cros_typec_configure_mux(typec, port_num, mux_resp.flags, &resp); + ret = cros_typec_configure_mux(typec, port_num, &resp); if (ret) dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); From patchwork Tue Feb 8 18:47:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 12739210 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E31532C9C for ; Tue, 8 Feb 2022 18:47:58 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id t14-20020a17090a3e4e00b001b8f6032d96so2598149pjm.2 for ; Tue, 08 Feb 2022 10:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jLio1a1l75mHbmNEuBlAUNzao55kTSeKszQYcAQRX+I=; b=MsjVta7IYbQNKqHe58RtLXBHcrrrukRhSUHG22zWAasQ99i8xGDjf6fjdG686TlnIa nybAKSUI943yDMYt1V4L4HPXRb7QQjwNcAdgkBEA7mkKq7rvOzgkYGUwhNrja80IyCzj TubUKDuwMDz9gZ1PzfVVVhqUkOhBd0PGbly6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jLio1a1l75mHbmNEuBlAUNzao55kTSeKszQYcAQRX+I=; b=lQvn4XCAIhpBkJ8956uXs/9OLW5S51RfOzr5bSddn24gGs8HTQfcw/uvf+ILuHxz2b +al3huFj8JsQL+05oxQXgHqnSZc3d2C/DsVwgYelMG2mk/8bx86RtxuxEDnYpbLjgJrD +Kv3L8JByoqkdf9Czfn0eRuCzpR2MS4eMDnSHgj3dMOlekhmDDfWSWu4j4ek0agpy13/ NEzS0AerCdqBifugoJWres2J3UKUmf7MnF+qL+4tz+TK+Kkcxis2p8vMuK3DbPBrI9vO 77Gz7z/lbxXpYZ+A3WWt/Q8C+CITFyt75uMOP97IPe9+rdykoWS3x8XKlkK2VEt0cudK 20YQ== X-Gm-Message-State: AOAM5320b1NE2J1qprpcrCInAsvdng9A3J46yCpT977SWplrachq/kWG 0OU4Xqh0adCDkbwEzuhDf6Gf2g== X-Google-Smtp-Source: ABdhPJzA8ECq/26nKv0NhBy5xwK2bu7d8aQaB1wRho9op9ZuMhWeJ0H4ktflQM6NMxY0ajIdDbI8/g== X-Received: by 2002:a17:902:da88:: with SMTP id j8mr5904035plx.105.1644346078477; Tue, 08 Feb 2022 10:47:58 -0800 (PST) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id gk15sm3594453pjb.3.2022.02.08.10.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 10:47:58 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: Prashant Malani , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev (open list:CHROMEOS EC USB TYPE-C DRIVER) Subject: [PATCH v2 3/4] platform/chrome: cros_ec_typec: Configure muxes at start of port update Date: Tue, 8 Feb 2022 18:47:22 +0000 Message-Id: <20220208184721.1697194-4-pmalani@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208184721.1697194-1-pmalani@chromium.org> References: <20220208184721.1697194-1-pmalani@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are situations where the mux state reported by the Embedded Controller (EC), might lag the partner "connected" state. So, the mux state might still suggest that a partner is connected, while the PD "connected" state, being in Try.SNK (for example) suggests that the partner is disconnected. In such a scenario, we will end up sending a disconnect command to the mux driver, followed by a connect command, since the mux is configured later. Avoid this by configuring the mux before registering/disconnecting a partner. Signed-off-by: Prashant Malani Reviewed-by: Benson Leung --- Changes in v2: - Change return at end of port_update() to just return 0. drivers/platform/chrome/cros_ec_typec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 3d34ece7f790..3019e29f200d 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -965,6 +965,11 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num) if (ret < 0) return ret; + /* Update the switches if they exist, according to requested state */ + ret = cros_typec_configure_mux(typec, port_num, &resp); + if (ret) + dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); + dev_dbg(typec->dev, "Enabled %d: 0x%hhx\n", port_num, resp.enabled); dev_dbg(typec->dev, "Role %d: 0x%hhx\n", port_num, resp.role); dev_dbg(typec->dev, "Polarity %d: 0x%hhx\n", port_num, resp.polarity); @@ -980,12 +985,7 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num) if (typec->typec_cmd_supported) cros_typec_handle_status(typec, port_num); - /* Update the switches if they exist, according to requested state */ - ret = cros_typec_configure_mux(typec, port_num, &resp); - if (ret) - dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); - - return ret; + return 0; } static int cros_typec_get_cmd_version(struct cros_typec_data *typec) From patchwork Tue Feb 8 18:47:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 12739227 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CC592C9C for ; Tue, 8 Feb 2022 18:48:28 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id qe15so17583pjb.3 for ; Tue, 08 Feb 2022 10:48:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3nJw75yUn0Ak2LbjP8FDSUKGk9cBjMNSHZr8K3rv/n8=; b=Kcc50LqTHuQIYf273mHplhXaUKkVZo5PUBRoSWfRcf58iiGQ2BqdIdG45EwyPs1uXs CAAbXNkEd2gr6pK4HN7DiQh4qUIHHNlorxb+wH1BXIOdeK6oQxUKyLl5QTwejhLKNtmR CteLOdhUCS5CWbC0mzNmxIdXJAHtmnBxfT90k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3nJw75yUn0Ak2LbjP8FDSUKGk9cBjMNSHZr8K3rv/n8=; b=wu8wZCsblrVHWvhCWhINDc7Qnpx0rryjIKRWCWW258YKW6Y1WLwU4glK5+pRgMn89J 1Sqxnt2VO9miar2/7KC9qpupucZExsNjyQENgn24ZSzVK0cNnCQdRAx/SGN/Y+DqftB9 kNPLYnmFk5MY9TQ/bZ3B8OdcLOGFUxU7toZIJJ/AqVsk1wbWnvBYFqKcilHdAt20fvUC QSIbiBK6NdbhUC8S9ckol0CWsCLhaZXSCSWl0OTdANHrMrXG+RHS4BCaV6rgfsX//KOZ xcqU7svqKqetxCSSxRP/MFg+s1bKiy4w3JgxVQcByh6qng2hp7dHqVIvbxqr5Ik8G11H rBxg== X-Gm-Message-State: AOAM532bQ/R5D5tnjmpMbV386ce8DuR1OAGvdemKvNLcY0B41l6bEOQy snejeLcKGMb6cxWwdtqMu4eRvw== X-Google-Smtp-Source: ABdhPJzUwlOAtGq+Y2cBB0fnuRDAYTc8P/abuAm1YmIdSlVd7T3zol+qZiMELS+dYrh3y9do6LWUBA== X-Received: by 2002:a17:90b:4c91:: with SMTP id my17mr2870441pjb.121.1644346107948; Tue, 08 Feb 2022 10:48:27 -0800 (PST) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id gk15sm3594453pjb.3.2022.02.08.10.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 10:48:27 -0800 (PST) From: Prashant Malani To: linux-kernel@vger.kernel.org Cc: Prashant Malani , Benson Leung , Guenter Roeck , chrome-platform@lists.linux.dev (open list:CHROMEOS EC USB TYPE-C DRIVER) Subject: [PATCH v2 4/4] platform/chrome: cros_ec_typec: Update mux flags during partner removal Date: Tue, 8 Feb 2022 18:47:24 +0000 Message-Id: <20220208184721.1697194-5-pmalani@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220208184721.1697194-1-pmalani@chromium.org> References: <20220208184721.1697194-1-pmalani@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In cros_typec_remove_partner(), we call cros_typec_usb_disconnect_state() which sets the switches/muxes to be in a disconnected state. This also happens in cros_typec_configure_mux(). However, unlike there, here the mux_flags variable hasn't been updated to reflect that a disconnection has occurred. Update the flag here accordingly. Signed-off-by: Prashant Malani Reviewed-by: Tzung-Bi Shih --- Changes in v2: - No changes. drivers/platform/chrome/cros_ec_typec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 3019e29f200d..4bd2752c0823 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -228,6 +228,7 @@ static void cros_typec_remove_partner(struct cros_typec_data *typec, cros_typec_unregister_altmodes(typec, port_num, true); cros_typec_usb_disconnect_state(port); + port->mux_flags = USB_PD_MUX_NONE; typec_unregister_partner(port->partner); port->partner = NULL;