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: 12244563 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 7F6F1C433B4 for ; Fri, 7 May 2021 13:16:20 +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 DEB7B61466 for ; Fri, 7 May 2021 13:16:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEB7B61466 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-arm-kernel-bounces+linux-arm-kernel=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=v35/SdGXFff4aCGhmgierv3P62qtnwpchvzKuX0p+ww=; b=JoCZmOaGjXWgVT5lPjK1HesHR inm0zmU1WPESfN840VZKkpiryWAUZDQIzGEF1MhYcw29l4gg11jQXESCev7uu9zTDeQYZ2idm0DFq 3nOIPdF9u3l0qxuXmHVBXPXzjFW9/V2+Jc20y8BRHS3r0hCQjMPC2Fcf1YTmGTSN9gYIUK5n1QKgU +fzpQwU5lI8hmWBFt0u7xtOGNjduQuyMWTyhU4/cs2zIoqdN+HuAyXdn7p8zdhs6Kx1Tma1DejzCz VQB2FWG0FV5AtpLImq3fqmQv0NyZHyDkeRung2h89M/GQ19ztj+NG0S2yVbmhycQp4ilrrA6ThKJU 71BbvK7lg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JM-0077rc-0v; Fri, 07 May 2021 13:14:32 +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-0077pe-EV for linux-arm-kernel@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-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0J5-006sXa-Mt for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 13:14:17 +0000 Received: by mail-pj1-x102b.google.com with SMTP id t2-20020a17090a0242b0290155433387beso4590632pje.1 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=flooUJLkl1f8QImJ0Z/8YgRMKxZqnZnhePuTuAfkMnLgxpGtkxBHN6KMby9luSTbhk u/gws4AMgi5LbTnQZe92XTbGLhV3RjIV7AooMBhQ2NPfs2REIui0jsYmd7oHbIDelNyt l75q4ca76VuN/bAzgcZbgZsOP75+bxn+AfvPSUDQw54HgPt2ha9cLOQDBB09NZQY8jBm lTQl/4Xr0rShvCemc9iuBmgdpJE/GUeKtzkEM/C7g7NqWoapWBaPs+YE7823xJxTzrO1 4gTEvQtQ5iQlPqyA14iYiKElWlXhPJs9H6Z7Jed9fAI63v00V1TQBGdbzQEfxSyJRQg6 yLow== X-Gm-Message-State: AOAM530onD8nXxXtorifxDCIYXRMK2zQtYzeX/3uLoBkcsct3KJcG4X5 4uyFC5YsK6dmjA0IyFZJFy9c0g== 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_770993_895EF254 X-CRM114-Status: GOOD ( 20.88 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 12244565 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 4E792C433B4 for ; Fri, 7 May 2021 13:16:36 +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 A1B2361042 for ; Fri, 7 May 2021 13:16:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A1B2361042 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-arm-kernel-bounces+linux-arm-kernel=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=5CT12h6a0iiclfbCb8y0ftHYPJ2m7Orb5EyrVliSRHQ=; b=RtybeD9JpPOoJuedb/zBWJlHv lgw37+wOjvnuEHiPvBRIoOuObZguWW/kd3ST3O1GgIzIKDUHYJYiNHOhOiGmM4jDuApByZ9yue+LG lhwxkfDwAueWYY+tx7XEweID0cmlHdQG9TMWEgD5fAWE/JyuDRZogViG0APcJfoIRPOqXzx/51hxy 1oqCm2FXJ8y/FwBOKLm5uYZpyvdqJVYLr3QPhEudTOimFGij1kEgj9TmlvhOQtv7Ezduj2876Kqvh 88H3uholnSjYFA8CSva51oDY7peEhg7owD0HBtlDAmGiPYt4Elv29hCkr7g9EBTCQ6h2uJpjfVxzJ b83bSZDCQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0Ja-0077uM-R8; Fri, 07 May 2021 13:14:46 +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-0077q1-PA for linux-arm-kernel@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-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0J8-006sYD-C1 for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 13:14:19 +0000 Received: by mail-pg1-x536.google.com with SMTP id m124so7091358pgm.13 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=id3WHY26aEKCejYitG3oNeisZSEn/8YyCM094XBlPaPPOcNlXPdipvsbkdvY0faeKb 2ILKcCwnEdQf651M7pZYnInO2NZxvpKM04EB5BxGxlroO4a6sqdG57eIXrdrukVUBj0n aSYtU/E9SCY1NSlRfV38qu6g80q72jNC0X54r5T4D3W9jLKDLEo1VGTEKU45kmf8rpLe +3mprti2t1Fg5+//+FB4K95l4oUJ2ApgOtYtWNPxTsc/G7+93lJbJehfxyTBhlcM92bS 0hn/feOe4GBPTtiVFq5VxH+GBDmhf/cPQwONSlCKGZHY7XUnAh7NBlgnV/fOAuRCEnI+ qCCw== X-Gm-Message-State: AOAM533R2zyEa4UOC0Iq8L1duM6OBgc4qfJFbAtSJMFF2Fz291KoD/+s kMCtAIvkpCRNzeRmQl0kV/Tyzw== 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_061418_414503_BD9AB5AD X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 12244567 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 2CBCAC433B4 for ; Fri, 7 May 2021 13:16: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 8ADBC610FC for ; Fri, 7 May 2021 13:16:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8ADBC610FC 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-arm-kernel-bounces+linux-arm-kernel=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=IjcyjPLnkNuuQ1DxYtkRPeRJoS2GJ8ZE49hz4/eAoUY=; b=EUAtdjEm4HU1/pUtMJnL4wVD+ C2GkWmQ6M4lBueFhtp22fa9fzfhTApUWkEicp8ixlxUUYI9xy+Ub5QvOdpn3geCjINGt47e5egMnz dI53qMfNjeOq0mtfndbtr9QaNXBTvleE7+2bzmO/qQ5hRGqCFQM1KzF7PsEpjWJnzIFhkgANaqt8Q 7t4j+UBaT+dXl5vf0PzMj2NGgtVzNcAUkko8wNGC+QtEMO4mlBlIUKBbzpdGPOCyT9gz6amO3X8ha 5n3fA5ALAVUAHW5LfGiWVYSiSvOQuRrKzRpJSAU1nsAAr+WT+QKeIyn4HQwi8lN0NNpZ15u06Yfya SiWhypHxg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0Jp-0077yW-0F; Fri, 07 May 2021 13:15:01 +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-0077qO-Gc for linux-arm-kernel@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-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JB-006sYm-2H for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 13:14:22 +0000 Received: by mail-pl1-x636.google.com with SMTP id h20so5122551plr.4 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=Vw+6paKRV+ya8pE6HoHuuoD6+gb27Ip9SRXjsLDaTUIIb2ET3L5I+qsdyVRBt99AKJ CwaaZLovrfzTiaZtQpxUiwjVGWuTidNxKMAAdBtVKsryM6rAAmTXxetiDo7u+zSizaAg WFTnJcZYPVUGLnY9EfKt4/DMzmFY+HItKWqolZDGvIB+uM3Arn9wy0IKFblT6TFh7fMU ZJkyUXYWpeZzryHT06L5pl2Jx48VOqCmFCxLeFaY+wUW7fj24rjifJ/6da5bvJdlYSBZ ylFa0wluiZ0yZIwaze5pIQVSh2GElOuC6in/MDpUr5I83HCKYtwac88wqQDKAgwX4p8E Upcw== X-Gm-Message-State: AOAM5338nxIEK3V2pKaattcSefBcy545ilJXNuSVsvLeGPNOaV59reHt 186a4sS0Fp/FqxwObeq65n5Qpg== 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_124805_6AC89D6F X-CRM114-Status: GOOD ( 13.99 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 12244569 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 98DFEC433ED for ; Fri, 7 May 2021 13:16:57 +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 F2235610FC for ; Fri, 7 May 2021 13:16:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2235610FC 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-arm-kernel-bounces+linux-arm-kernel=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=em7gSb9utebfWoygEaiNC2mlJl3aJzTLPZLUEGymkfs=; b=mLc3U5rEoqavFKuIqoNn6ViTF eJTTHFkaMFxJDw0rJFpaY1B9Ycuc5RqqPwG5AYS6vlVzVJUKEshtvB3YbW7RsbLT6eoeXexd4hK6M iLcwYT+aAXjMayX1COQpd1j7VsJrHNfdsL705fT4kQpDk/J+OsVQu0z2ELzMm/bDkp2x5ru66Y9PC D6+0CJr9AMrDTaLTfl0TWrtDSAnE+EP/O+JhMvkjo/bnd9TzNBQQCzlyjInoDKwvf6CbhoE/rsp7L GEkvuW4JZX5b4XFKTmRXjzKa1JHLCILgDVfSM5aHc218aLG0QQc3ogvxANiC686a0PxfEjTFf2NQX I2imcXNrQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0K3-007830-EE; Fri, 07 May 2021 13:15:16 +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 1lf0JG-0077qr-86 for linux-arm-kernel@desiato.infradead.org; Fri, 07 May 2021 13:14:26 +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-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JD-006sZJ-N8 for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 13:14:25 +0000 Received: by mail-pl1-x62a.google.com with SMTP id h20so5122603plr.4 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=CUl9u6fV/qIrhB9kwLKTY5hh/sSIwSpeGcUvH7aCklvhdqfNMeBjuvx695W6XjCoQt bhLJooN79E28yhle0zuaZmQRKBvUSKvdmsn1cL9MDVza/uAwHpXZ4sN1QMBjiNgxC4QO jVXYcFAjOqs3ZdRRoDEQ7kKtat+lNUSILGUT0RhLL0h5epumBGVMidhSPelA8oY2eaM7 XaEb5hVai4SkfEUD87Nln48k0rnKPEG7G/bs+izr4m1XeIFeL1yiSLJxrQplaVq2pfkN THNPt+LA6gcXXdZAcWHDlb7m4E7g1IPNRAiMkKXp0PQ6r/iclp00C1tF+K5kXVPydVZJ f9Bw== X-Gm-Message-State: AOAM532rL3eIDp9VgkmKjfyOYVy+70KHaxAuNzB3mx10YCd0tPZ5vShn BuUIEVng1hguw9l+7y6MFpyFIQ== 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_759690_B28929F7 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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: 12244571 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 776C7C433B4 for ; Fri, 7 May 2021 13:17: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 CBBFC61443 for ; Fri, 7 May 2021 13:17:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBBFC61443 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-arm-kernel-bounces+linux-arm-kernel=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=WeOdIwrUO7VhSsUcU347vCfUwEeyn4QPm6XJPeDVA7k=; b=DSE+P2sUvu5kM2YJ2d5Khxbx/ twL/5Ws0kBCkr3nDW8Txt7VoKQrBOHc8dLYG/yhZWSFIeiQLHlFxqEpNug3b9iAILWQDCoPST0WT9 gvFGxdZYaGAZ14/RT39wF5/Ryfi1jfPe54+HVO7oIIvPWV5wKC6CXLzTCEw6EDxe2Ke7VYd5AirPs UZYSyDK8yQ3pvRDP4fV4k6swtnGrKPssG/3Zxcn0W2VlwyR+7uzqVhP375Kazi+5aubPR5Bl9Cykf EkCVzE99W3ew5uj8D0J5Au0/ZU7ZaG9TOu4VSiC5nThiG2q4t4Y6LU9V/Na9wmtq57GwLLTZJfsTe w0V/3Ryvg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lf0KG-00789o-CE; Fri, 07 May 2021 13:15:28 +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-0077rG-TI for linux-arm-kernel@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-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lf0JG-006sZq-CM for linux-arm-kernel@lists.infradead.org; Fri, 07 May 2021 13:14:27 +0000 Received: by mail-pf1-x42b.google.com with SMTP id k19so7595683pfu.5 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=syYLVRK1juAf/PrWuXpJhn3mtjqoS1dkuE5zNnHEosmP5wa7DptwMtHqjcQZh7HF90 OTpv8KFzubgq2mDyF6wNm8yRW8Bl/Af5E9MOoImqzKMRS4AZb6JV3lj+q7pPvthnFO20 yNJcWPZGwBJ60Aco81pQT/2EdOoZ8r7w2qYWZzkAkvU3DN+tfk5oxS2IbbzoM50wXe84 WyC4RyNGrwLTWF8z7Zv6KMiwj0BCA1F/mR5UhOfBFnw3FkGS18GrXw81EEstW4I7cCB3 c9Yo85sy9tDWw8pgM3MhovHF23IS9uZWJNDjw6xa5jJtWYp+nqVn8bCQKJ88TinZUbdU 1/cA== X-Gm-Message-State: AOAM532N2izuN+SRUZY0xPwoOSz4QW4PbuA9NfHNUHJiPsIwPNQdcwLr kFJpPVIZF0eOoWVXqt1vQKecfg== 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_437525_DC04D0CF X-CRM114-Status: GOOD ( 12.12 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=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>; }; };