From patchwork Sun Sep 3 21:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C710CCA0FFA for ; Sun, 3 Sep 2023 21:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349137AbjICVmS (ORCPT ); Sun, 3 Sep 2023 17:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349128AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93E9A11D for ; Sun, 3 Sep 2023 14:41:59 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5007c8308c3so1310849e87.0 for ; Sun, 03 Sep 2023 14:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777318; x=1694382118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k1gyG4EA+KF88AUvqDVJpMyc5ibJn0KvVHVwRSeTDTM=; b=UHecZlFu28oyM1EdwF5xu4mbh3c2hb9MD1AU+tQzl8OtnJ90IX3AnYpsaXP5H/9n+K 7RSSHsOk6xIOwWDE4bzOUWVpuwqj4GACfNrd9MPwiQGsouwn9HIoabmEZiv31jSd1KrL uH23NUO7LadsBKSRoVYdeINOieKFf8Bho2p5Vo7JqZ3cT5Ev0sLvodGS/LF7wv5huys8 xPfGsgB9scNjYQbe3XUeXoj51Oh2/YtvW2bmycHFSM6JDAfHrhk2JqaNa2ftxlwZdEOY q255uEOuw3G3ki2y9VodbHLknRoerdOIWj9YaEAZaymp4DGlP7RHW0bVu2DXodZvkzvx nbsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777318; x=1694382118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k1gyG4EA+KF88AUvqDVJpMyc5ibJn0KvVHVwRSeTDTM=; b=X3Sr/Ow6P6X5y39YC+dMABW1etIT3ywS525QZQIqEEBVL1HFXg4foACqwa0/HoCkHL zQV7hcM/KEELfER39realsHhu51BPjTd+hERXLKhaWpxmhgrVPvO5XV0bJ20U3aiFXXS x1BVwRgcj9x9sz8bHpoL0xx2FZVJdFWfw8TEd1QxYMmJdg0aWRwdiHc5EyPWittKnQ0q 1AX475QlHtbFneCRf9jz5Y5k3+ZAwLV/ED+3MtMgo4Y3wPVX+Xt1eKPwi9i16L43KJ7Q C1/JikNjz0Vdptzq5IuH7eqivLHFn+WlfDnNQh0t2LEr4DTVSJ0plMxepKspSsVEdaAn 8TSg== X-Gm-Message-State: AOJu0Yx3bjM5JhcNCyHN5/PYbYdpyj9sarV0n+MjoSwNuiZ+tKede5oJ N1lgAPAML82Lerk1m/WfthFuhQ== X-Google-Smtp-Source: AGHT+IFeimZforUo3xm2aTW6r+gvYdhOH4RX08O1w99CKPaCyS3lubUtNJ5cXMhhp/mnVE4/u6CHlg== X-Received: by 2002:a05:6512:3b8a:b0:4f8:7055:6f7e with SMTP id g10-20020a0565123b8a00b004f870556f7emr6244283lfv.44.1693777317966; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:57 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 09/12] usb: typec: tcpm: support generating Type-C port names for userspace Date: Mon, 4 Sep 2023 00:41:47 +0300 Message-Id: <20230903214150.2877023-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org We need a way to generate and return the Type-C port device names. For example, it is going to be used by the DRM to provide PATH property for DisplayPort connectors. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/tcpm.c | 14 ++++++++++++++ include/linux/usb/tcpm.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index d962f67c95ae..9709b56a3046 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5539,6 +5539,20 @@ bool tcpm_port_is_toggling(struct tcpm_port *port) } EXPORT_SYMBOL_GPL(tcpm_port_is_toggling); +/** + * tcpm_port_get_name - get the name of the corresponding USB Type-C port + * @port: TCPM port instance + * + * Returns a name of the USB Type-C port correponding to the passed TCPM port + * instance on success or NULL when the port has not been enumerated yet. The + * resulting string should be freed by the caller. + */ +char *tcpm_port_get_name(struct tcpm_port *port) +{ + return typec_port_get_name(port->typec_port); +} +EXPORT_SYMBOL_GPL(tcpm_port_get_name); + static void tcpm_enable_frs_work(struct kthread_work *work) { struct tcpm_port *port = container_of(work, struct tcpm_port, enable_frs); diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index ab7ca872950b..623c34788680 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -161,6 +161,8 @@ struct tcpm_port; struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc); void tcpm_unregister_port(struct tcpm_port *port); +char *tcpm_port_get_name(struct tcpm_port *port); + void tcpm_vbus_change(struct tcpm_port *port); void tcpm_cc_change(struct tcpm_port *port); void tcpm_sink_frs(struct tcpm_port *port);