요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==================
The SMBus Protocol
==================
The following is a summary of the SMBus protocol. It applies to
all revisions of the protocol (1.0, 1.1, and 2.0).
Certain protocol features which are not supported by
this package are briefly described at the end of this document.
Some adapters understand only the SMBus (System Management Bus) protocol,
which is a subset from the I2C protocol. Fortunately, many devices use
only the same subset, which makes it possible to put them on an SMBus.
If you write a driver for some I2C device, please try to use the SMBus
commands if at all possible (if the device uses only that subset of the
I2C protocol). This makes it possible to use the device driver on both
SMBus adapters and I2C adapters (the SMBus command set is automatically
translated to I2C on I2C adapters, but plain I2C commands can not be
handled at all on most pure SMBus adapters).
Below is a list of SMBus protocol operations, and the functions executing
them. Note that the names used in the SMBus protocol specifications usually
don't match these function names. For some of the operations which pass a
single data byte, the functions using SMBus protocol operation names execute
a different protocol operation entirely.
Each transaction type corresponds to a functionality flag. Before calling a
transaction function, a device driver should always check (just once) for
the corresponding functionality flag to ensure that the underlying I2C
adapter supports the transaction in question. See
Documentation/i2c/functionality.rst for the details.
Key to symbols
==============
=============== =============================================================
S Start condition
Sr Repeated start condition, used to switch from write to
read mode.
P Stop condition
Rd/Wr (1 bit) Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) Acknowledge (ACK) and Not Acknowledge (NACK) bit
Addr (7 bits) I2C 7 bit address. Note that this can be expanded to
get a 10 bit I2C address.
Comm (8 bits) Command byte, a data byte which often selects a register on
the device.
Data (8 bits) A plain data byte. DataLow and DataHigh represent the low and
high byte of a 16 bit word.
Count (8 bits) A data byte containing the length of a block operation.
[..] Data sent by I2C device, as opposed to data sent by the host
adapter.
=============== =============================================================
SMBus Quick Command
===================
This sends a single bit to the device, at the place of the Rd/Wr bit::
S Addr Rd/Wr [A] P
Functionality flag: I2C_FUNC_SMBUS_QUICK
SMBus Receive Byte
==================
Implemented by i2c_smbus_read_byte()
This reads a single byte from a device, without specifying a device
register. Some devices are so simple that this interface is enough; for
others, it is a shorthand if you want to read the same register as in
the previous SMBus command::
S Addr Rd [A] [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_BYTE
SMBus Send Byte
===============
Implemented by i2c_smbus_write_byte()
This operation is the reverse of Receive Byte: it sends a single byte
to a device. See Receive Byte for more information.
::
S Addr Wr [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE
SMBus Read Byte
===============
Implemented by i2c_smbus_read_byte_data()
This reads a single byte from a device, from a designated register.
The register is specified through the Comm byte::
S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_BYTE_DATA
SMBus Read Word
===============
Implemented by i2c_smbus_read_word_data()
This operation is very like Read Byte; again, data is read from a
device, from a designated register that is specified through the Comm
byte. But this time, the data is a complete word (16 bits)::
S Addr Wr [A] Comm [A] Sr Addr Rd [A] [DataLow] A [DataHigh] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_WORD_DATA
Note the convenience function i2c_smbus_read_word_swapped() is
available for reads where the two data bytes are the other way
around (not SMBus compliant, but very popular.)
SMBus Write Byte
================
Implemented by i2c_smbus_write_byte_data()
This writes a single byte to a device, to a designated register. The
register is specified through the Comm byte. This is the opposite of
the Read Byte operation.
::
S Addr Wr [A] Comm [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE_DATA
SMBus Write Word
================
Implemented by i2c_smbus_write_word_data()
This is the opposite of the Read Word operation. 16 bits
of data are written to a device, to the designated register that is
specified through the Comm byte::
S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_WORD_DATA
Note the convenience function i2c_smbus_write_word_swapped() is
available for writes where the two data bytes are the other way
around (not SMBus compliant, but very popular.)
SMBus Process Call
==================
This command selects a device register (through the Comm byte), sends
16 bits of data to it, and reads 16 bits of data in return::
S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]
Sr Addr Rd [A] [DataLow] A [DataHigh] NA P
Functionality flag: I2C_FUNC_SMBUS_PROC_CALL
SMBus Block Read
================
Implemented by i2c_smbus_read_block_data()
This command reads a block of up to 32 bytes from a device, from a
designated register that is specified through the Comm byte. The amount
of data is specified by the device in the Count byte.
::
S Addr Wr [A] Comm [A]
Sr Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_BLOCK_DATA
SMBus Block Write
=================
Implemented by i2c_smbus_write_block_data()
The opposite of the Block Read command, this writes up to 32 bytes to
a device, to a designated register that is specified through the
Comm byte. The amount of data is specified in the Count byte.
::
S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
SMBus Block Write - Block Read Process Call
===========================================
SMBus Block Write - Block Read Process Call was introduced in
Revision 2.0 of the specification.
This command selects a device register (through the Comm byte), sends
1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return::
S Addr Wr [A] Comm [A] Count [A] Data [A] ...
Sr Addr Rd [A] [Count] A [Data] ... A P
Functionality flag: I2C_FUNC_SMBUS_BLOCK_PROC_CALL
SMBus Host Notify
=================
This command is sent from a SMBus device acting as a master to the
SMBus host acting as a slave.
It is the same form as Write Word, with the command code replaced by the
alerting device's address.
::
[S] [HostAddr] [Wr] A [DevAddr] A [DataLow] A [DataHigh] A [P]
This is implemented in the following way in the Linux kernel:
* I2C bus drivers which support SMBus Host Notify should report
I2C_FUNC_SMBUS_HOST_NOTIFY.
* I2C bus drivers trigger SMBus Host Notify by a call to
i2c_handle_smbus_host_notify().
* I2C drivers for devices which can trigger SMBus Host Notify will have
client->irq assigned to a Host Notify IRQ if no one else specified another.
There is currently no way to retrieve the data parameter from the client.
Packet Error Checking (PEC)
===========================
Packet Error Checking was introduced in Revision 1.1 of the specification.
PEC adds a CRC-8 error-checking byte to transfers using it, immediately
before the terminating STOP.
Address Resolution Protocol (ARP)
=================================
The Address Resolution Protocol was introduced in Revision 2.0 of
the specification. It is a higher-layer protocol which uses the
messages above.
ARP adds device enumeration and dynamic address assignment to
the protocol. All ARP communications use slave address 0x61 and
require PEC checksums.
SMBus Alert
===========
SMBus Alert was introduced in Revision 1.0 of the specification.
The SMBus alert protocol allows several SMBus slave devices to share a
single interrupt pin on the SMBus master, while still allowing the master
to know which slave triggered the interrupt.
This is implemented the following way in the Linux kernel:
* I2C bus drivers which support SMBus alert should call
i2c_new_smbus_alert_device() to install SMBus alert support.
* I2C drivers for devices which can trigger SMBus alerts should implement
the optional alert() callback.
I2C Block Transactions
======================
The following I2C block transactions are similar to the SMBus Block Read
and Write operations, except these do not have a Count byte. They are
supported by the SMBus layer and are described here for completeness, but
they are *NOT* defined by the SMBus specification.
I2C block transactions do not limit the number of bytes transferred
but the SMBus layer places a limit of 32 bytes.
I2C Block Read
==============
Implemented by i2c_smbus_read_i2c_block_data()
This command reads a block of bytes from a device, from a
designated register that is specified through the Comm byte::
S Addr Wr [A] Comm [A]
Sr Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_I2C_BLOCK
I2C Block Write
===============
Implemented by i2c_smbus_write_i2c_block_data()
The opposite of the Block Read command, this writes bytes to
a device, to a designated register that is specified through the
Comm byte. Note that command lengths of 0, 2, or more bytes are
supported as they are indistinguishable from data.
::
S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
SMBus 범위, 호환성과 기호
1-55이 문서는 SMBus 프로토콜 1.0, 1.1, 2.0 전체에 적용되는 요약입니다. 이 Linux 패키지가 지원하지 않는 일부 프로토콜 기능도 문서 끝에서 간단히 설명합니다.
일부 어댑터는 I2C의 부분집합인 SMBus(System Management Bus) 프로토콜만 이해합니다. 많은 장치도 이 공통 부분집합만 사용하므로 SMBus에 연결할 수 있습니다.
I2C 장치가 SMBus 부분집합만 사용한다면 드라이버는 가능한 한 SMBus 명령을 사용해야 합니다. 그러면 같은 드라이버를 SMBus 어댑터와 I2C 어댑터 모두에서 쓸 수 있습니다. I2C 어댑터는 SMBus 명령 집합을 일반 I2C로 자동 변환하지만, 순수 SMBus 어댑터 대부분은 임의의 일반 I2C 명령을 처리하지 못합니다.
아래 연산 이름과 이를 실행하는 Linux 함수 이름은 SMBus 규격의 이름과 항상 일치하지 않습니다. 특히 데이터 바이트 하나를 전달하는 일부 함수는 이름과 다른 프로토콜 연산을 실제로 수행할 수 있으므로 전송 형식을 확인해야 합니다.
각 트랜잭션 유형에는 대응 기능 플래그가 있습니다. 장치 드라이버는 트랜잭션 함수를 호출하기 전에 기반 I2C 어댑터가 해당 연산을 지원하는지 대응 플래그로 한 번 확인해야 합니다. 자세한 내용은 `Documentation/i2c/functionality.rst`를 참조합니다.
전송 순서 도식에서 사용하는 기호와 비트 폭입니다.
드라이버가 어댑터 기능을 확인하고 호출하는 순서입니다.
==================
The SMBus Protocol
==================
The following is a summary of the SMBus protocol. It applies to
all revisions of the protocol (1.0, 1.1, and 2.0).
Certain protocol features which are not supported by
this package are briefly described at the end of this document.
Some adapters understand only the SMBus (System Management Bus) protocol,
which is a subset from the I2C protocol. Fortunately, many devices use
only the same subset, which makes it possible to put them on an SMBus.
If you write a driver for some I2C device, please try to use the SMBus
commands if at all possible (if the device uses only that subset of the
I2C protocol). This makes it possible to use the device driver on both
SMBus adapters and I2C adapters (the SMBus command set is automatically
translated to I2C on I2C adapters, but plain I2C commands can not be
handled at all on most pure SMBus adapters).
Below is a list of SMBus protocol operations, and the functions executing
them. Note that the names used in the SMBus protocol specifications usually
don't match these function names. For some of the operations which pass a
single data byte, the functions using SMBus protocol operation names execute
a different protocol operation entirely.
Each transaction type corresponds to a functionality flag. Before calling a
transaction function, a device driver should always check (just once) for
the corresponding functionality flag to ensure that the underlying I2C
adapter supports the transaction in question. See
Documentation/i2c/functionality.rst for the details.
Key to symbols
==============
=============== =============================================================
S Start condition
Sr Repeated start condition, used to switch from write to
read mode.
P Stop condition
Rd/Wr (1 bit) Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) Acknowledge (ACK) and Not Acknowledge (NACK) bit
Addr (7 bits) I2C 7 bit address. Note that this can be expanded to
get a 10 bit I2C address.
Comm (8 bits) Command byte, a data byte which often selects a register on
the device.
Data (8 bits) A plain data byte. DataLow and DataHigh represent the low and
high byte of a 16 bit word.
Count (8 bits) A data byte containing the length of a block operation.
[..] Data sent by I2C device, as opposed to data sent by the host
adapter.
=============== =============================================================
Quick, Receive/Send Byte와 레지스터 Byte/Word 읽기
56-125SMBus Quick Command는 `Rd/Wr` 비트 위치에서 장치로 단일 비트를 보냅니다. 전송은 `S Addr Rd/Wr [A] P`이고 기능 플래그는 `I2C_FUNC_SMBUS_QUICK`입니다.
SMBus Receive Byte는 `i2c_smbus_read_byte()`로 구현합니다. 장치 레지스터를 지정하지 않고 한 바이트를 읽습니다. 단순 장치에는 이것만으로 충분하고, 다른 장치에서는 직전 SMBus 명령과 같은 레지스터를 다시 읽는 축약형으로 사용할 수 있습니다.
Receive Byte 전송은 `S Addr Rd [A] [Data] NA P`이고 기능 플래그는 `I2C_FUNC_SMBUS_READ_BYTE`입니다. 호스트는 데이터 한 바이트를 받은 뒤 NACK하고 STOP합니다.
SMBus Send Byte는 Receive Byte의 반대이며 `i2c_smbus_write_byte()`가 한 바이트를 장치에 보냅니다. 전송은 `S Addr Wr [A] Data [A] P`, 기능 플래그는 `I2C_FUNC_SMBUS_WRITE_BYTE`입니다.
SMBus Read Byte는 `i2c_smbus_read_byte_data()`로 지정 레지스터의 한 바이트를 읽습니다. `Comm` 바이트로 레지스터를 고른 뒤 repeated START로 read 방향을 시작합니다. 전송은 `S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P`이고 기능 플래그는 `I2C_FUNC_SMBUS_READ_BYTE_DATA`입니다.
SMBus Read Word는 `i2c_smbus_read_word_data()`로 지정 레지스터의 16비트 워드를 읽습니다. Read Byte와 같은 방식이지만 장치가 `DataLow`를 먼저, `DataHigh`를 다음에 보냅니다. 호스트는 하위 바이트에 ACK하고 마지막 상위 바이트에는 NACK합니다.
Read Word 전송은 `S Addr Wr [A] Comm [A] Sr Addr Rd [A] [DataLow] A [DataHigh] NA P`, 기능 플래그는 `I2C_FUNC_SMBUS_READ_WORD_DATA`입니다. SMBus 규격과 반대로 두 바이트를 보내는 흔한 장치는 편의 함수 `i2c_smbus_read_word_swapped()`로 읽을 수 있습니다.
연산별 Linux 함수, 전송 형식과 기능 플래그입니다.
Read Byte와 Read Word가 공유하는 방향 전환입니다.
SMBus Quick Command
===================
This sends a single bit to the device, at the place of the Rd/Wr bit::
S Addr Rd/Wr [A] P
Functionality flag: I2C_FUNC_SMBUS_QUICK
SMBus Receive Byte
==================
Implemented by i2c_smbus_read_byte()
This reads a single byte from a device, without specifying a device
register. Some devices are so simple that this interface is enough; for
others, it is a shorthand if you want to read the same register as in
the previous SMBus command::
S Addr Rd [A] [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_BYTE
SMBus Send Byte
===============
Implemented by i2c_smbus_write_byte()
This operation is the reverse of Receive Byte: it sends a single byte
to a device. See Receive Byte for more information.
::
S Addr Wr [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE
SMBus Read Byte
===============
Implemented by i2c_smbus_read_byte_data()
This reads a single byte from a device, from a designated register.
The register is specified through the Comm byte::
S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_BYTE_DATA
SMBus Read Word
===============
Implemented by i2c_smbus_read_word_data()
This operation is very like Read Byte; again, data is read from a
device, from a designated register that is specified through the Comm
byte. But this time, the data is a complete word (16 bits)::
S Addr Wr [A] Comm [A] Sr Addr Rd [A] [DataLow] A [DataHigh] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_WORD_DATA
Note the convenience function i2c_smbus_read_word_swapped() is
available for reads where the two data bytes are the other way
around (not SMBus compliant, but very popular.)
레지스터 Byte/Word 쓰기와 Process Call
126-173SMBus Write Byte는 `i2c_smbus_write_byte_data()`로 지정 레지스터에 한 바이트를 씁니다. `Comm`으로 레지스터를 선택하며 Read Byte의 반대입니다. 전송은 `S Addr Wr [A] Comm [A] Data [A] P`, 기능 플래그는 `I2C_FUNC_SMBUS_WRITE_BYTE_DATA`입니다.
SMBus Write Word는 `i2c_smbus_write_word_data()`로 지정 레지스터에 16비트 데이터를 씁니다. `DataLow`를 먼저 보내고 `DataHigh`를 보냅니다. 전송은 `S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P`, 기능 플래그는 `I2C_FUNC_SMBUS_WRITE_WORD_DATA`입니다.
장치가 두 바이트를 SMBus 규격과 반대 순서로 기대하는 흔한 경우에는 `i2c_smbus_write_word_swapped()` 편의 함수를 사용할 수 있습니다.
SMBus Process Call은 `Comm`으로 장치 레지스터를 선택하고 16비트 데이터를 쓴 뒤, STOP 없이 repeated START로 방향을 바꿔 16비트 결과를 읽습니다.
전송은 write 구간의 `S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]` 뒤에 read 구간의 `Sr Addr Rd [A] [DataLow] A [DataHigh] NA P`가 이어집니다. 기능 플래그는 `I2C_FUNC_SMBUS_PROC_CALL`입니다.
단방향 쓰기와 쓰기-읽기 결합을 비교합니다.
하나의 트랜잭션에서 요청 워드와 응답 워드를 교환합니다.
SMBus Write Byte
================
Implemented by i2c_smbus_write_byte_data()
This writes a single byte to a device, to a designated register. The
register is specified through the Comm byte. This is the opposite of
the Read Byte operation.
::
S Addr Wr [A] Comm [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_BYTE_DATA
SMBus Write Word
================
Implemented by i2c_smbus_write_word_data()
This is the opposite of the Read Word operation. 16 bits
of data are written to a device, to the designated register that is
specified through the Comm byte::
S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_WORD_DATA
Note the convenience function i2c_smbus_write_word_swapped() is
available for writes where the two data bytes are the other way
around (not SMBus compliant, but very popular.)
SMBus Process Call
==================
This command selects a device register (through the Comm byte), sends
16 bits of data to it, and reads 16 bits of data in return::
S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A]
Sr Addr Rd [A] [DataLow] A [DataHigh] NA P
Functionality flag: I2C_FUNC_SMBUS_PROC_CALL
블록 전송, Block Process Call과 Host Notify
174-245SMBus Block Read는 `i2c_smbus_read_block_data()`로 `Comm`이 지정하는 레지스터에서 최대 32바이트를 읽습니다. 장치가 `Count` 바이트로 데이터 양을 알려줍니다.
전송은 `S Addr Wr [A] Comm [A]` 뒤 repeated START와 `Addr Rd`가 이어지고, 장치가 `[Count]`와 그 수만큼의 `[Data]`를 보냅니다. 호스트는 중간 바이트마다 ACK하고 마지막 바이트에 NACK한 뒤 STOP합니다. 기능 플래그는 `I2C_FUNC_SMBUS_READ_BLOCK_DATA`입니다.
SMBus Block Write는 `i2c_smbus_write_block_data()`로 반대 방향의 전송을 수행합니다. `Comm`으로 레지스터를 지정하고 `Count`에 이어 최대 32바이트를 씁니다. 기능 플래그는 `I2C_FUNC_SMBUS_WRITE_BLOCK_DATA`입니다.
SMBus Block Write - Block Read Process Call은 규격 2.0에서 도입됐습니다. `Comm`으로 레지스터를 선택하고 1~31바이트를 쓴 뒤 repeated START로 1~31바이트를 읽습니다. 쓰기와 읽기 구간은 각각 자체 `Count`를 사용하며 기능 플래그는 `I2C_FUNC_SMBUS_BLOCK_PROC_CALL`입니다.
Count가 정하는 방향별 길이와 상한입니다.
SMBus Host Notify는 SMBus 장치가 마스터 역할로, 슬레이브 역할의 SMBus 호스트에 보내는 명령입니다. 형식은 Write Word와 같지만 command code 자리에 알림을 보낸 장치 주소가 들어갑니다.
전송은 장치가 주도하는 `[S] [HostAddr] [Wr] A [DevAddr] A [DataLow] A [DataHigh] A [P]`입니다.
Linux에서 Host Notify를 지원하는 I2C 버스 드라이버는 `I2C_FUNC_SMBUS_HOST_NOTIFY`를 보고해야 하고, 알림을 수신하면 `i2c_handle_smbus_host_notify()`를 호출합니다. Host Notify를 발생시킬 수 있는 장치의 I2C 드라이버는 다른 IRQ가 지정되지 않았을 때 `client->irq`에 Host Notify IRQ를 할당받습니다.
현재는 클라이언트에서 Host Notify의 data 매개변수를 가져오는 방법이 없습니다.
버스 드라이버와 장치 드라이버의 책임입니다.
장치가 마스터가 되어 호스트의 IRQ 처리로 이어집니다.
SMBus Block Read
================
Implemented by i2c_smbus_read_block_data()
This command reads a block of up to 32 bytes from a device, from a
designated register that is specified through the Comm byte. The amount
of data is specified by the device in the Count byte.
::
S Addr Wr [A] Comm [A]
Sr Addr Rd [A] [Count] A [Data] A [Data] A ... A [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_BLOCK_DATA
SMBus Block Write
=================
Implemented by i2c_smbus_write_block_data()
The opposite of the Block Read command, this writes up to 32 bytes to
a device, to a designated register that is specified through the
Comm byte. The amount of data is specified in the Count byte.
::
S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_BLOCK_DATA
SMBus Block Write - Block Read Process Call
===========================================
SMBus Block Write - Block Read Process Call was introduced in
Revision 2.0 of the specification.
This command selects a device register (through the Comm byte), sends
1 to 31 bytes of data to it, and reads 1 to 31 bytes of data in return::
S Addr Wr [A] Comm [A] Count [A] Data [A] ...
Sr Addr Rd [A] [Count] A [Data] ... A P
Functionality flag: I2C_FUNC_SMBUS_BLOCK_PROC_CALL
SMBus Host Notify
=================
This command is sent from a SMBus device acting as a master to the
SMBus host acting as a slave.
It is the same form as Write Word, with the command code replaced by the
alerting device's address.
::
[S] [HostAddr] [Wr] A [DevAddr] A [DataLow] A [DataHigh] A [P]
This is implemented in the following way in the Linux kernel:
* I2C bus drivers which support SMBus Host Notify should report
I2C_FUNC_SMBUS_HOST_NOTIFY.
* I2C bus drivers trigger SMBus Host Notify by a call to
i2c_handle_smbus_host_notify().
* I2C drivers for devices which can trigger SMBus Host Notify will have
client->irq assigned to a Host Notify IRQ if no one else specified another.
There is currently no way to retrieve the data parameter from the client.
PEC, ARP와 SMBus Alert
246-283Packet Error Checking(PEC)은 SMBus 규격 1.1에서 도입됐습니다. PEC를 사용하는 전송에서는 종료 STOP 바로 앞에 CRC-8 오류 검사 바이트 하나를 추가합니다.
Address Resolution Protocol(ARP)은 규격 2.0에서 도입된 상위 계층 프로토콜이며 앞에서 설명한 메시지를 사용합니다. 장치 열거와 동적 주소 할당 기능을 추가합니다.
모든 ARP 통신은 슬레이브 주소 `0x61`을 사용하며 PEC 체크섬이 필수입니다.
SMBus Alert는 규격 1.0에서 도입됐습니다. 여러 SMBus 슬레이브 장치가 SMBus 마스터의 인터럽트 핀 하나를 공유하면서도, 마스터가 어느 슬레이브가 인터럽트를 발생시켰는지 식별하게 합니다.
Linux에서 SMBus Alert를 지원하는 I2C 버스 드라이버는 `i2c_new_smbus_alert_device()`를 호출해 alert 지원을 설치해야 합니다. Alert를 발생시킬 수 있는 장치의 I2C 드라이버는 선택적 `alert()` 콜백을 구현해야 합니다.
도입 버전과 핵심 의미입니다.
공유 핀 인터럽트를 장치별 콜백으로 연결합니다.
Packet Error Checking (PEC)
===========================
Packet Error Checking was introduced in Revision 1.1 of the specification.
PEC adds a CRC-8 error-checking byte to transfers using it, immediately
before the terminating STOP.
Address Resolution Protocol (ARP)
=================================
The Address Resolution Protocol was introduced in Revision 2.0 of
the specification. It is a higher-layer protocol which uses the
messages above.
ARP adds device enumeration and dynamic address assignment to
the protocol. All ARP communications use slave address 0x61 and
require PEC checksums.
SMBus Alert
===========
SMBus Alert was introduced in Revision 1.0 of the specification.
The SMBus alert protocol allows several SMBus slave devices to share a
single interrupt pin on the SMBus master, while still allowing the master
to know which slave triggered the interrupt.
This is implemented the following way in the Linux kernel:
* I2C bus drivers which support SMBus alert should call
i2c_new_smbus_alert_device() to install SMBus alert support.
* I2C drivers for devices which can trigger SMBus alerts should implement
the optional alert() callback.
SMBus 계층이 제공하는 I2C Block 전송
284-324I2C block 트랜잭션은 SMBus Block Read/Write와 비슷하지만 `Count` 바이트가 없습니다. SMBus 계층이 완전성을 위해 지원하고 이 문서에서 설명하지만 SMBus 규격 자체에는 정의되지 않은 연산입니다.
I2C block 트랜잭션의 프로토콜 자체는 전송 바이트 수를 제한하지 않지만 Linux SMBus 계층은 32바이트로 제한합니다.
I2C Block Read는 `i2c_smbus_read_i2c_block_data()`로 `Comm`이 지정하는 레지스터에서 바이트 블록을 읽습니다. `S Addr Wr [A] Comm [A]` 뒤 repeated START로 read 방향을 열고, 장치 데이터들을 읽은 뒤 마지막 데이터에 NACK하고 STOP합니다. 기능 플래그는 `I2C_FUNC_SMBUS_READ_I2C_BLOCK`입니다.
I2C Block Write는 `i2c_smbus_write_i2c_block_data()`로 지정 레지스터에 바이트를 씁니다. 길이 0, 2 또는 그 이상의 command도 데이터와 구분할 수 없으므로 지원됩니다. 전송은 `S Addr Wr [A] Comm [A] Data [A] ... Data [A] P`, 기능 플래그는 `I2C_FUNC_SMBUS_WRITE_I2C_BLOCK`입니다.
Count 존재와 Linux 계층의 길이 제한을 구분합니다.
규격 외 I2C block 연산의 Linux API입니다.
I2C Block Transactions
======================
The following I2C block transactions are similar to the SMBus Block Read
and Write operations, except these do not have a Count byte. They are
supported by the SMBus layer and are described here for completeness, but
they are *NOT* defined by the SMBus specification.
I2C block transactions do not limit the number of bytes transferred
but the SMBus layer places a limit of 32 bytes.
I2C Block Read
==============
Implemented by i2c_smbus_read_i2c_block_data()
This command reads a block of bytes from a device, from a
designated register that is specified through the Comm byte::
S Addr Wr [A] Comm [A]
Sr Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
Functionality flag: I2C_FUNC_SMBUS_READ_I2C_BLOCK
I2C Block Write
===============
Implemented by i2c_smbus_write_i2c_block_data()
The opposite of the Block Read command, this writes bytes to
a device, to a designated register that is specified through the
Comm byte. Note that command lengths of 0, 2, or more bytes are
supported as they are indistinguishable from data.
::
S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P
Functionality flag: I2C_FUNC_SMBUS_WRITE_I2C_BLOCK
요약·해설
smbus-protocol.rst:1-324SMBus는 I2C의 공통 부분집합이며 Linux는 각 전송 유형을 `i2c_smbus_*` API와 기능 플래그로 노출합니다. 드라이버는 호출 전에 어댑터 지원을 확인하고 ACK, repeated START, Count와 바이트 순서를 해당 프로토콜에 맞춰야 합니다.
원문 분량과 핵심 검토 대상을 요약합니다.
문서의 주요 판단과 동작을 압축합니다.