From patchwork Tue Aug 14 17:06:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10565897 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F3131057 for ; Tue, 14 Aug 2018 17:06:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7675F2A478 for ; Tue, 14 Aug 2018 17:06:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A74B2A4C4; Tue, 14 Aug 2018 17:06:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 104802A478 for ; Tue, 14 Aug 2018 17:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387624AbeHNTy4 (ORCPT ); Tue, 14 Aug 2018 15:54:56 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:44309 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387621AbeHNTy4 (ORCPT ); Tue, 14 Aug 2018 15:54:56 -0400 Received: by mail-pl0-f66.google.com with SMTP id ba4-v6so8557652plb.11 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=oy2JCMzPcu8OZwZl186h30OYp8DYYcc0iXvfq0xCReMtYGGjVWb7Tr/pMVlKaN1XVu mH6+4wxtFu8NKn9l5mxdlwws3J/nehGtc1w9WA/Obx/SL0xsHBKVfDIF8STw4rKVrdG9 Gt9RkvYdz6EVuFrmwr9yAlAocgVUKUl5kqMQDstwKgChEL45z/oR9mt3VwoaZ386DkUk WDb7N5QgmqfsG0wC3w5aH5I+legxcNqdRGJ0InEgSaamPHLY2jK3KNNP7/wZio1oup4E w7vYpBxJTa0b5Iaocuuobh9NDqaVGsYVAop9+qxtTQI63EDxiL3A/d32BVuwFzjN3eyz QDyg== X-Gm-Message-State: AOUpUlGGUdxKyne2zw98kEuMbNC5SyKXNxPgH1m8j5cVO7l4bpmDNSQC SmjoPAqfTT8Az/8jH78UjG11h04/rAc= X-Google-Smtp-Source: AA+uWPyQrwjmOQuqmBW8AnCV+/Mz0X0CtsBBURdzMZmqqFH5AB+24KWSqB98yK8eGYfQzr3lqMH75A== 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);