Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp723637rdb; Thu, 15 Feb 2024 13:29:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVX8mmdk0qWhSNzK6PE1nYg6DxxxB9P96hKyPFyYAwO4aTm11LbOU0bJCG9GGjHQ9yV7kBp2mV6MUvWg+gsgH+EpiDilUZAtNqtUGL1aA== X-Google-Smtp-Source: AGHT+IF8OBostvUdcFj7bq67HVmdfvhkqAWoECyYTZQZqCdJk2qc0DqH5VTy9CdAKj8Z41YzzSc8 X-Received: by 2002:a0c:f346:0:b0:68c:facf:710a with SMTP id e6-20020a0cf346000000b0068cfacf710amr3425137qvm.53.1708032596866; Thu, 15 Feb 2024 13:29:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708032596; cv=pass; d=google.com; s=arc-20160816; b=JKfS26F2nUF1fRNX2UUXNcmome82jBDKmJD85K7d9UoMpwRDTrnCS9NhI/4k5i+VIz 7L+Ae4P0fvQfrNnGMRiOVTd6AglyAOe2wh0B+apZHELm/gdDw95PlLTx7UzbhU+rfN9h UeRgl6hHTouwFf8aHML7Xy5uOcETQXO+pXoDys+ayIr+EUl8Fc1+8mETU/3rSDzJ7R9L au317dbbSBaBsulFkvm+Pu1qnHcM+jJ3G2xPzyk4qHMZ6X3Bnsko//gP+gr5rB1k9OGC 2yrkx502fPdyB4soTPl7Sy15kSxGvE/cHtqierpd3M8ZlZWv1IXK+lG8WzZoTbImUwTY 57Iw== 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=bBaJtrwXFZNlez11d3GBZEil4iiBlgCT4C8htqodcSs=; fh=/cbLjW7Rfwzb3I2vrEK+NHt6YgOcJ+Bp+XUtKNVrstM=; b=I+2rPGleHoOgGx6ZybiUJGZdlpVBarxRRO41deGmTzjq3pfANLsEwBnaki23Jtxl0S FLsM3dzugkIuEu08NxC0xjXIMCrR5ep/1QQTBeMyrTbJA8e2qNjPB1moBSV0pGv9IQCI GjOF3e+o/dea4Qn29KpSCl7nqEf+K3sTjpthOdVEchdA8krS2i0N9gcGdZCZPkBVpU8F PeH+9N/xrBloUnRPVPJdmZbqwNsTSo9UGqj8HKvjLFzIbDbr0yWveIeG8leJwpU61067 WmreKA0Vu65qfFDmV+KcdyTtymh6auAKql2fk+OvV9rt9LmaSy6l10+sJ9T97AhdfNuV KzUg==; 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-67696-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67696-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 gv15-20020a056214262f00b0068eda269640si2389992qvb.448.2024.02.15.13.29.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 13:29:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67696-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-67696-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67696-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 9BD511C2246E for ; Thu, 15 Feb 2024 21:29:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49732145B06; Thu, 15 Feb 2024 21:29:14 +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 6723A13DB87 for ; Thu, 15 Feb 2024 21:29:12 +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=1708032553; cv=none; b=TsostEogm+Sjpeg5wSRXhv4bWcnhrnkrLRX+1ob7NzjcNVKq9iqJhshdBXjevuJ94ISQS+e1j7UW7KH3vZ258lw9+bJJQqKt1v0rZ0TDQ/7QaVcy1nIoHTXvHn/OE8JHiDtmgvJrEginjGrseOLq2Icgg5TSivjzVEm9pVzih/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708032553; c=relaxed/simple; bh=vck8aRHuxSoYaBFUbbPNie10ullAPmiqdjueyrw4+/c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IWopR9lJNm0RttN7xCGrP6wqQeslnlMzVgxkObuAR84DPRcM/BfUXQJzwwkG6ZAeLPqr1H2OHu0qD4aHdJZTRIf2kXngP7LNTJNcdhvT2J5ybn0nOlonZMJhyTjI9xRGgzkDyGJrJ5HrElj0lkQbvZGCKbcYRY89K22vM/xPwNs= 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 1rajHr-0001xh-IV; Thu, 15 Feb 2024 22:28:55 +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: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 3/4] usb: typec: tcpm: add support to set tcpc connector orientatition Date: Thu, 15 Feb 2024 22:28:51 +0100 Message-Id: <20240215212852.1202339-4-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215212852.1202339-1-m.felsch@pengutronix.de> References: <20240215212852.1202339-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 --- 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