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

Commit 31eff267 authored by Loic Poulain's avatar Loic Poulain Committed by Marcel Holtmann
Browse files

Bluetooth: hci_intel: Remove LPM enabling from setup procedure



LPM can be enabled via a DDC write command at specific DDC ID.
As any other DDC value, this is up to the DDC config file to
include (or not) the low power mode configuration.

Signed-off-by: default avatarLoic Poulain <loic.poulain@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent ca8bee5d
Loading
Loading
Loading
Loading
+7 −21
Original line number Original line Diff line number Diff line
@@ -537,9 +537,7 @@ static int intel_setup(struct hci_uart *hu)
{
{
	static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
	static const u8 reset_param[] = { 0x00, 0x01, 0x00, 0x01,
					  0x00, 0x08, 0x04, 0x00 };
					  0x00, 0x08, 0x04, 0x00 };
	static const u8 lpm_param[] = { 0x03, 0x07, 0x01, 0x0b };
	struct intel_data *intel = hu->priv;
	struct intel_data *intel = hu->priv;
	struct intel_device *idev = NULL;
	struct hci_dev *hdev = hu->hdev;
	struct hci_dev *hdev = hu->hdev;
	struct sk_buff *skb;
	struct sk_buff *skb;
	struct intel_version ver;
	struct intel_version ver;
@@ -884,35 +882,23 @@ static int intel_setup(struct hci_uart *hu)


	bt_dev_info(hdev, "Device booted in %llu usecs", duration);
	bt_dev_info(hdev, "Device booted in %llu usecs", duration);


	/* Enable LPM if matching pdev with wakeup enabled */
	/* Enable LPM if matching pdev with wakeup enabled, set TX active
	 * until further LPM TX notification.
	 */
	mutex_lock(&intel_device_list_lock);
	mutex_lock(&intel_device_list_lock);
	list_for_each(p, &intel_device_list) {
	list_for_each(p, &intel_device_list) {
		struct intel_device *dev = list_entry(p, struct intel_device,
		struct intel_device *dev = list_entry(p, struct intel_device,
						      list);
						      list);
		if (hu->tty->dev->parent == dev->pdev->dev.parent) {
		if (hu->tty->dev->parent == dev->pdev->dev.parent) {
			if (device_may_wakeup(&dev->pdev->dev))
			if (device_may_wakeup(&dev->pdev->dev)) {
				idev = dev;
				set_bit(STATE_LPM_ENABLED, &intel->flags);
				set_bit(STATE_TX_ACTIVE, &intel->flags);
			}
			break;
			break;
		}
		}
	}
	}
	mutex_unlock(&intel_device_list_lock);
	mutex_unlock(&intel_device_list_lock);


	if (!idev)
		goto no_lpm;

	bt_dev_info(hdev, "Enabling LPM");

	skb = __hci_cmd_sync(hdev, 0xfc8b, sizeof(lpm_param), lpm_param,
			     HCI_CMD_TIMEOUT);
	if (IS_ERR(skb)) {
		bt_dev_err(hdev, "Failed to enable LPM");
		goto no_lpm;
	}
	kfree_skb(skb);

	set_bit(STATE_LPM_ENABLED, &intel->flags);

no_lpm:
	/* Ignore errors, device can work without DDC parameters */
	/* Ignore errors, device can work without DDC parameters */
	btintel_load_ddc_config(hdev, fwname);
	btintel_load_ddc_config(hdev, fwname);