← Documents Documentation/userspace-api/gpio/gpio-handle-set-config-ioctl.rst GitHub 원문 ↗

Linux 6.18.37 · Userspace API

GPIOHANDLE_SET_CONFIG_IOCTL

기존 line handle을 유지한 채 모든 requested line을 무중단 재구성하는 ioctl과 제약을 설명합니다.

Source pathDocumentation/userspace-api/gpio/gpio-handle-set-config-ioctl.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

gpio-handle-set-config-ioctl.rst:1-66

기존 line handle을 유지한 채 모든 requested line을 무중단 재구성하는 ioctl과 제약을 설명합니다.

원문의 read/ioctl prototype, struct, flag, errno, clock, buffer 규칙과 줄 좌표를 보존해 전문 번역했습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

상태, 이름, 호출 형식

1-34

`GPIOHANDLE_SET_CONFIG_IOCTL`은 이미 요청한 GPIO line의 configuration을 갱신합니다. ABI v1 ioctl이며 `gpio-v2-line-set-config-ioctl.rst`로 대체되었습니다.

호출 형식은 `int ioctl(int handle_fd, GPIOHANDLE_SET_CONFIG_IOCTL, struct gpiohandle_config *config)`입니다. `handle_fd`는 line handle descriptor이고 `config`는 요청한 line에 적용할 새 `gpiohandle_config`입니다.

Line 재구성 인자
항목설명
handle_fdLine handle file descriptor
config새 struct gpiohandle_config

기존 handle의 모든 line에 새 구성을 적용합니다.

.. SPDX-License-Identifier: GPL-2.0

.. _GPIOHANDLE_SET_CONFIG_IOCTL:

***************************
GPIOHANDLE_SET_CONFIG_IOCTL
***************************

.. warning::
    This ioctl is part of chardev_v1.rst and is obsoleted by
    gpio-v2-line-set-config-ioctl.rst.

Name
====

GPIOHANDLE_SET_CONFIG_IOCTL - Update the configuration of previously requested lines.

Synopsis
========

.. c:macro:: GPIOHANDLE_SET_CONFIG_IOCTL

``int ioctl(int handle_fd, GPIOHANDLE_SET_CONFIG_IOCTL, struct gpiohandle_config *config)``

Arguments
=========

``handle_fd``
    The file descriptor of the GPIO character device, as returned in the
    :c:type:`request.fd<gpiohandle_request>` by gpio-get-linehandle-ioctl.rst.

``config``
    The new :c:type:`configuration<gpiohandle_config>` to apply to the
    requested lines.

무중단 재구성과 제약

35-59

Line을 해제하거나 잠재적인 glitch를 만들지 않고 이미 요청한 line의 구성을 갱신합니다. 새 구성은 handle에 포함된 모든 line에 적용됩니다.

Line을 처음 요청할 때 적용한 `gpio-get-linehandle-config-rules`와 `gpio-get-linehandle-config-support`가 갱신에도 그대로 적용됩니다. 추가로 방향 flag를 반드시 설정해야 합니다. 방향 flag가 없거나 그 밖에 유효하지 않은 구성이면 `EINVAL`입니다.

주요 사용 사례는 bidirectional line을 input과 output 사이에서 전환하는 것이지만, 일반적으로 line을 한 구성 상태에서 다른 상태로 끊김 없이 옮기는 데 사용할 수 있습니다. Output line의 값만 바꾸려면 `gpio-handle-set-line-values-ioctl.rst`를 사용합니다. 이 ioctl은 Linux 5.5에서 처음 추가되었습니다.

SET_CONFIG 제약
항목설명
적용 범위Handle의 모든 requested line
Line release발생하지 않음
Glitch잠재적 glitch 없이 전환
Direction flag반드시 필요
Invalid configurationEINVAL
값만 변경SET_LINE_VALUES ioctl 사용

기존 요청 규칙에 방향 flag 필수 조건이 추가됩니다.

Bidirectional line 전환
기존 line handle 유지새 gpiohandle_config 준비Direction flag와 조합 규칙 검증GPIOHANDLE_SET_CONFIG_IOCTL 호출Input 또는 output 구성으로 무중단 전환

Handle과 소유권을 유지한 채 구성 상태를 바꿉니다.


Description
===========

Update the configuration of previously requested lines, without releasing the
line or introducing potential glitches.

The configuration applies to all requested lines.

The same :ref:`gpio-get-linehandle-config-rules` and
:ref:`gpio-get-linehandle-config-support` that apply when requesting the
lines also apply when updating the line configuration, with the additional
restriction that a direction flag must be set. Requesting an invalid
configuration, including without a direction flag set, is an error
(**EINVAL**).

The motivating use case for this command is changing direction of
bi-directional lines between input and output, but it may be used more
generally to move lines seamlessly from one configuration state to another.

To only change the value of output lines, use
gpio-handle-set-line-values-ioctl.rst.

First added in 5.5.

반환값

60-66

성공하면 0을 반환합니다. 실패하면 -1을 반환하고 `errno`를 설정합니다. 공통 오류 코드는 `error-codes.rst`에 설명되어 있습니다.

Return Value
============

On success 0.

On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.