1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpigen.h>
9 * Check/Set Reset Delay (aa10f4e0-81ac-4233-abf6-3b2ac50e28d9)
10 * Arg2 == 0: Return a package with the following bit set
11 * BIT(0) Indicates whether the device supports other functions
12 * BIT(1) Check Bluetooth reset timing
14 * Arg2 == 1: Set the reset delay based on Arg3
16 * Arg2 == 3: Set the reset method based on Arg3 (Not supported by this driver)
17 * WDISABLE2 (BT_RF_KILL_N)
18 * VSEC (PCI Config Space)
21 static void check_reset_delay(void *arg
)
23 acpigen_write_if_lequal_op_int(ARG1_OP
, 0);
25 acpigen_write_return_singleton_buffer(0x03);
29 acpigen_write_return_singleton_buffer(0x00);
34 static void set_reset_delay(void *arg
)
36 acpigen_write_store_op_to_namestr(ARG3_OP
, "RDLY");
39 static void not_supported(void *arg
)
41 acpigen_write_return_singleton_buffer(0x00);
44 void (*reset_supported
[])(void *) = { check_reset_delay
, set_reset_delay
};
45 void (*reset_unsupported
[])(void *) = { not_supported
};
47 void acpi_device_intel_bt(unsigned int reset_gpio
, unsigned int enable_gpio
, bool audio_offload
)
52 acpigen_write_name_integer("RDLY", 0x69);
55 * Method (_DSM, 4, Serialized)
57 * If ((Arg0 == ToUUID ("aa10f4e0-81ac-4233-abf6-3b2ac50e28d9")))
63 * Return (Buffer (One)
70 * Return (Buffer (One)
84 * Return (Buffer (One)
92 struct dsm_uuid uuid_callbacks
[] = {
93 DSM_UUID("aa10f4e0-81ac-4233-abf6-3b2ac50e28d9",
94 reset_gpio
? reset_supported
: reset_unsupported
,
95 reset_gpio
? ARRAY_SIZE(reset_supported
) : ARRAY_SIZE(reset_unsupported
),
99 acpigen_write_dsm_uuid_arr(uuid_callbacks
, ARRAY_SIZE(uuid_callbacks
));
101 * PowerResource (BTRT, 0, 0)
103 * Method (_STA, 0, NotSerialized)
105 * Return (\_SB.PCI0.GBTE())
107 * Method (_ON, 0, NotSerialized)
111 * Method (_OFF, 0, NotSerialized)
115 * Method (_RST, 0, NotSerialized)
117 * Local0 = Acquire (\_SB.PCI0.CNMT, 1000)
118 * If ((Local0 == Zero))
120 * \_SB.PCI0.BTRK (Zero)
122 * \_SB.PCI0.BTRK (One)
124 * Release (\_SB.PCI0.CNMT)
129 acpigen_write_power_res("BTRT", 0, 0, NULL
, 0);
131 acpigen_write_method("_STA", 0);
134 acpigen_write_store();
135 acpigen_emit_namestring("\\_SB.PCI0.GBTE");
136 acpigen_emit_byte(LOCAL0_OP
);
138 acpigen_write_return_op(LOCAL0_OP
);
140 acpigen_write_return_integer(1);
145 acpigen_write_method("_ON", 0);
148 acpigen_emit_namestring("\\_SB.PCI0.SBTE");
149 acpigen_emit_byte(1);
154 acpigen_write_method("_OFF", 0);
157 acpigen_emit_namestring("\\_SB.PCI0.SBTE");
158 acpigen_emit_byte(0);
163 acpigen_write_method("_RST", 0);
166 acpigen_write_store();
167 acpigen_write_acquire("\\_SB.PCI0.CNMT", 1000);
168 acpigen_emit_byte(LOCAL0_OP
);
170 acpigen_write_if_lequal_op_int(LOCAL0_OP
, 0);
172 acpigen_emit_namestring("\\_SB.PCI0.BTRK");
173 acpigen_emit_byte(0);
175 acpigen_emit_ext_op(SLEEP_OP
);
176 acpigen_emit_namestring("RDLY");
178 acpigen_emit_namestring("\\_SB.PCI0.BTRK");
179 acpigen_emit_byte(1);
181 acpigen_emit_ext_op(SLEEP_OP
);
182 acpigen_emit_namestring("RDLY");
184 acpigen_write_release("\\_SB.PCI0.CNMT");
191 acpigen_write_power_res_end();
194 * Name (_PRR, Package (0x01)
199 acpigen_write_name("_PRR");
201 acpigen_write_package(1);
202 acpigen_emit_namestring("BTRT");
207 * Name (_PR0, Package (0x01)
212 acpigen_write_name("_PR0");
214 acpigen_write_package(1);
215 acpigen_emit_namestring("BTRT");
220 * Name (_PR3, Package (0x01)
225 acpigen_write_name("_PR3");
227 acpigen_write_package(1);
228 acpigen_emit_namestring("BTRT");
233 * Method (AOLD, 0, Serialized)
235 * Name (AODS, Package (0x03)
239 * Zero // Audio Offload - 0: Disabled
245 acpigen_write_method_serialized("AOLD", 0);
247 acpigen_write_name("AODS");
248 acpigen_write_package(3);
250 acpigen_write_integer(0);
251 acpigen_write_integer(0x12);
252 acpigen_write_integer(audio_offload
);
256 acpigen_write_return_namestr("AODS");
261 void acpi_device_intel_bt_common(unsigned int enable_gpio
, unsigned int reset_gpio
)
263 acpigen_write_scope("\\_SB.PCI0");
267 acpigen_write_mutex("CNMT", 0);
270 * Method (SBTE, 1, Serialized)
280 acpigen_write_method_serialized("SBTE", 1);
283 acpigen_write_if_lequal_op_int(ARG0_OP
, 1);
285 acpigen_soc_set_tx_gpio(enable_gpio
);
287 acpigen_write_else();
289 acpigen_soc_clear_tx_gpio(enable_gpio
);
297 * Method (GBTE, 0, NotSerialized)
299 * Return (GTXS (enable_gpio))
302 acpigen_write_method("GBTE", 0);
305 acpigen_soc_get_tx_gpio(enable_gpio
);
306 acpigen_write_return_op(LOCAL0_OP
);
308 acpigen_write_return_integer(0);
314 * Method (BTRK, 1, Serialized)
324 acpigen_write_method_serialized("BTRK", 1);
326 acpigen_write_if_lequal_op_int(ARG0_OP
, 1);
328 acpigen_soc_set_tx_gpio(reset_gpio
);
330 acpigen_write_else();
332 acpigen_soc_clear_tx_gpio(reset_gpio
);
339 * Method (GBTR, 0, NotSerialized)
341 * Return (GTXS (reset_gpio))
344 acpigen_write_method("GBTR", 0);
347 acpigen_soc_get_tx_gpio(reset_gpio
);
348 acpigen_write_return_op(LOCAL0_OP
);
350 acpigen_write_return_op(0);