Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp566374pxa; Fri, 21 Aug 2020 14:47:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3pRltRWB+RuAA18xR463lzJOZTq6AhZ24MMNPT5pW+EGE9DJX8dv0yrZIU8dnVmsBhGn+ X-Received: by 2002:a17:907:205c:: with SMTP id pg28mr4732108ejb.22.1598046457933; Fri, 21 Aug 2020 14:47:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598046457; cv=none; d=google.com; s=arc-20160816; b=yCAO9Ynyg3B1je7Suz46xWxI6eze9Mr/Zv6GVTbWbJvNYEpk5KjqR+lE25a6uJr01U +hE4/H9iapwgWEb7PA69qEePBAByPIkAEQV5ypsWoDdERp2BiPxIZ8l+6vVyZ9c/5ud/ xek/PWk9AqFYA7/DxXO/u0KdXEaOMQ/mILCH//jZ/iywHvioXWz1zuZuug7Mwfmzo3kQ vol9c29V3vcikQaKVH5jAg50PSDucaA4PsWO2I+oaJko+rqiGCZoerKBSLXr1d5NNRSk RpVJ8Ltiy0dINkq+swtPE7DNxUBavEU3Ozttt6C3v9LnutTGxyLieLUN9oejhIq5smGQ S+cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=Gyias1a28T7a3JG++NWAonaMuGmJOp6BXHJqDxk23U0=; b=YGo7RMLxgA7vlGltF3TXdYo9ytNA6KzYM0WGkBDWCbfzuSSdit0oVU0zbNcxmbAmIY yuj6nDZjio/rMV0TuA6rAwDqzjqq3+ch0tb02XnNZ0Bdalpi2q8tD5rrXcAKFHB+8H39 hRih5pH9QBIlCO+g0UFGmPK7UbOYaqGUovI1XTrJkHiEml+2r7G6fJgCv3fNhNwz7mtT f+wOHTfc5TVTtGzv38Z0teYEKRBs2Jn0nIdnYKTYOBbgOobtdBaYR5wGpNAvGUaDCumi IJMP8dMN/cIQzYvvoe+jlDORmLHdeaqg09kIPtddbrtPR714rkGnZ/Q92G6UuNrv9Cqo usvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a22si1895945ejj.163.2020.08.21.14.47.14; Fri, 21 Aug 2020 14:47:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726818AbgHUVqh (ORCPT + 99 others); Fri, 21 Aug 2020 17:46:37 -0400 Received: from mga17.intel.com ([192.55.52.151]:51124 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726570AbgHUVqg (ORCPT ); Fri, 21 Aug 2020 17:46:36 -0400 IronPort-SDR: Iw9eGNyG1OrmBysRwkj34+RTdYRGid3PClXhrl4cjx83QZytmtu/EKLFAfohFTUtOLf6FwhrfI 8L5B4Q5zu40g== X-IronPort-AV: E=McAfee;i="6000,8403,9720"; a="135704246" X-IronPort-AV: E=Sophos;i="5.76,338,1592895600"; d="scan'208";a="135704246" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2020 14:46:34 -0700 IronPort-SDR: lToYYZPPROX6ANHr/RK7GD+c5UgwBXkkMivNh3FzdtOAHGyimuRtQQ/F5EJv82awIzLkmrc2Vc eBIzwUnaYdkw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,338,1592895600"; d="scan'208";a="372033687" Received: from otc-chromeosbuild-1.jf.intel.com ([10.54.30.83]) by orsmga001.jf.intel.com with ESMTP; 21 Aug 2020 14:46:34 -0700 From: Azhar Shaikh To: bleung@chromium.org, enric.balletbo@collabora.com, groeck@chromium.org, heikki.krogerus@linux.intel.com, pmalani@chromium.org Cc: linux-kernel@vger.kernel.org, azhar.shaikh@intel.com, rajmohan.mani@intel.com, utkarsh.h.patel@intel.com, casey.g.bowman@intel.com Subject: [PATCH v5 1/3] platform/chrome: cros_ec_typec: Send enum values to usb_role_switch_set_role() Date: Fri, 21 Aug 2020 14:47:22 -0700 Message-Id: <20200821214724.20056-2-azhar.shaikh@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200821214724.20056-1-azhar.shaikh@intel.com> References: <20200821214724.20056-1-azhar.shaikh@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes in v5: - Rebased on top of https://lkml.org/lkml/2020/7/10/1063 Changes in v4: - Remove extra line between Fixes and Signed-off tag. - Added Reviewed-by and Cc tags from v1 and v2. Changes in v3: - No changes Changes in v2: - Update the commit message to change 'USB_ROLE_HOST in case of UFP.' to 'USB_ROLE_HOST in case of DFP.' 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 585f27e2b362..739a1c846949 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -622,7 +622,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) -- 2.17.1