From: Frederic Danis <frederic.danis@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 4/7] Bluetooth: btbcm: Split setup() function
Date: Fri, 10 Apr 2015 15:37:43 +0200 [thread overview]
Message-ID: <1428673066-1349-4-git-send-email-frederic.danis@linux.intel.com> (raw)
In-Reply-To: <1428673066-1349-1-git-send-email-frederic.danis@linux.intel.com>
BCM firmware loading will reset controller speed to default one.
So we need to split it in 2 functions done before and after this speed
change.
Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
---
drivers/bluetooth/btbcm.c | 33 ++++++++++++++++++++++-----------
drivers/bluetooth/btbcm.h | 6 ++++++
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 47e0563..f7802c4 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -283,7 +283,7 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
err = request_firmware(&fw, fw_name, &hdev->dev);
if (err < 0) {
BT_INFO("%s: BCM: patch %s not found", hdev->name, fw_name);
- return 0;
+ return -ENOENT;
}
/* Start Download */
@@ -292,7 +292,7 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
err = PTR_ERR(skb);
BT_ERR("%s: BCM: Download Minidrv command failed (%d)",
hdev->name, err);
- goto reset;
+ goto done;
}
kfree_skb(skb);
@@ -313,7 +313,7 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
BT_ERR("%s: BCM: patch %s is corrupted", hdev->name,
fw_name);
err = -EINVAL;
- goto reset;
+ goto done;
}
cmd_param = fw_ptr;
@@ -328,7 +328,7 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
err = PTR_ERR(skb);
BT_ERR("%s: BCM: patch command %04x failed (%d)",
hdev->name, opcode, err);
- goto reset;
+ goto done;
}
kfree_skb(skb);
}
@@ -336,7 +336,20 @@ int btbcm_setup_patchram(struct hci_dev *hdev)
/* 250 msec delay after Launch Ram completes */
msleep(250);
-reset:
+done:
+ release_firmware(fw);
+
+ return err;
+}
+EXPORT_SYMBOL_GPL(btbcm_setup_patchram);
+
+int btbcm_setup_post(struct hci_dev *hdev)
+{
+ struct sk_buff *skb;
+ struct hci_rp_read_local_version *ver;
+ u16 subver, rev;
+ int err;
+
/* Reset */
err = btbcm_reset(hdev);
if (err)
@@ -354,20 +367,18 @@ reset:
subver = le16_to_cpu(ver->lmp_subver);
kfree_skb(skb);
- BT_INFO("%s: %s (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
- hw_name ? : "BCM", (subver & 0x7000) >> 13,
- (subver & 0x1f00) >> 8, (subver & 0x00ff), rev & 0x0fff);
+ BT_INFO("%s: BCM (%3.3u.%3.3u.%3.3u) build %4.4u", hdev->name,
+ (subver & 0x7000) >> 13, (subver & 0x1f00) >> 8,
+ (subver & 0x00ff), rev & 0x0fff);
btbcm_check_bdaddr(hdev);
set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks);
done:
- release_firmware(fw);
-
return err;
}
-EXPORT_SYMBOL_GPL(btbcm_setup_patchram);
+EXPORT_SYMBOL_GPL(btbcm_setup_post);
int btbcm_setup_apple(struct hci_dev *hdev)
{
diff --git a/drivers/bluetooth/btbcm.h b/drivers/bluetooth/btbcm.h
index 34268ae..245fa30 100644
--- a/drivers/bluetooth/btbcm.h
+++ b/drivers/bluetooth/btbcm.h
@@ -27,6 +27,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev);
int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
int btbcm_setup_patchram(struct hci_dev *hdev);
+int btbcm_setup_post(struct hci_dev *hdev);
int btbcm_setup_apple(struct hci_dev *hdev);
#else
@@ -46,6 +47,11 @@ static inline int btbcm_setup_patchram(struct hci_dev *hdev)
return 0;
}
+static inline int btbcm_setup_post(struct hci_dev *hdev)
+{
+ return 0;
+}
+
static inline int btbcm_setup_apple(struct hci_dev *hdev)
{
return 0;
--
1.9.1
next prev parent reply other threads:[~2015-04-10 13:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 13:37 [PATCH 1/7] Bluetooth: btbcm: Add BCM4324B3 UART device Frederic Danis
2015-04-10 13:37 ` [PATCH 2/7] Bluetooth: hci_uart: Add HCIUARTSETBAUDRATE ioctl Frederic Danis
2015-04-10 15:24 ` Peter Hurley
2015-04-10 18:20 ` Marcel Holtmann
2015-04-10 19:05 ` Peter Hurley
2015-04-29 15:06 ` Frederic Danis
2015-04-10 13:37 ` [PATCH 3/7] Bluetooth: hci_uart: Support final speed during setup Frederic Danis
2015-04-10 19:05 ` Marcel Holtmann
2015-04-10 13:37 ` Frederic Danis [this message]
2015-04-10 20:12 ` [PATCH 4/7] Bluetooth: btbcm: Split setup() function Marcel Holtmann
2015-04-10 13:37 ` [PATCH 5/7] Bluetooth: btusb: Use btbcm_setup_post() Frederic Danis
2015-04-10 13:37 ` [PATCH 6/7] Bluetooth: hci_uart: " Frederic Danis
2015-04-10 13:37 ` [PATCH 7/7] Bluetooth: btbcm: Add bcm_set_baudrate() Frederic Danis
2015-04-10 20:19 ` Marcel Holtmann
2015-04-10 21:44 ` Peter Hurley
2015-04-10 21:57 ` Marcel Holtmann
2015-04-29 14:30 ` Frederic Danis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428673066-1349-4-git-send-email-frederic.danis@linux.intel.com \
--to=frederic.danis@linux.intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).