Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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