← Documents Documentation/hwmon/pcf8591.rst GitHub 원문 ↗

Linux 6.18.37 · Hardware Monitoring

Kernel driver pcf8591

PCF8591 8비트 ADC/DAC의 네 아날로그 입력 모드와 명시적 I2C 생성을 설명합니다.

Source pathDocumentation/hwmon/pcf8591.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

pcf8591.rst:1-98

AIN0~AIN3을 단일 종단 또는 차동으로 조합하고 0x48~0x4f에 장치를 직접 생성해 8비트 입력과 출력을 사용합니다.

문서 개요
항목
SourceDocumentation/hwmon/pcf8591.rst
분량98 source lines
ADC 입력4
DAC 출력1

원문 분량과 핵심 장치 구성을 정리합니다.

운영 흐름
I2C 주소 확인input_mode 선택장치 생성ADC 읽기DAC 출력 활성화

장치 인식부터 측정·제어까지의 핵심 순서입니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 Kernel driver pcf8591
2 =====================
3
4 Supported chips:
5
6 * Philips/NXP PCF8591
7
8 Prefix: 'pcf8591'
9
10 Addresses scanned: none
11
12 Datasheet: Publicly available at the NXP website
13
14 http://www.nxp.com/pip/PCF8591_6.html
15
16 Authors:
17 - Aurelien Jarno <aurelien@aurel32.net>
18 - valuable contributions by Jan M. Sendler <sendler@sendler.de>,
19 - Jean Delvare <jdelvare@suse.de>
20
21
22 Description
23 -----------
24
25 The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
26 analog output) for the I2C bus produced by Philips Semiconductors (now NXP).
27 It is designed to provide a byte I2C interface to up to 4 separate devices.
28
29 The PCF8591 has 4 analog inputs programmable as single-ended or
30 differential inputs:
31
32 - mode 0 : four single ended inputs
33 Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3
34
35 - mode 1 : three differential inputs
36 Pins AIN3 is the common negative differential input
37 Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2
38
39 - mode 2 : single ended and differential mixed
40 Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
41 Pins AIN2 is the positive differential input for channel 3
42 Pins AIN3 is the negative differential input for channel 3
43
44 - mode 3 : two differential inputs
45 Pins AIN0 is the positive differential input for channel 0
46 Pins AIN1 is the negative differential input for channel 0
47 Pins AIN2 is the positive differential input for channel 1
48 Pins AIN3 is the negative differential input for channel 1
49
50 See the datasheet for details.
51
52 Module parameters
53 -----------------
54
55 * input_mode int
56
57 Analog input mode:
58
59 - 0 = four single ended inputs
60 - 1 = three differential inputs
61 - 2 = single ended and differential mixed
62 - 3 = two differential inputs
63
64
65 Accessing PCF8591 via /sys interface
66 -------------------------------------
67
68 The PCF8591 is plainly impossible to detect! Thus the driver won't even
69 try. You have to explicitly instantiate the device at the relevant
70 address (in the interval [0x48..0x4f]) either through platform data, or
71 using the sysfs interface. See Documentation/i2c/instantiating-devices.rst
72 for details.
73
74 Directories are being created for each instantiated PCF8591:
75
76 /sys/bus/i2c/devices/<0>-<1>/
77 where <0> is the bus the chip is connected to (e. g. i2c-0)
78 and <1> the chip address ([48..4f])
79
80 Inside these directories, there are such files:
81
82 in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name
83
84 Name contains chip name.
85
86 The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives
87 the value of the corresponding channel. Depending on the current analog inputs
88 configuration, files in2_input and in3_input may not exist. Values range
89 from 0 to 255 for single ended inputs and -128 to +127 for differential inputs
90 (8-bit ADC).
91
92 The out0_enable file is RW. Reading gives "1" for analog output enabled and
93 "0" for analog output disabled. Writing accepts "0" and "1" accordingly.
94
95 The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
96 the value to the digital-to-analog converter. Note that a voltage will
97 only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
98 value written.
99

3. 한국어 전문 번역

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

8비트 ADC/DAC와 네 입력 모드

1-50

Aurelien Jarno가 작성하고 Jan M. Sendler와 Jean Delvare가 기여한 `pcf8591` 드라이버는 Philips/NXP PCF8591을 지원합니다. 주소를 자동 검색하지 않으며 NXP 웹사이트에서 데이터시트를 구할 수 있습니다.

PCF8591은 I2C 버스용 8비트 A/D 및 D/A 변환기로 아날로그 입력 4개와 아날로그 출력 1개를 갖습니다. 바이트 단위 I2C 인터페이스로 최대 네 개의 개별 입력 장치를 처리하도록 설계되었습니다.

모드 0은 AIN0~AIN3을 채널 0~3의 단일 종단 입력으로 사용합니다. 모드 1은 AIN3을 공통 음의 차동 입력, AIN0~AIN2를 채널 0~2의 양의 차동 입력으로 사용합니다.

모드 2는 AIN0과 AIN1을 채널 0·1의 단일 종단 입력으로 쓰고 AIN2와 AIN3을 채널 3의 양·음 차동 입력으로 사용합니다. 모드 3은 AIN0/AIN1을 채널 0, AIN2/AIN3을 채널 1의 양·음 차동 쌍으로 사용합니다.

PCF8591 입력 모드
모드공개 채널AIN0AIN1AIN2AIN3
00~3CH0 단일CH1 단일CH2 단일CH3 단일
10~2CH0 +CH1 +CH2 +공통 -
20, 1, 3CH0 단일CH1 단일CH3 +CH3 -
30~1CH0 +CH0 -CH1 +CH1 -

네 핀의 단일 종단·차동 연결을 구조화했습니다.

아날로그 입력 구성
필요한 단일 종단·차동 채널 수 결정input_mode 0~3 선택AIN0~AIN3 배선 확인8비트 ADC 변환 실행존재하는 inX_input만 공개

input_mode에 맞춰 핀과 채널을 연결합니다.

Kernel driver pcf8591
=====================

Supported chips:

  * Philips/NXP PCF8591

    Prefix: 'pcf8591'

    Addresses scanned: none

    Datasheet: Publicly available at the NXP website

               http://www.nxp.com/pip/PCF8591_6.html

Authors:
      - Aurelien Jarno <aurelien@aurel32.net>
      - valuable contributions by Jan M. Sendler <sendler@sendler.de>,
      - Jean Delvare <jdelvare@suse.de>


Description
-----------

The PCF8591 is an 8-bit A/D and D/A converter (4 analog inputs and one
analog output) for the I2C bus produced by Philips Semiconductors (now NXP).
It is designed to provide a byte I2C interface to up to 4 separate devices.

The PCF8591 has 4 analog inputs programmable as single-ended or
differential inputs:

- mode 0 : four single ended inputs
        Pins AIN0 to AIN3 are single ended inputs for channels 0 to 3

- mode 1 : three differential inputs
        Pins AIN3 is the common negative differential input
        Pins AIN0 to AIN2 are positive differential inputs for channels 0 to 2

- mode 2 : single ended and differential mixed
        Pins AIN0 and AIN1 are single ended inputs for channels 0 and 1
        Pins AIN2 is the positive differential input for channel 3
        Pins AIN3 is the negative differential input for channel 3

- mode 3 : two differential inputs
        Pins AIN0 is the positive differential input for channel 0
        Pins AIN1 is the negative differential input for channel 0
        Pins AIN2 is the positive differential input for channel 1
        Pins AIN3 is the negative differential input for channel 1

See the datasheet for details.

input_mode와 명시적 장치 생성

51-72

정수형 모듈 매개변수 `input_mode`는 아날로그 입력 구성을 선택합니다. 0은 단일 종단 4개, 1은 차동 3개, 2는 단일 종단과 차동 혼합, 3은 차동 2개입니다.

PCF8591은 자동 감지가 불가능하므로 드라이버는 검색을 시도하지 않습니다. 플랫폼 데이터나 sysfs 인터페이스를 사용해 실제 주소에 장치를 명시적으로 생성해야 합니다.

허용 I2C 주소 범위는 `0x48..0x4f`입니다. 구체적인 생성 방법은 `Documentation/i2c/instantiating-devices.rst`를 참고합니다.

PCF8591 생성 매개변수
항목의미
input_mode=04 single-ended단일 종단 네 채널
input_mode=13 differential공통 음극 차동 세 채널
input_mode=2mixed단일 두 채널+차동 한 채널
input_mode=32 differential독립 차동 두 채널
I2C 주소0x48..0x4f플랫폼 또는 sysfs로 명시적 생성
자동 감지불가능주소 검색 안 함

입력 모드와 주소 지정 요구사항입니다.

장치 인스턴스 생성
실제 I2C 버스 확인0x48~0x4f 주소 확인input_mode 결정플랫폼 데이터 또는 sysfs로 생성드라이버 바인딩 확인

버스와 주소를 알고 있을 때만 장치를 등록합니다.


Module parameters
-----------------

* input_mode int

    Analog input mode:

         - 0 = four single ended inputs
         - 1 = three differential inputs
         - 2 = single ended and differential mixed
         - 3 = two differential inputs


Accessing PCF8591 via /sys interface
-------------------------------------

The PCF8591 is plainly impossible to detect! Thus the driver won't even
try. You have to explicitly instantiate the device at the relevant
address (in the interval [0x48..0x4f]) either through platform data, or
using the sysfs interface. See Documentation/i2c/instantiating-devices.rst
for details.

ADC 입력과 DAC 출력 sysfs

73-98

생성된 각 PCF8591에는 `/sys/bus/i2c/devices/<0>-<1>/` 디렉터리가 생깁니다. `<0>`은 `i2c-0` 같은 버스이고 `<1>`은 `48..4f`의 칩 주소입니다.

디렉터리에는 `in0_input`부터 `in3_input`, `out0_enable`, `out0_output`, `name`이 존재할 수 있습니다. `name`은 칩 이름을 담습니다.

입력 파일은 읽기 전용이며 해당 채널의 값을 반환합니다. 현재 입력 모드에 따라 `in2_input`과 `in3_input`은 없을 수 있습니다. 8비트 ADC 값 범위는 단일 종단 입력에서 0~255, 차동 입력에서 -128~+127입니다.

`out0_enable`은 읽기·쓰기가 가능하며 아날로그 출력 활성화는 1, 비활성화는 0입니다. `out0_output`도 읽기·쓰기가 가능하고 0~255 값을 8비트 DAC로 보냅니다.

AOUT 핀에 실제 전압이 나타나려면 `out0_enable`이 1이어야 합니다. `out0_output`을 읽으면 마지막으로 쓴 값을 반환합니다.

PCF8591 sysfs
속성권한범위·의미
nameRO칩 이름
in0_input~in3_inputROsingle 0~255, differential -128~127
in2/in3 존재 여부모드 의존input_mode에 따라 생략
out0_enableRW0 비활성, 1 활성
out0_outputRW0~255, 마지막 기록값 반환
AOUT 전압조건out0_enable=1이어야 출력

입력 범위와 출력 활성화 조건을 정리합니다.

DAC 출력 적용
out0_output에 0~255 기록out0_enable에 1 기록AOUT 핀 전압 확인필요 시 out0_output 갱신종료할 때 out0_enable을 0으로 설정

값을 기록하고 출력 활성화를 별도로 제어합니다.


Directories are being created for each instantiated PCF8591:

/sys/bus/i2c/devices/<0>-<1>/
   where <0> is the bus the chip is connected to (e. g. i2c-0)
   and <1> the chip address ([48..4f])

Inside these directories, there are such files:

   in0_input, in1_input, in2_input, in3_input, out0_enable, out0_output, name

Name contains chip name.

The in0_input, in1_input, in2_input and in3_input files are RO. Reading gives
the value of the corresponding channel. Depending on the current analog inputs
configuration, files in2_input and in3_input may not exist. Values range
from 0 to 255 for single ended inputs and -128 to +127 for differential inputs
(8-bit ADC).

The out0_enable file is RW. Reading gives "1" for analog output enabled and
"0" for analog output disabled. Writing accepts "0" and "1" accordingly.

The out0_output file is RW. Writing a number between 0 and 255 (8-bit DAC), send
the value to the digital-to-analog converter. Note that a voltage will
only appears on AOUT pin if aout0_enable equals 1. Reading returns the last
value written.