Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4758360ooa; Tue, 14 Aug 2018 10:08:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz+4zQwtfXpov64eTga4eXOjwDl/0ZMASxpaISSlp0tNKeuO/L3ew8nfEW8cAsI/p6ec8fs X-Received: by 2002:a62:34c4:: with SMTP id b187-v6mr23945073pfa.15.1534266512797; Tue, 14 Aug 2018 10:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534266512; cv=none; d=google.com; s=arc-20160816; b=PJAj4L9EYXJxCxyCafk3uDNV1GGNxWwRqdMFYI6WHO6CmNyr73oa5SCdwKzksIjvEh vdXuMM/G5h2+6UFzcYOW5RH6kVSFqc5rnp+SPv6yEVhI/g75IFhIi17T8jt0BGB6S3Z2 FHp4Wxkjl+pRTVBevrMemDm/rYc7mpsz0NVoFq7+1BH4IrfvAUCZ3k4VuZx1NAaFyTYP N5r7PMrDY7wDR7izOKdzhtPsawj7X/8Af1RdRWAyuGb2LWl2pnMPyM59qGh/brrhiyaz if1KWXuJShdBluCM0UZ9f8qD+VLuSrlRF56q87HXkk8ZpG8giw/KPxYBzt3Z21L/It82 J2Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=0IryqUHHn803R0vItVfBlrN0avv0GNYFsdGQ+ij7oqE=; b=dfWw1w6pr3CrlW2mWtmDUWMWGKodX4aAC4MuFvJsUaY7TMDrOC6ZLbSmXlQhVCHe5s KuF7QI2Q2bXeIAM/ZfK/g3KofCiQCi3hMDpwpnUrWlxyHZzCtnDlWpV6xmLcEWyuNCUF e81w4CeH4pzbgUAV98aDzR/+0F0nSJ/QUCJ0+b0yoRU9FhzONm8+tH2iFJLsWUu9VQD6 TpZOCPzk2wngzC8WtOGheF7BiNMCYhV4k8wbKHW8qoQUoX9+TBAbYQvX8gklntR+UIcO VzswDjX410Off7v4mhZed5L8pBKWfUbSJB1jaafGwJnW1KXklAIefdmX8PqpDeE84Hk1 3fPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZeNjSzz5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z125-v6si23450334pfz.10.2018.08.14.10.08.17; Tue, 14 Aug 2018 10:08:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZeNjSzz5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387647AbeHNTyz (ORCPT + 99 others); Tue, 14 Aug 2018 15:54:55 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:46321 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387624AbeHNTyz (ORCPT ); Tue, 14 Aug 2018 15:54:55 -0400 Received: by mail-pl0-f68.google.com with SMTP id t17-v6so8551007ply.13 for ; Tue, 14 Aug 2018 10:06:55 -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=0IryqUHHn803R0vItVfBlrN0avv0GNYFsdGQ+ij7oqE=; b=ZeNjSzz5HLbhfuNJQcituRS361qr5a2daqWMHzECXaRpDGJcRXC60eouLteyl9fz4V KWPpR40choIe2dSpDgi+pQ+Hxxxv1VoKbzOjNGFZRXZRmrd8GeMbkZI83V7w28imhiHp dtyeDugjHMhp3RT3mq1Olmymyaq5bVW7WHKWw= 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=0IryqUHHn803R0vItVfBlrN0avv0GNYFsdGQ+ij7oqE=; b=QVLAqtQ8aAXbfFm21Nd0VctzNAE+s6/nZ5FWsbCWISP+lDJX6q0huJ4C+U9XeslfFG mx7DS49S3gAAcu7li2kChFfGnSMsuGJYjj76CImmIcJFWo+V+jCdMe57FdBNf8kTK8Ef UY/eo+Zgbk/3AY4RVP0ORTnscIGcwLoR6s+/KWzv9pfYTUXRC1+yebwfmxavERB2vL13 t/hpIF2/25X2eBwaH8waVkC3wze4dUsINJyjN/+LgVkt1w8ACXubdtmX9i3bBO+nUF5B 8MYAcPzZWOvnrtvg71nl5OSMAqnSCRJskvnUmjpceHwI3975MWHEbJEUHhBnCSjQ8c8J 7/8A== X-Gm-Message-State: AOUpUlHilFs+glOgpT/z/BJtSY684EE2d9XD2j8Hiby7pEPHjILdiqZy eMMLiXneMriGmCMkgSfTqcxyig== X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr21189586plg.153.1534266415190; Tue, 14 Aug 2018 10:06:55 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:c8e0:70d7:4be7:a36]) by smtp.gmail.com with ESMTPSA id d19-v6sm67940763pfe.42.2018.08.14.10.06.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Aug 2018 10:06:54 -0700 (PDT) From: Douglas Anderson To: broonie@kernel.org Cc: linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, collinsd@codeaurora.org, swboyd@chromium.org, Douglas Anderson , Liam Girdwood , linux-kernel@vger.kernel.org Subject: [PATCH 2/4] regulator: core: Add the opmode to regulator_summary Date: Tue, 14 Aug 2018 10:06:15 -0700 Message-Id: <20180814170617.100087-3-dianders@chromium.org> X-Mailer: git-send-email 2.18.0.865.gffc8e1a3cd6-goog In-Reply-To: <20180814170617.100087-1-dianders@chromium.org> References: <20180814170617.100087-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's handy to know what opmode a regulator has been configured to in the summary. Add it. Signed-off-by: Douglas Anderson --- drivers/regulator/core.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a4da68775b49..b8b8048efbdd 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -426,19 +426,24 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_RO(name); -static ssize_t regulator_print_opmode(char *buf, int mode) +static const char *regulator_opmode_to_str(int mode) { switch (mode) { case REGULATOR_MODE_FAST: - return sprintf(buf, "fast\n"); + return "fast"; case REGULATOR_MODE_NORMAL: - return sprintf(buf, "normal\n"); + return "normal"; case REGULATOR_MODE_IDLE: - return sprintf(buf, "idle\n"); + return "idle"; case REGULATOR_MODE_STANDBY: - return sprintf(buf, "standby\n"); + return "standby"; } - return sprintf(buf, "unknown\n"); + return "unknown"; +} + +static ssize_t regulator_print_opmode(char *buf, int mode) +{ + return sprintf(buf, "%s\n", regulator_opmode_to_str(mode)); } static ssize_t regulator_opmode_show(struct device *dev, @@ -4668,10 +4673,11 @@ static void regulator_summary_show_subtree(struct seq_file *s, if (!rdev) return; - seq_printf(s, "%*s%-*s %3d %4d %6d ", + seq_printf(s, "%*s%-*s %3d %4d %6d %7s ", level * 3 + 1, "", 30 - level * 3, rdev_get_name(rdev), - rdev->use_count, rdev->open_count, rdev->bypass_count); + rdev->use_count, rdev->open_count, rdev->bypass_count, + regulator_opmode_to_str(_regulator_get_mode(rdev))); seq_printf(s, "%5dmV ", _regulator_get_voltage(rdev) / 1000); seq_printf(s, "%5dmA ", _regulator_get_current_limit(rdev) / 1000); @@ -4703,7 +4709,7 @@ static void regulator_summary_show_subtree(struct seq_file *s, switch (rdev->desc->type) { case REGULATOR_VOLTAGE: - seq_printf(s, "%37dmV %5dmV", + seq_printf(s, "%45dmV %5dmV", consumer->voltage[PM_SUSPEND_ON].min_uV / 1000, consumer->voltage[PM_SUSPEND_ON].max_uV / 1000); break; @@ -4735,8 +4741,8 @@ static int regulator_summary_show_roots(struct device *dev, void *data) static int regulator_summary_show(struct seq_file *s, void *data) { - seq_puts(s, " regulator use open bypass voltage current min max\n"); - seq_puts(s, "-------------------------------------------------------------------------------\n"); + seq_puts(s, " regulator use open bypass opmode voltage current min max\n"); + seq_puts(s, "---------------------------------------------------------------------------------------\n"); class_for_each_device(®ulator_class, NULL, s, regulator_summary_show_roots); -- 2.18.0.865.gffc8e1a3cd6-goog