Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Documentation: gpio: Clarify effect of active low flag on line values

The documentation does not make sufficiently clear that the uAPI deals with
logical line values, nor does it describe the influence of the active low
flag on the mapping between physical and logical line values.

Clarify the relationship between physical and logical line values and the
effect of the active low flag for ioctls passing line values.

Suggested-by: David C. Rankin <drankinatty@gmail.com>
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240610092157.9147-2-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

authored by

Kent Gibson and committed by
Bartosz Golaszewski
5ca84d41 3ff1180a

+28
+7
Documentation/userspace-api/gpio/gpio-handle-get-line-values-ioctl.rst
··· 36 36 37 37 Get the values of all requested lines. 38 38 39 + The values returned are logical, indicating if the line is active or inactive. 40 + The ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` flag controls the mapping between physical 41 + values (high/low) and logical values (active/inactive). 42 + If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is not set then high is active and 43 + low is inactive. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is set then low is active 44 + and high is inactive. 45 + 39 46 The values of both input and output lines may be read. 40 47 41 48 For output lines, the value returned is driver and configuration dependent and
+7
Documentation/userspace-api/gpio/gpio-handle-set-line-values-ioctl.rst
··· 36 36 37 37 Set the values of all requested output lines. 38 38 39 + The values set are logical, indicating if the line is to be active or inactive. 40 + The ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` flag controls the mapping between logical 41 + values (active/inactive) and physical values (high/low). 42 + If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is not set then active is high and 43 + inactive is low. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is set then active is low 44 + and inactive is high. 45 + 39 46 Only the values of output lines may be set. 40 47 Attempting to set the value of input lines is an error (**EPERM**). 41 48
+7
Documentation/userspace-api/gpio/gpio-v2-line-get-values-ioctl.rst
··· 34 34 35 35 Get the values of requested lines. 36 36 37 + The values returned are logical, indicating if the line is active or inactive. 38 + The ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` flag controls the mapping between physical 39 + values (high/low) and logical values (active/inactive). 40 + If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is not set then high is active and low is 41 + inactive. If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is set then low is active and 42 + high is inactive. 43 + 37 44 The values of both input and output lines may be read. 38 45 39 46 For output lines, the value returned is driver and configuration dependent and
+7
Documentation/userspace-api/gpio/gpio-v2-line-set-values-ioctl.rst
··· 35 35 36 36 Set the values of requested output lines. 37 37 38 + The values set are logical, indicating if the line is to be active or inactive. 39 + The ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` flag controls the mapping between logical 40 + values (active/inactive) and physical values (high/low). 41 + If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is not set then active is high and inactive 42 + is low. If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is set then active is low and 43 + inactive is high. 44 + 38 45 Only the values of output lines may be set. 39 46 Attempting to set the value of an input line is an error (**EPERM**). 40 47