From patchwork Fri Aug 28 10:30:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChiYuan Huang X-Patchwork-Id: 11742549 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D97D6739 for ; Fri, 28 Aug 2020 10:30:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D60F208CA for ; Fri, 28 Aug 2020 10:30:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tOBZyKUf"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mtyvLnyB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D60F208CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=jjxEdxQkbZ4raO31M62CI2bN/Ansxb+gpJNv+CJ97CA=; b=tOBZyKUfFiNHeji4Bv2zjKc28A l8rmtv+X1zHEF78Ohd6ufDJxI/LNTELMfs5gbytNanc9mzABo0VRg+G989+RHKCe+yeJ+aHqbbRaI TL8PIRO+TRg9wj3dslTi1lQFNl9WwJYLFew4TQdeeK1gOnNvVHDq+dk29wJLjhVVnnIelCXPmvA57 SFNwFCfKuSHhRtjY9ScUhKeuMA51DSw2OncI8M/Eg/1DE1JVYiW3RGUgOt4J6MCF/MWT0nvKC1EZB rkrwNkMa6OX94CRP/3Z7gurQ3c+Qk1W5iZM2EvoBEy69/QgWUtixi5rlr+w4BZbnLNo9HKPibB9oD Fpc5Rxrg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBbem-0006lF-SZ; Fri, 28 Aug 2020 10:30:52 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBbei-0006jo-Kp; Fri, 28 Aug 2020 10:30:49 +0000 Received: by mail-pj1-x1042.google.com with SMTP id kx11so318011pjb.5; Fri, 28 Aug 2020 03:30:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=1blY7YfGL0S6/Fm0+4EefdWU7VjP/MGYuIEnLDJEdiM=; b=mtyvLnyB0S2MLhw7bMIsbcOMDqRhBeNYqTBVOSYMzPH643hAagrkvNyHSq31/NLv2e Jh68hUrShI3zzVSnMaLLqjub+qGy/HO2PLgvGmW7g1yMlzkWJ13K1wtBGxy4fCL7j1vl cYkPNw5BcY7cJhR6coKJg6PtF08fVmJ2O4+L54Uunnjgp1AIiP2XtsTuauUeO3IuH9WY kfzduMkWow9ANp8spyjjfG6qpgnLra2xcFcq+hyYySNobiIoxarMUUewbaMO1sxCyuPe rTSbHesbEA7a1II6yaAntSsXacEJkX0mdIwA5exWhfeHEqB7BNXIEPh9iggxTkajBaj+ 7DJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1blY7YfGL0S6/Fm0+4EefdWU7VjP/MGYuIEnLDJEdiM=; b=lIGgP8wtTHYlpoITaDi2GTp4FW/6CnAWnb0gcpLk+0hOXpKBWvkC7zFrH/eDvIkNQx MSNjd+nRvSNqxdq+/DacQXbwuyS43aBX5KVTT/FfgNRidf/plcR8DL6gCs54HJSWsVTI lUr6BubTwgTJzpYL2/UgD2JvZsnaoRB5mGLJNnrpS5rKRk0LlTAtPjn8ZmpiWvAU4l73 Ut05xrFZGcTtf05XO+3iF62sOk8N0vIXIkZUN2QLqPb1nRqo+Fv26kP1/TA12i4Q75G7 7hRx0UCKSq34Di+ArQ9mNsC6Zec/ldjqahKQPwrv27RvoefwEKu7vEiUDS4ZwZZh1J43 7hbA== X-Gm-Message-State: AOAM5307OkljTj+45X2aEyEMhfPS6tORwaejcn0dfnWWJBePgS/dOIEA 7BxY6aZVC1yveuRjfq94K3c= X-Google-Smtp-Source: ABdhPJyOUEwRIh0rwjUPxAxlMlOZq/JiZAPdLrfJCtTkHUmzoBuxtkKOTuUE0O+Of6Xpr4mDJXG2Fw== X-Received: by 2002:a17:902:7044:: with SMTP id h4mr797256plt.78.1598610645703; Fri, 28 Aug 2020 03:30:45 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:46a:912:790c:5a03:60b5:8987]) by smtp.gmail.com with ESMTPSA id g25sm1232224pfk.37.2020.08.28.03.30.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2020 03:30:44 -0700 (PDT) From: cy_huang To: gregkh@linuxfoundation.org, robh+dt@kernel.org, matthias.bgg@gmail.com, linux@roeck-us.net, heikki.krogerus@linux.intel.com Subject: [PATCH v4 1/2] usb typec: mt6360: Add support for mt6360 Type-C driver Date: Fri, 28 Aug 2020 18:30:35 +0800 Message-Id: <1598610636-4939-1-git-send-email-u0084500@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200828_063048_727327_ED12BE0D X-CRM114-Status: GOOD ( 25.04 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [u0084500[at]gmail.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [u0084500[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gene_chen@richtek.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, cy_huang@richtek.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: ChiYuan Huang Mediatek MT6360 is a multi-functional IC that includes USB Type-C. It works with Type-C Port Controller Manager to provide USB PD and USB Type-C functionalities. Signed-off-by: ChiYuan Huang Reviewed-by: Guenter Roeck --- v2 1. Add fix to Prevent the race condition from interrupt and tcpci port unregister during module remove. v3 1. Change comment style for the head of source code. 2. No need to print error for platform_get_irq_byname. 3. Fix tcpci_register_port check from IS_ERR_OR_NULL to IS_ERR. 4. Rename driver/Kconfig/Makefile form mt6360 to mt636x. 5. Rename DT binding documents from mt6360 to mt636x. v4 1. revert v3 item 4 for mt636x patch in driver/Kconfig/Makefile 2. revert v3 item 5 for mt636x DT binding document. added the mark line after changelog ended. --- drivers/usb/typec/tcpm/Kconfig | 8 ++ drivers/usb/typec/tcpm/Makefile | 1 + drivers/usb/typec/tcpm/tcpci_mt6360.c | 212 ++++++++++++++++++++++++++++++++++ 3 files changed, 221 insertions(+) create mode 100644 drivers/usb/typec/tcpm/tcpci_mt6360.c diff --git a/drivers/usb/typec/tcpm/Kconfig b/drivers/usb/typec/tcpm/Kconfig index fa3f393..58a64e1 100644 --- a/drivers/usb/typec/tcpm/Kconfig +++ b/drivers/usb/typec/tcpm/Kconfig @@ -27,6 +27,14 @@ config TYPEC_RT1711H Type-C Port Controller Manager to provide USB PD and USB Type-C functionalities. +config TYPEC_MT6360 + tristate "Mediatek MT6360 Type-C driver" + depends on MFD_MT6360 + help + Mediatek MT6360 is a multi-functional IC that includes + USB Type-C. It works with Type-C Port Controller Manager + to provide USB PD and USB Type-C functionalities. + endif # TYPEC_TCPCI config TYPEC_FUSB302 diff --git a/drivers/usb/typec/tcpm/Makefile b/drivers/usb/typec/tcpm/Makefile index a5ff6c8..7592ccb 100644 --- a/drivers/usb/typec/tcpm/Makefile +++ b/drivers/usb/typec/tcpm/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_TYPEC_WCOVE) += typec_wcove.o typec_wcove-y := wcove.o obj-$(CONFIG_TYPEC_TCPCI) += tcpci.o obj-$(CONFIG_TYPEC_RT1711H) += tcpci_rt1711h.o +obj-$(CONFIG_TYPEC_MT6360) += tcpci_mt6360.o diff --git a/drivers/usb/typec/tcpm/tcpci_mt6360.c b/drivers/usb/typec/tcpm/tcpci_mt6360.c new file mode 100644 index 00000000..f1bd9e0 --- /dev/null +++ b/drivers/usb/typec/tcpm/tcpci_mt6360.c @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2020 MediaTek Inc. + * + * Author: ChiYuan Huang + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "tcpci.h" + +#define MT6360_REG_VCONNCTRL1 0x8C +#define MT6360_REG_MODECTRL2 0x8F +#define MT6360_REG_SWRESET 0xA0 +#define MT6360_REG_DEBCTRL1 0xA1 +#define MT6360_REG_DRPCTRL1 0xA2 +#define MT6360_REG_DRPCTRL2 0xA3 +#define MT6360_REG_I2CTORST 0xBF +#define MT6360_REG_RXCTRL2 0xCF +#define MT6360_REG_CTDCTRL2 0xEC + +/* MT6360_REG_VCONNCTRL1 */ +#define MT6360_VCONNCL_ENABLE BIT(0) +/* MT6360_REG_RXCTRL2 */ +#define MT6360_OPEN40M_ENABLE BIT(7) +/* MT6360_REG_CTDCTRL2 */ +#define MT6360_RPONESHOT_ENABLE BIT(6) + +struct mt6360_tcpc_info { + struct tcpci_data tdata; + struct tcpci *tcpci; + struct device *dev; + int irq; +}; + +static inline int mt6360_tcpc_read16(struct regmap *regmap, + unsigned int reg, u16 *val) +{ + return regmap_raw_read(regmap, reg, val, sizeof(u16)); +} + +static inline int mt6360_tcpc_write16(struct regmap *regmap, + unsigned int reg, u16 val) +{ + return regmap_raw_write(regmap, reg, &val, sizeof(u16)); +} + +static int mt6360_tcpc_init(struct tcpci *tcpci, struct tcpci_data *tdata) +{ + struct regmap *regmap = tdata->regmap; + int ret; + + ret = regmap_write(regmap, MT6360_REG_SWRESET, 0x01); + if (ret) + return ret; + + /* after reset command, wait 1~2ms to wait IC action */ + usleep_range(1000, 2000); + + /* write all alert to masked */ + ret = mt6360_tcpc_write16(regmap, TCPC_ALERT_MASK, 0); + if (ret) + return ret; + + /* config I2C timeout reset enable , and timeout to 200ms */ + ret = regmap_write(regmap, MT6360_REG_I2CTORST, 0x8F); + if (ret) + return ret; + + /* config CC Detect Debounce : 26.7*val us */ + ret = regmap_write(regmap, MT6360_REG_DEBCTRL1, 0x10); + if (ret) + return ret; + + /* DRP Toggle Cycle : 51.2 + 6.4*val ms */ + ret = regmap_write(regmap, MT6360_REG_DRPCTRL1, 4); + if (ret) + return ret; + + /* DRP Duyt Ctrl : dcSRC: /1024 */ + ret = mt6360_tcpc_write16(regmap, MT6360_REG_DRPCTRL2, 330); + if (ret) + return ret; + + /* Enable VCONN Current Limit function */ + ret = regmap_update_bits(regmap, MT6360_REG_VCONNCTRL1, MT6360_VCONNCL_ENABLE, + MT6360_VCONNCL_ENABLE); + if (ret) + return ret; + + /* Enable cc open 40ms when pmic send vsysuv signal */ + ret = regmap_update_bits(regmap, MT6360_REG_RXCTRL2, MT6360_OPEN40M_ENABLE, + MT6360_OPEN40M_ENABLE); + if (ret) + return ret; + + /* Enable Rpdet oneshot detection */ + ret = regmap_update_bits(regmap, MT6360_REG_CTDCTRL2, MT6360_RPONESHOT_ENABLE, + MT6360_RPONESHOT_ENABLE); + if (ret) + return ret; + + /* Set shipping mode off, AUTOIDLE on */ + return regmap_write(regmap, MT6360_REG_MODECTRL2, 0x7A); +} + +static irqreturn_t mt6360_irq(int irq, void *dev_id) +{ + struct mt6360_tcpc_info *mti = dev_id; + + return tcpci_irq(mti->tcpci); +} + +static int mt6360_tcpc_probe(struct platform_device *pdev) +{ + struct mt6360_tcpc_info *mti; + int ret; + + mti = devm_kzalloc(&pdev->dev, sizeof(*mti), GFP_KERNEL); + if (!mti) + return -ENOMEM; + + mti->dev = &pdev->dev; + + mti->tdata.regmap = dev_get_regmap(pdev->dev.parent, NULL); + if (!mti->tdata.regmap) { + dev_err(&pdev->dev, "Failed to get parent regmap\n"); + return -ENODEV; + } + + mti->irq = platform_get_irq_byname(pdev, "PD_IRQB"); + if (mti->irq < 0) + return mti->irq; + + mti->tdata.init = mt6360_tcpc_init; + mti->tcpci = tcpci_register_port(&pdev->dev, &mti->tdata); + if (IS_ERR(mti->tcpci)) { + dev_err(&pdev->dev, "Failed to register tcpci port\n"); + return PTR_ERR(mti->tcpci); + } + + ret = devm_request_threaded_irq(mti->dev, mti->irq, NULL, mt6360_irq, IRQF_ONESHOT, + dev_name(&pdev->dev), mti); + if (ret) { + dev_err(mti->dev, "Failed to register irq\n"); + tcpci_unregister_port(mti->tcpci); + return ret; + } + + device_init_wakeup(&pdev->dev, true); + platform_set_drvdata(pdev, mti); + + return 0; +} + +static int mt6360_tcpc_remove(struct platform_device *pdev) +{ + struct mt6360_tcpc_info *mti = platform_get_drvdata(pdev); + + disable_irq(mti->irq); + tcpci_unregister_port(mti->tcpci); + return 0; +} + +static int __maybe_unused mt6360_tcpc_suspend(struct device *dev) +{ + struct mt6360_tcpc_info *mti = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + enable_irq_wake(mti->irq); + + return 0; +} + +static int __maybe_unused mt6360_tcpc_resume(struct device *dev) +{ + struct mt6360_tcpc_info *mti = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + disable_irq_wake(mti->irq); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(mt6360_tcpc_pm_ops, mt6360_tcpc_suspend, mt6360_tcpc_resume); + +static const struct of_device_id __maybe_unused mt6360_tcpc_of_id[] = { + { .compatible = "mediatek,mt6360-tcpc", }, + {}, +}; +MODULE_DEVICE_TABLE(of, mt6360_tcpc_of_id); + +static struct platform_driver mt6360_tcpc_driver = { + .driver = { + .name = "mt6360-tcpc", + .pm = &mt6360_tcpc_pm_ops, + .of_match_table = mt6360_tcpc_of_id, + }, + .probe = mt6360_tcpc_probe, + .remove = mt6360_tcpc_remove, +}; +module_platform_driver(mt6360_tcpc_driver); + +MODULE_AUTHOR("ChiYuan Huang "); +MODULE_DESCRIPTION("MT6360 USB Type-C Port Controller Interface Driver"); +MODULE_LICENSE("GPL v2"); From patchwork Fri Aug 28 10:30:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ChiYuan Huang X-Patchwork-Id: 11742553 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2497516B1 for ; Fri, 28 Aug 2020 10:31:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F06B2208CA for ; Fri, 28 Aug 2020 10:31:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QRvpkoSm"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jSBYefrA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F06B2208CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=22TmyOdbAhMo6amuqY/fJLQai86YdhkJlzUgkYq6U4Q=; b=QRvpkoSma/rF9S7mfkV6AqLXva VNGW+q6qK1UmN8KTVg695anEYulv8Hi1qB/0SHMIimd4MuFO2DbkMGRDGRyizPuG3F59DoHIpS9Fq 7F7Z66tMoR3sSd+iEszl63esk630cR150BOx7ChWiRzV2oeCkEO+3b3HFBbM1ZtCdzilniCn/wd2t nQPwE2f4JxunyRmSRVAs0Jb8CclCKGcY1T43uyhvdH2IRMS1QmryPr+NESZTigojth822wLYTpsIn 2Nn+ZqH/e1Jt9fxx6WwNkfd286DxwQO8tfTcGdvdXcsGJuFUMs/wCy3+Aa7MFivHrpe7TpMJTK0Hf v7RE+QFQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBbew-0006ng-Tn; Fri, 28 Aug 2020 10:31:02 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBbem-0006kl-Ay; Fri, 28 Aug 2020 10:30:53 +0000 Received: by mail-pg1-x541.google.com with SMTP id l191so256555pgd.5; Fri, 28 Aug 2020 03:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=htXOCVPrq8HdJeur07eO9bXCbnwDHC4OtbEI9rP9Tn4=; b=jSBYefrAZXpv+3xnFQAVI3JPtpbLw5e930QLjDyJDlEkHKYU2qNN12+NjMaQQzrdhQ fdX6N3fidTAAbijg9JQiMFWxIUcc3HVVueSN6wzz9SPfw4uiExWh6sznbWhsU/Fcu3KM R20xoHhTwxxlJ0aX2p8ly+aJYWVGThFICBRCqj/xEspdxM8KdfNk92AIRQZ9NmydSJ81 dOtxXTo9mkC3FY+NqlDGvv/ePYMpgKGMukDsFJJxYTSCPYdjbK0P1gk9DCCzj3Vnzd98 O5zhLjChK8mr5lIrUoXUs9vrpIdA/M94HcRFLeLMaEfA7MimARXiG7Z11228tIuv2kNr 1reQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=htXOCVPrq8HdJeur07eO9bXCbnwDHC4OtbEI9rP9Tn4=; b=PMoYZxp8AHtbKh6b2renZrPsACIIvkpOQkgRnvxiRRtetOtuvxpq26r1Jblbj+rDDm kM8B1oG7CZmYzdkaSCYmARXX6yL2fCdX+4bJooCjNu+BPagpxLfTNEI4/UCdQ5gziXR1 qMSw6wpzchHSiAj6OQNPqR/vq7uKUO3exgmks3RdXw3Eh5HwvNvifD587xfcJIEn34ZA iH7XzF3ldR18jI5tFZs2GRjcN2TJlRPCZdIMJImGSqrjBV7T2lwCUtPwVpmDaxiaK2Ox OBAqUx9vJqGQkFCBbofl8h87Xn9IdRRU8Crbh2exV4w2Qjx1NM8q1m7qE23TSoIOqoP6 5uOA== X-Gm-Message-State: AOAM532urAogDRUO4oYs6HGse4EhSR16Fz8gE1M4ycv0WlWL0N9pcL87 LaxPwhKlDJfd668uoNcolL8= X-Google-Smtp-Source: ABdhPJzAikASnfF5fhZ0b1hQfPKicQB/myOGamaEIpzFEbCmIe0pEQH3qzKz0PISqby+vMHZzrUaeQ== X-Received: by 2002:a62:4ed4:: with SMTP id c203mr688174pfb.151.1598610649951; Fri, 28 Aug 2020 03:30:49 -0700 (PDT) Received: from localhost.localdomain ([2402:7500:46a:912:790c:5a03:60b5:8987]) by smtp.gmail.com with ESMTPSA id g25sm1232224pfk.37.2020.08.28.03.30.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Aug 2020 03:30:49 -0700 (PDT) From: cy_huang To: gregkh@linuxfoundation.org, robh+dt@kernel.org, matthias.bgg@gmail.com, linux@roeck-us.net, heikki.krogerus@linux.intel.com Subject: [PATCH v4 2/2] usb typec: mt6360: Add MT6360 Type-C DT binding documentation Date: Fri, 28 Aug 2020 18:30:36 +0800 Message-Id: <1598610636-4939-2-git-send-email-u0084500@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1598610636-4939-1-git-send-email-u0084500@gmail.com> References: <1598610636-4939-1-git-send-email-u0084500@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200828_063052_412193_FE949F9D X-CRM114-Status: GOOD ( 15.39 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [u0084500[at]gmail.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [u0084500[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gene_chen@richtek.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, cy_huang@richtek.com, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org From: ChiYuan Huang Add a devicetree binding documentation for the MT6360 Type-C driver. usb typec: mt6360: Rename DT binding doument from mt6360 to mt636x Signed-off-by: ChiYuan Huang --- .../bindings/usb/mediatek,mt6360-tcpc.yaml | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.yaml diff --git a/Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.yaml b/Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.yaml new file mode 100644 index 00000000..9e8ab0d --- /dev/null +++ b/Documentation/devicetree/bindings/usb/mediatek,mt6360-tcpc.yaml @@ -0,0 +1,73 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/usb/mediatek,mt6360-tcpc.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Mediatek MT6360 Type-C Port Switch and Power Delivery controller DT bindings + +maintainers: + - ChiYuan Huang + +description: | + Mediatek MT6360 is a multi-functional device. It integrates charger, ADC, flash, RGB indicators, + regulators (BUCKs/LDOs), and TypeC Port Switch with Power Delivery controller. + This document only describes MT6360 Type-C Port Switch and Power Delivery controller. + +properties: + compatible: + enum: + - mediatek,mt6360-tcpc + + interrupts-extended: + maxItems: 1 + + interrupt-names: + items: + - const: PD_IRQB + +patternProperties: + "connector": + type: object + $ref: ../connector/usb-connector.yaml# + description: + Properties for usb c connector. + +additionalProperties: false + +required: + - compatible + - interrupts-extended + - interrupt-names + +examples: + - | + #include + #include + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + mt6360@34 { + compatible = "mediatek,mt6360"; + reg = <0x34>; + + tcpc { + compatible = "mediatek,mt6360-tcpc"; + interrupts-extended = <&gpio26 3 IRQ_TYPE_LEVEL_LOW>; + interrupt-names = "PD_IRQB"; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "dual"; + try-power-role = "sink"; + source-pdos = ; + sink-pdos = ; + op-sink-microwatt = <10000000>; + }; + }; + }; + }; +...