Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Marcel Holtmann | 4fba30f | 2015-04-05 22:52:10 -0700 | [diff] [blame] | 2 | /* |
| 3 | * |
| 4 | * Bluetooth support for Broadcom devices |
| 5 | * |
| 6 | * Copyright (C) 2015 Intel Corporation |
Marcel Holtmann | 4fba30f | 2015-04-05 22:52:10 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Frederic Danis | 61b2fc2 | 2015-06-09 16:15:37 +0200 | [diff] [blame] | 9 | #define BCM_UART_CLOCK_48MHZ 0x01 |
| 10 | #define BCM_UART_CLOCK_24MHZ 0x02 |
| 11 | |
| 12 | struct bcm_update_uart_baud_rate { |
| 13 | __le16 zero; |
| 14 | __le32 baud_rate; |
| 15 | } __packed; |
| 16 | |
| 17 | struct bcm_write_uart_clock_setting { |
| 18 | __u8 type; |
| 19 | } __packed; |
| 20 | |
Ilya Faenson | 40db5f0 | 2015-06-17 11:42:46 -0400 | [diff] [blame] | 21 | struct bcm_set_sleep_mode { |
| 22 | __u8 sleep_mode; |
| 23 | __u8 idle_host; |
| 24 | __u8 idle_dev; |
| 25 | __u8 bt_wake_active; |
| 26 | __u8 host_wake_active; |
| 27 | __u8 allow_host_sleep; |
| 28 | __u8 combine_modes; |
| 29 | __u8 tristate_control; |
| 30 | __u8 usb_auto_sleep; |
| 31 | __u8 usb_resume_timeout; |
Ilya Faenson | 40db5f0 | 2015-06-17 11:42:46 -0400 | [diff] [blame] | 32 | __u8 break_to_host; |
Lukas Wunner | ff87596 | 2018-01-10 16:32:10 +0100 | [diff] [blame] | 33 | __u8 pulsed_host_wake; |
Ilya Faenson | 40db5f0 | 2015-06-17 11:42:46 -0400 | [diff] [blame] | 34 | } __packed; |
| 35 | |
| 36 | struct bcm_set_pcm_int_params { |
| 37 | __u8 routing; |
| 38 | __u8 rate; |
| 39 | __u8 frame_sync; |
| 40 | __u8 sync_mode; |
| 41 | __u8 clock_mode; |
| 42 | } __packed; |
| 43 | |
| 44 | struct bcm_set_pcm_format_params { |
| 45 | __u8 lsb_first; |
| 46 | __u8 fill_value; |
| 47 | __u8 fill_method; |
| 48 | __u8 fill_num; |
| 49 | __u8 right_justify; |
| 50 | } __packed; |
| 51 | |
Marcel Holtmann | 4fba30f | 2015-04-05 22:52:10 -0700 | [diff] [blame] | 52 | #if IS_ENABLED(CONFIG_BT_BCM) |
| 53 | |
| 54 | int btbcm_check_bdaddr(struct hci_dev *hdev); |
| 55 | int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); |
Frederic Danis | 18aeb44 | 2015-05-28 11:25:01 +0200 | [diff] [blame] | 56 | int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw); |
Abhishek Pandit-Subedi | 5283799 | 2019-11-26 08:17:30 +0100 | [diff] [blame] | 57 | int btbcm_read_pcm_int_params(struct hci_dev *hdev, |
| 58 | struct bcm_set_pcm_int_params *params); |
| 59 | int btbcm_write_pcm_int_params(struct hci_dev *hdev, |
| 60 | const struct bcm_set_pcm_int_params *params); |
Marcel Holtmann | 4fba30f | 2015-04-05 22:52:10 -0700 | [diff] [blame] | 61 | |
Marcel Holtmann | 1c8ba6d | 2015-04-05 22:52:13 -0700 | [diff] [blame] | 62 | int btbcm_setup_patchram(struct hci_dev *hdev); |
| 63 | int btbcm_setup_apple(struct hci_dev *hdev); |
| 64 | |
Hans de Goede | 22ac191 | 2018-04-20 14:44:05 +0200 | [diff] [blame] | 65 | int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len, |
| 66 | bool reinit); |
Frederic Danis | 75e167e | 2015-05-28 11:25:04 +0200 | [diff] [blame] | 67 | int btbcm_finalize(struct hci_dev *hdev); |
| 68 | |
Marcel Holtmann | 4fba30f | 2015-04-05 22:52:10 -0700 | [diff] [blame] | 69 | #else |
| 70 | |
| 71 | static inline int btbcm_check_bdaddr(struct hci_dev *hdev) |
| 72 | { |
| 73 | return -EOPNOTSUPP; |
| 74 | } |
| 75 | |
| 76 | static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) |
| 77 | { |
| 78 | return -EOPNOTSUPP; |
| 79 | } |
| 80 | |
Abhishek Pandit-Subedi | 5bd64c6 | 2019-12-26 11:03:40 -0800 | [diff] [blame^] | 81 | static inline int btbcm_read_pcm_int_params(struct hci_dev *hdev, |
Abhishek Pandit-Subedi | 5283799 | 2019-11-26 08:17:30 +0100 | [diff] [blame] | 82 | struct bcm_set_pcm_int_params *params) |
| 83 | { |
| 84 | return -EOPNOTSUPP; |
| 85 | } |
| 86 | |
Abhishek Pandit-Subedi | 5bd64c6 | 2019-12-26 11:03:40 -0800 | [diff] [blame^] | 87 | static inline int btbcm_write_pcm_int_params(struct hci_dev *hdev, |
Abhishek Pandit-Subedi | 5283799 | 2019-11-26 08:17:30 +0100 | [diff] [blame] | 88 | const struct bcm_set_pcm_int_params *params) |
| 89 | { |
| 90 | return -EOPNOTSUPP; |
| 91 | } |
| 92 | |
Frederic Danis | 18aeb44 | 2015-05-28 11:25:01 +0200 | [diff] [blame] | 93 | static inline int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw) |
Marcel Holtmann | 50862ee | 2015-04-10 14:02:20 -0700 | [diff] [blame] | 94 | { |
| 95 | return -EOPNOTSUPP; |
| 96 | } |
| 97 | |
Marcel Holtmann | 1c8ba6d | 2015-04-05 22:52:13 -0700 | [diff] [blame] | 98 | static inline int btbcm_setup_patchram(struct hci_dev *hdev) |
| 99 | { |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | static inline int btbcm_setup_apple(struct hci_dev *hdev) |
| 104 | { |
| 105 | return 0; |
| 106 | } |
| 107 | |
Frederic Danis | 75e167e | 2015-05-28 11:25:04 +0200 | [diff] [blame] | 108 | static inline int btbcm_initialize(struct hci_dev *hdev, char *fw_name, |
Hans de Goede | 22ac191 | 2018-04-20 14:44:05 +0200 | [diff] [blame] | 109 | size_t len, bool reinit) |
Frederic Danis | 75e167e | 2015-05-28 11:25:04 +0200 | [diff] [blame] | 110 | { |
| 111 | return 0; |
| 112 | } |
| 113 | |
| 114 | static inline int btbcm_finalize(struct hci_dev *hdev) |
| 115 | { |
| 116 | return 0; |
| 117 | } |
| 118 | |
Marcel Holtmann | 4fba30f | 2015-04-05 22:52:10 -0700 | [diff] [blame] | 119 | #endif |