]>
Commit | Line | Data |
---|---|---|
c942fddf | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
db33c77d CC |
2 | /* |
3 | * Bluetooth support for Realtek devices | |
4 | * | |
5 | * Copyright (C) 2015 Endless Mobile, Inc. | |
db33c77d CC |
6 | */ |
7 | ||
8 | #define RTL_FRAG_LEN 252 | |
9 | ||
26503ad2 MB |
10 | #define rtl_dev_err(dev, fmt, ...) bt_dev_err(dev, "RTL: " fmt, ##__VA_ARGS__) |
11 | #define rtl_dev_warn(dev, fmt, ...) bt_dev_warn(dev, "RTL: " fmt, ##__VA_ARGS__) | |
12 | #define rtl_dev_info(dev, fmt, ...) bt_dev_info(dev, "RTL: " fmt, ##__VA_ARGS__) | |
13 | #define rtl_dev_dbg(dev, fmt, ...) bt_dev_dbg(dev, "RTL: " fmt, ##__VA_ARGS__) | |
14 | ||
15 | struct btrtl_device_info; | |
16 | ||
db33c77d CC |
17 | struct rtl_download_cmd { |
18 | __u8 index; | |
19 | __u8 data[RTL_FRAG_LEN]; | |
20 | } __packed; | |
21 | ||
22 | struct rtl_download_response { | |
23 | __u8 status; | |
24 | __u8 index; | |
25 | } __packed; | |
26 | ||
27 | struct rtl_rom_version_evt { | |
28 | __u8 status; | |
29 | __u8 version; | |
30 | } __packed; | |
31 | ||
32 | struct rtl_epatch_header { | |
33 | __u8 signature[8]; | |
34 | __le32 fw_version; | |
35 | __le16 num_patches; | |
36 | } __packed; | |
37 | ||
b85b0ee1 MB |
38 | struct rtl_vendor_config_entry { |
39 | __le16 offset; | |
40 | __u8 len; | |
a7e45454 | 41 | __u8 data[]; |
b85b0ee1 MB |
42 | } __packed; |
43 | ||
44 | struct rtl_vendor_config { | |
45 | __le32 signature; | |
46 | __le16 total_len; | |
a7e45454 | 47 | struct rtl_vendor_config_entry entry[]; |
b85b0ee1 MB |
48 | } __packed; |
49 | ||
db33c77d CC |
50 | #if IS_ENABLED(CONFIG_BT_RTL) |
51 | ||
1cc194ca HG |
52 | struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, |
53 | const char *postfix); | |
26503ad2 MB |
54 | void btrtl_free(struct btrtl_device_info *btrtl_dev); |
55 | int btrtl_download_firmware(struct hci_dev *hdev, | |
56 | struct btrtl_device_info *btrtl_dev); | |
db33c77d | 57 | int btrtl_setup_realtek(struct hci_dev *hdev); |
7af3f558 | 58 | int btrtl_shutdown_realtek(struct hci_dev *hdev); |
b85b0ee1 MB |
59 | int btrtl_get_uart_settings(struct hci_dev *hdev, |
60 | struct btrtl_device_info *btrtl_dev, | |
61 | unsigned int *controller_baudrate, | |
62 | u32 *device_baudrate, bool *flow_control); | |
db33c77d CC |
63 | |
64 | #else | |
65 | ||
1cc194ca HG |
66 | static inline struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, |
67 | const char *postfix) | |
26503ad2 MB |
68 | { |
69 | return ERR_PTR(-EOPNOTSUPP); | |
70 | } | |
71 | ||
72 | static inline void btrtl_free(struct btrtl_device_info *btrtl_dev) | |
73 | { | |
74 | } | |
75 | ||
76 | static inline int btrtl_download_firmware(struct hci_dev *hdev, | |
77 | struct btrtl_device_info *btrtl_dev) | |
78 | { | |
79 | return -EOPNOTSUPP; | |
80 | } | |
81 | ||
db33c77d CC |
82 | static inline int btrtl_setup_realtek(struct hci_dev *hdev) |
83 | { | |
84 | return -EOPNOTSUPP; | |
85 | } | |
86 | ||
7af3f558 JHP |
87 | static inline int btrtl_shutdown_realtek(struct hci_dev *hdev) |
88 | { | |
89 | return -EOPNOTSUPP; | |
90 | } | |
91 | ||
b85b0ee1 MB |
92 | static inline int btrtl_get_uart_settings(struct hci_dev *hdev, |
93 | struct btrtl_device_info *btrtl_dev, | |
94 | unsigned int *controller_baudrate, | |
95 | u32 *device_baudrate, | |
96 | bool *flow_control) | |
97 | { | |
98 | return -ENOENT; | |
99 | } | |
100 | ||
db33c77d | 101 | #endif |