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

Commit 1b988daf authored by Rodrigo Rivas Costa's avatar Rodrigo Rivas Costa Committed by Siarhei Vishniakou
Browse files

UPSTREAM: HID: steam: fix boot loop with bluetooth firmware

There is a new firmware for the Steam Controller with support for BLE
connections. When using such a device with a wired connection, it
reboots itself every 10 seconds unless an application has opened it.

Doing hid_hw_open() unconditionally on probe fixes the issue, and the
code becomes simpler.

(cherry-picked from commit cf28aee292e102740e49f74385b4b89c00050763
("HID: steam: fix boot loop with bluetooth firmware"))
https://github.com/torvalds/linux/commit/cf28aee292e102740e49f74385b4b89c00050763



Bug: 136263708

Signed-off-by: default avatarRodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
Signed-off-by: default avatarSiarhei Vishniakou <svv@google.com>
Change-Id: I55b573d6db1bc336626ce4a6563255374da590ae
parent b4338d2e
Loading
Loading
Loading
Loading
+11 −23
Original line number Diff line number Diff line
@@ -283,11 +283,6 @@ static void steam_set_lizard_mode(struct steam_device *steam, bool enable)
static int steam_input_open(struct input_dev *dev)
{
	struct steam_device *steam = input_get_drvdata(dev);
	int ret;

	ret = hid_hw_open(steam->hdev);
	if (ret)
		return ret;

	mutex_lock(&steam->mutex);
	if (!steam->client_opened && lizard_mode)
@@ -304,8 +299,6 @@ static void steam_input_close(struct input_dev *dev)
	if (!steam->client_opened && lizard_mode)
		steam_set_lizard_mode(steam, true);
	mutex_unlock(&steam->mutex);

	hid_hw_close(steam->hdev);
}

static enum power_supply_property steam_battery_props[] = {
@@ -623,11 +616,6 @@ static void steam_client_ll_stop(struct hid_device *hdev)
static int steam_client_ll_open(struct hid_device *hdev)
{
	struct steam_device *steam = hdev->driver_data;
	int ret;

	ret = hid_hw_open(steam->hdev);
	if (ret)
		return ret;

	mutex_lock(&steam->mutex);
	steam->client_opened = true;
@@ -635,7 +623,7 @@ static int steam_client_ll_open(struct hid_device *hdev)

	steam_input_unregister(steam);

	return ret;
	return 0;
}

static void steam_client_ll_close(struct hid_device *hdev)
@@ -646,7 +634,6 @@ static void steam_client_ll_close(struct hid_device *hdev)
	steam->client_opened = false;
	mutex_unlock(&steam->mutex);

	hid_hw_close(steam->hdev);
	if (steam->connected) {
		steam_set_lizard_mode(steam, lizard_mode);
		steam_input_register(steam);
@@ -759,14 +746,15 @@ static int steam_probe(struct hid_device *hdev,
	if (ret)
		goto client_hdev_add_fail;

	if (steam->quirks & STEAM_QUIRK_WIRELESS) {
	ret = hid_hw_open(hdev);
	if (ret) {
		hid_err(hdev,
				"%s:hid_hw_open for wireless\n",
			"%s:hid_hw_open\n",
			__func__);
		goto hid_hw_open_fail;
	}

	if (steam->quirks & STEAM_QUIRK_WIRELESS) {
		hid_info(hdev, "Steam wireless receiver connected");
		steam_request_conn_status(steam);
	} else {
@@ -781,8 +769,8 @@ static int steam_probe(struct hid_device *hdev,

	return 0;

hid_hw_open_fail:
input_register_fail:
hid_hw_open_fail:
client_hdev_add_fail:
	hid_hw_stop(hdev);
hid_hw_start_fail:
@@ -809,8 +797,8 @@ static void steam_remove(struct hid_device *hdev)
	cancel_work_sync(&steam->work_connect);
	if (steam->quirks & STEAM_QUIRK_WIRELESS) {
		hid_info(hdev, "Steam wireless receiver disconnected");
		hid_hw_close(hdev);
	}
	hid_hw_close(hdev);
	hid_hw_stop(hdev);
	steam_unregister(steam);
}