mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
67 lines
1.4 KiB
C
67 lines
1.4 KiB
C
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* ADC module for Chrome EC */
|
|
|
|
#include "adc.h"
|
|
#include "adc_chip.h"
|
|
#include "common.h"
|
|
#include "console.h"
|
|
#include "util.h"
|
|
|
|
/* 'adc' console command is not supported in continuous mode */
|
|
#ifndef CONFIG_ADC_PROFILE_FAST_CONTINUOUS
|
|
static enum adc_channel find_adc_channel_by_name(const char *name)
|
|
{
|
|
const struct adc_t *ch = adc_channels;
|
|
int i;
|
|
|
|
if (!name || !*name)
|
|
return ADC_CH_COUNT;
|
|
|
|
for (i = 0; i < ADC_CH_COUNT; i++, ch++) {
|
|
if (!strcasecmp(name, ch->name))
|
|
return i;
|
|
}
|
|
|
|
return ADC_CH_COUNT;
|
|
}
|
|
|
|
static int print_one_adc(int channel)
|
|
{
|
|
int v;
|
|
|
|
v = adc_read_channel(channel);
|
|
if (v == ADC_READ_ERROR)
|
|
return EC_ERROR_UNKNOWN;
|
|
ccprintf(" %s = %d\n", adc_channels[channel].name, v);
|
|
return EC_SUCCESS;
|
|
}
|
|
|
|
static int command_adc(int argc, char **argv)
|
|
{
|
|
int i, ret;
|
|
|
|
/* If a channel is specified, read only that one */
|
|
if (argc == 2) {
|
|
i = find_adc_channel_by_name(argv[1]);
|
|
if (i == ADC_CH_COUNT)
|
|
return EC_ERROR_PARAM1;
|
|
return print_one_adc(i);
|
|
} else {
|
|
/* Otherwise print them all */
|
|
for (i = 0; i < ADC_CH_COUNT; ++i) {
|
|
ret = print_one_adc(i);
|
|
if (ret)
|
|
return ret;
|
|
}
|
|
return EC_SUCCESS;
|
|
}
|
|
}
|
|
DECLARE_CONSOLE_COMMAND(adc, command_adc,
|
|
"[name]",
|
|
"Print ADC channel(s)");
|
|
#endif
|