From patchwork Thu Oct 10 00:12:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 11182431 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 95C7014DB for ; Thu, 10 Oct 2019 00:12:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75D79206C0 for ; Thu, 10 Oct 2019 00:12:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732483AbfJJAMk (ORCPT ); Wed, 9 Oct 2019 20:12:40 -0400 Received: from muru.com ([72.249.23.125]:36792 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732334AbfJJAMj (ORCPT ); Wed, 9 Oct 2019 20:12:39 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id A28A68140; Thu, 10 Oct 2019 00:13:12 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Merlijn Wajer , Pavel Machek , Sebastian Reichel Subject: [PATCH 8/8] ARM: OMAP2+: Initialize voltage controller for omap4 Date: Wed, 9 Oct 2019 17:12:24 -0700 Message-Id: <20191010001224.41826-9-tony@atomide.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010001224.41826-1-tony@atomide.com> References: <20191010001224.41826-1-tony@atomide.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org We're missing initializing the PRM_VOLTCTRL register for voltage controller. Let's add omap4_vc_init_pmic_signaling() similar to what we have for omap3 and enable voltage control for retention. This brings down droid4 power consumption with mainline kernel to somewhere between 40 and 50mW from about 70 to 80 mW for the whole device when running idle with LCD and backlight off, WLAN connected, and USB and modem modules unloaded. Mostly just rmmod of omap2430, ohci-platform and phy-mapphone-mdm6600 are needed to idle USB and shut down the modem. And after that measuring idle power consumption can be done with reading sysfs entry every ten seconds for /sys/class/power_supply/battery/power_avg. Then rmmod of phy-cpcap-usb will save few more mW, but will disable the debug UART. Note that sometimes CM_L4PER_UART1_CLKCTRL at 0x4a009540 does not idle properly after unloading of phy-mapphone-mdm6600. Cc: Merlijn Wajer Cc: Pavel Machek Cc: Sebastian Reichel Signed-off-by: Tony Lindgren Acked-by: Pavel Machek Signed-off-by: Tony Lindgren Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/vc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c @@ -26,6 +26,16 @@ #include "scrm44xx.h" #include "control.h" +#define OMAP4430_AUTO_CTRL_VDD_IVA(x) ((x) << 4) +#define OMAP4430_AUTO_CTRL_VDD_MPU(x) ((x) << 2) +#define OMAP4430_AUTO_CTRL_VDD_CORE(x) ((x) << 0) +#define OMAP4430_AUTO_CTRL_VDD_RET 2 + +#define OMAP4_VDD_DEFAULT_VAL \ + (OMAP4430_AUTO_CTRL_VDD_IVA(OMAP4430_AUTO_CTRL_VDD_RET) | \ + OMAP4430_AUTO_CTRL_VDD_MPU(OMAP4430_AUTO_CTRL_VDD_RET) | \ + OMAP4430_AUTO_CTRL_VDD_CORE(OMAP4430_AUTO_CTRL_VDD_RET)) + /** * struct omap_vc_channel_cfg - describe the cfg_channel bitfield * @sa: bit for slave address @@ -542,9 +552,19 @@ static void omap4_set_timings(struct voltagedomain *voltdm, bool off_mode) writel_relaxed(val, OMAP4_SCRM_CLKSETUPTIME); } +static void __init omap4_vc_init_pmic_signaling(struct voltagedomain *voltdm) +{ + if (vc.vd) + return; + + vc.vd = voltdm; + voltdm->write(OMAP4_VDD_DEFAULT_VAL, OMAP4_PRM_VOLTCTRL_OFFSET); +} + /* OMAP4 specific voltage init functions */ static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) { + omap4_vc_init_pmic_signaling(voltdm); omap4_set_timings(voltdm, true); omap4_set_timings(voltdm, false); }