blob: e41974f8af401208b1155d87774837de7b8ae003 [file] [log] [blame]
Carlo Caionedb33c772015-05-14 10:49:09 +02001/*
2 * Bluetooth support for Realtek devices
3 *
4 * Copyright (C) 2015 Endless Mobile, Inc.
5 *
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.
10 *
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.
15 *
16 */
17
18#define RTL_FRAG_LEN 252
19
Martin Blumenstingl26503ad22018-08-02 16:57:13 +020020#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__)
24
25struct btrtl_device_info;
26
Carlo Caionedb33c772015-05-14 10:49:09 +020027struct rtl_download_cmd {
28 __u8 index;
29 __u8 data[RTL_FRAG_LEN];
30} __packed;
31
32struct rtl_download_response {
33 __u8 status;
34 __u8 index;
35} __packed;
36
37struct rtl_rom_version_evt {
38 __u8 status;
39 __u8 version;
40} __packed;
41
42struct rtl_epatch_header {
43 __u8 signature[8];
44 __le32 fw_version;
45 __le16 num_patches;
46} __packed;
47
48#if IS_ENABLED(CONFIG_BT_RTL)
49
Martin Blumenstingl26503ad22018-08-02 16:57:13 +020050struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev);
51void btrtl_free(struct btrtl_device_info *btrtl_dev);
52int btrtl_download_firmware(struct hci_dev *hdev,
53 struct btrtl_device_info *btrtl_dev);
Carlo Caionedb33c772015-05-14 10:49:09 +020054int btrtl_setup_realtek(struct hci_dev *hdev);
55
56#else
57
Martin Blumenstingl26503ad22018-08-02 16:57:13 +020058static inline struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev)
59{
60 return ERR_PTR(-EOPNOTSUPP);
61}
62
63static inline void btrtl_free(struct btrtl_device_info *btrtl_dev)
64{
65}
66
67static inline int btrtl_download_firmware(struct hci_dev *hdev,
68 struct btrtl_device_info *btrtl_dev)
69{
70 return -EOPNOTSUPP;
71}
72
Carlo Caionedb33c772015-05-14 10:49:09 +020073static inline int btrtl_setup_realtek(struct hci_dev *hdev)
74{
75 return -EOPNOTSUPP;
76}
77
78#endif