Skip to content

arpi 12 : framework patch

Peter Yoon edited this page Sep 14, 2022 · 9 revisions

Add HW reset on Bluetooth HCI startup_timer_expired()

Workaround for bt_hci timeout. Information from following links :

https://github.com/raspberrypi/linux/issues/2832

https://github.com/raspberrypi/userland/blob/master/host_applications/linux/apps/vcmailbox/vcmailbox.c

Apply following patch under system/bt/

hci/src/hci_layer.cc
@@ line 373
   startup_future = NULL;
 }

+#include <fcntl.h>
+#include <sys/ioctl.h>
+static void hw_reset(bool reset) {
+  unsigned buf[8] = { 8 * 4, 0, 0x38041, 8, 8, 128, 0, 0};
+  buf[6] = reset ? 0 : 1;
+  int fd = open("/dev/vcio", 0);
+  if (fd >= 0) {
+    ioctl(fd, _IOWR(100, 0, char *), buf);
+    close(fd);
+  }
+}

 static void startup_timer_expired(UNUSED_ATTR void* context) {
   LOG_ERROR(LOG_TAG, "%s", __func__);

   LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_STARTUP_TIMED_OUT);

   hci_close();
   if (abort_timer.IsScheduled()) {
     LOG_ERROR(LOG_TAG, "%s: waiting for abort_timer", __func__);
     return;
   }
+  hw_reset(true);
+  sleep(2);
+  hw_reset(false);
   abort();
 }

Disable Low Power Mode of Bluetooth

Patch from https://github.com/android-rpi/device_arpi_rpi4/issues/25#issuecomment-673996293

Apply following changes under hardware/interfaces/

bluetooth/1.0/default/vendor_interface.cc
@@ line 343 @@ void VendorInterface::OnFirmwareConfigured(
   lib_interface_->op(BT_VND_OP_GET_LPM_IDLE_TIMEOUT, &lpm_timeout_ms);
   ALOGI("%s: lpm_timeout_ms %d", __func__, lpm_timeout_ms);

-  bt_vendor_lpm_mode_t mode = BT_VND_LPM_ENABLE;
+  bt_vendor_lpm_mode_t mode = BT_VND_LPM_DISABLE;
   lib_interface_->op(BT_VND_OP_LPM_SET_MODE, &mode);

Enable camera hal 64bit build

Apply following changes under hardware/interfaces/

camera/provider/2.5/default/Android.bp
@@ line 164
     relative_install_path: "hw",
     srcs: ["external-service.cpp"],
-    compile_multilib: "32",
     init_rc: ["[email protected]"],
     shared_libs: [