aboutsummaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/Makefile4
-rw-r--r--drivers/power/battery/Makefile7
-rw-r--r--drivers/power/battery/bat_trats.c91
-rw-r--r--drivers/power/battery/bat_trats2.c65
-rw-r--r--drivers/power/ftpmu010.c87
-rw-r--r--drivers/power/fuel_gauge/Makefile6
-rw-r--r--drivers/power/fuel_gauge/fg_max17042.c287
-rw-r--r--drivers/power/mfd/Makefile8
-rw-r--r--drivers/power/mfd/fg_max77693.c137
-rw-r--r--drivers/power/mfd/muic_max77693.c77
-rw-r--r--drivers/power/mfd/pmic_max77693.c96
-rw-r--r--drivers/power/pmic/Makefile1
-rw-r--r--drivers/power/pmic/muic_max8997.c74
13 files changed, 0 insertions, 940 deletions
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index f805027784d..ba64b2c5938 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -4,10 +4,7 @@
# Tom Rix <Tom.Rix at windriver.com>
obj-$(CONFIG_$(SPL_TPL_)ACPI_PMC) += acpi_pmc/
-obj-y += battery/
obj-$(CONFIG_$(SPL_TPL_)POWER_DOMAIN) += domain/
-obj-y += fuel_gauge/
-obj-y += mfd/
obj-y += pmic/
obj-y += regulator/
@@ -18,7 +15,6 @@ obj-$(CONFIG_AXP305_POWER) += axp305.o
obj-$(CONFIG_AXP809_POWER) += axp809.o
obj-$(CONFIG_AXP818_POWER) += axp818.o
obj-$(CONFIG_EXYNOS_TMU) += exynos-tmu.o
-obj-$(CONFIG_FTPMU010_POWER) += ftpmu010.o
obj-$(CONFIG_SY8106A_POWER) += sy8106a.o
obj-$(CONFIG_TPS6586X_POWER) += tps6586x.o
obj-$(CONFIG_TWL4030_POWER) += twl4030.o
diff --git a/drivers/power/battery/Makefile b/drivers/power/battery/Makefile
deleted file mode 100644
index 370923a6ed9..00000000000
--- a/drivers/power/battery/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2012 Samsung Electronics
-# Lukasz Majewski <l.majewski@samsung.com>
-
-obj-$(CONFIG_POWER_BATTERY_TRATS) += bat_trats.o
-obj-$(CONFIG_POWER_BATTERY_TRATS2) += bat_trats2.o
diff --git a/drivers/power/battery/bat_trats.c b/drivers/power/battery/bat_trats.c
deleted file mode 100644
index 54b2bf91e5c..00000000000
--- a/drivers/power/battery/bat_trats.c
+++ /dev/null
@@ -1,91 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2012 Samsung Electronics
- * Lukasz Majewski <l.majewski@samsung.com>
- */
-
-#include <common.h>
-#include <console.h>
-#include <log.h>
-#include <linux/delay.h>
-#include <power/pmic.h>
-#include <power/battery.h>
-#include <power/max8997_pmic.h>
-#include <errno.h>
-
-static struct battery battery_trats;
-
-static int power_battery_charge(struct pmic *bat)
-{
- struct power_battery *p_bat = bat->pbat;
- struct battery *battery = p_bat->bat;
- int k;
-
- if (bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_ENABLE, 450))
- return -1;
-
- for (k = 0; bat->chrg->chrg_bat_present(p_bat->chrg) &&
- bat->chrg->chrg_type(p_bat->muic) &&
- battery->state_of_chrg < 100; k++) {
- udelay(2000000);
- if (!(k % 5))
- puts(".");
- bat->fg->fg_battery_update(p_bat->fg, bat);
-
- if (k == 200) {
- debug(" %d [V]", battery->voltage_uV);
- puts("\n");
- k = 0;
- }
-
- if (ctrlc()) {
- printf("\nCharging disabled on request.\n");
- goto exit;
- }
- }
- exit:
- bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_DISABLE, 0);
-
- return 0;
-}
-
-static int power_battery_init_trats(struct pmic *bat_,
- struct pmic *fg_,
- struct pmic *chrg_,
- struct pmic *muic_)
-{
- bat_->pbat->fg = fg_;
- bat_->pbat->chrg = chrg_;
- bat_->pbat->muic = muic_;
-
- bat_->fg = fg_->fg;
- bat_->chrg = chrg_->chrg;
- bat_->chrg->chrg_type = muic_->chrg->chrg_type;
- return 0;
-}
-
-static struct power_battery power_bat_trats = {
- .bat = &battery_trats,
- .battery_init = power_battery_init_trats,
- .battery_charge = power_battery_charge,
-};
-
-int power_bat_init(unsigned char bus)
-{
- static const char name[] = "BAT_TRATS";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board BAT init\n");
-
- p->interface = PMIC_NONE;
- p->name = name;
- p->bus = bus;
-
- p->pbat = &power_bat_trats;
- return 0;
-}
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
deleted file mode 100644
index 1172970d1e0..00000000000
--- a/drivers/power/battery/bat_trats2.c
+++ /dev/null
@@ -1,65 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2013 Samsung Electronics
- * Piotr Wilczek <p.wilczek@samsung.com>
- */
-
-#include <common.h>
-#include <log.h>
-#include <power/pmic.h>
-#include <power/battery.h>
-#include <power/max77693_pmic.h>
-#include <errno.h>
-
-static struct battery battery_trats;
-
-static int power_battery_charge(struct pmic *bat)
-{
- struct power_battery *p_bat = bat->pbat;
-
- if (bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_ENABLE, 450))
- return -EINVAL;
-
- return 0;
-}
-
-static int power_battery_init_trats2(struct pmic *bat_,
- struct pmic *fg_,
- struct pmic *chrg_,
- struct pmic *muic_)
-{
- bat_->pbat->fg = fg_;
- bat_->pbat->chrg = chrg_;
- bat_->pbat->muic = muic_;
-
- bat_->fg = fg_->fg;
- bat_->chrg = chrg_->chrg;
- bat_->chrg->chrg_type = muic_->chrg->chrg_type;
- return 0;
-}
-
-static struct power_battery power_bat_trats2 = {
- .bat = &battery_trats,
- .battery_init = power_battery_init_trats2,
- .battery_charge = power_battery_charge,
-};
-
-int power_bat_init(unsigned char bus)
-{
- static const char name[] = "BAT_TRATS2";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board BAT init\n");
-
- p->interface = PMIC_NONE;
- p->name = name;
- p->bus = bus;
-
- p->pbat = &power_bat_trats2;
- return 0;
-}
diff --git a/drivers/power/ftpmu010.c b/drivers/power/ftpmu010.c
deleted file mode 100644
index 9a48b36554d..00000000000
--- a/drivers/power/ftpmu010.c
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2009 Faraday Technology
- * Po-Yu Chuang <ratbert@faraday-tech.com>
- *
- * Copyright (C) 2010 Andes Technology Corporation
- * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
- * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <faraday/ftpmu010.h>
-
-/* OSCC: OSC Control Register */
-void ftpmu010_32768osc_enable(void)
-{
- static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
- unsigned int oscc;
-
- /* enable the 32768Hz oscillator */
- oscc = readl(&pmu->OSCC);
- oscc &= ~(FTPMU010_OSCC_OSCL_OFF | FTPMU010_OSCC_OSCL_TRI);
- writel(oscc, &pmu->OSCC);
-
- /* wait until ready */
- while (!(readl(&pmu->OSCC) & FTPMU010_OSCC_OSCL_STABLE))
- ;
-
- /* select 32768Hz oscillator */
- oscc = readl(&pmu->OSCC);
- oscc |= FTPMU010_OSCC_OSCL_RTCLSEL;
- writel(oscc, &pmu->OSCC);
-}
-
-/* MFPSR: Multi-Function Port Setting Register */
-void ftpmu010_mfpsr_select_dev(unsigned int dev)
-{
- static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
- unsigned int mfpsr;
-
- mfpsr = readl(&pmu->MFPSR);
- mfpsr |= dev;
- writel(mfpsr, &pmu->MFPSR);
-}
-
-void ftpmu010_mfpsr_diselect_dev(unsigned int dev)
-{
- static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
- unsigned int mfpsr;
-
- mfpsr = readl(&pmu->MFPSR);
- mfpsr &= ~dev;
- writel(mfpsr, &pmu->MFPSR);
-}
-
-/* PDLLCR0: PLL/DLL Control Register 0 */
-void ftpmu010_dlldis_disable(void)
-{
- static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
- unsigned int pdllcr0;
-
- pdllcr0 = readl(&pmu->PDLLCR0);
- pdllcr0 |= FTPMU010_PDLLCR0_DLLDIS;
- writel(pdllcr0, &pmu->PDLLCR0);
-}
-
-void ftpmu010_sdram_clk_disable(unsigned int cr0)
-{
- static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
- unsigned int pdllcr0;
-
- pdllcr0 = readl(&pmu->PDLLCR0);
- pdllcr0 |= FTPMU010_PDLLCR0_HCLKOUTDIS(cr0);
- writel(pdllcr0, &pmu->PDLLCR0);
-}
-
-/* SDRAMHTC: SDRAM Signal Hold Time Control */
-void ftpmu010_sdramhtc_set(unsigned int val)
-{
- static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
- unsigned int sdramhtc;
-
- sdramhtc = readl(&pmu->SDRAMHTC);
- sdramhtc |= val;
- writel(sdramhtc, &pmu->SDRAMHTC);
-}
diff --git a/drivers/power/fuel_gauge/Makefile b/drivers/power/fuel_gauge/Makefile
deleted file mode 100644
index ca2df947585..00000000000
--- a/drivers/power/fuel_gauge/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2012 Samsung Electronics
-# Lukasz Majewski <l.majewski@samsung.com>
-
-obj-$(CONFIG_POWER_FG_MAX17042) += fg_max17042.o
diff --git a/drivers/power/fuel_gauge/fg_max17042.c b/drivers/power/fuel_gauge/fg_max17042.c
deleted file mode 100644
index a395d587a86..00000000000
--- a/drivers/power/fuel_gauge/fg_max17042.c
+++ /dev/null
@@ -1,287 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2012 Samsung Electronics
- * Lukasz Majewski <l.majewski@samsung.com>
- */
-
-#include <common.h>
-#include <log.h>
-#include <linux/delay.h>
-#include <power/pmic.h>
-#include <power/max17042_fg.h>
-#include <i2c.h>
-#include <power/max8997_pmic.h>
-#include <power/power_chrg.h>
-#include <power/battery.h>
-#include <power/fg_battery_cell_params.h>
-#include <errno.h>
-
-static int fg_write_regs(struct pmic *p, u8 addr, u16 *data, int num)
-{
- int ret = 0;
- int i;
-
- for (i = 0; i < num; i++, addr++) {
- ret = pmic_reg_write(p, addr, *(data + i));
- if (ret)
- return ret;
- }
-
- return 0;
-}
-
-static int fg_read_regs(struct pmic *p, u8 addr, u16 *data, int num)
-{
- unsigned int dat;
- int ret = 0;
- int i;
-
- for (i = 0; i < num; i++, addr++) {
- ret = pmic_reg_read(p, addr, &dat);
- if (ret)
- return ret;
-
- *(data + i) = (u16)dat;
- }
-
- return 0;
-}
-
-static int fg_write_and_verify(struct pmic *p, u8 addr, u16 data)
-{
- unsigned int val = data;
- int ret = 0;
-
- ret |= pmic_reg_write(p, addr, val);
- ret |= pmic_reg_read(p, addr, &val);
-
- if (ret)
- return ret;
-
- if (((u16) val) == data)
- return 0;
-
- return -1;
-}
-
-static void por_fuelgauge_init(struct pmic *p)
-{
- u16 r_data0[16], r_data1[16], r_data2[16];
- u32 rewrite_count = 5;
- u32 check_count;
- u32 lock_count;
- u32 i = 0;
- u32 val;
- s32 ret = 0;
- char *status_msg;
-
- /* Delay 500 ms */
- mdelay(500);
- /* Initilize Configuration */
- pmic_reg_write(p, MAX17042_CONFIG, 0x2310);
-
-rewrite_model:
- check_count = 5;
- lock_count = 5;
-
- if (!rewrite_count--) {
- status_msg = "init failed!";
- goto error;
- }
-
- /* Unlock Model Access */
- pmic_reg_write(p, MAX17042_MLOCKReg1, MODEL_UNLOCK1);
- pmic_reg_write(p, MAX17042_MLOCKReg2, MODEL_UNLOCK2);
-
- /* Write/Read/Verify the Custom Model */
- ret = fg_write_regs(p, MAX17042_MODEL1, cell_character0,
- ARRAY_SIZE(cell_character0));
- if (ret)
- goto rewrite_model;
-
- ret = fg_write_regs(p, MAX17042_MODEL2, cell_character1,
- ARRAY_SIZE(cell_character1));
- if (ret)
- goto rewrite_model;
-
- ret = fg_write_regs(p, MAX17042_MODEL3, cell_character2,
- ARRAY_SIZE(cell_character2));
- if (ret)
- goto rewrite_model;
-
-check_model:
- if (!check_count--) {
- if (rewrite_count)
- goto rewrite_model;
- else
- status_msg = "check failed!";
-
- goto error;
- }
-
- ret = fg_read_regs(p, MAX17042_MODEL1, r_data0, ARRAY_SIZE(r_data0));
- if (ret)
- goto check_model;
-
- ret = fg_read_regs(p, MAX17042_MODEL2, r_data1, ARRAY_SIZE(r_data1));
- if (ret)
- goto check_model;
-
- ret = fg_read_regs(p, MAX17042_MODEL3, r_data2, ARRAY_SIZE(r_data2));
- if (ret)
- goto check_model;
-
- for (i = 0; i < 16; i++) {
- if ((cell_character0[i] != r_data0[i])
- || (cell_character1[i] != r_data1[i])
- || (cell_character2[i] != r_data2[i]))
- goto rewrite_model;
- }
-
-lock_model:
- if (!lock_count--) {
- if (rewrite_count)
- goto rewrite_model;
- else
- status_msg = "lock failed!";
-
- goto error;
- }
-
- /* Lock model access */
- pmic_reg_write(p, MAX17042_MLOCKReg1, MODEL_LOCK1);
- pmic_reg_write(p, MAX17042_MLOCKReg2, MODEL_LOCK2);
-
- /* Verify the model access is locked */
- ret = fg_read_regs(p, MAX17042_MODEL1, r_data0, ARRAY_SIZE(r_data0));
- if (ret)
- goto lock_model;
-
- ret = fg_read_regs(p, MAX17042_MODEL2, r_data1, ARRAY_SIZE(r_data1));
- if (ret)
- goto lock_model;
-
- ret = fg_read_regs(p, MAX17042_MODEL3, r_data2, ARRAY_SIZE(r_data2));
- if (ret)
- goto lock_model;
-
- for (i = 0; i < ARRAY_SIZE(r_data0); i++) {
- /* Check if model locked */
- if (r_data0[i] || r_data1[i] || r_data2[i])
- goto lock_model;
- }
-
- /* Write Custom Parameters */
- fg_write_and_verify(p, MAX17042_RCOMP0, RCOMP0);
- fg_write_and_verify(p, MAX17042_TEMPCO, TempCo);
-
- /* Delay at least 350mS */
- mdelay(350);
-
- /* Initialization Complete */
- pmic_reg_read(p, MAX17042_STATUS, &val);
- /* Write and Verify Status with POR bit Cleared */
- fg_write_and_verify(p, MAX17042_STATUS, val & ~MAX17042_POR);
-
- /* Delay at least 350 ms */
- mdelay(350);
-
- status_msg = "OK!";
-error:
- debug("%s: model init status: %s\n", p->name, status_msg);
- return;
-}
-
-static int power_update_battery(struct pmic *p, struct pmic *bat)
-{
- struct power_battery *pb = bat->pbat;
- unsigned int val;
- int ret = 0;
-
- if (pmic_probe(p)) {
- puts("Can't find max17042 fuel gauge\n");
- return -ENODEV;
- }
-
- ret |= pmic_reg_read(p, MAX17042_VFSOC, &val);
- pb->bat->state_of_chrg = (val >> 8);
-
- pmic_reg_read(p, MAX17042_VCELL, &val);
- debug("vfsoc: 0x%x\n", val);
- pb->bat->voltage_uV = ((val & 0xFFUL) >> 3) + ((val & 0xFF00) >> 3);
- pb->bat->voltage_uV = (pb->bat->voltage_uV * 625);
-
- pmic_reg_read(p, 0x05, &val);
- pb->bat->capacity = val >> 2;
-
- return ret;
-}
-
-static int power_check_battery(struct pmic *p, struct pmic *bat)
-{
- struct power_battery *pb = bat->pbat;
- unsigned int val;
- int ret = 0;
-
- if (pmic_probe(p)) {
- puts("Can't find max17042 fuel gauge\n");
- return -ENODEV;
- }
-
- ret |= pmic_reg_read(p, MAX17042_STATUS, &val);
- debug("fg status: 0x%x\n", val);
-
- if (val & MAX17042_POR)
- por_fuelgauge_init(p);
-
- ret |= pmic_reg_read(p, MAX17042_VERSION, &val);
- pb->bat->version = val;
-
- power_update_battery(p, bat);
- debug("fg ver: 0x%x\n", pb->bat->version);
- printf("BAT: state_of_charge(SOC):%d%%\n",
- pb->bat->state_of_chrg);
-
- printf(" voltage: %d.%6.6d [V] (expected to be %d [mAh])\n",
- pb->bat->voltage_uV / 1000000,
- pb->bat->voltage_uV % 1000000,
- pb->bat->capacity);
-
- if (pb->bat->voltage_uV > 3850000)
- pb->bat->state = EXT_SOURCE;
- else if (pb->bat->voltage_uV < 3600000 || pb->bat->state_of_chrg < 5)
- pb->bat->state = CHARGE;
- else
- pb->bat->state = NORMAL;
-
- return ret;
-}
-
-static struct power_fg power_fg_ops = {
- .fg_battery_check = power_check_battery,
- .fg_battery_update = power_update_battery,
-};
-
-int power_fg_init(unsigned char bus)
-{
- static const char name[] = "MAX17042_FG";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board Fuel Gauge init\n");
-
- p->name = name;
- p->interface = PMIC_I2C;
- p->number_of_regs = FG_NUM_OF_REGS;
- p->hw.i2c.addr = MAX17042_I2C_ADDR;
- p->hw.i2c.tx_num = 2;
- p->sensor_byte_order = PMIC_SENSOR_BYTE_ORDER_BIG;
- p->bus = bus;
-
- p->fg = &power_fg_ops;
- return 0;
-}
diff --git a/drivers/power/mfd/Makefile b/drivers/power/mfd/Makefile
deleted file mode 100644
index a8eb7f81e72..00000000000
--- a/drivers/power/mfd/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Copyright (C) 2013 Samsung Electronics
-# Piotr Wilczek <p.wilczek@samsung.com>
-
-obj-$(CONFIG_POWER_PMIC_MAX77693) += pmic_max77693.o
-obj-$(CONFIG_POWER_MUIC_MAX77693) += muic_max77693.o
-obj-$(CONFIG_POWER_FG_MAX77693) += fg_max77693.o
diff --git a/drivers/power/mfd/fg_max77693.c b/drivers/power/mfd/fg_max77693.c
deleted file mode 100644
index 983a6d4a2bd..00000000000
--- a/drivers/power/mfd/fg_max77693.c
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2013 Samsung Electronics
- * Piotr Wilczek <p.wilczek@samsung.com>
- */
-
-#include <common.h>
-#include <log.h>
-#include <power/pmic.h>
-#include <power/max77693_fg.h>
-#include <i2c.h>
-#include <power/power_chrg.h>
-#include <power/battery.h>
-#include <power/fg_battery_cell_params.h>
-#include <errno.h>
-
-static int max77693_get_vcell(u32 *vcell)
-{
- u16 value;
- u8 ret;
-
- ret = i2c_read(MAX77693_FUEL_I2C_ADDR, MAX77693_VCELL, 1,
- (u8 *)&value, 2);
- if (ret)
- return ret;
-
- *vcell = (u32)(value >> 3);
- *vcell = *vcell * 625;
-
- return 0;
-}
-
-static int max77693_get_soc(u32 *soc)
-{
- u16 value;
- u8 ret;
-
- ret = i2c_read(MAX77693_FUEL_I2C_ADDR, MAX77693_VFSOC, 1,
- (u8 *)&value, 2);
- if (ret)
- return ret;
-
- *soc = (u32)(value >> 8);
-
- return 0;
-}
-
-static int power_update_battery(struct pmic *p, struct pmic *bat)
-{
- struct power_battery *pb = bat->pbat;
- int ret;
-
- if (pmic_probe(p)) {
- puts("Can't find max77693 fuel gauge\n");
- return -ENODEV;
- }
-
- ret = max77693_get_soc(&pb->bat->state_of_chrg);
- if (ret)
- return ret;
-
- max77693_get_vcell(&pb->bat->voltage_uV);
-
- return 0;
-}
-
-static int power_check_battery(struct pmic *p, struct pmic *bat)
-{
- struct power_battery *pb = bat->pbat;
- unsigned int val;
- int ret = 0;
-
- if (pmic_probe(p)) {
- puts("Can't find max77693 fuel gauge\n");
- return -ENODEV;
- }
-
- ret = pmic_reg_read(p, MAX77693_STATUS, &val);
- if (ret)
- return ret;
- debug("fg status: 0x%x\n", val);
-
- ret = pmic_reg_read(p, MAX77693_VERSION, &pb->bat->version);
- if (ret)
- return ret;
-
- ret = power_update_battery(p, bat);
- if (ret)
- return ret;
- debug("fg ver: 0x%x\n", pb->bat->version);
- printf("BAT: state_of_charge(SOC):%d%%\n",
- pb->bat->state_of_chrg);
-
- printf(" voltage: %d.%6.6d [V] (expected to be %d [mAh])\n",
- pb->bat->voltage_uV / 1000000,
- pb->bat->voltage_uV % 1000000,
- pb->bat->capacity);
-
- if (pb->bat->voltage_uV > 3850000)
- pb->bat->state = EXT_SOURCE;
- else if (pb->bat->voltage_uV < 3600000 || pb->bat->state_of_chrg < 5)
- pb->bat->state = CHARGE;
- else
- pb->bat->state = NORMAL;
-
- return 0;
-}
-
-static struct power_fg power_fg_ops = {
- .fg_battery_check = power_check_battery,
- .fg_battery_update = power_update_battery,
-};
-
-int power_fg_init(unsigned char bus)
-{
- static const char name[] = "MAX77693_FG";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board Fuel Gauge init\n");
-
- p->name = name;
- p->interface = PMIC_I2C;
- p->number_of_regs = FG_NUM_OF_REGS;
- p->hw.i2c.addr = MAX77693_FUEL_I2C_ADDR;
- p->hw.i2c.tx_num = 2;
- p->sensor_byte_order = PMIC_SENSOR_BYTE_ORDER_BIG;
- p->bus = bus;
-
- p->fg = &power_fg_ops;
-
- return 0;
-}
diff --git a/drivers/power/mfd/muic_max77693.c b/drivers/power/mfd/muic_max77693.c
deleted file mode 100644
index 36ee44b9a2c..00000000000
--- a/drivers/power/mfd/muic_max77693.c
+++ /dev/null
@@ -1,77 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2013 Samsung Electronics
- * Piotr Wilczek <p.wilczek@samsung.com>
- */
-
-#include <common.h>
-#include <log.h>
-#include <power/pmic.h>
-#include <power/power_chrg.h>
-#include <power/max77693_muic.h>
-#include <i2c.h>
-#include <errno.h>
-
-static int power_chrg_get_type(struct pmic *p)
-{
- unsigned int val;
- unsigned int charge_type, charger;
-
- /* if probe failed, return cable none */
- if (pmic_probe(p))
- return CHARGER_NO;
-
- pmic_reg_read(p, MAX77693_MUIC_STATUS2, &val);
-
- charge_type = val & MAX77693_MUIC_CHG_MASK;
-
- switch (charge_type) {
- case MAX77693_MUIC_CHG_NO:
- charger = CHARGER_NO;
- break;
- case MAX77693_MUIC_CHG_USB:
- case MAX77693_MUIC_CHG_USB_D:
- charger = CHARGER_USB;
- break;
- case MAX77693_MUIC_CHG_TA:
- case MAX77693_MUIC_CHG_TA_1A:
- charger = CHARGER_TA;
- break;
- case MAX77693_MUIC_CHG_TA_500:
- charger = CHARGER_TA_500;
- break;
- default:
- charger = CHARGER_UNKNOWN;
- break;
- }
-
- return charger;
-}
-
-static struct power_chrg power_chrg_muic_ops = {
- .chrg_type = power_chrg_get_type,
-};
-
-int power_muic_init(unsigned int bus)
-{
- static const char name[] = "MAX77693_MUIC";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board Micro USB Interface Controller init\n");
-
- p->name = name;
- p->interface = PMIC_I2C;
- p->number_of_regs = MUIC_NUM_OF_REGS;
- p->hw.i2c.addr = MAX77693_MUIC_I2C_ADDR;
- p->hw.i2c.tx_num = 1;
- p->bus = bus;
-
- p->chrg = &power_chrg_muic_ops;
-
- return 0;
-}
diff --git a/drivers/power/mfd/pmic_max77693.c b/drivers/power/mfd/pmic_max77693.c
deleted file mode 100644
index e32a9722a40..00000000000
--- a/drivers/power/mfd/pmic_max77693.c
+++ /dev/null
@@ -1,96 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2013 Samsung Electronics
- * Piotr Wilczek <p.wilczek@samsung.com>
- */
-
-#include <common.h>
-#include <log.h>
-#include <power/pmic.h>
-#include <power/max77693_pmic.h>
-#include <i2c.h>
-#include <errno.h>
-
-static int max77693_charger_state(struct pmic *p, int state, int current)
-{
- unsigned int val;
-
- if (pmic_probe(p))
- return -ENODEV;
-
- /* unlock write capability */
- val = MAX77693_CHG_UNLOCK;
- pmic_reg_write(p, MAX77693_CHG_CNFG_06, val);
-
- if (state == PMIC_CHARGER_DISABLE) {
- puts("Disable the charger.\n");
- pmic_reg_read(p, MAX77693_CHG_CNFG_00, &val);
- val &= ~0x01;
- pmic_reg_write(p, MAX77693_CHG_CNFG_00, val);
- return -ENOTSUPP;
- }
-
- if (current < CHARGER_MIN_CURRENT || current > CHARGER_MAX_CURRENT) {
- printf("%s: Wrong charge current: %d [mA]\n",
- __func__, current);
- return -EINVAL;
- }
-
- /* set charging current */
- pmic_reg_read(p, MAX77693_CHG_CNFG_02, &val);
- val &= ~MAX77693_CHG_CC;
- val |= current * 10 / 333; /* 0.1A/3 steps */
- pmic_reg_write(p, MAX77693_CHG_CNFG_02, val);
-
- /* enable charging */
- val = MAX77693_CHG_MODE_ON;
- pmic_reg_write(p, MAX77693_CHG_CNFG_00, val);
-
- /* check charging current */
- pmic_reg_read(p, MAX77693_CHG_CNFG_02, &val);
- val &= 0x3f;
- printf("Enable the charger @ %d [mA]\n", val * 333 / 10);
-
- return 0;
-}
-
-static int max77693_charger_bat_present(struct pmic *p)
-{
- unsigned int val;
-
- if (pmic_probe(p))
- return -ENODEV;
-
- pmic_reg_read(p, MAX77693_CHG_INT_OK, &val);
-
- return !(val & MAX77693_CHG_DETBAT);
-}
-
-static struct power_chrg power_chrg_pmic_ops = {
- .chrg_bat_present = max77693_charger_bat_present,
- .chrg_state = max77693_charger_state,
-};
-
-int pmic_init_max77693(unsigned char bus)
-{
- static const char name[] = "MAX77693_PMIC";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board PMIC init\n");
-
- p->name = name;
- p->interface = PMIC_I2C;
- p->number_of_regs = PMIC_NUM_OF_REGS;
- p->hw.i2c.addr = MAX77693_PMIC_I2C_ADDR;
- p->hw.i2c.tx_num = 1;
- p->bus = bus;
-
- p->chrg = &power_chrg_pmic_ops;
-
- return 0;
-}
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index c3180c58208..0b3b3d62d0e 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_POWER_TPS65218) += pmic_tps65218.o
ifeq ($(CONFIG_$(SPL_)POWER_LEGACY),y)
obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o
-obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
obj-$(CONFIG_POWER_PCA9450) += pmic_pca9450.o
obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
obj-$(CONFIG_POWER_PFUZE3000) += pmic_pfuze3000.o
diff --git a/drivers/power/pmic/muic_max8997.c b/drivers/power/pmic/muic_max8997.c
deleted file mode 100644
index 969ce902395..00000000000
--- a/drivers/power/pmic/muic_max8997.c
+++ /dev/null
@@ -1,74 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2012 Samsung Electronics
- * Lukasz Majewski <l.majewski@samsung.com>
- */
-
-#include <common.h>
-#include <log.h>
-#include <power/pmic.h>
-#include <power/power_chrg.h>
-#include <power/max8997_muic.h>
-#include <i2c.h>
-#include <errno.h>
-
-static int power_chrg_get_type(struct pmic *p)
-{
- unsigned int val;
- unsigned char charge_type, charger;
-
- if (pmic_probe(p))
- return CHARGER_NO;
-
- pmic_reg_read(p, MAX8997_MUIC_STATUS2, &val);
- charge_type = val & MAX8997_MUIC_CHG_MASK;
-
- switch (charge_type) {
- case MAX8997_MUIC_CHG_NO:
- charger = CHARGER_NO;
- break;
- case MAX8997_MUIC_CHG_USB:
- case MAX8997_MUIC_CHG_USB_D:
- charger = CHARGER_USB;
- break;
- case MAX8997_MUIC_CHG_TA:
- case MAX8997_MUIC_CHG_TA_1A:
- charger = CHARGER_TA;
- break;
- case MAX8997_MUIC_CHG_TA_500:
- charger = CHARGER_TA_500;
- break;
- default:
- charger = CHARGER_UNKNOWN;
- break;
- }
-
- return charger;
-}
-
-static struct power_chrg power_chrg_muic_ops = {
- .chrg_type = power_chrg_get_type,
-};
-
-int power_muic_init(unsigned int bus)
-{
- static const char name[] = "MAX8997_MUIC";
- struct pmic *p = pmic_alloc();
-
- if (!p) {
- printf("%s: POWER allocation error!\n", __func__);
- return -ENOMEM;
- }
-
- debug("Board Micro USB Interface Controller init\n");
-
- p->name = name;
- p->interface = PMIC_I2C;
- p->number_of_regs = MUIC_NUM_OF_REGS;
- p->hw.i2c.addr = MAX8997_MUIC_I2C_ADDR;
- p->hw.i2c.tx_num = 1;
- p->bus = bus;
-
- p->chrg = &power_chrg_muic_ops;
- return 0;
-}