[9610] wlbt: Let kernel driver present a fallback bdaddr
authorNick Oestergaard <nick.oe@samsung.com>
Mon, 9 Jul 2018 14:17:30 +0000 (16:17 +0200)
committerWanhyuk Seo <wan_hyuk.seo@samsung.com>
Tue, 24 Jul 2018 09:57:07 +0000 (18:57 +0900)
A new kernel module parameter with a suggested address that the host
stack can use as a fallback.  We use the SOC ID as is used if there is
no android stack, i.e. btcli. This will make sure we do not touch that
stack and the address will be the same in btcli as is used by the stack.

SCSC-Bug-Id: SSB-41759
Change-Id: Iff679b464622920e01fe617f32ee98ab23fdf1d8
Signed-off-by: Nick Oestergaard <nick.oe@samsung.com>
drivers/misc/samsung/scsc_bt/scsc_bt_module.c

index 9288084ef49d616ca83016028681f0f0760f91a0..0de645d2b4e0f37e9b47b43a5b3bf8e836659d06 100755 (executable)
@@ -74,6 +74,9 @@ static int ant_service_start_count;
 #endif
 
 static u64 bluetooth_address;
+#ifdef CONFIG_ARCH_EXYNOS
+static char *bluetooth_address_fallback = "00:00:00:00:00:00";
+#endif
 static u32 bt_info_trigger;
 static u32 bt_info_interrupt;
 static u32 firmware_control;
@@ -93,6 +96,12 @@ module_param(bluetooth_address, ullong, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(bluetooth_address,
                 "Bluetooth address");
 
+#ifdef CONFIG_ARCH_EXYNOS
+module_param(bluetooth_address_fallback, charp, 0444);
+MODULE_PARM_DESC(bluetooth_address_fallback,
+                "Bluetooth address as proposed by the driver");
+#endif
+
 module_param(service_start_count, int, S_IRUGO);
 MODULE_PARM_DESC(service_start_count,
                "Track how many times the BT service has been started");
@@ -1979,6 +1988,16 @@ static int __init scsc_bt_module_init(void)
        spin_lock_init(&bt_service.avdtp_detect.lock);
        spin_lock_init(&bt_service.avdtp_detect.fw_write_lock);
 
+#ifdef CONFIG_ARCH_EXYNOS
+       sprintf(bluetooth_address_fallback, "%02X:%02X:%02X:%02X:%02X:%02X",
+              (exynos_soc_info.unique_id & 0x000000FF0000) >> 16,
+              (exynos_soc_info.unique_id & 0x00000000FF00) >> 8,
+              (exynos_soc_info.unique_id & 0x0000000000FF) >> 0,
+              (exynos_soc_info.unique_id & 0xFF0000000000) >> 40,
+              (exynos_soc_info.unique_id & 0x00FF00000000) >> 32,
+              (exynos_soc_info.unique_id & 0x0000FF000000) >> 24);
+#endif
+
 #ifdef CONFIG_SCSC_ANT
        SCSC_TAG_DEBUG(BT_COMMON, "dev=%u class=%p\n",
                           ant_service.device, common_service.class);