gpio-handle-set-config-ioctl.rst 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. _GPIOHANDLE_SET_CONFIG_IOCTL:
  3. ***************************
  4. GPIOHANDLE_SET_CONFIG_IOCTL
  5. ***************************
  6. .. warning::
  7. This ioctl is part of chardev_v1.rst and is obsoleted by
  8. gpio-v2-line-set-config-ioctl.rst.
  9. Name
  10. ====
  11. GPIOHANDLE_SET_CONFIG_IOCTL - Update the configuration of previously requested lines.
  12. Synopsis
  13. ========
  14. .. c:macro:: GPIOHANDLE_SET_CONFIG_IOCTL
  15. ``int ioctl(int handle_fd, GPIOHANDLE_SET_CONFIG_IOCTL, struct gpiohandle_config *config)``
  16. Arguments
  17. =========
  18. ``handle_fd``
  19. The file descriptor of the GPIO character device, as returned in the
  20. :c:type:`request.fd<gpiohandle_request>` by gpio-get-linehandle-ioctl.rst.
  21. ``config``
  22. The new :c:type:`configuration<gpiohandle_config>` to apply to the
  23. requested lines.
  24. Description
  25. ===========
  26. Update the configuration of previously requested lines, without releasing the
  27. line or introducing potential glitches.
  28. The configuration applies to all requested lines.
  29. The same :ref:`gpio-get-linehandle-config-rules` and
  30. :ref:`gpio-get-linehandle-config-support` that apply when requesting the
  31. lines also apply when updating the line configuration, with the additional
  32. restriction that a direction flag must be set. Requesting an invalid
  33. configuration, including without a direction flag set, is an error
  34. (**EINVAL**).
  35. The motivating use case for this command is changing direction of
  36. bi-directional lines between input and output, but it may be used more
  37. generally to move lines seamlessly from one configuration state to another.
  38. To only change the value of output lines, use
  39. gpio-handle-set-line-values-ioctl.rst.
  40. First added in 5.5.
  41. Return Value
  42. ============
  43. On success 0.
  44. On error -1 and the ``errno`` variable is set appropriately.
  45. Common error codes are described in error-codes.rst.