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

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

Merge "Disable ASD regulator if HST is attached"

parents dd16bdea 361cb9fe
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -830,6 +830,27 @@ static void bt_power_vreg_put(void)
	}
}

static int bt_disable_asd(void)
{
	int rc = 0;
	int i;
	int num_vregs =  bt_power_pdata->num_vregs;
	struct bt_power_vreg_data *vreg_info = NULL;

	for (i = 0; i < num_vregs; i++) {
		vreg_info = &bt_power_pdata->vreg_info[i];
		if (strnstr(vreg_info->name, "bt-vdd-asd", sizeof(vreg_info->name))) {
			if (vreg_info->reg) {
				pr_warn("%s: Disabling ASD regulator\n", __func__);
				rc = bt_vreg_disable(vreg_info);
			} else {
				pr_warn("%s: ASD regulator is not configured\n", __func__);
			}
			break;
		}
	}
	return rc;
}

static int bt_power_populate_dt_pinfo(struct platform_device *pdev)
{
@@ -1056,6 +1077,14 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
			chipset_version);
		if (chipset_version) {
			soc_id = chipset_version;
			if (soc_id == HASTINGS_SOC_ID_0100 ||
				soc_id == HASTINGS_SOC_ID_0101 ||
				soc_id == HASTINGS_SOC_ID_0110 ||
				soc_id == HASTINGS_SOC_ID_0200) {
				ret = bt_disable_asd();
				if (ret >= 0)
					PWR_SRC_STATUS_SET(BT_VDD_ASD_LDO, PWR_SRC_NOT_AVAILABLE);
			}
		} else {
			pr_err("%s: got invalid soc version\n", __func__);
			soc_id = 0;
+9 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#ifndef __LINUX_BLUETOOTH_POWER_H
@@ -18,6 +18,14 @@ enum bt_power_modes {
	BT_POWER_RETENTION
};

/* Hasting chipset version information */
enum {
	HASTINGS_SOC_ID_0100 = 0x400A0100,
	HASTINGS_SOC_ID_0101 = 0x400A0101,
	HASTINGS_SOC_ID_0110 = 0x400A0110,
	HASTINGS_SOC_ID_0200 = 0x400A0200,
};

struct log_index {
	int init;
	int crash;