WIP: Bluetooth: LE auto connection procedure

This patch implements the LE auto connection procedure.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Add command to load LE auto connect addresses

This patch adds a new Mgmt command to enable userspace inform the
kernel the remote devices he wants the kernel automaticaly establish
a connection once the device is in range.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Create start_background_scan helper

This patch creates the start_background_scan() function so it can
be reused in the next patch.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Temporarily stop background scanning on connection

Some LE controllers don't support scanning and initiating a connection
at the same time. So, for those controllers, we should temporarily
stop the background scanning and start it again once the connection
attempt is finished (successfully or not).

So this patch introduces the hci_check_background_scan() which checks
if the background scanning should be started.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Temporarily stop background scanning on discovery

If the user send a mgmt start discovery command while the background
scanning is running, we should temporarily stop it. Once the discovery
finishes, we start the background scanning again.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Fix background trigger/untrigger functions

This patch fixes to hci_trigger_background_scan() and hci_untrigger_
background_scan() so they can be called concurrently with the device
discovery procedure.

In hci_trigger_background_scan(), if it is the first trigger, we are
supposed to start the background scanning. However, if device discovery
is running, we should not send any HCI command. The background scanning
will be started once the discovery procedure is finished.

In hci_untrigger_background_scan(), if it is the last trigger, we are
supposed to stop the background scanning. However, if discovery is
running, it means the background is stop so we don't need to send
any HCI command.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Bluetooth: Fix hci_initiate_le_connection()

When a LE device we want automatically connect to is found during the
device discovery procedure, we initiate the connection. Since some LE
controllers don't support scanning and initiating state combination,
the scanning will be disabled and, therefore, we should set the
discovery state to DISCOVERY_STOPPED

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>