[PATCH 56/88] power: Drop unused bat_trats driver and battery code

Jaehoon Chung jh80.chung at gmail.com
Tue Jan 31 13:53:06 CET 2023



On 1/24/23 06:59, Simon Glass wrote:
> This driver and bat_trats2 are not used. Drop them and the entire battery
> directory, since there is nothing left.
> 
> Signed-off-by: Simon Glass <sjg at chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>

Best Regards,
Jaehoon Chung

> ---
> 
>  drivers/power/Makefile             |  1 -
>  drivers/power/battery/Makefile     |  7 ---
>  drivers/power/battery/bat_trats.c  | 91 ------------------------------
>  drivers/power/battery/bat_trats2.c | 65 ---------------------
>  4 files changed, 164 deletions(-)
>  delete mode 100644 drivers/power/battery/Makefile
>  delete mode 100644 drivers/power/battery/bat_trats.c
>  delete mode 100644 drivers/power/battery/bat_trats2.c
> 
> diff --git a/drivers/power/Makefile b/drivers/power/Makefile
> index 34a84808a9c..efdae3655ac 100644
> --- a/drivers/power/Makefile
> +++ b/drivers/power/Makefile
> @@ -4,7 +4,6 @@
>  # 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/
> 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 at 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 at 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 at 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;
> -}


More information about the U-Boot mailing list