blob: 8bf01565fdfca4272e74508e38f18fe7621acc1d [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Marcel Holtmann4fba30f2015-04-05 22:52:10 -07002/*
3 *
4 * Bluetooth support for Broadcom devices
5 *
6 * Copyright (C) 2015 Intel Corporation
Marcel Holtmann4fba30f2015-04-05 22:52:10 -07007 */
8
Frederic Danis61b2fc22015-06-09 16:15:37 +02009#define BCM_UART_CLOCK_48MHZ 0x01
10#define BCM_UART_CLOCK_24MHZ 0x02
11
12struct bcm_update_uart_baud_rate {
13 __le16 zero;
14 __le32 baud_rate;
15} __packed;
16
17struct bcm_write_uart_clock_setting {
18 __u8 type;
19} __packed;
20
Ilya Faenson40db5f02015-06-17 11:42:46 -040021struct 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 Faenson40db5f02015-06-17 11:42:46 -040032 __u8 break_to_host;
Lukas Wunnerff875962018-01-10 16:32:10 +010033 __u8 pulsed_host_wake;
Ilya Faenson40db5f02015-06-17 11:42:46 -040034} __packed;
35
36struct 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
44struct 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 Holtmann4fba30f2015-04-05 22:52:10 -070052#if IS_ENABLED(CONFIG_BT_BCM)
53
54int btbcm_check_bdaddr(struct hci_dev *hdev);
55int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
Frederic Danis18aeb442015-05-28 11:25:01 +020056int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw);
Abhishek Pandit-Subedi52837992019-11-26 08:17:30 +010057int btbcm_read_pcm_int_params(struct hci_dev *hdev,
58 struct bcm_set_pcm_int_params *params);
59int btbcm_write_pcm_int_params(struct hci_dev *hdev,
60 const struct bcm_set_pcm_int_params *params);
Marcel Holtmann4fba30f2015-04-05 22:52:10 -070061
Marcel Holtmann1c8ba6d2015-04-05 22:52:13 -070062int btbcm_setup_patchram(struct hci_dev *hdev);
63int btbcm_setup_apple(struct hci_dev *hdev);
64
Hans de Goede0287c5d2020-04-17 19:15:27 +020065int btbcm_initialize(struct hci_dev *hdev, bool *fw_load_done);
Hans de Goede0383f162020-04-17 19:15:29 +020066int btbcm_finalize(struct hci_dev *hdev, bool *fw_load_done);
Frederic Danis75e167e2015-05-28 11:25:04 +020067
Marcel Holtmann4fba30f2015-04-05 22:52:10 -070068#else
69
70static inline int btbcm_check_bdaddr(struct hci_dev *hdev)
71{
72 return -EOPNOTSUPP;
73}
74
75static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
76{
77 return -EOPNOTSUPP;
78}
79
Abhishek Pandit-Subedi5bd64c62019-12-26 11:03:40 -080080static inline int btbcm_read_pcm_int_params(struct hci_dev *hdev,
Abhishek Pandit-Subedi52837992019-11-26 08:17:30 +010081 struct bcm_set_pcm_int_params *params)
82{
83 return -EOPNOTSUPP;
84}
85
Abhishek Pandit-Subedi5bd64c62019-12-26 11:03:40 -080086static inline int btbcm_write_pcm_int_params(struct hci_dev *hdev,
Abhishek Pandit-Subedi52837992019-11-26 08:17:30 +010087 const struct bcm_set_pcm_int_params *params)
88{
89 return -EOPNOTSUPP;
90}
91
Frederic Danis18aeb442015-05-28 11:25:01 +020092static inline int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw)
Marcel Holtmann50862ee2015-04-10 14:02:20 -070093{
94 return -EOPNOTSUPP;
95}
96
Marcel Holtmann1c8ba6d2015-04-05 22:52:13 -070097static inline int btbcm_setup_patchram(struct hci_dev *hdev)
98{
99 return 0;
100}
101
102static inline int btbcm_setup_apple(struct hci_dev *hdev)
103{
104 return 0;
105}
106
Hans de Goede0287c5d2020-04-17 19:15:27 +0200107static inline int btbcm_initialize(struct hci_dev *hdev, bool *fw_load_done)
Frederic Danis75e167e2015-05-28 11:25:04 +0200108{
109 return 0;
110}
111
Hans de Goede0383f162020-04-17 19:15:29 +0200112static inline int btbcm_finalize(struct hci_dev *hdev, bool *fw_load_done)
Frederic Danis75e167e2015-05-28 11:25:04 +0200113{
114 return 0;
115}
116
Marcel Holtmann4fba30f2015-04-05 22:52:10 -0700117#endif