Re: [questions] : gpiolib and gpioset behaviour

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

 



On Sat, Apr 27, 2024 at 02:09 PM Kent Gibson wrote:
> On Fri, Apr 26, 2024 at 10:07:20AM +0800, Kent Gibson wrote:
>> On Mon, Apr 22, 2024 at 06:49:05PM +0200, Gilles BULOZ wrote:
>>> On Mon, Apr 22, 2024 at 3:55 PM Bartosz Golaszewski wrote :
>>>> On Mon, Apr 22, 2024 at 2:44 PM Gilles BULOZ <gilles.buloz@xxxxxxxxxxx> wrote:
>>>>>
>>
>> Note that the mask in gc->get_multiple() is unsigned long*, so it is a
>> pointer to an array of unsigned long.  Its width is not limited by
>> unsigned long, but by the bits parameter.  In your case the mask you pass
>> should contain multiple unsigned longs to achieve 112 bits.
>> Refer to gpiod_get_array_value_complex() for an example of building bitmap
>> masks to pass to gc->get_multiple(), in that case via
>> gpio_chip_get_multiple().
>>
>
> Bah, what was I saying here - both the mask AND bits parameters of
> get_multiple()/set_multiple() are bitmaps of width gc->ngpio, where the
> mask identifies the pins to get/set and bits contains the values.
>
> My bad - must've been before the coffee soaked in.
>

Yes, that's clear to me now thanks to your explainations.
I also understand now the allocation of these "mask" and "bits". I was
missing the fact that gpiod_get_array_value_complex() has two calls to
gpio_chip_get_multiple(), the first without new allocation (value_bitmap
directly passed as last parameter to gpio_chip_get_multiple() and the
second allocating "mask" and "bits" (on FASTPATH_NGPIO bits so 512 bits
by default as set by CONFIG_GPIOLIB_FASTPATH_LIMIT). The second call
is the one used in the path from ioctl GPIO_V2_LINE_GET_VALUES_IOCTL to
the driver so OK.
The same occurs for gpiod_set_array_value_complex() having two calls to
gpio_chip_set_multiple() where the second one is used for ioctl
GPIO_V2_LINE_SET_VALUES_IOCTL.

> Cheers,
> Kent.
>
> .





[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