2 * Bluetooth support for Realtek devices
4 * Copyright (C) 2015 Endless Mobile, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #define RTL_FRAG_LEN 252
20 #define rtl_dev_err(dev, fmt, ...) bt_dev_err(dev, "RTL: " fmt, ##__VA_ARGS__)
21 #define rtl_dev_warn(dev, fmt, ...) bt_dev_warn(dev, "RTL: " fmt, ##__VA_ARGS__)
22 #define rtl_dev_info(dev, fmt, ...) bt_dev_info(dev, "RTL: " fmt, ##__VA_ARGS__)
23 #define rtl_dev_dbg(dev, fmt, ...) bt_dev_dbg(dev, "RTL: " fmt, ##__VA_ARGS__)
25 struct btrtl_device_info
;
27 struct rtl_download_cmd
{
29 __u8 data
[RTL_FRAG_LEN
];
32 struct rtl_download_response
{
37 struct rtl_rom_version_evt
{
42 struct rtl_epatch_header
{
48 struct rtl_vendor_config_entry
{
54 struct rtl_vendor_config
{
57 struct rtl_vendor_config_entry entry
[0];
60 #if IS_ENABLED(CONFIG_BT_RTL)
62 struct btrtl_device_info
*btrtl_initialize(struct hci_dev
*hdev
,
64 void btrtl_free(struct btrtl_device_info
*btrtl_dev
);
65 int btrtl_download_firmware(struct hci_dev
*hdev
,
66 struct btrtl_device_info
*btrtl_dev
);
67 int btrtl_setup_realtek(struct hci_dev
*hdev
);
68 int btrtl_shutdown_realtek(struct hci_dev
*hdev
);
69 int btrtl_get_uart_settings(struct hci_dev
*hdev
,
70 struct btrtl_device_info
*btrtl_dev
,
71 unsigned int *controller_baudrate
,
72 u32
*device_baudrate
, bool *flow_control
);
76 static inline struct btrtl_device_info
*btrtl_initialize(struct hci_dev
*hdev
,
79 return ERR_PTR(-EOPNOTSUPP
);
82 static inline void btrtl_free(struct btrtl_device_info
*btrtl_dev
)
86 static inline int btrtl_download_firmware(struct hci_dev
*hdev
,
87 struct btrtl_device_info
*btrtl_dev
)
92 static inline int btrtl_setup_realtek(struct hci_dev
*hdev
)
97 static inline int btrtl_shutdown_realtek(struct hci_dev
*hdev
)
102 static inline int btrtl_get_uart_settings(struct hci_dev
*hdev
,
103 struct btrtl_device_info
*btrtl_dev
,
104 unsigned int *controller_baudrate
,
105 u32
*device_baudrate
,