Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4691170rwb; Tue, 17 Jan 2023 04:23:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXsix/1rR1xsRkWmoh0NgBKo5tS6NuLyeTpRktZal9MXjgapAh3XP1mjPVrg49/LtaGmNw7Z X-Received: by 2002:a62:27c6:0:b0:583:312a:b344 with SMTP id n189-20020a6227c6000000b00583312ab344mr3037553pfn.31.1673958190805; Tue, 17 Jan 2023 04:23:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673958190; cv=none; d=google.com; s=arc-20160816; b=KYsVREZpczuZJAJV5y9lLLUt2GtyqPw/xA4izWbVMP1AOirrZL0zXqGuaGMAAcoppQ 4722aTkwWYoN1xH1OCjbQnmlnIY5NoFts8moMpEXWBhToj/I1J9Eqp4eDfI4S25H50KV bLCUVsXBmRY63smIx4/gNCea5CBqOG5DBIg2LHeZ0wEuyfCcqZd3e3DYArskvKnIsAKJ RavAO805jJhP91v2ySIUMAz9RPqx1Rc+GwCYqPqyPi/14SlO6E/1k7Bpjce8ScjlyEr8 AE438ixKo20hsmZYrEZDA4mxk4CVeGmYP+6RzEpjfCITal5gi2mgV0nDH5/0VCVk+xid wBfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eTEKpEcHL00HkBq0NqX85DdQprEvbDUsLw0chm+tWRY=; b=vZgqgUTnjrwVVai6ld/WF2vrBvnhHa/ttwXzxOe14UL0Oo8lt88gmt5t9MbHKqhVmk bcraaHD5XJ5+ylE7D0R1ce668Qxe2zwQWW4I2yS2/phzqztDt5xmHRPpdPZfMvapo0pH WcSsEmL12nX7kXlQoHwYufflo/DpG7kNGAMtDek5SaV/5/F3+lSxT6XsYY6KKBV8sNT1 RLM8pikFryDbD/W3/ROXPVz50IydbAU4w4fWFAq7DtX9t0Ugm5dmGC7ISrenH0/yQtK+ FNKv0AQdV6YWLLq138jHXxDu0KSI5UlwroxJflBP9WZQuZ/LQiWTjqj/43cIGjQ75WXB m35Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=grzAoe+Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s66-20020a625e45000000b00586896d5978si10245176pfb.232.2023.01.17.04.23.04; Tue, 17 Jan 2023 04:23:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=grzAoe+Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234607AbjAQLnx (ORCPT + 50 others); Tue, 17 Jan 2023 06:43:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236747AbjAQLnv (ORCPT ); Tue, 17 Jan 2023 06:43:51 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC812DE54; Tue, 17 Jan 2023 03:43:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673955830; x=1705491830; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=imB9YxQa8VlfGq2xlLTsoJA/LByTPqGbSSSCO3xAm58=; b=grzAoe+Yal6NTdZpGu7oSVSbKotts7odNccggVAEpxsA7SrZOZK/dfni TwpCzbpLigEqSiYwMUweNu+P3y98TJtuUuzVwpvqX/UibwDbf6yrkhtAN E2eVPvKToAj6Slt/lJfPIF0j8JcT6jBAak9+CALsDkzl97jOW4ocZxAIr MiLSyISM/bJzNE/Wy6xsV4XOMzE5Ji8AgyLriuGxj/Aq6KbIQ9z6NkDiW qFW0NRHvlOQxUKxQURDCi7kDxTFUlczrx6IaSP9CmKwB2a+Bx1sY12jCY 9MaATyHOxAhTWEe2S/PX9hvfVoE2QtrrVJxEo5uWsW1JeU2KKvV4CY03L A==; X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="387024664" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="387024664" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 03:43:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="801717277" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="801717277" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 17 Jan 2023 03:43:38 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 17 Jan 2023 13:43:38 +0200 Date: Tue, 17 Jan 2023 13:43:38 +0200 From: Heikki Krogerus To: Prashant Malani Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, bleung@chromium.org, Greg Kroah-Hartman Subject: Re: [PATCH 3/3] usb: typec: Make bus switch code retimer-aware Message-ID: References: <20230112221609.540754-1-pmalani@chromium.org> <20230112221609.540754-4-pmalani@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230112221609.540754-4-pmalani@chromium.org> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2023 at 10:16:08PM +0000, Prashant Malani wrote: > Since ports can have retimers associated with them, update the Type-C > alternate mode bus code to also set retimer state when the switch state > is updated. > > While we are here, make the typec_retimer_dev_type declaration in the > retimer.h file as extern, so that the header file can be successfully > included in the bus code without redeclaration compilation errors. > > Signed-off-by: Prashant Malani Reviewed-by: Heikki Krogerus > --- > drivers/usb/typec/bus.c | 22 ++++++++++++++++++++++ > drivers/usb/typec/retimer.h | 2 +- > 2 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c > index 9f1bbd26ca47..0c8d554240be 100644 > --- a/drivers/usb/typec/bus.c > +++ b/drivers/usb/typec/bus.c > @@ -11,6 +11,22 @@ > #include "bus.h" > #include "class.h" > #include "mux.h" > +#include "retimer.h" > + > +static inline int > +typec_altmode_set_retimer(struct altmode *alt, unsigned long conf, void *data) > +{ > + struct typec_retimer_state state; > + > + if (!alt->retimer) > + return 0; > + > + state.alt = &alt->adev; > + state.mode = conf; > + state.data = data; > + > + return typec_retimer_set(alt->retimer, &state); > +} > > static inline int > typec_altmode_set_mux(struct altmode *alt, unsigned long conf, void *data) > @@ -31,6 +47,12 @@ typec_altmode_set_mux(struct altmode *alt, unsigned long conf, void *data) > static inline int > typec_altmode_set_switches(struct altmode *alt, unsigned long conf, void *data) > { > + int ret; > + > + ret = typec_altmode_set_retimer(alt, conf, data); > + if (ret) > + return ret; > + > return typec_altmode_set_mux(alt, conf, data); > } > > diff --git a/drivers/usb/typec/retimer.h b/drivers/usb/typec/retimer.h > index e34bd23323be..d6a5ef9881e1 100644 > --- a/drivers/usb/typec/retimer.h > +++ b/drivers/usb/typec/retimer.h > @@ -12,7 +12,7 @@ struct typec_retimer { > > #define to_typec_retimer(_dev_) container_of(_dev_, struct typec_retimer, dev) > > -const struct device_type typec_retimer_dev_type; > +extern const struct device_type typec_retimer_dev_type; > > #define is_typec_retimer(dev) ((dev)->type == &typec_retimer_dev_type) > > -- > 2.39.0.314.g84b9a713c41-goog -- heikki