From patchwork Fri May 7 13:14:02 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: 12244583 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.4 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 B63D8C433ED for ; Fri, 7 May 2021 13:14:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 158C061466 for ; Fri, 7 May 2021 13:14:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 158C061466 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=desiato.20200630; 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=7Vut1UKUgRt50oaNhb9e30kVFMKZ0MCRUva6lTHIYrc=; b=hUWckmvXa75olMgAl4jb62fVY vuIEZEFX4lGnhEsTbHXj6BlZajxaPmubCb0+bu2xKLInUkWeiTQm3qGRRkr/NHhZpM912qsP+SRsg GbHJqqLtlOzQ7aagZnXwM2ObzobN240Qqk5uLAjH59wdRUvv2e/muRiyRd8U8G69WVsL2yHDd5jeg UK45OSHWZHk5Cm8VmqKnyfrMirOOu01jWAsFpovCJKu9fiip2BJaQVd7JptLC5QGhG0twKRqNytdy ZE2SNyPIjmNcBQGrj7dGfKQCzyIOo2VoQOgkgfcT0zkThecfAAWFPBRQHcSv9hmkyIBuOLfnYLfFK BBWmwCqOg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JU-0077sl-Tr; Fri, 07 May 2021 13:14:41 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0J8-0077pf-G7 for linux-mediatek@desiato.infradead.org; Fri, 07 May 2021 13:14:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=zc6/3/VfcHCcsyhsjpHk83+1mY6bLdnDzZw5bgOgDug=; b=3apxzaSIyrpm+vQ8ldjc5KyGyh PYOd+1KObWRxCpjMKekASM83cORauz2y1FCJ06ZO8lZCQZKwHj1UyyTnpYY/ab+K15fMu8YhOBDfm nNma0EyvM+JtZ69i/YPnWO5mBuBOvzuMlGwjp0rh9iZmtSCPESlP6Hjn3XuEBEBgqYVZzA0axmzU6 z6rZFiahIrpKoP21mP9NrJ9fjkc1Wb6w2et0FXxiJxRpaA+mwPMkhCg455VC1P0W9NeYk7zlItvG6 26JZOmu8WrDFUK6P86B4go07rPJlwNT+ITAYn1hgevbjpTBz/ckQ8DMwo0kdHhAR8x9ubXXvHYK8a V+6+0K0g==; Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0J5-006sXb-MQ for linux-mediatek@lists.infradead.org; Fri, 07 May 2021 13:14:17 +0000 Received: by mail-pl1-x62c.google.com with SMTP id b3so5103407plg.11 for ; Fri, 07 May 2021 06:14:15 -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=zc6/3/VfcHCcsyhsjpHk83+1mY6bLdnDzZw5bgOgDug=; b=POFBgKAPpYfOQn+zGMU4zVvD61ln1R7Iz0VNQU2NOPqLsRwHWA0+/KzHDjiO1lNzqv 4J6S2UVlB6iJlyJGqsqZpq3NIO/ApK6zBKw2VG/t8PDkBUxhKDxcGujl0t6c04E1nuLj vYdZiHUwIhNPWwUl2zdKlWd2cZwpgEih3zPOQ= 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=zc6/3/VfcHCcsyhsjpHk83+1mY6bLdnDzZw5bgOgDug=; b=DJlZc0zBpOqHd/sloPQxay8s1ctWnj9zSpHyulE/m/LO8r4ZTknMT7KwSGSLHjbuTX wk/Oe0OrhRB23gjBEiNARFdhyS6JSdHkk0hWJj45mrdU5RupL3avN3bN+obsBzbZ//pO 2dERskITBugzwKkzTpilXB7n1so+W8ky5Vaw1raO0PIXh1bAUiH28KWULo23cVchtJxB 36MAxsIduJ7pb91MeUqFBnCom2nL+RBEKXon1huCXCWmN+OcaTmqCMZhxURxBYZwX0EG lM8bIGBdmExhlzEbU1a2gB+IyD4MpcoZ4dU/QlqN4mPCPMyxzuOuxpa4iIN38pOx3+Vd A6IA== X-Gm-Message-State: AOAM530IVkhelbVsRSFYN/49/IgJF0gW7xxoFSYWT0FB4904kTSqfcFf cbWJqaQQfOEADoJzaeq2y9MQUrY6nGKEVg== X-Google-Smtp-Source: ABdhPJxqT7U6uQjQoBNiFS/tGiuwtuAfj3Zop0aaTEvptjo8FjdlTzjrtlDJlNmeXJAXIlPVuDDk+Q== X-Received: by 2002:a17:90a:cc11:: with SMTP id b17mr10270349pju.119.1620393254578; Fri, 07 May 2021 06:14:14 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:711f:8553:a124:a19]) by smtp.gmail.com with ESMTPSA id z29sm4656539pga.52.2021.05.07.06.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 06:14:14 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , 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 1/5] i2c: core: support bus regulator controlling in adapter Date: Fri, 7 May 2021 21:14:02 +0800 Message-Id: <20210507131406.2224177-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210507131406.2224177-1-hsinyi@chromium.org> References: <20210507131406.2224177-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_061415_758808_2716FB1A X-CRM114-Status: GOOD ( 19.46 ) 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 Fri May 7 13:14:03 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: 12244585 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.4 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 6E1C3C433B4 for ; Fri, 7 May 2021 13:15:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 C0D7461468 for ; Fri, 7 May 2021 13:14:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0D7461468 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=desiato.20200630; 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=kt8udRmXOx9FXmOE00uN9tP1XFTxFOh4ZpmPVLKbZHs=; b=pcQu8xr+jvYC/SOEsQdRlmkWY ZCStQzkEyznVsRNwcxdJSFnFvtIU997tq8yNHxVcMM9nYzZCBw3l+kz1uZnCKBWv0Md7edvoRq8FJ mXABJMihftSijzX0yprDp6mr8rLAAdKmMy8w9rNZTlrZim8kU+B0+zV3wLJtBPShci+zSh5c3s+68 EPw3dAOFalPwrJNv+mQ2Rlqjhe4tLqLHO4CEp3qttEHwWViT/R0XkwP5L46Y0qS5GOmDbqAk6WItV chh0ambVQ+w9sSCOSoRn8/dt7uHGnwCpWJkwnI/5sDxaIemRBR3whtJBfJO0Bex+Z/Y+qmx/eKA6x FgerzRGzA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JY-0077tr-M6; Fri, 07 May 2021 13:14:44 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JA-0077px-6F for linux-mediatek@desiato.infradead.org; Fri, 07 May 2021 13:14:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Z5uRcm+z5t4aeBxWsSjq74fZr3pDWXQjhRR69I0+uIA=; b=bKQzb+dzAxlJ+33vwfsIXQK+3l 9OkDWcCIrwBp4ZSR1nsRpyoX30f1htVTvXeXg88qUaqmPmh5w0V9SEGgsPpUlWAHRRj2cBmSg9cJ6 qA6Q7dyysPiCynMhVJzdD+4pfLByGFUv4rqUUJDjWh1B7muCdpVxhz24oMbOE78mjH+OwzK/nadDi 8u3I1EI3GeIG2d4LnIDHSd5FQxdfkmk0FW2vJFZ85pfhuLf0/Iv98gyuiDzI5lK1+hVtXXWasZi4E 8D457FMXl4Thvx244ASryFy3Y7TUgjEWVhyOnQ4jw+cxusKmMX4Eebcx+ReB4iECndZHv8QQ+fAQy XAW6fDhA==; Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0J7-006sYC-Pm for linux-mediatek@lists.infradead.org; Fri, 07 May 2021 13:14:19 +0000 Received: by mail-pg1-x532.google.com with SMTP id p12so7101419pgj.10 for ; Fri, 07 May 2021 06:14:17 -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=Z5uRcm+z5t4aeBxWsSjq74fZr3pDWXQjhRR69I0+uIA=; b=H3z2qCoLD7IfYuyroPiDy5fAoe2wbDqn1Vnl1mTG/23sUSa0pIb0dBthqVqkDnwxv5 +gkIBUv8mIFN5pvK/ryk7yl35ZYzq+8nnwQcXY1Bpe0XvVy4vkIQdRhY7J5N1+YssF8D 5HxJZYjzDawin42Sq91HpOpWvSq7lxCu0Nmcg= 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=Z5uRcm+z5t4aeBxWsSjq74fZr3pDWXQjhRR69I0+uIA=; b=Kq45p4qttc1suuY0kGrhYSJHYhbVGVdP1W1aIWKfmNgRcItASTFgj/FpCNzZaDRTCR neztlhQRPPVVbdyMkRtaDh0HTw5W96QKXBoy/3RRKANoaSuLL21e7xR8QWD89X3+dIqh KKK0yw7bxMf03FlHhyeVJYZh3ZB40o9X5xDfrLsZnu8+tlSxDa8zG7Ea96ybX0RnsbeW A/sPzwiDDbTqIVJYtu7WWlw4/ortjC0C41fRvAkkkHwjByhT+0RYrCLm0hOpEzhntUqF puBbo7x6aHi8qZmUNzaCDH2y++j68zhDlPJmraNl7DTEC3JeYkn/+FC4bNIQNu0SkwBK G+eg== X-Gm-Message-State: AOAM5335kKZi2BHM5bHXuXiHPZ/v61SG/qjCZASbwbZUQULxZCdssGL9 OECw4y+LWeqgU1MgMiX5C1SBRA== X-Google-Smtp-Source: ABdhPJwXgl15gc0vRklpyyJcdK2f9/dPf52EGEjnqBHI+xiQ73HrxYgQkGwIjLYder7XGpt9XbxDYQ== X-Received: by 2002:a62:3106:0:b029:25c:cd66:3be1 with SMTP id x6-20020a6231060000b029025ccd663be1mr10438925pfx.29.1620393257211; Fri, 07 May 2021 06:14:17 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:711f:8553:a124:a19]) by smtp.gmail.com with ESMTPSA id z29sm4656539pga.52.2021.05.07.06.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 06:14:16 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , 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 2/5] dt-binding: i2c: mt65xx: add vbus-supply property Date: Fri, 7 May 2021 21:14:03 +0800 Message-Id: <20210507131406.2224177-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210507131406.2224177-1-hsinyi@chromium.org> References: <20210507131406.2224177-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_061417_852794_B1BF2357 X-CRM114-Status: GOOD ( 10.40 ) 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 Fri May 7 13:14:04 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: 12244587 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.4 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 68E4AC433B4 for ; Fri, 7 May 2021 13:15:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 BE3BB61040 for ; Fri, 7 May 2021 13:15:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE3BB61040 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=desiato.20200630; 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=SQFFrTHC4uvNRZd9IT/MSu5wUcte0YfDC1YLot9l0bk=; b=WZft48J2sWaESh7Hogp0LKdCV shxOB2xMHv+TqcTDV0QB0N4RKOfGAPrNjRu6nolbPE2J09xky2UM4MHbkCU+c9wNGW+WTV8ljBJLR rlHFQeAPymrRDEfYqiJKPo//Zl0viGawTQkeuu5LyfcdLuqx+kQ38A/qt1t4n3eYAjE1IRfYUC1Rs 6wXmR8HN4WW9yqX908kKatnllqCxNPKhDMUZRcsqyAFC1VLTVH2EPY+Bqke1Ny3aTzSVbIJDsE6J2 JivJqMkHpw0+UohMRW9S08c9Q1JJfHbljlktNL3T7gE894KsKSg7PRJ7MTQ0/2OXf9VX/xsHLHlKN /h8WXPsDA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0Jn-0077y4-4s; Fri, 07 May 2021 13:14:59 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JD-0077qP-I1 for linux-mediatek@desiato.infradead.org; Fri, 07 May 2021 13:14:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=kikr9ZhoRbpRt9r742gt6H3+Tb3lJblPdN6YyE6SQsY=; b=0J8Ji6sVzsiZNHJAUPEBxqvbQo /Bc7dWwvJ7tDFROCnTocDa3KDKGYSAucL2tVT8tiDlpRc0sCZxnmn5/bceIrpqmapoAnHMlKiUn4d PUugv0+pQOwKx6OujtgV3vXQmBDlxIer6bvuO89mWrb1r3bomIoJvC3aUULB4nP5BzFDuc7fMc9/Y VAWPkFLJipo9r5usGE82TEgyWhWGJE5kiZeg7Il0xwulg+4igBGjpW64Y4Fuc2uKrU4GtvP7nYXzr gPR6ThL4DqsbEntsgQt7/HssKzNDRfUvbLgZlNWDR6vM/mu0v60gPWH2qfxRf9p4+OOV6YDH8Ut9a 38U3uGSA==; Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JB-006sYn-2q for linux-mediatek@lists.infradead.org; Fri, 07 May 2021 13:14:22 +0000 Received: by mail-pl1-x62e.google.com with SMTP id a11so5116160plh.3 for ; Fri, 07 May 2021 06:14:20 -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=kikr9ZhoRbpRt9r742gt6H3+Tb3lJblPdN6YyE6SQsY=; b=EAvHCPHyHbXHiIiNsXn2M8do7dMCJUcobH25Fpf1g+s7gllEtWszn+qb/57yyeQQmp CBhSV5miPj08lzUv2duZT8QDmc5As69tht5584Xf6Nh8y2dwtdK8QJ2ot5p1Qz9zsFgs U8IzCzmwdrhPxHFILcqqaB0XfofyPavr0uwkw= 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=kikr9ZhoRbpRt9r742gt6H3+Tb3lJblPdN6YyE6SQsY=; b=BbHDZ+nMTjAkEbcoIPTDFsC958fwQFBEGWrv8W73v3Hv8QQ2xo0h1puiFkNn+j4HQq ypnNTnnvhuiLrDHJPFTNm5OrHkdz3npsXdFrHNO5IJq9aJt0nbKi4Dg2+aESxa6tHIlg RNt9EQiZA0s0lbSQX7BrSptcQ2ZP39Aafr03rSqj/29J9bR/OV1+Iw26SqGwNqEEULiq tlbEe58iQhzcPTSV/1v564Kfvqvdj6V+llAUgochLEUXl4MeR/Yc+oFG+mQjgfYwmtwJ fqZp2IggwJrbH82yOqDMi+slddEsy9bmb0thlg+MRurMSSB186bVTF5uJOPU3oy82pNZ Txag== X-Gm-Message-State: AOAM530NrbIk7Ca2nVXvjZD/H+WU8crv2LjXsTbYqW4WnzIzm1pkfpgM cQkyn2MeG7GE5HXApcrQCDcHFg== X-Google-Smtp-Source: ABdhPJwXqN//d5LHFxyd15ybs67ak235z16Nesh7tNZdIpgwmAaqvd1c9pGhWHrfZAv/rGknYi/i1Q== X-Received: by 2002:a17:902:8682:b029:ef:d2:4311 with SMTP id g2-20020a1709028682b02900ef00d24311mr6293896plo.4.1620393259946; Fri, 07 May 2021 06:14:19 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:711f:8553:a124:a19]) by smtp.gmail.com with ESMTPSA id z29sm4656539pga.52.2021.05.07.06.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 06:14:19 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , 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 3/5] i2c: mediatek: mt65xx: add optional vbus-supply Date: Fri, 7 May 2021 21:14:04 +0800 Message-Id: <20210507131406.2224177-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210507131406.2224177-1-hsinyi@chromium.org> References: <20210507131406.2224177-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_061421_129955_9BF17791 X-CRM114-Status: GOOD ( 12.57 ) 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 Fri May 7 13:14:05 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: 12244589 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.4 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 D5A63C433B4 for ; Fri, 7 May 2021 13:15:27 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 2AC4A61466 for ; Fri, 7 May 2021 13:15:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AC4A61466 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=desiato.20200630; 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=3e3J2eU7PwxVZtxSTWPAlhPGgPTQu6G8YRsMphbkD/c=; b=EmvJ95FpXutIeCL/MFIsfNb1T x0V9nDp5sAzUKZGxkmjSteldh22dK7vDsRz242juXo9zGzf9rR1bnheiCrOSDRU+9U9fSm5vqKBBi mYvBOVf/j3RjaFl91HrNQgogENQ9oJdTcGuoIhY8z9YroZjdvxq3IjKM3j1MZ+dPlQtjkjd8Iw7yB ErH1J2d8JdTozS+cXuPji44A3J/JdPYIM9mFF/D3NwVeqInXBQtDp8TBaFJdIG25kEvhfvIl4BdvP 5+y9UhnTbwSFPpnOU45bUJJe8rL5E63OMApekkHqt3MEFR1Nvm3hS69QjnJ34UDHo+OyNgGLvjqY5 eJFHPIEag==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0K1-00782e-NK; Fri, 07 May 2021 13:15:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JF-0077qm-GN for linux-mediatek@desiato.infradead.org; Fri, 07 May 2021 13:14:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=xcouiPP4ZWr6sE0GiZdxnLUxfCWsAQ8aBA7BAFbwZSg=; b=hYHwtRLS7bDKDSmUUuwC8djBZJ RJKVuKkZwTrEdpGTsn9VatlQtAbIafdSorfby4lHN2L5hHDhK+na8+Z2pvot3n43WLjGSmatzEjAx ScMF/8ZWQPnb9Q0GkZHMpHCkR5ciqPAFjKr1QtBqamyrelsANVgvejpcyFDThQhkZ0t+aNWgz93ru YGjqmv3FsvM8pVirN3t6dHmFTf8809KKcHR5o0WQNOqxr1yX/6ZSHp3T5irF5BfsN+SO0UUG+vsHi hs52YEzWRFA8lkTF9Dz5yAmWT+GK2QBMaU3SnkZFU5lZE3ipWeC6bqCtz2H8qyhW38s3k/PpFfHDX ZuciKWeg==; Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JD-006sZK-28 for linux-mediatek@lists.infradead.org; Fri, 07 May 2021 13:14:24 +0000 Received: by mail-pl1-x62c.google.com with SMTP id 69so507064plc.5 for ; Fri, 07 May 2021 06:14:23 -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=xcouiPP4ZWr6sE0GiZdxnLUxfCWsAQ8aBA7BAFbwZSg=; b=Bn7vnWvwErgkHww/wyQaRKbnP9HyfiwnkzeUkAsUBO0BgofkV3NljJIagFWPurDaho YOgo+zkazaGGORdA2xpfpMGYBWtNss8jXkpPQf801I83KdaJkDXqOa8Na8gPZY/8+62T w2M9LP5s2KYkB90H9MdCsCEPDNiPtvh/h8Fmg= 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=xcouiPP4ZWr6sE0GiZdxnLUxfCWsAQ8aBA7BAFbwZSg=; b=Oso1Y/rLEV6x756dWNlsZyxYtkLtSKG/cuMa8HIPl/hc3K8DJcqc53dgwLZcdZBeko e7ecO4BavR4SnkpM8buJElsiQGfUDGVdrEpq1JI+SbB7or1DZezGeRR6FYj3UcTVmVeI UPdVR95jmqAIvTGbwxt3sHONr1PYNE4Jm9Zv3yRqFDlcTRwE2pGVYdOWC0po9hRKGuNf Jm9/KtnYZCmhYA7t1wGVzWGteOE908aE1/pgZ+VRNnCMRWStyL81OZM8lpPevpMe+px9 ahh19V+oyVj4Lu9DlUAHoJs8A8D4cv+BLlHHpVR0ALHSnklpzLaoJ5hKChR1mCDu2rtS lyZA== X-Gm-Message-State: AOAM531V8eR8IPbgbz6pjfYHf8Rcf8JY1cKEYy8hLNUBPZ98IJF98YYq KkCx2W5ukQdxucsm7iQAusfGmQ== X-Google-Smtp-Source: ABdhPJzNumxAR1eE6lJcWpdeibTL2dL9mK96HWGhUZ0Oi+h7BgBrA3QkEyBkkzCtGm7At7VQeu0w8g== X-Received: by 2002:a17:902:7205:b029:ed:6fc0:bbd4 with SMTP id ba5-20020a1709027205b02900ed6fc0bbd4mr10509724plb.4.1620393262574; Fri, 07 May 2021 06:14:22 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:711f:8553:a124:a19]) by smtp.gmail.com with ESMTPSA id z29sm4656539pga.52.2021.05.07.06.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 06:14:22 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , 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 4/5] misc: eeprom: at24: check suspend status before disable regulator Date: Fri, 7 May 2021 21:14:05 +0800 Message-Id: <20210507131406.2224177-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210507131406.2224177-1-hsinyi@chromium.org> References: <20210507131406.2224177-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_061423_120985_9EEF2872 X-CRM114-Status: GOOD ( 11.87 ) 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 cd5676db0574 ("misc: eeprom: at24: support pm_runtime control") disables regulator in runtime suspend. If runtime suspend is called before regulator disable, it will results in regulator unbalanced disabling. Fixes: cd5676db0574 ("misc: eeprom: at24: support pm_runtime control") Signed-off-by: Hsin-Yi Wang Acked-by: Bartosz Golaszewski --- drivers/misc/eeprom/at24.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 926408b41270..7a6f01ace78a 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client *client) at24->nvmem = devm_nvmem_register(dev, &nvmem_config); if (IS_ERR(at24->nvmem)) { pm_runtime_disable(dev); - regulator_disable(at24->vcc_reg); + if (!pm_runtime_status_suspended(dev)) + regulator_disable(at24->vcc_reg); return PTR_ERR(at24->nvmem); } @@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client *client) err = at24_read(at24, 0, &test_byte, 1); if (err) { pm_runtime_disable(dev); - regulator_disable(at24->vcc_reg); + if (!pm_runtime_status_suspended(dev)) + regulator_disable(at24->vcc_reg); return -ENODEV; } From patchwork Fri May 7 13:14:06 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: 12244591 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.4 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 9CF5BC433B4 for ; Fri, 7 May 2021 13:15:56 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 EB1E061468 for ; Fri, 7 May 2021 13:15:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB1E061468 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=desiato.20200630; 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=CK2LWseW944+8FMfTy5eZG2QS9atW6YNuomcxmV4+Gc=; b=ADJmB6PNLkPkPVdv7kFQhJ2rL 2cu9aHvElJ6Csx1lVrlbpUyXu5qTIdZFq8sE8zBuMJl6YUDBQiArBaalL1ECubPbC+hmcw/rmZQ35 L1G2DiDxlaSSAUdjeXG6qmiWYy9OGZmZTZ/N9Y6wtrjUXRx4678tgszAh+VUEvnvL39BaiafRhAc/ LLPRO5ol2lVNdt1o94HBI4YNqfWwd7JCqvHCJoI2F7UQMa8i6oaePnXFLzdR5AX/RxfFvwKoixYlh OJhgeZdhGUIyF0UIyIZ1PcF2+CsVLeLdZGy/43grJRu9L7rI6olUPtT7fLg6zCsGIUrzUgqFOjLws aE6cFy8RA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0KR-0078FM-AU; Fri, 07 May 2021 13:15:39 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JI-0077rI-VQ for linux-mediatek@desiato.infradead.org; Fri, 07 May 2021 13:14:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=/iQHjQJIEusNn1tquHlPyPfKvKOnU6uAD3LtZICkSiM=; b=u96GqyznJzTg0rmVkzjFqoVux/ UDoiraMsZUfzXC7P2T7kRmZaFGC84rUdzyt6H7gUNrO2NjUVZ01XC77TuQp5wCQKC63UTRIAyrWyB UKr8jrz8rHeNklGQ4iIGhb5K+KqWnzQqZ2ChtOMAecbCcR6CyVm+tZ3uyIjDGYi9uH0zmpM3aqyy2 Vf98i3E8dod/OPUj/IDi1rGd6HsYCG2vPxBiSo8GuIjBerrcmdk8JKKxS0Ku2yN9clehdMWbutTRI DYqaPvEK+6YG99M4JZ/qFU+ZWE1TuPBrGk/AqXz82O83Vw8y924ECcaYMD8SlR/MsqZqyZfVBymhs pSxaswAA==; Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JG-006sZp-D7 for linux-mediatek@lists.infradead.org; Fri, 07 May 2021 13:14:27 +0000 Received: by mail-pf1-x435.google.com with SMTP id q2so7528815pfh.13 for ; Fri, 07 May 2021 06:14:25 -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=/iQHjQJIEusNn1tquHlPyPfKvKOnU6uAD3LtZICkSiM=; b=Ntg96WjpZ1VistrBYqL1M+HK91mFEC+3LlO4WcHsmMOyYoAslkXmmt2h1ClxsM3Apb W0RPjQkzmRQ6pAeshLswDxYI/yHhuHUvntGs7ECONjXx5tt/ikILaFPgozqnrKsSfYSK y0Z3sfhDiGGkMJ4FClXIiU33vLsL8BM++f2IY= 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=/iQHjQJIEusNn1tquHlPyPfKvKOnU6uAD3LtZICkSiM=; b=OeJccs3d9bZHadOkG0aa7OhO5a6Zv3PWOg9cnGkOcdhcK00JUd9gJKvWGhdbhiAHK/ /PqiHidlPJxA5rs6iGFj8lk78siFcLO6mUTV/5ADU8/wnfB/HJ4LAeDgSlxc+PkC28Ma buS6F/FRk62ClRtXT6/CjcB/pgesvYOeoEIPAH44/UkBfpES4bzKjj5MjGJFyq/mHtnC GLrKYjQG2/eHhsRHp0GXyhDEQaHq67VKEYrFWap0ZzRurYzMxDj6O3MGhfEEOClImyoE gBMw0Qg7eb4O2D4OZxdKjlwDhXWVO/nJJ1JetXklMlLPacoitkYHaPrbWeZxZrnfNYN1 iYLg== X-Gm-Message-State: AOAM530XVIcb8kksLo1ud4vWz7yk7ec4b9xvQ1lfq8v+fG0SGoWb2I/f MhgjquyGeD4AApWASLs/EmWbvQ== X-Google-Smtp-Source: ABdhPJweownY6VlR0g3o1Ae3IqbU2FAY+KMj3UbN7XuWvnzt3rtaswXISD0Xy/yW7E2bmE0y6nb0Ow== X-Received: by 2002:aa7:9191:0:b029:256:898f:150 with SMTP id x17-20020aa791910000b0290256898f0150mr10411116pfa.74.1620393265252; Fri, 07 May 2021 06:14:25 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:711f:8553:a124:a19]) by smtp.gmail.com with ESMTPSA id z29sm4656539pga.52.2021.05.07.06.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 May 2021 06:14:24 -0700 (PDT) From: Hsin-Yi Wang To: Wolfram Sang , Matthias Brugger , 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 5/5] arm64: dts: mt8183: add supply name for eeprom Date: Fri, 7 May 2021 21:14:06 +0800 Message-Id: <20210507131406.2224177-6-hsinyi@chromium.org> X-Mailer: git-send-email 2.31.1.607.g51e8a6a459-goog In-Reply-To: <20210507131406.2224177-1-hsinyi@chromium.org> References: <20210507131406.2224177-1-hsinyi@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210507_061426_448657_6B17E892 X-CRM114-Status: GOOD ( 10.70 ) 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>; }; };