[U-Boot] [PATCH] cmd: add ADC cli commands
Simon Glass
sjg at chromium.org
Mon Apr 30 23:12:31 UTC 2018
Hi Neil,
On 27 April 2018 at 04:07, Neil Armstrong <narmstrong at baylibre.com> wrote:
> Hi,
>
> On 26/04/2018 16:40, Simon Glass wrote:
>> Hi Neil,
>>
>> On 23 April 2018 at 08:18, Neil Armstrong <narmstrong at baylibre.com> wrote:
>>> Add an 'adc' cli command to get adc devices informations and read single
>>> shots datas.
>>>
>>> Signed-off-by: Neil Armstrong <narmstrong at baylibre.com>
>>> ---
>>> cmd/Kconfig | 7 ++++
>>> cmd/Makefile | 1 +
>>> cmd/adc.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 3 files changed, 134 insertions(+)
>>> create mode 100644 cmd/adc.c
>>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>>
>> Nits below
>>
>>>
>>> diff --git a/cmd/Kconfig b/cmd/Kconfig
>>> index bc1d2f3..631daee 100644
>>> --- a/cmd/Kconfig
>>> +++ b/cmd/Kconfig
>>> @@ -601,6 +601,13 @@ config CMD_ARMFLASH
>>> help
>>> ARM Ltd reference designs flash partition access
>>>
>>> +config CMD_ADC
>>> + bool "adc - Access ADC info and data"
>>> + select ADC
>>> + select DM_REGULATOR
>>> + help
>>> + Shows ADC device info and get single shot data;
>>
>> Please spell out ADC in the help. Also, what is single-shot data?
>
> I'll add more text.
>
>>
>>> +
>>> config CMD_CLK
>>> bool "clk - Show clock frequencies"
>>> help
>>> diff --git a/cmd/Makefile b/cmd/Makefile
>>> index c4269ac..4c66353 100644
>>> --- a/cmd/Makefile
>>> +++ b/cmd/Makefile
>>> @@ -14,6 +14,7 @@ obj-y += version.o
>>>
>>> # command
>>> obj-$(CONFIG_CMD_AES) += aes.o
>>> +obj-$(CONFIG_CMD_ADC) += adc.o
>>> obj-$(CONFIG_CMD_ARMFLASH) += armflash.o
>>> obj-y += blk_common.o
>>> obj-$(CONFIG_SOURCE) += source.o
>>> diff --git a/cmd/adc.c b/cmd/adc.c
>>> new file mode 100644
>>> index 0000000..f82305c
>>> --- /dev/null
>>> +++ b/cmd/adc.c
>>> @@ -0,0 +1,126 @@
>>> +/*
>>> + * Copyright (C) 2018 BayLibre, SAS
>>> + * Author: Neil Armstrong <narmstrong at baylibre.com>
>>> + *
>>> + * SPDX-License-Identifier: GPL-2.0+
>>> + */
>>> +#include <common.h>
>>> +#include <command.h>
>>> +#include <dm.h>
>>> +#include <adc.h>
>>> +
>>> +static int do_adc_list(cmd_tbl_t *cmdtp, int flag, int argc,
>>> + char *const argv[])
>>> +{
>>> + struct udevice *dev;
>>> + int ret;
>>> +
>>> + ret = uclass_first_device_err(UCLASS_ADC, &dev);
>>
>> This will probe the device. Is that what you want?
>
> Is there another way ?
> I mean you need to probe to know if the device is actually usable, no ?
You can use something like uclass_find_first_device() which doesn't probe.
Regards,
Simon
More information about the U-Boot
mailing list