Re: [PATCH 2/2] tools/gpio: add the gpio-hammer tool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 27, 2016 at 6:00 PM, Michael Welling <mwelling@xxxxxxxx> wrote:
> On Tue, Apr 26, 2016 at 10:54:26AM +0200, Linus Walleij wrote:
>> The gpio-hammer is used from userspace as an example of how
>> to retrieve a GPIO handle for one or several GPIO lines and
>> hammer the outputs from low to high and back again. It will
>> pulse the selected lines once per second for a specified
>> number of times or indefinitely if no loop count is
>> supplied.
>>
>> Example output:
>> $ gpio-hammer -n gpiochip0 -o5 -o6 -o7
>> Hammer lines [5, 6, 7] on gpiochip0, initial states: [1, 1, 1]
>> [-] [5: 0, 6: 0, 7: 0]
>>
>> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> Tested-by: Michael Welling <mwelling@xxxxxxxx>

Thanks! :)

> Below is the output from my target.

You can now get rid of all the "unnamed" in the first column
by supplying the line/rail names in gpio-line-names = "A", "B" ...;
in the GPIO controller node in the device tree for the platform,
if it uses device tree too boot.

> You will notice that a kernel warning is
> spewed out if I use the mcp23s08.
> The processor GPIOs work fine as verified by blinking LEDs.
>
> root@som3517-som200:~# ./lsgpio
> GPIO chip: gpiochip4, "mcp23s08", 8 GPIO lines
>         line  0: unnamed unused
>         line  1: unnamed unused
>         line  2: unnamed unused
>         line  3: unnamed unused
>         line  4: unnamed unused
>         line  5: unnamed unused
>         line  6: unnamed unused
>         line  7: unnamed unused

> root@som3517-som200:~# ./gpio-hammer -n gpiochip4 -o0
> [  187.511606] ------------[ cut here ]------------
> [  187.516949] WARNING: CPU: 0 PID: 830 at /home/michael/projects/linux/linux-git/drivers/gpio/gpiolib.c:1907 gpiod_get_value+0x60/0xa4

Ah that's right, I have to use gpiod_get_value_cansleep(). Will
fix that.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux