From patchwork Tue Oct 27 13:53:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 307316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CEE7C63697 for ; Tue, 27 Oct 2020 16:37:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2084821707 for ; Tue, 27 Oct 2020 16:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603816641; bh=kFEfJA0BIjYptAwEMhWlCAXI1053v3fyFVB4Ke9sztU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gMvjQXv9jAVmQwLY0r2YvSVSFwbMo9a2uU4hjB2Qj22BH+0aScvbGIvrZ8FrBzSo/ p988vIKtNzgVaDZCGRNpNw2o+CFx607twgeRB39FUai+MaqexEm7+5WI89jU7arPPz d9KgCgiSDk4c11e1NtavpPfjEd4SRdNICMbFaBEA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1811105AbgJ0QhT (ORCPT ); Tue, 27 Oct 2020 12:37:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:40470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801900AbgJ0Po7 (ORCPT ); Tue, 27 Oct 2020 11:44:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1722B24179; Tue, 27 Oct 2020 15:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813464; bh=kFEfJA0BIjYptAwEMhWlCAXI1053v3fyFVB4Ke9sztU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yShlfAozGsnl8NzJi+tGe8wtc0UYWqwRAvO4Bx11ZUHewDeEVURdA5/OrAEaaJGzz cmK5hL1+IQlw0yee8JT3kBWqA059SwKSHRLhRSHDJPLlaGezoMo/8Dq/kDTsbn/nWo yf9yNR+eULv/oWtqb6DOvU9mr4UQ45zJ5oXRvgFY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Azhar Shaikh , Prashant Malani , Heikki Krogerus , Enric Balletbo i Serra , Sasha Levin Subject: [PATCH 5.9 560/757] platform/chrome: cros_ec_typec: Send enum values to usb_role_switch_set_role() Date: Tue, 27 Oct 2020 14:53:30 +0100 Message-Id: <20201027135516.764284415@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Azhar Shaikh [ Upstream commit 5381b0ed54b6af3c0e8184b43e34154e17904848 ] usb_role_switch_set_role() has the second argument as enum for usb_role. Currently depending upon the data role i.e. UFP(0) or DFP(1) is sent. This eventually translates to USB_ROLE_NONE in case of UFP and USB_ROLE_DEVICE in case of DFP. Correct this by sending correct enum values as USB_ROLE_DEVICE in case of UFP and USB_ROLE_HOST in case of DFP. Fixes: 7e7def15fa4b ("platform/chrome: cros_ec_typec: Add USB mux control") Signed-off-by: Azhar Shaikh Cc: Prashant Malani Reviewed-by: Prashant Malani Reviewed-by: Heikki Krogerus Signed-off-by: Enric Balletbo i Serra Signed-off-by: Sasha Levin --- drivers/platform/chrome/cros_ec_typec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 3fcd27ec9ad8f..10ef1fc75c0e1 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -591,7 +591,8 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num) dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret); return usb_role_switch_set_role(typec->ports[port_num]->role_sw, - !!(resp.role & PD_CTRL_RESP_ROLE_DATA)); + resp.role & PD_CTRL_RESP_ROLE_DATA + ? USB_ROLE_HOST : USB_ROLE_DEVICE); } static int cros_typec_get_cmd_version(struct cros_typec_data *typec)