[U-Boot] [PATCH 09/12] sandbox: add: sandbox PMIC device drivers: I2C emul, pmic, regulator

Przemyslaw Marczak p.marczak at samsung.com
Tue May 12 11:43:26 CEST 2015


Hello Simon,

On 05/10/2015 03:57 PM, Simon Glass wrote:
> Hi Przemyslaw,
>
> On 8 May 2015 at 10:20, Przemyslaw Marczak <p.marczak at samsung.com> wrote:
>> This commit adds emulation of sandbox PMIC device, which includes:
>> - PMIC I2C emulation driver
>> - PMIC I/O driver (UCLASS_PMIC)
>> - PMIC regulator driver (UCLASS_REGULATOR)
>>
>> The sandbox PMIC has 12 significant registers and 4 as padding to 16 bytes,
>> which allows using 'i2c md' command with the default count (16).
>>
>> The sandbox PMIC provides regulators:
>> - 2x BUCK
>> - 2x LDO
>>
>> Each, with adjustable output:
>> - Enable state
>> - Voltage
>> - Current limit (LDO1/BUCK1 only)
>> - Operation mode (different for BUCK and LDO)
>>
>> Each attribute has it's own register, beside the enable state, which depends
>> on operation mode.
>>
>> The header file: sandbox_pmic.h includes PMIC's default register values,
>> which are set on i2c pmic emul driver's probe() method.
>>
>> Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
>> ---
>>   doc/device-tree-bindings/pmic/sandbox.txt      |  35 +++
>>   doc/device-tree-bindings/regulator/sandbox.txt |  45 ++++
>>   drivers/power/pmic/Kconfig                     |  25 ++
>>   drivers/power/pmic/Makefile                    |   3 +-
>>   drivers/power/pmic/i2c_pmic_emul.c             | 145 ++++++++++
>>   drivers/power/pmic/sandbox.c                   |  79 ++++++
>>   drivers/power/regulator/Kconfig                |  30 +++
>>   drivers/power/regulator/Makefile               |   1 +
>>   drivers/power/regulator/sandbox.c              | 355 +++++++++++++++++++++++++
>>   include/power/sandbox_pmic.h                   | 189 +++++++++++++
>>   10 files changed, 906 insertions(+), 1 deletion(-)
>>   create mode 100644 doc/device-tree-bindings/pmic/sandbox.txt
>>   create mode 100644 doc/device-tree-bindings/regulator/sandbox.txt
>>   create mode 100644 drivers/power/pmic/i2c_pmic_emul.c
>>   create mode 100644 drivers/power/pmic/sandbox.c
>>   create mode 100644 drivers/power/regulator/sandbox.c
>>   create mode 100644 include/power/sandbox_pmic.h
>
> Acked-by: Simon Glass <sjg at chromium.org>
> Tested on sandbox:
> Tested-by: Simon Glass <sjg at chromium.org>
>
> I expected i2c_pmic_emul to get its settings from the device tree too
> - is that not possible for some reason?
>
> Regards,
> Simon
>

To put the default PMIC register settings into device tree,
I would like add some changes:
- add arch/sandbox/dts/include/dt-bindings/pmic/sandbox_pmic.h - to 
define "VAL2REG(min, step, val)" macro and operation mode IDs
- add arch/sandbox/dts/sandbox_pmic.dtsi
- include the sandbox_pmic.dtsi in sandbox.dts
- include the sandbox_pmic.dtsi in test.dts

And the last one is a problem, because it's compiled without the U-Boot 
build system - but by dtc command. I could extend the dtc by arg '-i' - 
to include the sandbox_pmic.dtsi, but then, still I can't use the 
preprocessor macro.

I think, that move the "test.dts" into "arch/sandbox/dts" directory is a 
good idea in this case.

Is that acceptable for you?

Actually I didn't used the script "test-dm.sh" before, since I just 
compile the U-Boot by my own script with the "dtc" routine.

Best regards,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com


More information about the U-Boot mailing list