요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==================================
Regulator Machine Driver Interface
==================================
The regulator machine driver interface is intended for board/machine specific
initialisation code to configure the regulator subsystem.
Consider the following machine::
Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
|
+-> [Consumer B @ 3.3V]
The drivers for consumers A & B must be mapped to the correct regulator in
order to control their power supplies. This mapping can be achieved in machine
initialisation code by creating a struct regulator_consumer_supply for
each regulator::
struct regulator_consumer_supply {
const char *dev_name; /* consumer dev_name() */
const char *supply; /* consumer supply - e.g. "vcc" */
};
e.g. for the machine above::
static struct regulator_consumer_supply regulator1_consumers[] = {
REGULATOR_SUPPLY("Vcc", "consumer B"),
};
static struct regulator_consumer_supply regulator2_consumers[] = {
REGULATOR_SUPPLY("Vcc", "consumer A"),
};
This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
to the 'Vcc' supply for Consumer A.
Constraints can now be registered by defining a struct regulator_init_data
for each regulator power domain. This structure also maps the consumers
to their supply regulators::
static struct regulator_init_data regulator1_data = {
.constraints = {
.name = "Regulator-1",
.min_uV = 3300000,
.max_uV = 3300000,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(regulator1_consumers),
.consumer_supplies = regulator1_consumers,
};
The name field should be set to something that is usefully descriptive
for the board for configuration of supplies for other regulators and
for use in logging and other diagnostic output. Normally the name
used for the supply rail in the schematic is a good choice. If no
name is provided then the subsystem will choose one.
Regulator-1 supplies power to Regulator-2. This relationship must be registered
with the core so that Regulator-1 is also enabled when Consumer A enables its
supply (Regulator-2). The supply regulator is set by the supply_regulator
field below and co::
static struct regulator_init_data regulator2_data = {
.supply_regulator = "Regulator-1",
.constraints = {
.min_uV = 1800000,
.max_uV = 2000000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(regulator2_consumers),
.consumer_supplies = regulator2_consumers,
};
Finally the regulator devices must be registered in the usual manner::
static struct platform_device regulator_devices[] = {
{
.name = "regulator",
.id = DCDC_1,
.dev = {
.platform_data = ®ulator1_data,
},
},
{
.name = "regulator",
.id = DCDC_2,
.dev = {
.platform_data = ®ulator2_data,
},
},
};
/* register regulator 1 device */
platform_device_register(®ulator_devices[0]);
/* register regulator 2 device */
platform_device_register(®ulator_devices[1]);
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Board별 초기화와 예제 topology
1-13Regulator machine driver interface는 board 또는 machine-specific initialization code가 regulator subsystem을 configure하도록 마련됐습니다.
예제 machine에서 `Regulator-1`은 `Regulator-2`와 3.3V의 `Consumer B`에 전력을 공급하고, `Regulator-2`는 1.8~2.0V의 `Consumer A`에 전력을 공급합니다.
원문의 ASCII tree를 supply 관계로 재구성했습니다.
Regulator-1은 downstream regulator와 direct consumer를 함께 공급합니다.
==================================
Regulator Machine Driver Interface
==================================
The regulator machine driver interface is intended for board/machine specific
initialisation code to configure the regulator subsystem.
Consider the following machine::
Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
|
+-> [Consumer B @ 3.3V]
Consumer supply mapping
14-36Consumer A와 B의 driver가 supply를 제어하려면 올바른 regulator에 mapping되어야 합니다. Machine initialization code는 각 regulator에 `struct regulator_consumer_supply`를 만들어 mapping합니다.
이 structure의 `dev_name`은 consumer의 `dev_name()`이고 `supply`는 `vcc` 같은 consumer supply ID입니다.
예제에서 `regulator1_consumers`는 `REGULATOR_SUPPLY("Vcc", "consumer B")`, `regulator2_consumers`는 `REGULATOR_SUPPLY("Vcc", "consumer A")`를 담습니다. 그 결과 Regulator-1은 Consumer B의 `Vcc`에, Regulator-2는 Consumer A의 `Vcc`에 mapping됩니다.
같은 supply ID라도 consumer device name과 함께 regulator를 식별합니다.
The drivers for consumers A & B must be mapped to the correct regulator in
order to control their power supplies. This mapping can be achieved in machine
initialisation code by creating a struct regulator_consumer_supply for
each regulator::
struct regulator_consumer_supply {
const char *dev_name; /* consumer dev_name() */
const char *supply; /* consumer supply - e.g. "vcc" */
};
e.g. for the machine above::
static struct regulator_consumer_supply regulator1_consumers[] = {
REGULATOR_SUPPLY("Vcc", "consumer B"),
};
static struct regulator_consumer_supply regulator2_consumers[] = {
REGULATOR_SUPPLY("Vcc", "consumer A"),
};
This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
to the 'Vcc' supply for Consumer A.
Power-domain constraint와 upstream regulator
37-74각 regulator power domain에 `struct regulator_init_data`를 정의해 constraint를 등록하고 consumer를 supply regulator에 mapping합니다.
`regulator1_data`는 이름 `Regulator-1`, minimum·maximum 3300000µV, `REGULATOR_MODE_NORMAL` mode를 설정하고 consumer supply array를 연결합니다.
`name` field는 다른 regulator의 supply configuration과 log·diagnostic output에 유용하도록 board를 잘 설명해야 합니다. 보통 schematic의 supply rail 이름이 적합하며, 이름이 없으면 subsystem이 선택합니다.
Regulator-1이 Regulator-2를 공급하므로 Consumer A가 Regulator-2를 enable할 때 Regulator-1도 enable되도록 이 관계를 core에 등록해야 합니다. `regulator2_data.supply_regulator = "Regulator-1"`로 upstream supply를 지정합니다.
Regulator-2 constraint는 1800000~2000000µV, `REGULATOR_CHANGE_VOLTAGE` operation과 `REGULATOR_MODE_NORMAL` mode를 허용하고 Consumer A mapping을 연결합니다.
Board 지식으로 voltage와 허용 operation을 제한합니다.
Downstream consumer 요청은 supply_regulator 관계를 따라 upstream을 먼저 켭니다.
Constraints can now be registered by defining a struct regulator_init_data
for each regulator power domain. This structure also maps the consumers
to their supply regulators::
static struct regulator_init_data regulator1_data = {
.constraints = {
.name = "Regulator-1",
.min_uV = 3300000,
.max_uV = 3300000,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(regulator1_consumers),
.consumer_supplies = regulator1_consumers,
};
The name field should be set to something that is usefully descriptive
for the board for configuration of supplies for other regulators and
for use in logging and other diagnostic output. Normally the name
used for the supply rail in the schematic is a good choice. If no
name is provided then the subsystem will choose one.
Regulator-1 supplies power to Regulator-2. This relationship must be registered
with the core so that Regulator-1 is also enabled when Consumer A enables its
supply (Regulator-2). The supply regulator is set by the supply_regulator
field below and co::
static struct regulator_init_data regulator2_data = {
.supply_regulator = "Regulator-1",
.constraints = {
.min_uV = 1800000,
.max_uV = 2000000,
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
.valid_modes_mask = REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(regulator2_consumers),
.consumer_supplies = regulator2_consumers,
};
Platform device 등록
75-97마지막으로 regulator device를 일반적인 방식으로 등록합니다. `platform_device regulator_devices[]`에 이름 `regulator`, ID `DCDC_1`·`DCDC_2`, 각각의 `.platform_data`로 `regulator1_data`와 `regulator2_data`를 지정합니다.
그 뒤 `platform_device_register(®ulator_devices[0])`과 `[1]`을 호출해 Regulator-1과 Regulator-2 device를 등록합니다.
Topology와 constraint data를 platform device에 연결한 뒤 upstream 순서로 등록합니다.
Finally the regulator devices must be registered in the usual manner::
static struct platform_device regulator_devices[] = {
{
.name = "regulator",
.id = DCDC_1,
.dev = {
.platform_data = ®ulator1_data,
},
},
{
.name = "regulator",
.id = DCDC_2,
.dev = {
.platform_data = ®ulator2_data,
},
},
};
/* register regulator 1 device */
platform_device_register(®ulator_devices[0]);
/* register regulator 2 device */
platform_device_register(®ulator_devices[1]);
요약·해설
machine.rst:1-97Board별 consumer mapping, voltage constraint, upstream supply 관계와 platform-device 등록을 설명합니다.