summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/hci_h5.c
Commit message (Collapse)AuthorAgeFilesLines
* Bluetooth: h5: Do not initialize Configuration fieldAndrei Emeltchenko2015-12-101-2/+2
| | | | | | | | | Initializing Configuration field in H5 Config message to 0x01 gives wrong impression that the value is used and needed. Later on the whole field is rewritten with h5_cfg_field(). Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Simplify setting Configuration FieldAndrei Emeltchenko2015-12-101-5/+1
| | | | | | | | Only Sliding Window Size is used at the moment for H5 Bluetooth Configuration messages. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Use hexadecimal notation for maskAndrei Emeltchenko2015-12-101-1/+1
| | | | | | | Using hexadecimal notation for mask makes code easier to read Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Use hex notation for maskAndrei Emeltchenko2015-11-191-1/+1
| | | | | | | This makes it easier to read and makes code consistent. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Fix mask for H5 header lenAndrei Emeltchenko2015-11-191-1/+1
| | | | | | | Fixes mask when calculating three-wire (h5) length. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Use new hci_skb_pkt_* wrappers for driversMarcel Holtmann2015-11-191-7/+7
| | | | | | | | | The new hci_skb_pkt_* wrappers are mainly intented for drivers to require less knowledge about bt_cb(sbk) handling. So after converting the core packet handling, convert all drivers. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: hci_h5: clean up hci_h5 codePrasanna Karthik2015-09-301-5/+5
| | | | | | | | | This patch fixes checkpatch warnings: - Comparison to NULL could be re-written - no space required after a cast Signed-off-by: Prasanna Karthik <mkarthi3@visteon.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: hci_h5: Cleaned up coding style warningsPrasanna Karthik2015-07-271-1/+1
| | | | | | | | Cleanedup "Unnecessary space before function pointer arguments" warning reported by Checkpatch Signed-off-by: Prasanna Karthik <mkarthi3@visteon.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: hci_uart: Remove the manual protocol init messageMarcel Holtmann2015-04-071-8/+1
| | | | | | | | | The init function for each HCI UART protocol prints the same on success and failure. This information is so generic, remove it and let the main HCI UART handling print it instead. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: hci_uart: Add name information to hci_uart_proto structMarcel Holtmann2015-04-071-0/+1
| | | | | | | | This adds an extra name field to the hci_uart_proto struct that provides a simple way of adding a string identifier to the protocol. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: hci_uart: Make struct hci_uart_proto always constMarcel Holtmann2015-04-071-1/+1
| | | | | | | | The usage of struct hci_uart_proto should always be const. Change the function headers and individual protocol drivers. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: hci_uart: Use const data pointer for received dataMarcel Holtmann2015-04-071-2/+2
| | | | | | | | | | The TTY layer provides its data pointers as const, but the HCI UART callbacks expect them as general data pointers. This is of course wrong and instead of casting them, just fix the individual drivers to actually take a const data pointer. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Switch HCI H5 driver to use hci_reset_dev() functionMarcel Holtmann2014-11-021-11/+2
| | | | | | | | Instead of having the driver generate the HCI Hardware Error event manually, just call hci_reset_dev() to trigger the upper stack reset. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Use HCI_EV_HARDWARE_ERROR define for event payloadMarcel Holtmann2014-11-021-2/+2
| | | | | | | | | | | When constructing the event payload for the HCI_Hardware_Error event message, use the HCI_EV_HARDWARE_ERROR define. In addition rename the variables from hard_err to hw_err to clearly indicate that this is about the hardware error and not a hard error. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: HCI H5 peer reset detectionLoic Poulain2014-10-311-0/+34
| | | | | | | | | | | | | | | | | | H5 Specification says: If a SYNC message is received while in the Active State, it is assumed that the peer device has reset. The local device should therefore perform a full reset of the upper stack, and start Link Establishment again at the Uninitialized State. Upon entering the Active State, the first packet sent shall have its SEQ and ACK numbers set to zero. This patch resets the HCI H5 driver data/state to unitialized and reports an HCI hardware error event to notify the upper stack that HCI synchronization has been lost. H5 will be re-synchronized and upper stack should generate an HCI Reset command. Signed-off-by: Loic Poulain <loic.poulain@intel.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Fix HCI H5 corrupted ack valueLoic Poulain2014-08-141-1/+1
| | | | | | | | | | | | | In this expression: seq = (seq - 1) % 8 seq (u8) is implicitly converted to an int in the arithmetic operation. So if seq value is 0, operation is ((0 - 1) % 8) => (-1 % 8) => -1. The new seq value is 0xff which is an invalid ACK value, we expect 0x07. It leads to frequent dropped ACK and retransmission. Fix this by using '&' binary operator instead of '%'. Signed-off-by: Loic Poulain <loic.poulain@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Cc: stable@vger.kernel.org
* Bluetooth: Remove redundant calls to h5_reset_rxLoic Poulain2014-07-031-4/+0
| | | | | | | | | h5_reset_rx is unconditionally called at the end of h5_complete_rx_pkt, no need to call it anymore after that. Signed-off-by: Loic Poulain <loic.poulain@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
* Bluetooth: Ignore H5 non-link packets in non-active stateLoic Poulain2014-06-231-0/+1
| | | | | | | | | | When detecting a non-link packet, h5_reset_rx() frees the Rx skb. Not returning after that will cause the upcoming h5_rx_payload() call to dereference a now NULL Rx skb and trigger a kernel oops. Signed-off-by: Loic Poulain <loic.poulain@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Cc: stable@vger.kernel.org
* Bluetooth: Remove assignments in if-statementsValentin Ilie2014-03-051-2/+4
| | | | | | | | Remove assignment in if-statements to be consistent with the coding style. Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Stop BCSP/H5 timer before cleaning upMichael Knudsen2014-03-041-2/+2
| | | | | | | | | | | When stopping BCSP/H5, stop the retransmission timer before proceeding to clean up packet queues. The previous code had a race condition where the timer could trigger after the packet lists and protocol structure had been removed which led to dereferencing NULL or use-after-free bugs. Signed-off-by: Michael Knudsen <m.knudsen@samsung.com> Reported-by: Kirill Tkhai <ktkhai@parallels.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Provide hdev parameter to hci_recv_frame() driver callbackMarcel Holtmann2013-10-111-1/+1
| | | | | | | | | | To avoid casting skb->dev into hdev, just let the drivers provide the hdev directly when calling hci_recv_frame() function. This patch also fixes up all drivers to provide the hdev. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
* Bluetooth: Introduce a flags variable to Three-wire UART stateJohan Hedberg2012-07-171-11/+15
| | | | | | | | This patch introduces a flags variable to the Three-wire UART state struct and converts the two existing bools in the struct into flags. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Improve Three-wire UART configuration handlingJohan Hedberg2012-07-171-7/+27
| | | | | | | | | | | The configuration request/response messages contain a configuration field which contains the sliding window size (amount of unacked reliable packets that can be pending). This patch makes sure that we configure the correct size (minimum of local and remote values) and use it when determining whether to send new packets or not. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Remove unnecessary h5_build_pkt functionJohan Hedberg2012-07-171-26/+23
| | | | | | | | | The implementation of h5_build_packet can be moved into h5_prepare_pkt since all h5_prepare_pkt does is determine whether the packet is reliable and then call h5_build_packet. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Implement proper low-power support for Three-wire UARTJohan Hedberg2012-07-171-5/+32
| | | | | | | | | | | | This patch adds on-demand wakeup request sending (and re-sendind) when we are in low-power state. When the controller enters this state it will send a sleep message after which the host is not allowed to send any other packets until a wakeup request has been sent and the woken message received as a response to it. The wakeup requests are re-sent periodically until a woken message is received. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add initialization tracking to HCI Three-wire driverJohan Hedberg2012-07-171-16/+50
| | | | | | | | | | | This patch adds tracking for the uninitialized, initialized and active states for Three-wire UART. This is needed so we can handle periodic sending of the Link Establishment messages before reaching active state and so that we do not try to do any higher level HCI data transmission before reaching active state. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add initial sleep support to Three-wire UARTJohan Hedberg2012-07-171-0/+13
| | | | | | | | | | This patch adds very basic support for the sleep related messages. The only thing the code does right now is send a wakeup message as soon as receiving a sleep one, essentially preventing the controller from going to sleep. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Improve rx debug logs for Three-wire UARTJohan Hedberg2012-07-171-14/+3
| | | | | | | Remove unnecessary debug logs and add some to more centralized places. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Use delayed init for Three-wire UARTJohan Hedberg2012-07-171-0/+3
| | | | | | | | This patch takes into use the delayed initialization feature that the Bluetooth UART framework provides. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add support for Three-wire Link Control packetsJohan Hedberg2012-07-171-17/+79
| | | | | | | | This patch adds basic support for parsing and sending Three-wire UART Link Control packets. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Fix/implement Three-wire reliable packet sendingJohan Hedberg2012-07-171-17/+70
| | | | | | | | This patch should complete the necessary code for sending reliable Three-wire packets. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add Three-wire header value convenience macrosJohan Hedberg2012-07-171-0/+8
| | | | | | | | This patch adds convenience macros for reading Three-wire header values. This will help make the code more readable. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add initial packet sending support to Three-wire UARTJohan Hedberg2012-07-171-7/+98
| | | | | | | | This patch adds initial packed encoding and sending support to the Three-wire UART HCI transport driver. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add basic packet parsing to Three-wire UART driverJohan Hedberg2012-07-171-8/+222
| | | | | | | | This patch adds basic packet parsing to the Three-wire UART HCI driver for packets received from the controller. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add initial reliable packet support for Three-wire UARTJohan Hedberg2012-07-171-0/+56
| | | | | | | | This patch adds initial support for reliable packets along with the necessary retransmission timer for the Three-wire UART HCI driver. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Add basic state tracking to Three-wire UART driverJohan Hedberg2012-07-171-4/+92
| | | | | | | | This patch adds basic state tracking and socket buffer handling to the Three-wire UART (H5) HCI driver. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
* Bluetooth: Initial skeleton for Three-wire UART (H5) supportJohan Hedberg2012-07-171-0/+88
This patch adds the initial skeleton for Three-wire UART (H5) support and hooks it up to the HCI UART framework. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
OpenPOWER on IntegriCloud