mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-24 20:13:39 +00:00
526c4f2e43
These PMICs provide some combination of battery charger, fuel gauge, GPIOs, regulators, and VBUS routing. These functions are represented as child nodes in the device tree. Add the minimal driver needed to probe these child devices and provide the DM_PMIC ops. Enable the driver by default for SoCs that normally pair with a PMIC. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
38 lines
903 B
C
38 lines
903 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
#include <dm.h>
|
|
#include <i2c.h>
|
|
#include <power/pmic.h>
|
|
|
|
static int axp_pmic_reg_count(struct udevice *dev)
|
|
{
|
|
/* TODO: Get the specific value from driver data. */
|
|
return 0x100;
|
|
}
|
|
|
|
static struct dm_pmic_ops axp_pmic_ops = {
|
|
.reg_count = axp_pmic_reg_count,
|
|
.read = dm_i2c_read,
|
|
.write = dm_i2c_write,
|
|
};
|
|
|
|
static const struct udevice_id axp_pmic_ids[] = {
|
|
{ .compatible = "x-powers,axp152" },
|
|
{ .compatible = "x-powers,axp202" },
|
|
{ .compatible = "x-powers,axp209" },
|
|
{ .compatible = "x-powers,axp221" },
|
|
{ .compatible = "x-powers,axp223" },
|
|
{ .compatible = "x-powers,axp803" },
|
|
{ .compatible = "x-powers,axp806" },
|
|
{ .compatible = "x-powers,axp809" },
|
|
{ .compatible = "x-powers,axp813" },
|
|
{ }
|
|
};
|
|
|
|
U_BOOT_DRIVER(axp_pmic) = {
|
|
.name = "axp_pmic",
|
|
.id = UCLASS_PMIC,
|
|
.of_match = axp_pmic_ids,
|
|
.bind = dm_scan_fdt_dev,
|
|
.ops = &axp_pmic_ops,
|
|
};
|