Enable BCM4339 Bluetooth on Brillo for picoimx

This reverts commit c93964cae37b96a5a6acca8cb001ef22f1d36240.
Added back bluetoooth configuration.
Pop up warning info if not found the bluetooth
firmware downloaded.

Change-Id: I77d66e8ab745f3a26703c4acb34736d771dd71cf
Signed-off-by: Wang Haoran <Haoran.Wang@freescale.com>
diff --git a/peripheral/bluetooth/bcm4339/Android.mk b/peripheral/bluetooth/bcm4339/Android.mk
new file mode 100644
index 0000000..d6a48d7
--- /dev/null
+++ b/peripheral/bluetooth/bcm4339/Android.mk
@@ -0,0 +1,28 @@
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := bt_bcm_bcm4339.imx
+LOCAL_MODULE_TAGS := optional
+LOCAL_REQUIRED_MODULES :=  \
+    libbt-vendor \
+    bluetooth.default \
+    bluetooth-cli \
+    bluetoothtbd \
+    net_bdtool
+LOCAL_INIT_RC := bt_bcm4339.rc
+include $(BUILD_PHONY_PACKAGE)
+
diff --git a/peripheral/bluetooth/bcm4339/bt_bcm4339.rc b/peripheral/bluetooth/bcm4339/bt_bcm4339.rc
new file mode 100644
index 0000000..f93978d
--- /dev/null
+++ b/peripheral/bluetooth/bcm4339/bt_bcm4339.rc
@@ -0,0 +1,34 @@
+########################################################
+#  BLUETOOTH CONFIGURATION - BROADCOM SPECIFIC
+########################################################
+
+on fs
+    mkdir /config/bt 0770 system bluetooth
+    setprop ro.bt.bdaddr_path /config/bt/bd_addr.conf
+    setprop bluetooth.enable_timeout_ms 15000
+
+on early-boot
+    chmod 0644 /config/bt/bd_addr.conf
+
+on post-fs-data
+    # Bluetooth
+    write /sys/devices/soc0/bt_rfkill.18/rfkill/rfkill0/state 1
+    chmod 0660 /sys/devices/soc0/bt_rfkill.18/rfkill/rfkill0/state
+    chown bluetooth net_bt_stack /sys/devices/soc0/bt_rfkill.18/rfkill/rfkill0/state
+    chown bluetooth net_bt_stack /sys/devices/soc0/bt_rfkill.18/rfkill/rfkill0/type
+
+on boot
+
+########################################################
+
+service dhcpcd_bt-pan /system/bin/dhcpcd -ABKL
+    class main
+    group bluetooth wifi system dhcp
+    disabled
+    oneshot
+
+service iprenew_bt-pan /system/bin/dhcpcd -n
+    group bluetooth system dhcp
+    disabled
+    oneshot
+
diff --git a/peripheral/bluetooth/bcm4339/bt_vendor.conf b/peripheral/bluetooth/bcm4339/bt_vendor.conf
new file mode 100644
index 0000000..3f3cb94
--- /dev/null
+++ b/peripheral/bluetooth/bcm4339/bt_vendor.conf
@@ -0,0 +1,6 @@
+# UART device port where Bluetooth controller is attached
+UartPort = /dev/ttymxc4
+
+# Firmware patch file location
+FwPatchFilePath = /vendor/firmware/bluetooth/bcm4339
+FwPatchFileName = BCM4335C0.ZP.hcd
diff --git a/peripheral/bluetooth/bcm4339/peripheral.mk b/peripheral/bluetooth/bcm4339/peripheral.mk
new file mode 100644
index 0000000..0c1a8f6
--- /dev/null
+++ b/peripheral/bluetooth/bcm4339/peripheral.mk
@@ -0,0 +1,37 @@
+#
+# Copyright 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# BCM4339 WIFI Firmware
+BCM4339_BT_SRC := hardware/bsp/freescale/peripheral/bluetooth/bcm4339
+BCM4339_BT_FIRMWARE := vendor/bsp/freescale/peripheral/bluetooth/bcm4339/firmware
+BCM4339_BT_FW_DST := system/vendor/firmware/bluetooth/bcm4339
+
+ifeq ($(BCM4339_BT_FIRMWARE), $(wildcard $(BCM4339_BT_FIRMWARE)))
+PRODUCT_COPY_FILES += \
+    $(BCM4339_BT_FIRMWARE)/Type_ZP.hcd:$(BCM4339_BT_FW_DST)/BCM4335C0.ZP.hcd
+else
+    $(warning "Not found bcm4339 BT firmware. Please use 'tools/bdk/brunch/brunch bsp download picoimx' command to download.")
+endif
+
+PRODUCT_COPY_FILES += \
+    $(BCM4339_BT_SRC)/bt_vendor.conf:system/etc/bluetooth/bt_vendor.conf
+
+# BCM Bluetooth
+BOARD_HAVE_BLUETOOTH_BCM := true
+BOARD_CUSTOM_BT_CONFIG := $(BCM4339_BT_SRC)/vnd_picoimx.txt
+
+DEVICE_PACKAGES += \
+    bt_bcm_bcm4339.imx
diff --git a/peripheral/bluetooth/bcm4339/vnd_picoimx.txt b/peripheral/bluetooth/bcm4339/vnd_picoimx.txt
new file mode 100644
index 0000000..7656697
--- /dev/null
+++ b/peripheral/bluetooth/bcm4339/vnd_picoimx.txt
@@ -0,0 +1,12 @@
+BLUETOOTH_UART_DEVICE_PORT = "/dev/ttymxc4"
+FW_PATCHFILE_LOCATION = "/vendor/firmware/bluetooth/bcm4339/"
+BT_WAKE_VIA_PROC = FALSE
+BT_WAKE_VIA_USERIAL_IOCTL = FALSE
+LPM_IDLE_TIMEOUT_MULTIPLE = 5
+BTVND_DBG = TRUE
+BTHW_DBG = TRUE
+VNDUSERIAL_DBG = TRUE
+UPIO_DBG = TRUE
+SCO_PCM_IF_CLOCK_RATE = 2
+USE_CONTROLLER_BDADDR = FALSE
+UART_TARGET_BAUD_RATE = 115200