From patchwork Wed Aug 12 13:31:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 11710827 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BD2714F6 for ; Wed, 12 Aug 2020 13:31:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 23462204FD for ; Wed, 12 Aug 2020 13:31:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EuWoJwld"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="c2AHu8++" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23462204FD 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=7FUkXYe4JBrElE8juoYL5qPOfgiL1v4NwrleVPnMrpQ=; b=EuWoJwldKnWXrhQN1lHBR4bUG0 gobogaQeOPMiFJR3UEj3buohzgbC9WhEdWwyzQsakdEDLA6/9PjvvtuGDD2I1d0pltjnXYhJEcpjt 8B2AC2cYSWHOlfYBI9SRhT22bW+Ud2XHpGWwJ35Bt7YWWUmECtIRZWixH8uBbehbfhq6DpqgsXCt8 WwzjWFWDrM04ZZF7W8cKHVJfGQV/1BA0xbvebawqzQxnzv7xfI/aYmLyZ71rp1RAheuZH2MA/xIQl G4IXbIVkupKPKAZtk7A8aXOuOaMYlC3nJUWl/9N2ADBg05+bgDdci6MlM0WxAV9/aGQLtQ0jy6yj/ IxuBFrYg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5qqk-0004KR-4S; Wed, 12 Aug 2020 13:31:26 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5qqh-0004Iv-7X for linux-arm-kernel@lists.infradead.org; Wed, 12 Aug 2020 13:31:24 +0000 Received: by mail-pf1-x442.google.com with SMTP id y206so1024023pfb.10 for ; Wed, 12 Aug 2020 06:31:21 -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:mime-version :content-transfer-encoding; bh=vlf2gQ258Yo0xeKkYNMeBOCIHVe3hvJX2SMEJPRuUbY=; b=c2AHu8++qdSURlnEYQVRqISoN1mnzzPboyfje7CpVG4P/AdpneMgNGfx+vclZ3SmJZ mrOFXwgOO3vK6Am/uNIgDP/uUcboRU3d7JhhPETV+s21RG7g1SXIG4mFstfweGJ23OE4 T0M8LDUAq/EplxYiiQNFOrdpjZd8vxugMAX9g= 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:mime-version :content-transfer-encoding; bh=vlf2gQ258Yo0xeKkYNMeBOCIHVe3hvJX2SMEJPRuUbY=; b=qb65amuT0pFjCpY+ZXQNZb7PdnmzYnWNbxs1OweZvmyOFcGWHo4Zezywm6mxn5Hb/h /Yyw2+G+TfT7xJZkmWxHb9iX34xTaKwH3lXMUOmFfWXkhTFmqjilWBrR5IP0TYrWFhPp 21MSCCfINLn2sFJ5bYaPOWiIaxNo9/8L411UWXL5U5DJ/+AKXuzDVzG6PnHgh5FLGkoY 0ph9/g+L3raY4DLm4PL+fznn9nvwppH3C60u6HR6BQ6BGfzZvAcrB47mc90WB1lty4I4 zIzfj3rhaLTCZWbcPFGu2mWc9GMI6YlJr5vnM3zc3b1ibZGUxyQYJxfeYLdY/Djop/zY keJA== X-Gm-Message-State: AOAM533Bnj7yR6hyBfBNZpn8h3zZvLLdxBwg1U3TAyhOrhm3qb/pwUqe DcXjr9RB5eQDhTL+xRpWiq84Ts8jZ4w= X-Google-Smtp-Source: ABdhPJzpMXs76cDKrcxnEiUeiPgvpYo8pxBDIU68bf9PUiSC35Y94TDM35dGj/w0hCqzbdmyYT2Acw== X-Received: by 2002:aa7:9703:: with SMTP id a3mr11043496pfg.268.1597239079820; Wed, 12 Aug 2020 06:31:19 -0700 (PDT) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:1a60:24ff:fe89:3e93]) by smtp.gmail.com with ESMTPSA id b63sm2488143pfg.43.2020.08.12.06.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 06:31:19 -0700 (PDT) From: Hsin-Yi Wang To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] regulator: da9211: add cache_type Date: Wed, 12 Aug 2020 21:31:02 +0800 Message-Id: <20200812133101.2513317-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.28.0.236.gb10cc79966-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200812_093123_312246_599C70A9 X-CRM114-Status: GOOD ( 12.77 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Boichat , Support Opensource , Liam Girdwood , linux-kernel@vger.kernel.org, Daniel Kurtz , Tomasz Figa , Mark Brown Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add regmap_cache to reduce wakeups events of interrupt if regulator is accessed frequently. This results in saving more power. Suggested-by: Daniel Kurtz Signed-off-by: Hsin-Yi Wang Acked-by: Adam Thomson --- drivers/regulator/da9211-regulator.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index 297b3aa7c753..cffcefd0538d 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c @@ -51,10 +51,24 @@ static const struct regmap_range_cfg da9211_regmap_range[] = { }, }; +static bool da9211_volatile_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case DA9211_REG_STATUS_A: + case DA9211_REG_STATUS_B: + case DA9211_REG_EVENT_A: + case DA9211_REG_EVENT_B: + return true; + } + return false; +} + static const struct regmap_config da9211_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 5 * 128, + .volatile_reg = da9211_volatile_reg, + .cache_type = REGCACHE_RBTREE, .ranges = da9211_regmap_range, .num_ranges = ARRAY_SIZE(da9211_regmap_range), };