Bluetooth: AMP: Use HCI cmd to Read Loc AMP Assoc
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / bluetooth / amp.c
CommitLineData
903e4541
AE
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#include <net/bluetooth/bluetooth.h>
15#include <net/bluetooth/hci.h>
16#include <net/bluetooth/hci_core.h>
17#include <net/bluetooth/a2mp.h>
18#include <net/bluetooth/amp.h>
19
20void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle)
21{
22 struct hci_cp_read_local_amp_assoc cp;
23 struct amp_assoc *loc_assoc = &hdev->loc_assoc;
24
25 BT_DBG("%s handle %d", hdev->name, phy_handle);
26
27 cp.phy_handle = phy_handle;
28 cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
29 cp.len_so_far = cpu_to_le16(loc_assoc->offset);
30
31 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
32}
33
34void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr)
35{
36 struct hci_cp_read_local_amp_assoc cp;
37
38 memset(&hdev->loc_assoc, 0, sizeof(struct amp_assoc));
39 memset(&cp, 0, sizeof(cp));
40
41 cp.max_len = cpu_to_le16(hdev->amp_assoc_size);
42
43 mgr->state = READ_LOC_AMP_ASSOC;
44 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_AMP_ASSOC, sizeof(cp), &cp);
45}