From patchwork Wed Jun 29 23:32:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prashant Malani X-Patchwork-Id: 12900853 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D61944C6E for ; Wed, 29 Jun 2022 23:34:34 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id x138so13814190pfc.3 for ; Wed, 29 Jun 2022 16:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qtIqL1f5IjnnZ0IhAnz04BNlW4zdz4jdXXNoGJ3W7Ro=; b=S68LdvYFW6ZcrUojtgtl/KObRBRIzIvcSoJ1fY/bqwiFZcWukxyLmF5rFpak2nx3R5 ABT7HwWkurNBHbsUuTWI0kQmXGVNnBA/3A7xFZe7DGgGr7NEGhz1bqV7leIlaHF4dU4C cgT4KO94Zk6NBTR6sJR0uYjEoOBtJbdDADuu4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qtIqL1f5IjnnZ0IhAnz04BNlW4zdz4jdXXNoGJ3W7Ro=; b=U5oQiRs7AMXUJhJ9BWpZ1DKxjVdgm6ZeL9NH9Kx2DO4BcaVlcddpC0vt0F3Sz/KnZh YCI+1LMj8gE0MEzCDCi61rXNQgExOi60H1JrtHjZyHw3jL4iLFDC7+S3jiDI4kln0hNX GUHTxRdI0bXqt6JiAp+uhshZjt4Nk0aS/45TaHcKLN4n+52surmq1qONq8QWwOwvCBfe wCEMDtcizWLABgEh1hWvw3FoArALe5N+oxQXkBVJs/gPxxgIkLuT6tdQMiaXn3OYNnAr Xf6ncH3URZwgBJaYih/S0R9+jXV+WIFh3nqD/XYB3tuCdtmUQgAiDqg4QbXMBrC57WQF 2eHw== X-Gm-Message-State: AJIora9CtnD4SuJ1ShEVShy79/f/T2alQbGAbMdBEr1NmkSYSV9x4wrF Xuy1zroFfbYsqsYcJU0pvDQjDQ== X-Google-Smtp-Source: AGRyM1udNCFmh3uhxGbwxMrkQ6H/rZ4kNvvOFcTcc41572KqRPc4APp6w6O0HWl//AGEpchkxzfcfg== X-Received: by 2002:a63:8943:0:b0:411:8cff:8b5d with SMTP id v64-20020a638943000000b004118cff8b5dmr3645496pgd.257.1656545674380; Wed, 29 Jun 2022 16:34:34 -0700 (PDT) Received: from pmalani.c.googlers.com.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id rm1-20020a17090b3ec100b001ed27d132c1sm127305pjb.2.2022.06.29.16.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 16:34:33 -0700 (PDT) From: Prashant Malani To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev Cc: bleung@chromium.org, heikki.krogerus@linux.intel.com, Prashant Malani , Daisuke Nojiri , "Dustin L. Howett" , Greg Kroah-Hartman , Guenter Roeck , "Gustavo A. R. Silva" , Kees Cook , Sebastian Reichel Subject: [PATCH 2/9] usb: typec: Add retimer handle to port Date: Wed, 29 Jun 2022 23:32:20 +0000 Message-Id: <20220629233314.3540377-3-pmalani@chromium.org> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220629233314.3540377-1-pmalani@chromium.org> References: <20220629233314.3540377-1-pmalani@chromium.org> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Similar to mux and orientation switch, add a handle for registered retimer to the port, so that it has handles to the various switches connected to it. Signed-off-by: Prashant Malani --- drivers/usb/typec/class.c | 8 ++++++++ drivers/usb/typec/class.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 2fa0b3718d23..2bc5fbdb25dd 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "bus.h" #include "class.h" @@ -2249,6 +2250,13 @@ struct typec_port *typec_register_port(struct device *parent, return ERR_PTR(ret); } + port->retimer = typec_retimer_get(&port->dev); + if (IS_ERR(port->retimer)) { + ret = PTR_ERR(port->retimer); + put_device(&port->dev); + return ERR_PTR(ret); + } + ret = device_add(&port->dev); if (ret) { dev_err(parent, "failed to register port (%d)\n", ret); diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h index 1bb1da124109..97520406929e 100644 --- a/drivers/usb/typec/class.h +++ b/drivers/usb/typec/class.h @@ -55,6 +55,7 @@ struct typec_port { enum typec_orientation orientation; struct typec_switch *sw; struct typec_mux *mux; + struct typec_retimer *retimer; const struct typec_capability *cap; const struct typec_operations *ops;