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

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

Merge "bt-power: Check reset-gpio status before calling BT reset"

parents 73d78e9d 043fdc25
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
/* Copyright (c) 2009-2010, 2013-2018 The Linux Foundation. All rights reserved.
/* Copyright (c) 2009-2010, 2013-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
@@ -613,6 +613,23 @@ static int bt_power_populate_dt_pinfo(struct platform_device *pdev)
	return 0;
}

static int get_bt_reset_gpio_value(void)
{
	int rc = 0;
	int bt_reset_gpio = bt_power_pdata->bt_gpio_sys_rst;

	rc = gpio_request(bt_reset_gpio, "bt_sys_rst_n");
	if (rc) {
		BT_PWR_ERR("unable to request gpio %d (%d)\n",
					bt_reset_gpio, rc);
		return rc;
	}

	rc = gpio_get_value(bt_reset_gpio);
	gpio_free(bt_power_pdata->bt_gpio_sys_rst);
	return rc;
}

static int bt_power_probe(struct platform_device *pdev)
{
	int ret = 0;
@@ -659,7 +676,8 @@ static int bt_power_probe(struct platform_device *pdev)
	btpdev = pdev;

	if (of_id) {
		if (strcmp(of_id->compatible, "qca,qca6174") == 0) {
		if ((get_bt_reset_gpio_value() == BT_RESET_GPIO_HIGH_VAL)
			&& (strcmp(of_id->compatible, "qca,qca6174") == 0)) {
			bluetooth_toggle_radio(pdev->dev.platform_data, 0);
			bluetooth_toggle_radio(pdev->dev.platform_data, 1);
		}
+4 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-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
@@ -88,4 +88,7 @@ int get_chipset_version(void);
#define BT_CMD_SLIM_TEST		0xbfac
#define BT_CMD_PWR_CTRL			0xbfad
#define BT_CMD_CHIPSET_VERS		0xbfae

#define BT_RESET_GPIO_HIGH_VAL	0x1

#endif /* __LINUX_BLUETOOTH_POWER_H */