drivers/platform/x86/toshiba_bluetooth.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/toshiba_bluetooth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/toshiba_bluetooth.c- Extension
.c- Size
- 7460 bytes
- Lines
- 317
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/init.hlinux/types.hlinux/acpi.hlinux/rfkill.hlinux/platform_device.h
Detected Declarations
struct toshiba_bluetooth_devfunction toshiba_bluetooth_presentfunction toshiba_bluetooth_statusfunction toshiba_bluetooth_enablefunction toshiba_bluetooth_disablefunction toshiba_bluetooth_sync_statusfunction bt_rfkill_set_blockfunction bt_rfkill_pollfunction toshiba_bt_rfkill_notifyfunction toshiba_bt_resumefunction toshiba_bt_rfkill_probefunction toshiba_bt_rfkill_remove
Annotated Snippet
struct toshiba_bluetooth_dev {
struct acpi_device *acpi_dev;
struct rfkill *rfk;
bool killswitch;
bool plugged;
bool powered;
};
static int toshiba_bt_rfkill_probe(struct platform_device *pdev);
static void toshiba_bt_rfkill_remove(struct platform_device *pdev);
static void toshiba_bt_rfkill_notify(acpi_handle handle, u32 event, void *data);
static const struct acpi_device_id bt_device_ids[] = {
{ "TOS6205", 0},
{ "", 0},
};
MODULE_DEVICE_TABLE(acpi, bt_device_ids);
#ifdef CONFIG_PM_SLEEP
static int toshiba_bt_resume(struct device *dev);
#endif
static SIMPLE_DEV_PM_OPS(toshiba_bt_pm, NULL, toshiba_bt_resume);
static struct platform_driver toshiba_bt_rfkill_driver = {
.probe = toshiba_bt_rfkill_probe,
.remove = toshiba_bt_rfkill_remove,
.driver = {
.name = "Toshiba BT",
.acpi_match_table = bt_device_ids,
.pm = &toshiba_bt_pm,
},
};
static int toshiba_bluetooth_present(acpi_handle handle)
{
acpi_status result;
u64 bt_present;
/*
* Some Toshiba laptops may have a fake TOS6205 device in
* their ACPI BIOS, so query the _STA method to see if there
* is really anything there.
*/
result = acpi_evaluate_integer(handle, "_STA", NULL, &bt_present);
if (ACPI_FAILURE(result)) {
pr_err("ACPI call to query Bluetooth presence failed\n");
return -ENXIO;
}
if (!bt_present) {
pr_info("Bluetooth device not present\n");
return -ENODEV;
}
return 0;
}
static int toshiba_bluetooth_status(acpi_handle handle)
{
acpi_status result;
u64 status;
result = acpi_evaluate_integer(handle, "BTST", NULL, &status);
if (ACPI_FAILURE(result)) {
pr_err("Could not get Bluetooth device status\n");
return -ENXIO;
}
return status;
}
static int toshiba_bluetooth_enable(acpi_handle handle)
{
acpi_status result;
result = acpi_evaluate_object(handle, "AUSB", NULL, NULL);
if (ACPI_FAILURE(result)) {
pr_err("Could not attach USB Bluetooth device\n");
return -ENXIO;
}
result = acpi_evaluate_object(handle, "BTPO", NULL, NULL);
if (ACPI_FAILURE(result)) {
pr_err("Could not power ON Bluetooth device\n");
return -ENXIO;
}
return 0;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/types.h`, `linux/acpi.h`, `linux/rfkill.h`, `linux/platform_device.h`.
- Detected declarations: `struct toshiba_bluetooth_dev`, `function toshiba_bluetooth_present`, `function toshiba_bluetooth_status`, `function toshiba_bluetooth_enable`, `function toshiba_bluetooth_disable`, `function toshiba_bluetooth_sync_status`, `function bt_rfkill_set_block`, `function bt_rfkill_poll`, `function toshiba_bt_rfkill_notify`, `function toshiba_bt_resume`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.