From patchwork Thu Feb 22 21:09:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 205061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp212054dyb; Thu, 22 Feb 2024 13:10:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXDhnNzzsLgg1fkilVfGKxZoFuOGOieXbS0jZJ/jsa0+mAPpUj9f1NiWFp2L/qaKt5Nemx4BM1n3WDylWmvMdUqhdpLWg== X-Google-Smtp-Source: AGHT+IG0440cUtuyumWS5sO6CiEBsmY9sAnnboKxsmaCc62VPWzLKYZFHEexqKoVYfK72jY6Ug4z X-Received: by 2002:a2e:9e10:0:b0:2d2:36aa:ed02 with SMTP id e16-20020a2e9e10000000b002d236aaed02mr138308ljk.17.1708636258950; Thu, 22 Feb 2024 13:10:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708636258; cv=pass; d=google.com; s=arc-20160816; b=bEIIlNsuyyZuhzate18VJJI72+jGqZ54M9LKwiL8dQzggGbOoC0ab3EW1zFDXTg1de mcjxhlfkOrLMA/g8oX/SXXSXPxhF3cnayb/r18+T/oS1n1kuXP2T0ZsP7bTBIgmMtiM3 psITAi3nsypow35eGLpGWi4w3JnwKkhuClIR3PlRqVB4FEvbpGNLAFpUbaVhDyf2Pg7F LOCnHsuu1E0l91/Q60r9VGMYAQD0I9lCN3ymtNYpQx87CD6p1BtfT4lNjBYU+noXDGJY tZZ6gZuXGqZjtak21EAEhnZCAk6rLo0UdNtd+dlg8YAUP0gYspfyjrG7v+gLS6mPvyHc RRLw== 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=Pmb0L8lVn+q7+zIBR+9LHDbfDUYmJABE0op8LMhf1oE=; fh=FttDRjnFdpjso3V5tb3WR+hSGsT8UJL4OhhG9l/Cs7o=; b=UWpsmwWOITnHeIILYCMH7X2wcLf4xmn14aipkSElqi+eO4ySO948x5+x6PkZYbp1t5 g2mcpnweVXJmrxyL+Er+hcY9aqorlV/yVOLZglt/eqcDIqzEnPCDK7TMCl3RSfsAbg6F SBm0Hz3njms1I0Y/y3MgF6myxjPiKY+wh62muKq5e8BTSfiRJYl9N8Zb6y0ResWOr0Cj vMhgUP22b2OyO++GZzlhsJt5I+AwWzH3aVSQRS3bk+ZLf/nbhWL3c5m6tw830ZGIupPZ s3gL+kNxePVN81ye2OP2ukCnlgR/rKIj0T3uI3kdI62ugzTUu7JNrmrKPr2tBzPfH//8 +sfw==; 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-77365-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77365-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l26-20020a056402029a00b005642258f88fsi5283812edv.454.2024.02.22.13.10.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:10:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77365-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77365-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77365-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8D2F71F24ADA for ; Thu, 22 Feb 2024 21:10:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 587AF13BACF; Thu, 22 Feb 2024 21:09:33 +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 641EB12D1FE for ; Thu, 22 Feb 2024 21:09:30 +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=1708636171; cv=none; b=azwfbI3KUJT1w1V0/GFIk7mUYHb4gNVT27FGdsbVvbGEPKY53WbGuunf9ASL2PqEqrLjcM9CCZaw2tQ/dfLqLeMSw6Jf7Sc6wdAAAgE3BEB+b9q9O3TGjwIhvgnwcPj9uXCWGII6wzr0+Fm/u2zAp8IZGFcnBeki7STi50bWjEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708636171; c=relaxed/simple; bh=I3EW9Vuk0mnGohws0wZ3vlCFahdWLNd/taLlxlA1rao=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JZ7Yj8By1UjMfM+RiF/lUuhRNY5abICZLaTQUo1HQuRxjxZCfWn4wFRguWHhbguTAMIWTZlbW5A6vSUv6CXiqpowJfO+BaJwtVI4othMhervRb0dBdeqLWibvC6Qn7dL86Kjh4mVXq8QfFzWjARvIL3MmmCi16OtvwjMSWqiIGQ= 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-03; 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 1/4] dt-bindings: usb: typec-tcpci: add tcpci fallback binding Date: Thu, 22 Feb 2024 22:09:00 +0100 Message-Id: <20240222210903.208901-2-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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791634973880842043 X-GMAIL-MSGID: 1791634973880842043 The NXP PTN5110 [1] is an TCPCI [2] compatible chip, so add the fallback binding. [1] https://www.nxp.com/docs/en/data-sheet/PTN5110.pdf [2] https://www.usb.org/sites/default/files/documents/usb-port_controller_specification_rev2.0_v1.0_0.pdf Signed-off-by: Marco Felsch Reviewed-by: Krzysztof Kozlowski --- v3: - use items - adapt example v2: - rephrase commit message Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml b/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml index eaedb4cc6b6c..65a8632b4d9e 100644 --- a/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml +++ b/Documentation/devicetree/bindings/usb/nxp,ptn5110.yaml @@ -11,7 +11,9 @@ maintainers: properties: compatible: - const: nxp,ptn5110 + items: + - const: nxp,ptn5110 + - const: tcpci reg: maxItems: 1 @@ -41,7 +43,7 @@ examples: #size-cells = <0>; tcpci@50 { - compatible = "nxp,ptn5110"; + compatible = "nxp,ptn5110", "tcpci"; reg = <0x50>; interrupt-parent = <&gpio3>; interrupts = <3 IRQ_TYPE_LEVEL_LOW>; From patchwork Thu Feb 22 21:09:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 205062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp212080dyb; Thu, 22 Feb 2024 13:11:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXx0iWDQf4azqH+9OYcM7CBVU8cqBpuq3Ai5GhAF4ZxM/hta9NF/DbqOegzaUqDNKz8AFFFzkadhpU8Ht6HYXQQ1j2bKQ== X-Google-Smtp-Source: AGHT+IH2jfkY0tPnGp5yFG37kDJtw3fXiOmEuG4TYVvrVrmR0Ppfbhat1NY3T7ppUC3AdrLNtmB7 X-Received: by 2002:a17:906:483:b0:a3f:33b5:64dd with SMTP id f3-20020a170906048300b00a3f33b564ddmr14145eja.49.1708636261363; Thu, 22 Feb 2024 13:11:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708636261; cv=pass; d=google.com; s=arc-20160816; b=lf+gM9xlC4HzKeiPrO8RRuKTuAV5mY7BlzPAlV5TIWg9oN3UDd2zWbwUkmPuAos18B bCWXRXaSMrBr/li9UBr002iT0kAHB3BuddIe9tJd5OHG8itn9ge5fbXmq5BBxIds286K gL+rlnqeJwWun4Ke3ErLBE1NqsDZuhNY2SxRxNdgsVjmBKnurTmOBF0T/6SlVpW+cksM OndPILAGX19feHnVyu9RlDANCw5S1YM5nUb3ww3ecL+7L3eXyXjvyWK7VFf0AqkrqT7v tAicYHiRNZMa4kQtb2q8xaepH7bxaEPxyEYuwYdD9v5JCbeKw0w3Vk26hu+GCeut+yUK ZExA== 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=TYzzTWHB8MuJScwbh/51rVPBHWNS7qp7IHKMZre8xSU=; fh=FttDRjnFdpjso3V5tb3WR+hSGsT8UJL4OhhG9l/Cs7o=; b=eGlv6XGZ2KEcxqaLSDHxE/0oyEYwaA7vzWqmyFMqqfw7dHWHDsmlgriP8l3ujezBp0 tubhxqIGJP7VngtnfudJ0lAX5sc2XDF2TdP2Q9RtyirotGLQHWXisRMNARpvDu9Euwo5 4NYb6tySfgZn/8RuriOLzEtHnGA8AYw60Y7IrDdg05de0JF88Zdz8w6Wa+0HvA/sVcDM nDiNmZkK+CF4uLlQ0gD042s+AavpXP9NnQA1UlPX9H9r2WeyRtwijRKco/TiGBN/JlMq MjgrQ1BbQLBlWdhlyXCJrwLly3tBtg0KTBqlKmRdxmIzWQQRxdsDL+hpOn6uW8UYQECq juig==; 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-77366-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77366-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v15-20020a170906180f00b00a3e95937621si3864368eje.449.2024.02.22.13.11.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:11:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77366-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77366-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77366-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id F38601F25916 for ; Thu, 22 Feb 2024 21:11:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A0CF13BAD3; Thu, 22 Feb 2024 21:09:33 +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 641B312D1FD for ; Thu, 22 Feb 2024 21:09:30 +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=1708636171; cv=none; b=ZZKuWqKji+WoZXYL44CPM/kWp3vLbo+1ID/FP/9N2iM6zaS20km2Q/ggpMsJ0XuxKnl02OIGwenMP+5/DJdkVI11Lt+z8lPXc206ArYvZ/07JIgexw9sCME9hRUS6z/2gaJSRH+MxUoY98TRQYbUp48XLEi268TZk0o3YPStugU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708636171; c=relaxed/simple; bh=CP/W/KjoUJAC5u+lS9nh0tLDWDlSc3SWhNf/31pSLlo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ao0GashJ5H8rOnIFloUOx2EjVQJ/g2BHCj9CsAvqeJ3j+g9IUDatYOi9ybjNsttCDoko3oKPpGMx0G2vS4VEZRauA1VsjdoBPLRMX0u50NkqJcoO9zveTKhtjUO4E/QriB5rEMKy5FEUwq5MVt86PkCQBm8TdG4KUErQjOmBRPU= 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-8L; 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 2/4] usb: typec: tcpci: add generic tcpci fallback compatible Date: Thu, 22 Feb 2024 22:09:01 +0100 Message-Id: <20240222210903.208901-3-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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791634976039769157 X-GMAIL-MSGID: 1791634976039769157 The driver already support the tcpci binding for the i2c_device_id so add the support for the of_device_id too. Signed-off-by: Marco Felsch Reviewed-by: Heikki Krogerus --- v3: - no changes v2: - no changes drivers/usb/typec/tcpm/tcpci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 0ee3e6e29bb1..7118551827f6 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -889,6 +889,7 @@ MODULE_DEVICE_TABLE(i2c, tcpci_id); #ifdef CONFIG_OF static const struct of_device_id tcpci_of_match[] = { { .compatible = "nxp,ptn5110", }, + { .compatible = "tcpci", }, {}, }; MODULE_DEVICE_TABLE(of, tcpci_of_match); From patchwork Thu Feb 22 21:09:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 205059 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp212003dyb; Thu, 22 Feb 2024 13:10:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVcI7+fZl+qE5seBxGcPqziRpWPer7M5LjSJq7Xwe7IMwZ8jwmeSRCxIRbwhyE4h0PxC0VPXNZ5rNgnKNm7hsPNSfpTRA== X-Google-Smtp-Source: AGHT+IETmoXG2lN7FmUq2tcLSmYVeMbE2dzSe/gXzQCaYSI9F/eN4wjFuaAq8AYXaiKc4+qwWg+D X-Received: by 2002:a05:6358:9893:b0:17b:602f:24e7 with SMTP id q19-20020a056358989300b0017b602f24e7mr6434052rwa.14.1708636251556; Thu, 22 Feb 2024 13:10:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708636251; cv=pass; d=google.com; s=arc-20160816; b=xSjbq/ck9W4P7/WPlXdRZfh8KzBt1O5PnOWsmB6K6LAuLoy9DuLGSQfpn/RDSbWPMb unzgr3raXOPLeqdKEPVfK4baRFhfXmWL2nPdDF8NbDF6KwjYCIUDd12UZzr/IIkbMN5p 4WZIR3ZeV72DIgMSCKcRiJ8FZLYDqmswKeGLYWrKrK9aiyn5g0RtwVmx3EGd+dougI4P NQKsakmEs1MTW/wjMdq4nrIvco6FDBtwv128ZE7r58Pz/LfUa8j7MTahvWuX3tRVwv7Q LTAwXIMq9rkabG+d1/Pb43rcOMxqcTV3OZXz834mS3JtRfB8XgtDpvYe98KAFPNw1Bu5 3qNw== 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77362-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t24-20020a639558000000b005dc4ec6cd2esi10926378pgn.767.2024.02.22.13.10.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:10:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77362-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77362-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77362-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EEF45286A2F for ; Thu, 22 Feb 2024 21:10:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B00E13790B; Thu, 22 Feb 2024 21:09:32 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791634965931670120 X-GMAIL-MSGID: 1791634965931670120 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 Reviewed-by: Heikki Krogerus --- 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); From patchwork Thu Feb 22 21:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 205060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp212030dyb; Thu, 22 Feb 2024 13:10:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXYVIBPAq6f4Y/dBT1oDhCH10cf1P8UTIcrHGRQZPqzouY34pF4Ijp/0kp9tnLknEIof/1spp2Hrbb7a2LQHtnptfvGDg== X-Google-Smtp-Source: AGHT+IGy796aOOpYV2ENJU0uG1dc5Ek7eDqwsvrCtEqKPIuxlHR1cDPV3a5tF21Sx/rY0jVNajjj X-Received: by 2002:a17:906:6b8c:b0:a3e:eb81:ab62 with SMTP id l12-20020a1709066b8c00b00a3eeb81ab62mr35003ejr.7.1708636256365; Thu, 22 Feb 2024 13:10:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708636256; cv=pass; d=google.com; s=arc-20160816; b=QYTsCX2Sz6KaPHrDc96YV+s2LRWOI+k973QLi8x/5bJr7cz7/khXhbU7pmSu7Rdm4I UBL5pPBVq9jd2gGWNpsLidNwmymTkyU7GZ3wS+U2ryH5x3NbJrfMsJDfbxjHTSK+FqRm H6OXhcaK31GpQHpk0mPZsw51rcwaGdAGcsPiVy8NavpQoKBqSburIkmLDn7USPjFsvFX b/DTVSTD0xrsETfWRnNzOxLVBOqaS23an0lsvMtuPS3MRiKZyr6VDr2fKCtrbHpDW0tz 9ZZQN2c/s5LVgDSe4NMFqu/JEm0H3ASrxLWztfLBuUjW1GshmuI6XalkyD+2g+m7Th0U sD0A== 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=RlhobY1gkRKDOglUXCldn9c3p6zkNSENeHt+0oQAYQ8=; fh=FttDRjnFdpjso3V5tb3WR+hSGsT8UJL4OhhG9l/Cs7o=; b=GCU3Xbd8wz2xgUTvKWpjjdQqZUSAKwXyHHluv7Al8QFDboO/u4HE53veiRxGmS3I9c 3KLuBSHoUejqvFs/my6QLrRcKgkDaldgaG2sWzrptmZaHHYNwY3dn3VIK8rnWhozS3Lb i9lN25rAlO62UPysDz34PA6QoyKcbee7rmNDU1mmaIU+lxazcGT1WLaxCMfRhulZTXoV rEAM+EB0ahB3KLuJrsz8BLClbxLL4C8qN0b3SucAN7gDbZksRBSeTrSdw2rLZe2y0pn0 t/Xbs0RYLxlBcRigsiqo7nbR7EtQ1G2ABKSPfvQXfzWCSqonjhKuihTk9ZRL6hhNNgxR fv8A==; 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-77363-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77363-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j2-20020a170906830200b00a3e6c4f6478si4276058ejx.465.2024.02.22.13.10.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 13:10:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77363-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-77363-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77363-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id C29EC1F23972 for ; Thu, 22 Feb 2024 21:10:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3793313BACA; Thu, 22 Feb 2024 21:09:33 +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 E429073F3D 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=1708636171; cv=none; b=BayNmovntvROCIFQ+fq57izo4jP5WZ9fyhrh7yFQhtNUdRtxgeWcqdcGfpP++Q/rNfFP3rHMv8+IXhtxwfWNNcpK6rAbHqPukfMOQaC8j2gud52L5D0uE2dtx1Wi07Finfz152Z3AHwwrVgJwm8+lTpXG8H8Vzjxdr4BEQGmDz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708636171; c=relaxed/simple; bh=jJBEyKL9gND32kj54k1i3vG+7Q/PclKg2QPivadtkVg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m/K1/9P8WFLs1SrgLxq5b3rG51hMYGCRznaqOtZ59MitgVK9gB4OVYvCQbgyqHoV59QycCGMhifAUOQKc+94H8U/sraWCcuWSq8asK/xJDQmJSJ1kNT+aofiHRRpQeT/VjC2GNcpE10ZtETTN0CdqBVfGi8/7tq72+UIAskalAM= 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-Be; 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 4/4] usb: typec: tcpci: add support to set connector orientation Date: Thu, 22 Feb 2024 22:09:03 +0100 Message-Id: <20240222210903.208901-5-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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791634971511409931 X-GMAIL-MSGID: 1791634971511409931 This add the support to set the optional connector orientation bit which is part of the optional CONFIG_STANDARD_OUTPUT register 0x18 [1]. This allows system designers to connect the tcpc orientation pin directly to the 2:1 ss-mux. [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: - Make use of fallthrough drivers/usb/typec/tcpm/tcpci.c | 44 ++++++++++++++++++++++++++++++++++ include/linux/usb/tcpci.h | 8 +++++++ 2 files changed, 52 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 7118551827f6..73a52e7f95c2 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -67,6 +67,18 @@ static int tcpci_write16(struct tcpci *tcpci, unsigned int reg, u16 val) return regmap_raw_write(tcpci->regmap, reg, &val, sizeof(u16)); } +static bool tcpci_check_std_output_cap(struct regmap *regmap, u8 mask) +{ + unsigned int reg; + int ret; + + ret = regmap_read(regmap, TCPC_STD_OUTPUT_CAP, ®); + if (ret < 0) + return ret; + + return (reg & mask) == mask; +} + static int tcpci_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); @@ -301,6 +313,28 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc, TCPC_TCPC_CTRL_ORIENTATION : 0); } +static int tcpci_set_orientation(struct tcpc_dev *tcpc, + enum typec_orientation orientation) +{ + struct tcpci *tcpci = tcpc_to_tcpci(tcpc); + unsigned int reg; + + switch (orientation) { + case TYPEC_ORIENTATION_NONE: + /* We can't put a single output into high impedance */ + fallthrough; + case TYPEC_ORIENTATION_NORMAL: + reg = TCPC_CONFIG_STD_OUTPUT_ORIENTATION_NORMAL; + break; + case TYPEC_ORIENTATION_REVERSE: + reg = TCPC_CONFIG_STD_OUTPUT_ORIENTATION_FLIPPED; + break; + } + + return regmap_update_bits(tcpci->regmap, TCPC_CONFIG_STD_OUTPUT, + TCPC_CONFIG_STD_OUTPUT_ORIENTATION_MASK, reg); +} + static void tcpci_set_partner_usb_comm_capable(struct tcpc_dev *tcpc, bool capable) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); @@ -808,6 +842,9 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data) if (tcpci->data->vbus_vsafe0v) tcpci->tcpc.is_vbus_vsafe0v = tcpci_is_vbus_vsafe0v; + if (tcpci->data->set_orientation) + tcpci->tcpc.set_orientation = tcpci_set_orientation; + err = tcpci_parse_config(tcpci); if (err < 0) return ERR_PTR(err); @@ -851,6 +888,13 @@ static int tcpci_probe(struct i2c_client *client) if (err < 0) return err; + err = tcpci_check_std_output_cap(chip->data.regmap, + TCPC_STD_OUTPUT_CAP_ORIENTATION); + if (err < 0) + return err; + + chip->data.set_orientation = err; + chip->tcpci = tcpci_register_port(&client->dev, &chip->data); if (IS_ERR(chip->tcpci)) return PTR_ERR(chip->tcpci); diff --git a/include/linux/usb/tcpci.h b/include/linux/usb/tcpci.h index 467e8045e9f8..f2bfb4250366 100644 --- a/include/linux/usb/tcpci.h +++ b/include/linux/usb/tcpci.h @@ -47,6 +47,9 @@ #define TCPC_SINK_FAST_ROLE_SWAP BIT(0) #define TCPC_CONFIG_STD_OUTPUT 0x18 +#define TCPC_CONFIG_STD_OUTPUT_ORIENTATION_MASK BIT(0) +#define TCPC_CONFIG_STD_OUTPUT_ORIENTATION_NORMAL 0 +#define TCPC_CONFIG_STD_OUTPUT_ORIENTATION_FLIPPED 1 #define TCPC_TCPC_CTRL 0x19 #define TCPC_TCPC_CTRL_ORIENTATION BIT(0) @@ -127,6 +130,7 @@ #define TCPC_DEV_CAP_2 0x26 #define TCPC_STD_INPUT_CAP 0x28 #define TCPC_STD_OUTPUT_CAP 0x29 +#define TCPC_STD_OUTPUT_CAP_ORIENTATION BIT(0) #define TCPC_MSG_HDR_INFO 0x2e #define TCPC_MSG_HDR_INFO_DATA_ROLE BIT(3) @@ -198,12 +202,16 @@ struct tcpci; * Chip level drivers are expected to check for contaminant and call * tcpm_clean_port when the port is clean to put the port back into * toggling state. + * @set_orientation: + * Optional; Enable setting the connector orientation + * CONFIG_STANDARD_OUTPUT (0x18) bit0. */ struct tcpci_data { struct regmap *regmap; unsigned char TX_BUF_BYTE_x_hidden:1; unsigned char auto_discharge_disconnect:1; unsigned char vbus_vsafe0v:1; + unsigned char set_orientation:1; int (*init)(struct tcpci *tcpci, struct tcpci_data *data); int (*set_vconn)(struct tcpci *tcpci, struct tcpci_data *data,