Message ID | 20240207145851.1603237-3-heikki.krogerus@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-56682-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2476067dyb; Wed, 7 Feb 2024 12:05:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV6+ZPdjRJPcWOlIgpji9tTZrw9I18Pzr2idzPRsfZmJ3HS93hdsVYRini5KxpVTzbzl562XKJNOwJZYrtOeRCEqAdSbg== X-Google-Smtp-Source: AGHT+IH4p6On4ebWoLFKEaAFUZrEhI+wpbjzNutVe6zR7FZda0669yZIFNkGP8Ud1eGfsIkpekPI X-Received: by 2002:a05:6358:2c8b:b0:178:c57d:8f3 with SMTP id l11-20020a0563582c8b00b00178c57d08f3mr4348717rwm.1.1707336350037; Wed, 07 Feb 2024 12:05:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707336349; cv=pass; d=google.com; s=arc-20160816; b=n2Y/oql5GPhcREurOqrC4Pf4YgLZ3iYIN9eYUMbyN/iNdHjy8XqmHZTsm7KQZrSfat PNICqAGfM+etAm34yTIWYusDt/s1x7ml06WKm2ZMFtm88poJUVGcAn8L8Mtl7PrJcn7p /EWeP+KGXx/E+rdwUuvb7vlgIXd3xMRJxDLE0G1WgCoA+4zUfOgIhErLyU1yqc1sTIZg 6eN113WKNlKUK0nHVkv5T6jpHAR0WaMsbKatzyZopWAtTNDIjRmVhVVMHgY+4vzFKvkR GX9P3RDlI5gkNXkZq+PukoMFv3QdZP2BhQ07/6z6hprbrZgbsLqpqTkAOMbGWmMYpYyG qRBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BYeftyOwOMJMWgypRQnW2rUGS3xqUTlYlTswlsHkHm4=; fh=biylflMEBEI7tY8upHnij+Uk6Kyez29DiOm/jxf82dM=; b=xi9ojnQJ7drHfCUanTLfVrfQJpqlzYw9ti3yie0jK5rTutBwfCBGdBAVQscRfZqDTB HLKxOqhwxW895KkKoUqbRPiYp0PArIzVHOH6lrZoE8181Nt8GGT9W8F09mc+s7bTOjT9 jgisSGu18GLXsfTY5e43yjWy8Ckvy6Oyfg8M2uMr3t10gfiIluSxBmnb7ETMLGRzglCT TDTfqUdywNUB6whpZ7mm7gnXONF4t+eTUjdskd6UfUNcxZxT6XSdWpt5ZiNXOglr8LdG Ia4vM59qBP7cx+B+ywQ8xb+W9LT5s9nds9JF2TdrdnIspQY60fMMSXI1GnM6rtESC+1o Nalw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Bz//pEE0"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56682-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56682-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCW8Fwqolv34xDHUtF+x2UrNMQVBDIE9JcMFqkuYPdeTdXl+8SRGz+mx9wBcmeKK8xniJ0f8PTrK2OJZY6fwpvbceZjIxA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f10-20020a056a001aca00b006e04bccfdefsi2405524pfv.138.2024.02.07.12.05.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 12:05:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56682-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Bz//pEE0"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56682-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56682-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 69D12B277B6 for <ouuuleilei@gmail.com>; Wed, 7 Feb 2024 15:00:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C1777F7F1; Wed, 7 Feb 2024 14:59:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Bz//pEE0" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65D227FBBE; Wed, 7 Feb 2024 14:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707317963; cv=none; b=MXtKbVpXTvfdRK5JG6D0P1A/y/+4Ksy+gNsuW6eaOr0J2I0IRShr+ZlIoUX8hiunS4CNEcLq4/zoPd0YnAh7GxpO5L8IEaD3iFp6vgR98qwC3YXitumOGQWvArJIL2wC/Dl0TBPJryBWq3ZC9eRbdt49Vo+Du5bFxrzaZfzk7J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707317963; c=relaxed/simple; bh=wJ5erar78HhMhQzSx2+rDQ9WduuYUwpvlY26tbDxq6g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tkJYzoKbk8duz38gZ8dpfnmV9JeFhsAVQt59IV9+wOR7W8Q860MJmp0BBMZYMbUn/J/LMkCeCeZ0HQ/mhF7v6g3GS2CEqzJdLxYDiPdQhvPD6tupUnDLbTA0pL/F71ALoFdQzHcPVAjXUo/iuDs9mNPDge4clGUU4OWGsxNAss0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Bz//pEE0; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707317962; x=1738853962; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wJ5erar78HhMhQzSx2+rDQ9WduuYUwpvlY26tbDxq6g=; b=Bz//pEE0nLE17QsgMYDeMR9rasJSCe4mNDgi8NttTfImga5p1tK6LmoH mbNjTsIJJmIZLStnlmLM3CYPBBkxZKafw7lzx84scLB1MO2REp29/hTaH kslrY5FE3da6JixXpP/fryzXqdkutboSTID7rJtIHU/JBQMgsesFkdr/L SvOqvlwjSkUBoaQ5M7ET+Marb2uNTLvZzl3lUFTZeO9flZH0BVKa1u4pz fFIug7yW+Y+Vv6gz3uJ0ykkeMzwrER+zhVc8YVPQafPOtGbC1UeBuML8m 7qRhew1puG0ButRuV09TsJ6qloFnOfdAYkVu1lfKOWj8NsPgkkNoXeF6f g==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="1155047" X-IronPort-AV: E=Sophos;i="6.05,251,1701158400"; d="scan'208";a="1155047" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2024 06:59:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="933799566" X-IronPort-AV: E=Sophos;i="6.05,251,1701158400"; d="scan'208";a="933799566" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 07 Feb 2024 06:59:00 -0800 From: Heikki Krogerus <heikki.krogerus@linux.intel.com> To: Prashant Malani <pmalani@chromium.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Benson Leung <bleung@chromium.org>, Tzung-Bi Shih <tzungbi@kernel.org>, Guenter Roeck <groeck@chromium.org>, Emilie Roberts <hadrosaur@google.com>, "Nyman, Mathias" <mathias.nyman@intel.com>, "Regupathy, Rajaram" <rajaram.regupathy@intel.com>, "Radjacoumar, Shyam Sundar" <ssradjacoumar@google.com>, Samuel Jacob <samjaco@google.com>, linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, Uday Bhat <uday.m.bhat@intel.com> Subject: [PATCH 2/2] platform/chrome: cros_ec_typec: Make sure the USB role switch has PLD Date: Wed, 7 Feb 2024 16:58:51 +0200 Message-ID: <20240207145851.1603237-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207145851.1603237-1-heikki.krogerus@linux.intel.com> References: <20240207145851.1603237-1-heikki.krogerus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790268742696753716 X-GMAIL-MSGID: 1790271920501514921 |
Series |
platform/chrome: typec: xHCI DbC
|
|
Commit Message
Heikki Krogerus
Feb. 7, 2024, 2:58 p.m. UTC
The USB role switch does not always have the _PLD (Physical Location of Device) in ACPI tables. If it's missing, assigning the PLD hash of the port to the switch. That should guarantee that the USB Type-C port mapping code is always able to find the connection between the two (the port and the switch). Tested-by: Uday Bhat <uday.m.bhat@intel.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> --- drivers/platform/chrome/cros_ec_typec.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
Comments
Hi Heikki, kernel test robot noticed the following build errors: [auto build test ERROR on usb/usb-testing] [also build test ERROR on usb/usb-next usb/usb-linus chrome-platform/for-next chrome-platform/for-firmware-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.8-rc3 next-20240207] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Heikki-Krogerus/usb-roles-Link-the-switch-to-its-connector/20240207-230017 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20240207145851.1603237-3-heikki.krogerus%40linux.intel.com patch subject: [PATCH 2/2] platform/chrome: cros_ec_typec: Make sure the USB role switch has PLD config: arm-defconfig (https://download.01.org/0day-ci/archive/20240208/202402080600.zOq5UvYq-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240208/202402080600.zOq5UvYq-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202402080600.zOq5UvYq-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/platform/chrome/cros_ec_typec.c:75:20: error: incomplete definition of type 'struct acpi_device' if (adev && !adev->pld_crc) ~~~~^ include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device' struct acpi_device; ^ drivers/platform/chrome/cros_ec_typec.c:76:8: error: incomplete definition of type 'struct acpi_device' adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; ~~~~^ include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device' struct acpi_device; ^ drivers/platform/chrome/cros_ec_typec.c:76:47: error: incomplete definition of type 'struct acpi_device' adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ include/linux/acpi.h:795:8: note: forward declaration of 'struct acpi_device' struct acpi_device; ^ 3 errors generated. vim +75 drivers/platform/chrome/cros_ec_typec.c 23 24 #define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \ 25 DP_CAP_DFP_D | DP_CAP_RECEPTACLE) 26 27 static int cros_typec_parse_port_props(struct typec_capability *cap, 28 struct fwnode_handle *fwnode, 29 struct device *dev) 30 { 31 struct fwnode_handle *sw_fwnode; 32 const char *buf; 33 int ret; 34 35 memset(cap, 0, sizeof(*cap)); 36 ret = fwnode_property_read_string(fwnode, "power-role", &buf); 37 if (ret) { 38 dev_err(dev, "power-role not found: %d\n", ret); 39 return ret; 40 } 41 42 ret = typec_find_port_power_role(buf); 43 if (ret < 0) 44 return ret; 45 cap->type = ret; 46 47 ret = fwnode_property_read_string(fwnode, "data-role", &buf); 48 if (ret) { 49 dev_err(dev, "data-role not found: %d\n", ret); 50 return ret; 51 } 52 53 ret = typec_find_port_data_role(buf); 54 if (ret < 0) 55 return ret; 56 cap->data = ret; 57 58 /* Try-power-role is optional. */ 59 ret = fwnode_property_read_string(fwnode, "try-power-role", &buf); 60 if (ret) { 61 dev_warn(dev, "try-power-role not found: %d\n", ret); 62 cap->prefer_role = TYPEC_NO_PREFERRED_ROLE; 63 } else { 64 ret = typec_find_power_role(buf); 65 if (ret < 0) 66 return ret; 67 cap->prefer_role = ret; 68 } 69 70 /* Assing the USB role switch the correct pld_crc if it's missing. */ 71 sw_fwnode = fwnode_find_reference(fwnode, "usb-role-switch", 0); 72 if (!IS_ERR_OR_NULL(sw_fwnode)) { 73 struct acpi_device *adev = to_acpi_device_node(sw_fwnode); 74 > 75 if (adev && !adev->pld_crc) 76 adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; 77 fwnode_handle_put(sw_fwnode); 78 } 79 80 cap->fwnode = fwnode; 81 82 return 0; 83 } 84
Hi Heikki, kernel test robot noticed the following build errors: [auto build test ERROR on usb/usb-testing] [also build test ERROR on usb/usb-next usb/usb-linus chrome-platform/for-next chrome-platform/for-firmware-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.8-rc3 next-20240207] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Heikki-Krogerus/usb-roles-Link-the-switch-to-its-connector/20240207-230017 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20240207145851.1603237-3-heikki.krogerus%40linux.intel.com patch subject: [PATCH 2/2] platform/chrome: cros_ec_typec: Make sure the USB role switch has PLD config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240208/202402081136.sve0cViZ-lkp@intel.com/config) compiler: m68k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240208/202402081136.sve0cViZ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202402081136.sve0cViZ-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/platform/chrome/cros_ec_typec.c: In function 'cros_typec_parse_port_props': >> drivers/platform/chrome/cros_ec_typec.c:75:34: error: invalid use of undefined type 'struct acpi_device' 75 | if (adev && !adev->pld_crc) | ^~ drivers/platform/chrome/cros_ec_typec.c:76:29: error: invalid use of undefined type 'struct acpi_device' 76 | adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; | ^~ drivers/platform/chrome/cros_ec_typec.c:76:68: error: invalid use of undefined type 'struct acpi_device' 76 | adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; | ^~ vim +75 drivers/platform/chrome/cros_ec_typec.c 23 24 #define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \ 25 DP_CAP_DFP_D | DP_CAP_RECEPTACLE) 26 27 static int cros_typec_parse_port_props(struct typec_capability *cap, 28 struct fwnode_handle *fwnode, 29 struct device *dev) 30 { 31 struct fwnode_handle *sw_fwnode; 32 const char *buf; 33 int ret; 34 35 memset(cap, 0, sizeof(*cap)); 36 ret = fwnode_property_read_string(fwnode, "power-role", &buf); 37 if (ret) { 38 dev_err(dev, "power-role not found: %d\n", ret); 39 return ret; 40 } 41 42 ret = typec_find_port_power_role(buf); 43 if (ret < 0) 44 return ret; 45 cap->type = ret; 46 47 ret = fwnode_property_read_string(fwnode, "data-role", &buf); 48 if (ret) { 49 dev_err(dev, "data-role not found: %d\n", ret); 50 return ret; 51 } 52 53 ret = typec_find_port_data_role(buf); 54 if (ret < 0) 55 return ret; 56 cap->data = ret; 57 58 /* Try-power-role is optional. */ 59 ret = fwnode_property_read_string(fwnode, "try-power-role", &buf); 60 if (ret) { 61 dev_warn(dev, "try-power-role not found: %d\n", ret); 62 cap->prefer_role = TYPEC_NO_PREFERRED_ROLE; 63 } else { 64 ret = typec_find_power_role(buf); 65 if (ret < 0) 66 return ret; 67 cap->prefer_role = ret; 68 } 69 70 /* Assing the USB role switch the correct pld_crc if it's missing. */ 71 sw_fwnode = fwnode_find_reference(fwnode, "usb-role-switch", 0); 72 if (!IS_ERR_OR_NULL(sw_fwnode)) { 73 struct acpi_device *adev = to_acpi_device_node(sw_fwnode); 74 > 75 if (adev && !adev->pld_crc) 76 adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; 77 fwnode_handle_put(sw_fwnode); 78 } 79 80 cap->fwnode = fwnode; 81 82 return 0; 83 } 84
On Thu, Feb 08, 2024 at 12:07:40PM +0800, kernel test robot wrote: > Hi Heikki, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on usb/usb-testing] > [also build test ERROR on usb/usb-next usb/usb-linus chrome-platform/for-next chrome-platform/for-firmware-next driver-core/driver-core-testing driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.8-rc3 next-20240207] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Heikki-Krogerus/usb-roles-Link-the-switch-to-its-connector/20240207-230017 > base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing > patch link: https://lore.kernel.org/r/20240207145851.1603237-3-heikki.krogerus%40linux.intel.com > patch subject: [PATCH 2/2] platform/chrome: cros_ec_typec: Make sure the USB role switch has PLD > config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240208/202402081136.sve0cViZ-lkp@intel.com/config) > compiler: m68k-linux-gcc (GCC) 13.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240208/202402081136.sve0cViZ-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202402081136.sve0cViZ-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > drivers/platform/chrome/cros_ec_typec.c: In function 'cros_typec_parse_port_props': > >> drivers/platform/chrome/cros_ec_typec.c:75:34: error: invalid use of undefined type 'struct acpi_device' > 75 | if (adev && !adev->pld_crc) > | ^~ > drivers/platform/chrome/cros_ec_typec.c:76:29: error: invalid use of undefined type 'struct acpi_device' > 76 | adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; > | ^~ > drivers/platform/chrome/cros_ec_typec.c:76:68: error: invalid use of undefined type 'struct acpi_device' > 76 | adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; > | ^~ Oh, so this has to be wrapped in ifdef CONFIG_ACPI :(
Hi Heikki, On Wed, Feb 7, 2024 at 6:59 AM Heikki Krogerus <heikki.krogerus@linux.intel.com> wrote: > > The USB role switch does not always have the _PLD (Physical > Location of Device) in ACPI tables. If it's missing, > assigning the PLD hash of the port to the switch. That > should guarantee that the USB Type-C port mapping code is > always able to find the connection between the two (the port > and the switch). > > Tested-by: Uday Bhat <uday.m.bhat@intel.com> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/platform/chrome/cros_ec_typec.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c > index 2b2f14a1b711..5c14e8db08b5 100644 > --- a/drivers/platform/chrome/cros_ec_typec.c > +++ b/drivers/platform/chrome/cros_ec_typec.c > @@ -28,6 +28,7 @@ static int cros_typec_parse_port_props(struct typec_capability *cap, > struct fwnode_handle *fwnode, > struct device *dev) > { > + struct fwnode_handle *sw_fwnode; > const char *buf; > int ret; > > @@ -66,6 +67,16 @@ static int cros_typec_parse_port_props(struct typec_capability *cap, > cap->prefer_role = ret; > } > > + /* Assing the USB role switch the correct pld_crc if it's missing */ > + sw_fwnode = fwnode_find_reference(fwnode, "usb-role-switch", 0); > + if (!IS_ERR_OR_NULL(sw_fwnode)) { > + struct acpi_device *adev = to_acpi_device_node(sw_fwnode); > + > + if (adev && !adev->pld_crc) > + adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; > + fwnode_handle_put(sw_fwnode); Can this be in common Type-C code (maybe typec_register_port())? It doesn't strike me as ChromeOS specific, but perhaps I am missing something. Thanks,
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c index 2b2f14a1b711..5c14e8db08b5 100644 --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -28,6 +28,7 @@ static int cros_typec_parse_port_props(struct typec_capability *cap, struct fwnode_handle *fwnode, struct device *dev) { + struct fwnode_handle *sw_fwnode; const char *buf; int ret; @@ -66,6 +67,16 @@ static int cros_typec_parse_port_props(struct typec_capability *cap, cap->prefer_role = ret; } + /* Assing the USB role switch the correct pld_crc if it's missing. */ + sw_fwnode = fwnode_find_reference(fwnode, "usb-role-switch", 0); + if (!IS_ERR_OR_NULL(sw_fwnode)) { + struct acpi_device *adev = to_acpi_device_node(sw_fwnode); + + if (adev && !adev->pld_crc) + adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; + fwnode_handle_put(sw_fwnode); + } + cap->fwnode = fwnode; return 0;