Lines Matching +full:open +full:- +full:firmware
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 #include <linux/firmware.h>
41 return -ENOMEM; in ag6xx_open()
43 skb_queue_head_init(&ag6xx->txq); in ag6xx_open()
45 hu->priv = ag6xx; in ag6xx_open()
51 struct ag6xx_data *ag6xx = hu->priv; in ag6xx_close()
55 skb_queue_purge(&ag6xx->txq); in ag6xx_close()
56 kfree_skb(ag6xx->rx_skb); in ag6xx_close()
59 hu->priv = NULL; in ag6xx_close()
65 struct ag6xx_data *ag6xx = hu->priv; in ag6xx_flush()
69 skb_queue_purge(&ag6xx->txq); in ag6xx_flush()
75 struct ag6xx_data *ag6xx = hu->priv; in ag6xx_dequeue()
78 skb = skb_dequeue(&ag6xx->txq); in ag6xx_dequeue()
83 memcpy(skb_push(skb, 1), &bt_cb(skb)->pkt_type, 1); in ag6xx_dequeue()
89 struct ag6xx_data *ag6xx = hu->priv; in ag6xx_enqueue()
91 skb_queue_tail(&ag6xx->txq, skb); in ag6xx_enqueue()
103 struct ag6xx_data *ag6xx = hu->priv; in ag6xx_recv()
105 if (!test_bit(HCI_UART_REGISTERED, &hu->flags)) in ag6xx_recv()
106 return -EUNATCH; in ag6xx_recv()
108 ag6xx->rx_skb = h4_recv_buf(hu->hdev, ag6xx->rx_skb, data, count, in ag6xx_recv()
111 if (IS_ERR(ag6xx->rx_skb)) { in ag6xx_recv()
112 int err = PTR_ERR(ag6xx->rx_skb); in ag6xx_recv()
113 bt_dev_err(hu->hdev, "Frame reassembly failed (%d)", err); in ag6xx_recv()
114 ag6xx->rx_skb = NULL; in ag6xx_recv()
143 plen -= fragment_len; in intel_mem_write()
153 struct hci_dev *hdev = hu->hdev; in ag6xx_setup()
156 const struct firmware *fw; in ag6xx_setup()
162 hu->hdev->set_diag = btintel_set_diag; in ag6xx_setup()
163 hu->hdev->set_bdaddr = btintel_set_bdaddr; in ag6xx_setup()
181 return -EINVAL; in ag6xx_setup()
185 * firmware setup method. in ag6xx_setup()
190 return -EINVAL; in ag6xx_setup()
193 snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bddata", in ag6xx_setup()
196 err = request_firmware(&fw, fwname, &hdev->dev); in ag6xx_setup()
198 bt_dev_err(hdev, "Failed to open Intel bddata file: %s (%d)", in ag6xx_setup()
205 skb = __hci_cmd_sync_ev(hdev, 0xfc2f, fw->size, fw->data, in ag6xx_setup()
218 * cases, current firmware is already patched. No need to patch it. in ag6xx_setup()
228 "intel/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.pbn", in ag6xx_setup()
233 err = request_firmware(&fw, fwname, &hdev->dev); in ag6xx_setup()
235 bt_dev_err(hdev, "Failed to open Intel patch file: %s(%d)", in ag6xx_setup()
239 fw_ptr = fw->data; in ag6xx_setup()
241 bt_dev_info(hdev, "Patching firmware file (%s)", fwname); in ag6xx_setup()
244 * of the embedded firmware. Each patch entry header contains the target in ag6xx_setup()
253 while (fw->size > fw_ptr - fw->data) { in ag6xx_setup()
257 if (pbn->addr == 0xffffffff) { in ag6xx_setup()
263 addr = le32_to_cpu(pbn->addr); in ag6xx_setup()
264 plen = le32_to_cpu(pbn->plen); in ag6xx_setup()
266 if (fw->data + fw->size <= pbn->data + plen) { in ag6xx_setup()
271 bt_dev_info(hdev, "Patching %td/%zu", (fw_ptr - fw->data), in ag6xx_setup()
272 fw->size); in ag6xx_setup()
274 err = intel_mem_write(hdev, addr, plen, pbn->data); in ag6xx_setup()
280 fw_ptr = pbn->data + plen; in ag6xx_setup()
304 .open = ag6xx_open,