From patchwork Thu May 27 07:55:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12283665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03DEAC47089 for ; Thu, 27 May 2021 07:58:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B68DC613E2 for ; Thu, 27 May 2021 07:58:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B68DC613E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=62oilLoo0auSBV5KcZTyY1J/yqQLPd+G6+mFlVxt6yE=; b=1WstYpIz8r4kAJ ui1byrEJpBHMFkD4h7uCfoc04AI+69fRdc0x/fW42AfcxNwM0VKVS4S1zuobxLvo/LoxSVIC3QH6V iRsubemyAV/kTnoWFidlgWPgInZoq3B/4lEx1wBCq3/EDgs+rWmQzBopVi+PzOyV9K7qF12j4JhtY C3khE0KjthZ4HK1lIVYgk0wYh1L3C2xjE6P9+gNqpg1ffMjujK6W6lCy0N+PDPf5gSSK/9UgMnmNd cIIDF7LKep4xVIVWtwItbF+wEDZ60g0MX7kXiz2tR9NWQh1bVUDzceBB9gD7uUD4AtZ4x2X1QYm2G 4ZHhk5IGCIpIRx3zQbqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAua-003a6U-FI; Thu, 27 May 2021 07:58:36 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAs9-003YZt-Og for linux-mediatek@lists.infradead.org; Thu, 27 May 2021 07:56:08 +0000 Received: by mail-pj1-x1031.google.com with SMTP id kr9so2268622pjb.5 for ; Thu, 27 May 2021 00:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VZUPXREZ1PjKj1d2Hxat9QQw1N2e9nbL6sFWBfS1Vpw=; b=HhR2Z+UR/b0SShfqRiDIqIeE9XVO40D7x12Ut0QL5fW0cu5OdPFV9MLpkYra2tKOeG SZMsmj2c++8KLKom7kTzirRKt2eHGZbxXvFJrFmUTZdB+sfx/I7LEIPg+5LQKFXgPZax SotQId1UeMa8u1Kppg+8CkVd/TwF+ppbFN3aM= 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:mime-version:content-transfer-encoding; bh=VZUPXREZ1PjKj1d2Hxat9QQw1N2e9nbL6sFWBfS1Vpw=; b=qv21wc+oBUPLlH/Vy9DBLOMSeLT9KZangTtKiJkJ3v6ivAAbr3Uti7EzIhkICJctWt QaFY4fKOzVDzhxGRHnt3MbekEEGFQGzGTRHqqqtNbFyKXrBFEYVSvIG5xVO3oy2ci4K9 2pTh2lQ1J8N+27Jkgcqq7vzFayNsAbFkOsvYmDpQFKMXP5s/w35I4cSe2qLHfq8ZkCij AJoGn70YtG9893JKJpXhu6uYEkevsgRmlhm27YsAenbrktahcOXedLlY8fdptXUaHjF2 GGPkUdY7N3R7ArwFzbjhsLXOEJzTNhSiIVNWOtWebTJf33uISVh8Zmn6pQX9nEQ/szTV lfcA== X-Gm-Message-State: AOAM5325OF+5LzwLAHRnro7gORZ0IvpShgRxpLasfuQ6pXIoHzXbVvNo fUxlEzsqKsvaexB8rFx0vyb/DA== X-Google-Smtp-Source: ABdhPJxYw0z3kukLLrhghFssV8w/BNkceyOm52LUGmCWpWzA9BjLVtbW2650pT5No76FyoGwTVw5+g== X-Received: by 2002:a17:90a:7bcc:: with SMTP id d12mr8385514pjl.230.1622102164520; Thu, 27 May 2021 00:56:04 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ece5:55a4:6ad3:d20f]) by smtp.gmail.com with ESMTPSA id 69sm1217790pfx.115.2021.05.27.00.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 00:56:04 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , Jean Delvare , Rob Herring , Bartosz Golaszewski Cc: linux-i2c@vger.kernel.org, Qii Wang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Mark Brown , Marek Szyprowski , Bibby Hsieh , Arnd Bergmann Subject: [PATCH v21 RESEND 1/4] i2c: core: support bus regulator controlling in adapter Date: Thu, 27 May 2021 15:55:53 +0800 Message-Id: <20210527075556.1709140-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210527075556.1709140-1-hsinyi@chromium.org> References: <20210527075556.1709140-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_005605_840781_1D122BDC X-CRM114-Status: GOOD ( 19.37 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Bibby Hsieh Although in the most platforms, the bus power of i2c are alway on, some platforms disable the i2c bus power in order to meet low power request. We can control bulk regulator if it is provided in i2c adapter device. Signed-off-by: Bibby Hsieh Signed-off-by: Marek Szyprowski Signed-off-by: Hsin-Yi Wang Reviewed-by: Matthias Brugger --- drivers/i2c/i2c-core-base.c | 95 +++++++++++++++++++++++++++++++++++++ include/linux/i2c.h | 2 + 2 files changed, 97 insertions(+) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index 5a97e4a02fa2..23bc7c269184 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -461,12 +461,14 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client) static int i2c_device_probe(struct device *dev) { struct i2c_client *client = i2c_verify_client(dev); + struct i2c_adapter *adap; struct i2c_driver *driver; int status; if (!client) return 0; + adap = client->adapter; client->irq = client->init_irq; if (!client->irq) { @@ -532,6 +534,14 @@ static int i2c_device_probe(struct device *dev) dev_dbg(dev, "probe\n"); + if (adap->bus_regulator) { + status = regulator_enable(adap->bus_regulator); + if (status < 0) { + dev_err(&adap->dev, "Failed to enable bus regulator\n"); + goto err_clear_wakeup_irq; + } + } + status = of_clk_set_defaults(dev->of_node, false); if (status < 0) goto err_clear_wakeup_irq; @@ -589,8 +599,10 @@ static int i2c_device_probe(struct device *dev) static int i2c_device_remove(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + struct i2c_adapter *adap; struct i2c_driver *driver; + adap = client->adapter; driver = to_i2c_driver(dev->driver); if (driver->remove) { int status; @@ -605,6 +617,8 @@ static int i2c_device_remove(struct device *dev) devres_release_group(&client->dev, client->devres_group_id); dev_pm_domain_detach(&client->dev, true); + if (!pm_runtime_status_suspended(&client->dev) && adap->bus_regulator) + regulator_disable(adap->bus_regulator); dev_pm_clear_wake_irq(&client->dev); device_init_wakeup(&client->dev, false); @@ -617,6 +631,86 @@ static int i2c_device_remove(struct device *dev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int i2c_resume_early(struct device *dev) +{ + struct i2c_client *client = i2c_verify_client(dev); + int err; + + if (!client) + return 0; + + if (pm_runtime_status_suspended(&client->dev) && + client->adapter->bus_regulator) { + err = regulator_enable(client->adapter->bus_regulator); + if (err) + return err; + } + + return pm_generic_resume_early(&client->dev); +} + +static int i2c_suspend_late(struct device *dev) +{ + struct i2c_client *client = i2c_verify_client(dev); + int err; + + if (!client) + return 0; + + err = pm_generic_suspend_late(&client->dev); + if (err) + return err; + + if (!pm_runtime_status_suspended(&client->dev) && + client->adapter->bus_regulator) + return regulator_disable(client->adapter->bus_regulator); + + return 0; +} +#endif + +#ifdef CONFIG_PM +static int i2c_runtime_resume(struct device *dev) +{ + struct i2c_client *client = i2c_verify_client(dev); + int err; + + if (!client) + return 0; + + if (client->adapter->bus_regulator) { + err = regulator_enable(client->adapter->bus_regulator); + if (err) + return err; + } + + return pm_generic_runtime_resume(&client->dev); +} + +static int i2c_runtime_suspend(struct device *dev) +{ + struct i2c_client *client = i2c_verify_client(dev); + int err; + + if (!client) + return 0; + + err = pm_generic_runtime_suspend(&client->dev); + if (err) + return err; + + if (client->adapter->bus_regulator) + return regulator_disable(client->adapter->bus_regulator); + return 0; +} +#endif + +static const struct dev_pm_ops i2c_device_pm = { + SET_LATE_SYSTEM_SLEEP_PM_OPS(i2c_suspend_late, i2c_resume_early) + SET_RUNTIME_PM_OPS(i2c_runtime_suspend, i2c_runtime_resume, NULL) +}; + static void i2c_device_shutdown(struct device *dev) { struct i2c_client *client = i2c_verify_client(dev); @@ -674,6 +768,7 @@ struct bus_type i2c_bus_type = { .probe = i2c_device_probe, .remove = i2c_device_remove, .shutdown = i2c_device_shutdown, + .pm = &i2c_device_pm, }; EXPORT_SYMBOL_GPL(i2c_bus_type); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index e8f2ac8c9c3d..953a4eecb88f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -15,6 +15,7 @@ #include /* for struct device */ #include /* for completion */ #include +#include #include #include /* for Host Notify IRQ */ #include /* for struct device_node */ @@ -729,6 +730,7 @@ struct i2c_adapter { const struct i2c_adapter_quirks *quirks; struct irq_domain *host_notify_domain; + struct regulator *bus_regulator; }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) From patchwork Thu May 27 07:55:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12283667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6397AC47089 for ; Thu, 27 May 2021 07:58:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 278C8613F4 for ; Thu, 27 May 2021 07:58:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 278C8613F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Nr6OYPZxCasruUxNMTKEyx1pFYQh4KMBeAPC+B2xNk4=; b=UCTYFpFUuXhpmY T3mtYOs0W/moHca9fGC6fn0O8qu/SEJWZI+LkGbovtiYGEXd8ZyLpObChsDGW8GSK7u3ByTh3A5xw m/9NWYG1sfxN6vs9bgrym/w8j48HIpFy04k9UN/Ec7hYOjl20JSFOX5sX9O5mYbBfttW3Ld+3evG8 YJRExyLb3pFolgzYbXSJnuDH1A3MRSL40N7gYtG0CVzznqcMQBKfmLnbbnHHNlv8z7mX+7FBPiMPi U/nQBro0jDLJdJjZr/6n5rbSvdiJQkoPOdtQ2p088zqjcR8sR2Eai8x8amP2drD70eCS4bVsjJwi4 xkClvsiEN8Ky98pNN1+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAuc-003a7t-Ht; Thu, 27 May 2021 07:58:38 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAsC-003Ybi-Ga for linux-mediatek@lists.infradead.org; Thu, 27 May 2021 07:56:09 +0000 Received: by mail-pf1-x42a.google.com with SMTP id x18so3014017pfi.9 for ; Thu, 27 May 2021 00:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MM8kzddH0ZuV0BgZsD6j/UZqR+lPZQliP2/mR7NqPNQ=; b=FnkqpDhRWtVgo98ZZzaFBu0d9tAx5+WqDrox/kScBtBSg+ZPgbBqYUf9050eZhoYqC UxGHrsorZlaYjWFhpa9O9UVUWJR+/gKBTBev+95L8cN9hHHLRsrhh4Si8ZNLnxiB2Swc HqOS4zXE1l3gZveClF6Zwx6TCcY7Aaf5ExlkY= 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:mime-version:content-transfer-encoding; bh=MM8kzddH0ZuV0BgZsD6j/UZqR+lPZQliP2/mR7NqPNQ=; b=SAUuHNNvstmDn7FXXMGLOwiPXmdtUUSBX6Y4dEL/6OOIQKJ0vOL3A7YxdcAGy6P5wO 2d9piDE6Xpamdasuwg3Ns8ruV31s3ITsqopAOaVcXFa0HcTdW0z07rTnA+Gf2vH0Kres Lyz2lrsVCcykcvtiGB1YHWgb62UUNvCONyhUlKVHZDUTBcj4fcdy3rF9gu0Htag/jYrn EXF2T/r3wSef1EprGTckOPkLzUNUVexIJHRkQXBY3CtdUQJsTUb37aX0KPQ/S09GTmiH ct7XltAY0JwjmmnKSyaXPBXWvd/vktAHK7vRSHs2+/B6ftVFUf22L9d8Xg80uBncNm+O rmdQ== X-Gm-Message-State: AOAM532PGll4dAL0xLWrh/8bHNcaETMSTZiQh0vlUJveXQBG3zmqkc57 El+qqSCElmCfBYQKJbuHUXGAgs7y5cVk4A== X-Google-Smtp-Source: ABdhPJyOChGktKvovO4oemHNBggRkAwTN52ULnjVngUsAWsrKKPIL7V1slxR+WXS+Ib+L6oEWikEHA== X-Received: by 2002:a63:1260:: with SMTP id 32mr2593858pgs.232.1622102167325; Thu, 27 May 2021 00:56:07 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ece5:55a4:6ad3:d20f]) by smtp.gmail.com with ESMTPSA id 69sm1217790pfx.115.2021.05.27.00.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 00:56:07 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , Jean Delvare , Rob Herring , Bartosz Golaszewski Cc: linux-i2c@vger.kernel.org, Qii Wang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Mark Brown , Marek Szyprowski , Bibby Hsieh , Arnd Bergmann Subject: [PATCH v21 RESEND 2/4] dt-binding: i2c: mt65xx: add vbus-supply property Date: Thu, 27 May 2021 15:55:54 +0800 Message-Id: <20210527075556.1709140-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210527075556.1709140-1-hsinyi@chromium.org> References: <20210527075556.1709140-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_005608_572429_A1E199C8 X-CRM114-Status: GOOD ( 10.53 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add vbus-supply property for mt65xx. The regulator can be passed into core and turned off during suspend/sleep to reduce power consumption. Signed-off-by: Hsin-Yi Wang Acked-by: Rob Herring --- Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt index 7f0194fdd0cc..2c45647e9f0b 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt +++ b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.txt @@ -32,6 +32,7 @@ Optional properties: - mediatek,have-pmic: platform can control i2c form special pmic side. Only mt6589 and mt8135 support this feature. - mediatek,use-push-pull: IO config use push-pull mode. + - vbus-supply: phandle to the regulator that provides power to SCL/SDA. Example: From patchwork Thu May 27 07:55:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12283669 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AB4AC47089 for ; Thu, 27 May 2021 07:59:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 BBF35613F4 for ; Thu, 27 May 2021 07:59:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBF35613F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LGWRTo+AShTObmmfpZwzZe632uDPnTceBkIKM+VF2XQ=; b=avRkF4WrgEXJe9 vIBzTshRx3KqWYD74WjezOszxSxU1mdCNU3akDLSjBtQwWm+808mN1gaefn260KIwEpsZ3zv8mH/g 40umh9olsn+NrN80H2YfMSl2+nGAbqDLTf+8EeUjtwwMjVIF2XPfdVcJ3CZy+CjazmGY9JoBwr2gH 3loKCTU2nHOz3ysYnyVsBvBiic1NFMPqiCHGJn9yAD8PeVba/rlNzke17oo6RnHttA2PuUAk3RSKi 6N9XWkJF6RN7VQMFO1ERc4XxOlodhAr5avpwFbz4QVpYO4vrCyg6pu2OyCdHWkhRcCdchxtnX2R7O FFzZx/jUWnZoZDciI4NA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAvN-003ada-5J; Thu, 27 May 2021 07:59:25 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAsF-003YdJ-7O for linux-mediatek@lists.infradead.org; Thu, 27 May 2021 07:56:12 +0000 Received: by mail-pg1-x52d.google.com with SMTP id t193so3093313pgb.4 for ; Thu, 27 May 2021 00:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8pyuCoGKMnN2+h3a3mvyZQi+Jw/dfI3iorf08UqC1XQ=; b=Bh1k5AsMvov0F8xhU0fy1JXtiKqODUjSEBaJH/LGR0vli6my0OASfRNaobtKGmuGra 0NicyBnDSjqwDNdJYbCBXlocfR3dyN8wQwphQ+txLBLfmIc1bW1CmAwxYf5RfPHxoxB9 GPaHUPZO1dOsaD7vOAlpSC38lh8+S3wQk6Ccw= 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:mime-version:content-transfer-encoding; bh=8pyuCoGKMnN2+h3a3mvyZQi+Jw/dfI3iorf08UqC1XQ=; b=e9GvVq30My28dxq3zbvapQhFenltcFjWVILymJFSSM6mNXRpBrPTtxKg0/SsKQO60H 3U+JurAGNPbCI7UHVGAh+zY4q7Dlp9KsWvLy+7LEN/oWnOcUNLSteCXEcS62mfcalKME F+i+uofydUhLgZuWHl1rSOg1fy9cgVzZrDR7Kcj8xDQYH8oc8+UUm3ia0fHtCs58K3jU pMKJVGBMZgz8/NfD9BMCx+SmSonzyKQbfExsHGwnCIkQUxl25qLkalLMJYHk7fymbJLx 0lz9GdUqeQFcVy9Mlu9XPRE2eFFuT3laopdJ6CiZBjKtlfXGthNU23DrFDqP1gh/asiG 2NEg== X-Gm-Message-State: AOAM533DDtXVYcPUmCgBuWON0vG91k9MxP9CnsZIp6+VpU8y48g5Z00+ HlGZyd+GxYeFfo8ABc8OJ+w8Ug== X-Google-Smtp-Source: ABdhPJy47jhHWTE50bdT7rNK/2BImA4ZBMyIusHrtkWOEZQI1HmguHizcP2LilT+5zCs4TFmn45X7Q== X-Received: by 2002:a65:625a:: with SMTP id q26mr2482964pgv.311.1622102170122; Thu, 27 May 2021 00:56:10 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ece5:55a4:6ad3:d20f]) by smtp.gmail.com with ESMTPSA id 69sm1217790pfx.115.2021.05.27.00.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 00:56:09 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , Jean Delvare , Rob Herring , Bartosz Golaszewski Cc: linux-i2c@vger.kernel.org, Qii Wang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Mark Brown , Marek Szyprowski , Bibby Hsieh , Arnd Bergmann Subject: [PATCH v21 RESEND 3/4] i2c: mediatek: mt65xx: add optional vbus-supply Date: Thu, 27 May 2021 15:55:55 +0800 Message-Id: <20210527075556.1709140-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210527075556.1709140-1-hsinyi@chromium.org> References: <20210527075556.1709140-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_005611_328186_17E3EF42 X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add vbus-supply which provides power to SCL/SDA. Pass this regulator into core so it can be turned on/off for low power mode support. Signed-off-by: Hsin-Yi Wang Reviewed-by: Matthias Brugger Reviewed-by: Qii Wang --- drivers/i2c/busses/i2c-mt65xx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index 5ddfa4e56ee2..22d1d14b5de5 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -1220,6 +1220,13 @@ static int mtk_i2c_probe(struct platform_device *pdev) i2c->adap.quirks = i2c->dev_comp->quirks; i2c->adap.timeout = 2 * HZ; i2c->adap.retries = 1; + i2c->adap.bus_regulator = devm_regulator_get_optional(&pdev->dev, "vbus"); + if (IS_ERR(i2c->adap.bus_regulator)) { + if (PTR_ERR(i2c->adap.bus_regulator) == -ENODEV) + i2c->adap.bus_regulator = NULL; + else + return PTR_ERR(i2c->adap.bus_regulator); + } ret = mtk_i2c_parse_dt(pdev->dev.of_node, i2c); if (ret) From patchwork Thu May 27 07:55:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 12283671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F264C47089 for ; Thu, 27 May 2021 08:00:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 388BA61417 for ; Thu, 27 May 2021 08:00:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 388BA61417 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K70EqRE5Tbgq/saxN3erljTFxBlZvV+puqapf6zjMh8=; b=xl8epsgswJQiok 5WG2EJL9ImsFmEQScOHw14PtJxgS3feoWcHT3AtENJP5ShwYTsAkyS0nEGxRIQAwmyjZ2rcFIjNWC GkQR2cigAnIEnD8XBd94pqX8gKAD8AYFCcTuYRn+dTIpyksnQAnHMuBBFxpTWFEwqk8sk+6SOBmvv SzESZnixXvtB6GlGt954AOHqJcqs7HWjyM6NibB1fjbTnJjeNd+ugDMhDG2BtdWrp2+MBi8aDSz9Z TDXhfBUPN11igNVIxdDRU7xVF6JbTH0N5riTuIJj9OsxQmOXK+C6KLnooDQv8WejTsH74URoYcJN7 dqQaao+hrOHKS/guHDrg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAwM-003bIC-0u; Thu, 27 May 2021 08:00:26 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmAsI-003Yes-35 for linux-mediatek@lists.infradead.org; Thu, 27 May 2021 07:56:15 +0000 Received: by mail-pj1-x102d.google.com with SMTP id n6-20020a17090ac686b029015d2f7aeea8so1868258pjt.1 for ; Thu, 27 May 2021 00:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bs9RElxHAA2/T87AXUzFrLVnBm2Et2bauPM/4axG/FU=; b=Kp6DjbrtwxHVMbu9vC89wum0z6Wd6wBAY+P3h9yODiqxzV1CSqEqZkn8AcVfdQAsiP +AAJyhqt6gPzl1LJUhiZvmX2Wqymn2hmGghdAdVnjPGXWpZeXRmz8HpHm6wcB/jkOpab +AmkG3itwe4pjzT6FoiTYBhKq/U8VWjdgTYjQ= 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:mime-version:content-transfer-encoding; bh=bs9RElxHAA2/T87AXUzFrLVnBm2Et2bauPM/4axG/FU=; b=kqQNcMLwK3KPNzbSIVZAZorH7pjx2WfCzkSVUB5743nRWgEhy5PZjc+mKu2YJg2SEK QM9w7TvzTgwTniVdiWE4G8aIcaIHpi4zQLia0/k9+xraJcUr3QJK7Nt4Ml+zgG0xtChf bcwVIkuCC5joDrFlt1Ugu3yYPWnYKcA0hljfoeb8xysynYn9v2dkagJTuggsfDV/kZ6h E2SDK1FrM03keEvrIUhN5v8jRS66cOcg0xTUe4BX1NyMLsX9c+7K7krSjldhu8HK3jl/ CXkVxgXhC/xGlVyu+crqHUWTUaIinRRwVoW2EaTQxEx+J3bk3IgNMuGnXSY8TN1RVcHN r50w== X-Gm-Message-State: AOAM530Z0pw+JjgjpDK28EHR0kvC/tXlcSEErPuHp6yDJnTeJiiUJdSg niZ3YbwC6mXIyX+VYnFGPPe4vA== X-Google-Smtp-Source: ABdhPJzDc7fsuKMi25L9v4XVlntAVouxCshVJH65zuHU4vn8GVctO7aUJevs+2Tk6+o8akhdHfAIlA== X-Received: by 2002:a17:90a:fa91:: with SMTP id cu17mr2501646pjb.214.1622102172870; Thu, 27 May 2021 00:56:12 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:ece5:55a4:6ad3:d20f]) by smtp.gmail.com with ESMTPSA id 69sm1217790pfx.115.2021.05.27.00.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 00:56:12 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , Jean Delvare , Rob Herring , Bartosz Golaszewski Cc: linux-i2c@vger.kernel.org, Qii Wang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Mark Brown , Marek Szyprowski , Bibby Hsieh , Arnd Bergmann Subject: [PATCH v21 RESEND 4/4] arm64: dts: mt8183: add supply name for eeprom Date: Thu, 27 May 2021 15:55:56 +0800 Message-Id: <20210527075556.1709140-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.818.g46aad6cb9e-goog In-Reply-To: <20210527075556.1709140-1-hsinyi@chromium.org> References: <20210527075556.1709140-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_005614_172766_BB07883D X-CRM114-Status: GOOD ( 10.90 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Add supplies for eeprom for mt8183 boards. Signed-off-by: Hsin-Yi Wang --- arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi index b442e38a3156..28966a65391b 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi @@ -88,11 +88,13 @@ &i2c2 { pinctrl-0 = <&i2c2_pins>; status = "okay"; clock-frequency = <400000>; + vbus-supply = <&mt6358_vcamio_reg>; eeprom@58 { compatible = "atmel,24c32"; reg = <0x58>; pagesize = <32>; + vcc-supply = <&mt6358_vcama2_reg>; }; }; @@ -101,11 +103,13 @@ &i2c4 { pinctrl-0 = <&i2c4_pins>; status = "okay"; clock-frequency = <400000>; + vbus-supply = <&mt6358_vcn18_reg>; eeprom@54 { compatible = "atmel,24c32"; reg = <0x54>; pagesize = <32>; + vcc-supply = <&mt6358_vcn18_reg>; }; }; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi index 2f5234a16ead..3aa79403c0c2 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi @@ -62,11 +62,13 @@ &i2c2 { pinctrl-0 = <&i2c2_pins>; status = "okay"; clock-frequency = <400000>; + vbus-supply = <&mt6358_vcamio_reg>; eeprom@58 { compatible = "atmel,24c64"; reg = <0x58>; pagesize = <32>; + vcc-supply = <&mt6358_vcamio_reg>; }; }; @@ -75,11 +77,13 @@ &i2c4 { pinctrl-0 = <&i2c4_pins>; status = "okay"; clock-frequency = <400000>; + vbus-supply = <&mt6358_vcn18_reg>; eeprom@54 { compatible = "atmel,24c64"; reg = <0x54>; pagesize = <32>; + vcc-supply = <&mt6358_vcn18_reg>; }; }; diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi index fbc471ccf805..30c183c96a54 100644 --- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi @@ -71,11 +71,13 @@ &i2c2 { pinctrl-0 = <&i2c2_pins>; status = "okay"; clock-frequency = <400000>; + vbus-supply = <&mt6358_vcamio_reg>; eeprom@58 { compatible = "atmel,24c32"; reg = <0x58>; pagesize = <32>; + vcc-supply = <&mt6358_vcama2_reg>; }; }; @@ -84,11 +86,13 @@ &i2c4 { pinctrl-0 = <&i2c4_pins>; status = "okay"; clock-frequency = <400000>; + vbus-supply = <&mt6358_vcn18_reg>; eeprom@54 { compatible = "atmel,24c32"; reg = <0x54>; pagesize = <32>; + vcc-supply = <&mt6358_vcn18_reg>; }; };