Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 254a633e authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5: Disable bat-temp irq upon debug battery detection"

parents cae09508 653c4926
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2340,7 +2340,7 @@ static int smb5_determine_initial_status(struct smb5 *chip)
	chg->early_usb_attach = val.intval;

	if (chg->iio_chan_list_qg)
		smblib_suspend_on_debug_battery(chg);
		smblib_config_charger_on_debug_battery(chg);

	smb5_usb_plugin_irq_handler(0, &irq_data);
	smb5_dc_plugin_irq_handler(0, &irq_data);
+36 −2
Original line number Diff line number Diff line
@@ -1358,7 +1358,7 @@ static void smblib_uusb_removal(struct smb_charger *chg)
	smblib_update_usb_type(chg);
}

void smblib_suspend_on_debug_battery(struct smb_charger *chg)
void smblib_config_charger_on_debug_battery(struct smb_charger *chg)
{
	int rc = 0, val;

@@ -1368,6 +1368,8 @@ void smblib_suspend_on_debug_battery(struct smb_charger *chg)
		return;
	}

	vote(chg->bat_temp_irq_disable_votable, DEBUG_BOARD_VOTER, val, 0);

	if (chg->suspend_input_on_debug_batt) {
		vote(chg->usb_icl_votable, DEBUG_BOARD_VOTER, val, 0);
		vote(chg->dc_suspend_votable, DEBUG_BOARD_VOTER, val, 0);
@@ -1854,6 +1856,27 @@ static int smblib_temp_change_irq_disable_vote_callback(struct votable *votable,
	return 0;
}

static int smblib_bat_temp_irq_disable_vote_callback(struct votable *votable,
				void *data, int disable, const char *client)
{
	struct smb_charger *chg = data;

	if (!chg->irq_info[BAT_TEMP_IRQ].irq)
		return 0;

	if (chg->irq_info[BAT_TEMP_IRQ].enabled && disable) {
		disable_irq_wake(chg->irq_info[BAT_TEMP_IRQ].irq);
		disable_irq_nosync(chg->irq_info[BAT_TEMP_IRQ].irq);
	} else if (!chg->irq_info[BAT_TEMP_IRQ].enabled && !disable) {
		enable_irq(chg->irq_info[BAT_TEMP_IRQ].irq);
		enable_irq_wake(chg->irq_info[BAT_TEMP_IRQ].irq);
	}

	chg->irq_info[BAT_TEMP_IRQ].enabled = !disable;

	return 0;
}

/*******************
 * VCONN REGULATOR *
 * *****************/
@@ -7379,7 +7402,7 @@ static void bms_update_work(struct work_struct *work)
		chg->iio_chan_list_qg = qg_list;
	}

	smblib_suspend_on_debug_battery(chg);
	smblib_config_charger_on_debug_battery(chg);

	if (chg->batt_psy)
		power_supply_changed(chg->batt_psy);
@@ -8173,6 +8196,15 @@ static int smblib_create_votables(struct smb_charger *chg)
		return rc;
	}

	chg->bat_temp_irq_disable_votable = create_votable(
			"BAT_TEMP_IRQ_DISABLE", VOTE_SET_ANY,
			smblib_bat_temp_irq_disable_vote_callback, chg);
	if (IS_ERR(chg->bat_temp_irq_disable_votable)) {
		rc = PTR_ERR(chg->bat_temp_irq_disable_votable);
		chg->bat_temp_irq_disable_votable = NULL;
		return rc;
	}

	return rc;
}

@@ -8186,6 +8218,8 @@ static void smblib_destroy_votables(struct smb_charger *chg)
		destroy_votable(chg->awake_votable);
	if (chg->chg_disable_votable)
		destroy_votable(chg->chg_disable_votable);
	if (chg->bat_temp_irq_disable_votable)
		destroy_votable(chg->bat_temp_irq_disable_votable);
}

static void smblib_iio_deinit(struct smb_charger *chg)
+3 −2
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
 */

#ifndef __SMB5_CHARGER_H
@@ -456,6 +456,7 @@ struct smb_charger {
	struct votable		*limited_irq_disable_votable;
	struct votable		*hdc_irq_disable_votable;
	struct votable		*temp_change_irq_disable_votable;
	struct votable		*bat_temp_irq_disable_votable;
	struct votable		*qnovo_disable_votable;

	/* work */
@@ -795,7 +796,7 @@ int smblib_set_prop_ship_mode(struct smb_charger *chg,
				int val);
int smblib_set_prop_rechg_soc_thresh(struct smb_charger *chg,
				int val);
void smblib_suspend_on_debug_battery(struct smb_charger *chg);
void smblib_config_charger_on_debug_battery(struct smb_charger *chg);
int smblib_rerun_apsd_if_required(struct smb_charger *chg);
void smblib_rerun_apsd(struct smb_charger *chg);
int smblib_get_prop_fcc_delta(struct smb_charger *chg,