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

Commit 69bd4c9c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: vm_bms: Skip adc-tm notifications for a debug board"

parents d0853541 2bf3f803
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
/* Copyright (c) 2013-2015, 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -414,6 +414,7 @@ struct qpnp_lbc_chip {
	struct qpnp_adc_tm_chip		*adc_tm_dev;
	struct led_classdev		led_cdev;
	struct dentry			*debug_root;
	struct work_struct		debug_board_work;

	/* parallel-chg params */
	struct power_supply		*parallel_psy;
@@ -1496,7 +1497,7 @@ static int qpnp_lbc_configure_jeita(struct qpnp_lbc_chip *chip,
		return -EINVAL;
	}

	if (chip->cfg_use_fake_battery)
	if (chip->cfg_use_fake_battery || chip->debug_board)
		return 0;

	mutex_lock(&chip->jeita_configure_lock);
@@ -1550,6 +1551,22 @@ static int qpnp_lbc_configure_jeita(struct qpnp_lbc_chip *chip,
	return rc;
}

static void qpnp_lbc_debug_board_work_fn(struct work_struct *work)
{
	struct qpnp_lbc_chip *chip = container_of(work, struct qpnp_lbc_chip,
						debug_board_work);
	int rc = 0;

	if (chip->adc_param.channel == LR_MUX1_BATT_THERM
					&& chip->debug_board) {
		pr_debug("Disable adc-tm notifications for debug board\n");
		rc = qpnp_adc_tm_disable_chan_meas(chip->adc_tm_dev,
							 &chip->adc_param);
		if (rc < 0)
			pr_err("failed to disable tm %d\n", rc);
	}
}

static int qpnp_batt_property_is_writeable(struct power_supply *psy,
					enum power_supply_property psp)
{
@@ -1663,6 +1680,7 @@ static int qpnp_batt_power_set_property(struct power_supply *psy,
		break;
	case POWER_SUPPLY_PROP_DEBUG_BATTERY:
		chip->debug_board = val->intval;
		schedule_work(&chip->debug_board_work);
		rc = qpnp_lbc_charger_enable(chip, DEBUG_BOARD,
						!(val->intval));
		break;
@@ -2679,6 +2697,9 @@ static irqreturn_t qpnp_lbc_batt_pres_irq_handler(int irq, void *_chip)
	struct qpnp_lbc_chip *chip = _chip;
	int batt_present;

	if (chip->debug_board)
		return IRQ_HANDLED;

	batt_present = qpnp_lbc_is_batt_present(chip);
	pr_debug("batt-pres triggered: %d\n", batt_present);

@@ -3343,7 +3364,7 @@ static int qpnp_lbc_main_probe(struct platform_device *pdev)
	alarm_init(&chip->vddtrim_alarm, ALARM_REALTIME, vddtrim_callback);
	INIT_DELAYED_WORK(&chip->collapsible_detection_work,
			qpnp_lbc_collapsible_detection_work);

	INIT_WORK(&chip->debug_board_work, qpnp_lbc_debug_board_work_fn);
	/* Get all device-tree properties */
	rc = qpnp_charger_read_dt_props(chip);
	if (rc) {
@@ -3553,6 +3574,7 @@ static int qpnp_lbc_remove(struct platform_device *pdev)
		alarm_cancel(&chip->vddtrim_alarm);
		cancel_work_sync(&chip->vddtrim_work);
	}
	cancel_work_sync(&chip->debug_board_work);
	cancel_delayed_work_sync(&chip->collapsible_detection_work);
	debugfs_remove_recursive(chip->debug_root);
	if (chip->bat_if_base)
+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2016, 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1863,6 +1863,10 @@ static int setup_vbat_monitoring(struct qpnp_bms_chip *chip)
{
	int rc;

	if (is_debug_batt_id(chip)) {
		pr_debug("skip configuring vbat monitoring for debug_board\n");
		return 0;
	}
	chip->vbat_monitor_params.low_thr =
					chip->dt.cfg_low_voltage_threshold;
	chip->vbat_monitor_params.high_thr =