Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp604433rdh; Wed, 14 Feb 2024 06:30:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0bZIcKJNVDy54blisDoMQIqpYZelh+dgT/2+awN2USu9Hkw6indlbGUK8KmAQP8ZHMnpULF5vXg3oc6zh+BZpaTA1yFr7JYVCvj5owQ== X-Google-Smtp-Source: AGHT+IGB0IHKVI8p6RPZHkBunBJXWGdyA8/NBElZIM+45S86h03Yu1n5TJT0x0Vqs341xFHF5Bez X-Received: by 2002:a92:cec4:0:b0:364:f9:6857 with SMTP id z4-20020a92cec4000000b0036400f96857mr3035250ilq.13.1707921041774; Wed, 14 Feb 2024 06:30:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707921041; cv=pass; d=google.com; s=arc-20160816; b=p4t77LqFwEKJi3P0n43v+Y2FKy1prEPtqPK4Xuik1V4RBHoD7liWMggjIm1CN8ZZ+c TvvWiwcr8THmLnmpgGvMwUnEg9nzAFYchEHOKnChkZ8s//OXpwiuMT3jbh/OjNOHV2ZO KLM/DChk1LmR+CrGg+Xflp11X24mui2USwN7KnhTJnJZnqCz4IMi7nGNUenC0WLICiTT 6fn478EWuI5eeelU0JzBysMtiq12q+eVjEoOkgbNqTiZdJAUXU+D7pBuorRpFc52Rlwp ahQ8z/nr2hNEyjm3Jfk++572LH8Rek9Rzz6ffpHtRT9Lj4Tm7WjwZkOTLoBh6clxQbAr zKIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eZanmRyCX7GAufR2d1FSyQVH9FJ5s4vVefyw60wLM9o=; fh=6y0qWD3fGSW1RWoKUjLwwPeOtimehtFbFMByd2tJrUM=; b=rd58/vmL8GKP6TfOlT3tN6wA11flzggNGyutebrr6UWARUqwr0DTe2jZdXok3otvuu lccue8THDr19o8XJ/y0i1AS6WA9E2FP80Hk3dyMmiToKyHRSMMCVK6lXqTaCLGOD8JH4 7umaX5Jn7pefYscW44m6jPQ9s/pxqSliI/sQSEaemhhbXovmKUv8XSJ67o/r6+vSBHo8 t0RRsmV1EqHv19RQiOoja9dp8QcU1q/YEPscfgHlLf0piCUnPdYzjhXgegHMOsYLEmwn uatdWTV67T8X+UwXnf2i+HnMl2MUJbY2BJqoqaWWwIuqa1b9UQHTK6X2Q7Wf2TEqZBzu F0OQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CrRZycvL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-65039-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65039-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVkbOamZYOGBjYNdV1+9PzZs/YBZAZ89pq9CJZO3Q88baU5j7YsRb+ReqE0BfU/jCrTyyEuwZ7kkFjy0KFwgOJPlvEIdskvsYjcgjnlkw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c23-20020a637257000000b005dc4fda246esi3781475pgn.615.2024.02.14.06.30.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 06:30:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65039-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CrRZycvL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-65039-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65039-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C392F28AE36 for ; Wed, 14 Feb 2024 10:22:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64BAB17584; Wed, 14 Feb 2024 10:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CrRZycvL" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 F207318027; Wed, 14 Feb 2024 10:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707906167; cv=none; b=AmESqnO3qcR+WUvPTjMYAKqY8u0ueG3FaASksDL+jgj4t4PVVigVCKDkAXedir/YrPDdxqhvLQ8lBSnkehBPae/dYmJGTtl0hga2lJG4sBTyyMij8bBR0yBBXJQHsniRlyQwt4sBUZOfytk1fuV26TfZo9Zk1Ex7sLsAZed+E3w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707906167; c=relaxed/simple; bh=DrNq9NIAiSAvKQs02UieUvDi/8KRVxqBmIiu38GkvBA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Cp7gqTitrXeYvI8L2hmsfYbmf990jd/Z4ncQv5zuTObpMTHDCLvz6MCkKERmdkxOWun7UJ1cE1W5VksUZ4QH4xgfmv8b5YtFM1reJym8nQU4zA44vvryUMhswB5Si9UmE53kNB1SQmcQGH72SUBDJyg4VIg8aYB6BrON3SdYW5k= 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=CrRZycvL; arc=none smtp.client-ip=198.175.65.19 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=1707906165; x=1739442165; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=DrNq9NIAiSAvKQs02UieUvDi/8KRVxqBmIiu38GkvBA=; b=CrRZycvLj9Np/AYfv4x4mxm6e02oLuxgM+S6neON0tjDszUC245aY65T ZX6v/R7T4A9I7PGWXqTu0LzeooqY3o5LkAqD/yaEkGENwp4FbNwTiG2iv wJpOGKxKBSBWDwBFu6eaNwvO0wUW1CbdXJWiPfxGDW9vK2Z0hD9rAlwwx lTLXunBmb0DWN7PufsYYkctFI3LBqDW2vtrodaOxOCQ9jChCOnQU6SLpN j8G7oZwUBGLyb2Q6fo4qOQhQb7vRh3KdG00NZKa8J0kxDqFXM9Ja5PhbX El069Yx08286OP0h5Et5NAkOgYPTaUTWzjD/uPrD0tkEClndoD5q/AP1h g==; X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="1794769" X-IronPort-AV: E=Sophos;i="6.06,159,1705392000"; d="scan'208";a="1794769" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2024 02:22:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10982"; a="935614506" X-IronPort-AV: E=Sophos;i="6.06,159,1705392000"; d="scan'208";a="935614506" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 14 Feb 2024 02:22:39 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 14 Feb 2024 12:22:38 +0200 Date: Wed, 14 Feb 2024 12:22:38 +0200 From: Heikki Krogerus To: Prashant Malani Cc: Greg Kroah-Hartman , Benson Leung , Tzung-Bi Shih , Guenter Roeck , Emilie Roberts , "Nyman, Mathias" , "Regupathy, Rajaram" , "Radjacoumar, Shyam Sundar" , Samuel Jacob , Uday Bhat , linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] platform/chrome: cros_ec_typec: Make sure the USB role switch has PLD Message-ID: References: <20240213130018.3029991-1-heikki.krogerus@linux.intel.com> <20240213130018.3029991-3-heikki.krogerus@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Feb 13, 2024 at 08:55:20AM -0800, Prashant Malani wrote: > Hi Heikki, > > On Tue, Feb 13, 2024 at 5:00 AM Heikki Krogerus > 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 > > Signed-off-by: Heikki Krogerus > > --- > > drivers/platform/chrome/cros_ec_typec.c | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c > > index 2b2f14a1b711..4d305876ec08 100644 > > --- a/drivers/platform/chrome/cros_ec_typec.c > > +++ b/drivers/platform/chrome/cros_ec_typec.c > > @@ -24,6 +24,23 @@ > > #define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \ > > DP_CAP_DFP_D | DP_CAP_RECEPTACLE) > > > > +static void cros_typec_role_switch_quirk(struct fwnode_handle *fwnode) > > +{ > > +#ifdef CONFIG_ACPI > > + struct fwnode_handle *switch_fwnode; > > + > > + /* Supply the USB role switch with the correct pld_crc if it's missing. */ > > + switch_fwnode = fwnode_find_reference(fwnode, "usb-role-switch", 0); > > + if (!IS_ERR_OR_NULL(switch_fwnode)) { > > + struct acpi_device *adev = to_acpi_device_node(switch_fwnode); > > + > > + if (adev && !adev->pld_crc) > > + adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc; > > + fwnode_handle_put(switch_fwnode); > > + } > > +#endif > > +} > > + > > I'll reiterate my comment[ 1] from v1: can this be in the > common Type-C code, i.e typec_register_port() ? > > I don't see anything in this implementation which is Chrome OS specific. I'm sorry Prashant, I failed to notice your comment. This is only needed for Chrome OS. The problem affects only certain Chromebooks. I do not want to put quirks to the generic subsystem code unless we have to. If there are more device drivers that need the same quirk, then we can move it there, but not before that. This solution is in any case a hack regardless of where we put it, and I don't like it because of that. But I don't have any better ideas unfortunately. thanks, -- heikki