← Documents Documentation/i2c/old-module-parameters.rst GitHub 원문 ↗

Linux 6.18.37 · I2C

I2C device driver binding control from user-space in old kernels

커널 2.6의 probe·force·ignore 모듈 매개변수를 현재 i2c-core sysfs 인터페이스로 바꾸는 방법을 설명합니다.

Source pathDocumentation/i2c/old-module-parameters.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

old-module-parameters.rst:1-55

오래된 드라이버의 probe·force·ignore 매개변수는 i2c-core의 new_device 인터페이스로 대체되었습니다. 특정 주소를 막으려면 실제 드라이버보다 먼저 dummy 장치를 생성합니다.

문서 개요
항목
SourceDocumentation/i2c/old-module-parameters.rst
분량55 source lines
과거 매개변수 계열4
대체 인터페이스new_device

원문 분량과 핵심 검토 대상을 요약합니다.

핵심 흐름
과거 명령의 버스·주소 해석장치 이름 결정new_device로 중앙 생성차단 목적이면 dummy 선점

문서의 주요 생성·구성 순서를 압축합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ================================================================
2 I2C device driver binding control from user-space in old kernels
3 ================================================================
4
5 .. NOTE::
6 Note: this section is only relevant if you are handling some old code
7 found in kernel 2.6. If you work with more recent kernels, you can
8 safely skip this section.
9
10 Up to kernel 2.6.32, many I2C drivers used helper macros provided by
11 <linux/i2c.h> which created standard module parameters to let the user
12 control how the driver would probe I2C buses and attach to devices. These
13 parameters were known as ``probe`` (to let the driver probe for an extra
14 address), ``force`` (to forcibly attach the driver to a given device) and
15 ``ignore`` (to prevent a driver from probing a given address).
16
17 With the conversion of the I2C subsystem to the standard device driver
18 binding model, it became clear that these per-module parameters were no
19 longer needed, and that a centralized implementation was possible. The new,
20 sysfs-based interface is described in
21 Documentation/i2c/instantiating-devices.rst, section
22 "Method 4: Instantiate from user-space".
23
24 Below is a mapping from the old module parameters to the new interface.
25
26 Attaching a driver to an I2C device
27 -----------------------------------
28
29 Old method (module parameters)::
30
31 # modprobe <driver> probe=1,0x2d
32 # modprobe <driver> force=1,0x2d
33 # modprobe <driver> force_<device>=1,0x2d
34
35 New method (sysfs interface)::
36
37 # echo <device> 0x2d > /sys/bus/i2c/devices/i2c-1/new_device
38
39 Preventing a driver from attaching to an I2C device
40 ---------------------------------------------------
41
42 Old method (module parameters)::
43
44 # modprobe <driver> ignore=1,0x2f
45
46 New method (sysfs interface)::
47
48 # echo dummy 0x2f > /sys/bus/i2c/devices/i2c-1/new_device
49 # modprobe <driver>
50
51 Of course, it is important to instantiate the ``dummy`` device before loading
52 the driver. The dummy device will be handled by i2c-core itself, preventing
53 other drivers from binding to it later on. If there is a real device at the
54 problematic address, and you want another driver to bind to it, then simply
55 pass the name of the device in question instead of ``dummy``.
56

3. 한국어 전문 번역

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

오래된 커널의 I2C 바인딩 제어

1-24

이 절은 커널 2.6에서 발견한 오래된 코드를 다룰 때만 관련됩니다. 최신 커널로 작업한다면 건너뛰어도 됩니다.

커널 2.6.32까지 많은 I2C 드라이버는 `<linux/i2c.h>`가 제공하는 도우미 매크로로 표준 모듈 매개변수를 만들었습니다. 사용자는 이 매개변수로 드라이버가 I2C 버스를 probe하고 장치에 연결하는 방식을 제어했습니다.

`probe`는 드라이버가 추가 주소를 probe하게 하고, `force`는 지정 장치에 드라이버를 강제로 연결하며, `ignore`는 드라이버가 지정 주소를 probe하지 못하게 했습니다.

I2C 하위 시스템이 표준 장치 드라이버 바인딩 모델로 전환되면서 모듈별 매개변수는 더 이상 필요하지 않게 되었고 중앙 구현이 가능해졌습니다.

새 sysfs 기반 인터페이스는 `Documentation/i2c/instantiating-devices.rst`의 "Method 4: Instantiate from user-space" 절에 설명되어 있습니다.

과거 I2C 모듈 매개변수
매개변수목적
`probe`추가 주소를 probe
`force`지정 주소의 장치에 강제 연결
`force_<device>`지정 유형으로 강제 연결
`ignore`지정 주소 probe 방지

2.6.32까지의 사용자 공간 제어 항목입니다.

바인딩 모델 전환
과거 드라이버별 probe·force·ignore표준 device-driver 바인딩 모델 도입i2c-core에 중앙 장치 생성 인터페이스 구현`new_device` 기반 사용자 공간 생성

드라이버별 매개변수가 i2c-core의 공통 sysfs로 대체되었습니다.

================================================================
I2C device driver binding control from user-space in old kernels
================================================================

.. NOTE::
   Note: this section is only relevant if you are handling some old code
   found in kernel 2.6. If you work with more recent kernels, you can
   safely skip this section.

Up to kernel 2.6.32, many I2C drivers used helper macros provided by
<linux/i2c.h> which created standard module parameters to let the user
control how the driver would probe I2C buses and attach to devices. These
parameters were known as ``probe`` (to let the driver probe for an extra
address), ``force`` (to forcibly attach the driver to a given device) and
``ignore`` (to prevent a driver from probing a given address).

With the conversion of the I2C subsystem to the standard device driver
binding model, it became clear that these per-module parameters were no
longer needed, and that a centralized implementation was possible. The new,
sysfs-based interface is described in
Documentation/i2c/instantiating-devices.rst, section
"Method 4: Instantiate from user-space".

Below is a mapping from the old module parameters to the new interface.

장치 연결 방식의 변환

25-38

과거에는 `modprobe <driver> probe=1,0x2d`, `force=1,0x2d`, 또는 `force_<device>=1,0x2d`로 버스 1의 주소 `0x2d`에 드라이버를 연결했습니다.

새 방식은 `echo <device> 0x2d > /sys/bus/i2c/devices/i2c-1/new_device`로 i2c-core에 장치를 생성하도록 요청합니다.

과거 연결과 현재 sysfs
목적과거현재
주소 probe`modprobe <driver> probe=1,0x2d``new_device`에 장치 이름과 `0x2d` 기록
강제 연결`force=1,0x2d``new_device`에 장치 이름과 `0x2d` 기록
유형 지정 강제 연결`force_<device>=1,0x2d``echo <device> 0x2d > .../new_device`

동일한 버스·주소 작업을 비교합니다.


Attaching a driver to an I2C device
-----------------------------------

Old method (module parameters)::

  # modprobe <driver> probe=1,0x2d
  # modprobe <driver> force=1,0x2d
  # modprobe <driver> force_<device>=1,0x2d

New method (sysfs interface)::

  # echo <device> 0x2d > /sys/bus/i2c/devices/i2c-1/new_device

특정 주소의 드라이버 연결 방지

39-55

과거에는 `modprobe <driver> ignore=1,0x2f`로 버스 1의 주소 `0x2f`를 probe하지 않도록 했습니다.

새 방식에서는 먼저 `echo dummy 0x2f > /sys/bus/i2c/devices/i2c-1/new_device`로 해당 주소에 `dummy` 장치를 만든 뒤 실제 드라이버를 로드합니다.

반드시 드라이버를 로드하기 전에 `dummy` 장치를 생성해야 합니다. `dummy`는 i2c-core가 직접 처리하므로 이후 다른 드라이버가 그 주소에 바인딩하지 못합니다.

문제가 되는 주소에 실제 장치가 있고 다른 드라이버를 연결하려면 `dummy` 대신 해당 장치 이름을 전달하면 됩니다.

주소 예약으로 바인딩 방지
`new_device`에 `dummy 0x2f` 기록i2c-core가 dummy 장치 생성실제 드라이버 모듈 로드주소가 이미 점유되어 다른 드라이버 바인딩 방지

dummy 장치가 주소를 먼저 점유하게 합니다.

ignore 대체 규칙
의도`new_device` 이름
다른 드라이버의 바인딩 방지`dummy`
실제 장치에 올바른 드라이버 바인딩해당 장치의 실제 이름

주소를 막거나 실제 장치에 넘기는 방법입니다.

Preventing a driver from attaching to an I2C device
---------------------------------------------------

Old method (module parameters)::

  # modprobe <driver> ignore=1,0x2f

New method (sysfs interface)::

  # echo dummy 0x2f > /sys/bus/i2c/devices/i2c-1/new_device
  # modprobe <driver>

Of course, it is important to instantiate the ``dummy`` device before loading
the driver. The dummy device will be handled by i2c-core itself, preventing
other drivers from binding to it later on. If there is a real device at the
problematic address, and you want another driver to bind to it, then simply
pass the name of the device in question instead of ``dummy``.