Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp595759rdb; Thu, 22 Feb 2024 13:09:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWIpqMOqLjsD8gZmjwxVkbj5maskp4jmLfGTY6QjnQbKkakx1Ti83NaQXdCGeEtsE7jo8YGcKLe7rBwhb3b0QnG4r48SKMmBWw61Y9oiA== X-Google-Smtp-Source: AGHT+IG9pq2z8vIeO1TbBsSRoxmo5p4zeGqyx2chwfXHyd7gAFr9O9kjxQwgkrIw7PCY8t4CmVNG X-Received: by 2002:a05:620a:359:b0:787:a1fc:b4e9 with SMTP id t25-20020a05620a035900b00787a1fcb4e9mr215407qkm.28.1708636196468; Thu, 22 Feb 2024 13:09:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708636196; cv=pass; d=google.com; s=arc-20160816; b=ZymCg3U1THLX/NlqIA0+edDM3UXLA+1S1YZpFe0wyqCeCQqiX7N3xUfWvXFLnvM09Z HSWwowPi0JSQnNMTdk9L/36lUr/UxIil9qRCwPSVsrZ9FuapoAAoNKf96/hcqqK2IP4Z YzgljgOXE9qmTb5PANs34BFvqSgQ+TMAYDwtuARjIf8BqrIidO0vW/luf8LClRwGCWgo 1tO+UjfYsGgTJToV1joGYPJfFcTFa4qOFTBQFM2S7m7u07xt8J+veYxr5HqPfBq/BLMZ JR59J2R73x9wASqPbg5zN/H1abycWsGbD5oUwkGbL8ks5Eoax3vqNOLloxHUWFHdhQfB QTkQ== 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; bh=rry6g/dpzUGOq1A1h43yCDjq/lLaNgUv+Gv32r8PnEE=; fh=FttDRjnFdpjso3V5tb3WR+hSGsT8UJL4OhhG9l/Cs7o=; b=lH8oPj7DDe9fy2yaZdHW93hiqDC6hu4pcBzdaYQg1QCZV6YJ9dMHyQdQErCMk1mUjX GCXLbjEaMlH/IVWNFmBbkPV+4rZzG4llSthBL80dAnaAsWerg82DOvpwBxHWc7WRIMLJ rpmkZJ5lKxU3VLYXlvNmY+rVHWrQ6270DjDFNGhEuXqexOguimEQaiBStqOAGTadzEBr GAzjZXNpbHoq5CNAqcxh975Hh+07OksbaA7UOTtjQREjbFhdDbFChDjTgH1hwQZDHqiH sNwA5/l6yrrSy7I+BZzcJ4sGFa4BsF7L9Sp9cggUqP1s1znLRiidpVO0XCE5fdT8ZG3G Rrag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77362-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77362-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u7-20020a05620a454700b007879cd000edsi2538952qkp.404.2024.02.22.13.09.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:09:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77362-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77362-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77362-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3841A1C22CD7 for ; Thu, 22 Feb 2024 21:09:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4813C12D1E8; Thu, 22 Feb 2024 21:09:31 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 4F4DE7175C for ; Thu, 22 Feb 2024 21:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708636170; cv=none; b=STFasF2r5LV7tXQLa1j6RvVLKzEclIfwT4hfERyJaPaNHeUMdFQT5Tx8zMjaSD9ik9xQoD7C/G29ygg2gDTGAek3tGese1AI/eb9ebj+HvdRWC+m2C8rBou8bSK09/aUVuuLwvKcHCO6eqEm6zxMqcCcY7E/EGA81Yh5yIAZIRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708636170; c=relaxed/simple; bh=9fXdVza5W4TGckttMR2jjvZECW0BZ3vgTQy5/Q1KsoQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=t8Q6rBjSUR6pFTcMhU3rXDL6d2K1F0VYSbznq+M1HelhJHroEXEp5DJ7YbCJr9kv6jDX0OLoc7ZJqFgFnKzlCLdOuOmDrezf32R50iA7ZTy1GbDgKs6A1k1+zHLhSXPZk6NLrSoVkEfRWFahza1NITGATeD7eMqsqN0nhdWxjxY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rdGJZ-0000lo-A0; Thu, 22 Feb 2024 22:09:09 +0100 From: Marco Felsch To: gregkh@linuxfoundation.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com, jun.li@nxp.com Cc: devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v3 3/4] usb: typec: tcpm: add support to set tcpc connector orientatition Date: Thu, 22 Feb 2024 22:09:02 +0100 Message-Id: <20240222210903.208901-4-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222210903.208901-1-m.felsch@pengutronix.de> References: <20240222210903.208901-1-m.felsch@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org This adds the support to set the connector orientation value accordingly. This is part of the optional CONFIG_STANDARD_OUTPUT register 0x18, specified within the USB port controller spsicification rev. 2.0 [1]. [1] https://www.usb.org/sites/default/files/documents/usb-port_controller_specification_rev2.0_v1.0_0.pdf Signed-off-by: Marco Felsch --- v3: - no changes v2: - no changes drivers/usb/typec/tcpm/tcpm.c | 6 ++++++ include/linux/usb/tcpm.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 5945e3a2b0f7..85ca26687324 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -1099,6 +1099,12 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached, if (ret < 0) return ret; + if (port->tcpc->set_orientation) { + ret = port->tcpc->set_orientation(port->tcpc, orientation); + if (ret < 0) + return ret; + } + port->pwr_role = role; port->data_role = data; typec_set_data_role(port->typec_port, data); diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index 65fac5e1f317..93b681ff3ef9 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -133,6 +133,8 @@ struct tcpc_dev { enum typec_cc_status *cc2); int (*set_polarity)(struct tcpc_dev *dev, enum typec_cc_polarity polarity); + int (*set_orientation)(struct tcpc_dev *dev, + enum typec_orientation orientation); int (*set_vconn)(struct tcpc_dev *dev, bool on); int (*set_vbus)(struct tcpc_dev *dev, bool on, bool charge); int (*set_current_limit)(struct tcpc_dev *dev, u32 max_ma, u32 mv); -- 2.39.2