This config enables implementation of driver-model pmic uclass features
for PMIC PFUZE100 in SPL. The driver implements read/write operations.
+config DM_PMIC_MAX8907
+ bool "Enable Driver Model for PMIC MAX8907"
+ ---help---
+ This config enables implementation of driver-model pmic uclass features
+ for PMIC MAX8907. The driver implements read/write operations.
+ This is a Power Management IC with a decent set of peripherals from which
+ 3 DC-to-DC Step-Down (SD) Regulators, 20 Low-Dropout Linear (LDO) Regulators,
+ Real-Time Clock (RTC) and more with I2C Compatible Interface.
+
config DM_PMIC_MAX77663
bool "Enable Driver Model for PMIC MAX77663"
---help---
obj-$(CONFIG_$(PHASE_)DM_PMIC_FAN53555) += fan53555.o
obj-$(CONFIG_$(PHASE_)DM_PMIC_DA9063) += da9063.o
obj-$(CONFIG_$(PHASE_)DM_PMIC_MAX77663) += max77663.o
+obj-$(CONFIG_$(PHASE_)DM_PMIC_MAX8907) += max8907.o
obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright(C) 2024 Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <dm.h>
+#include <dm/lists.h>
+#include <power/pmic.h>
+
+static int max8907_write(struct udevice *dev, uint reg, const uint8_t *buff, int len)
+{
+ int ret;
+
+ ret = dm_i2c_write(dev, reg, buff, len);
+ if (ret) {
+ log_debug("%s: write error to device: %p register: %#x!\n",
+ __func__, dev, reg);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int max8907_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+ int ret;
+
+ ret = dm_i2c_read(dev, reg, buff, len);
+ if (ret) {
+ log_debug("%s: read error from device: %p register: %#x!\n",
+ __func__, dev, reg);
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct dm_pmic_ops max8907_ops = {
+ .read = max8907_read,
+ .write = max8907_write,
+};
+
+static const struct udevice_id max8907_ids[] = {
+ { .compatible = "maxim,max8907" },
+ { }
+};
+
+U_BOOT_DRIVER(pmic_max8907) = {
+ .name = "max8907_pmic",
+ .id = UCLASS_PMIC,
+ .of_match = max8907_ids,
+ .ops = &max8907_ops,
+};