11 Sep, 2020

2 commits


29 Jul, 2020

1 commit


14 Jul, 2020

1 commit

  • 1.During SSR for command time out if BT SoC goes to inresponsive
    state, power cycling of BT SoC was not happening. Given the fix by
    sending hw error event to reset the BT SoC.

    2.If SSR is triggered then ignore the transmit data requests to
    BT SoC until SSR is completed.

    Signed-off-by: Venkata Lakshmi Narayana Gubba
    Signed-off-by: Marcel Holtmann

    Venkata Lakshmi Narayana Gubba
     

11 Jul, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Marcel Holtmann

    Gustavo A. R. Silva
     

12 Jun, 2020

2 commits


10 Jun, 2020

1 commit

  • Due to race conditions between qca_hw_error and qca_controller_memdump
    during SSR timeout,the same pointer is freed twice. This results in a
    double free. Now a lock is acquired before checking the stauts of SSR
    state.

    Fixes: d841502c79e3 ("Bluetooth: hci_qca: Collect controller memory dump during SSR")
    Signed-off-by: Venkata Lakshmi Narayana Gubba
    Reviewed-by: Abhishek Pandit-Subedi
    Signed-off-by: Marcel Holtmann

    Venkata Lakshmi Narayana Gubba
     

08 Jun, 2020

4 commits

  • If waiting for IBS sleep times out jump to the error handler, this is
    easier to read than multiple 'if' branches and a fall through to the
    error handler.

    Signed-off-by: Matthias Kaehlcke
    Reviewed-by: Abhishek Pandit-Subedi
    Signed-off-by: Marcel Holtmann

    Matthias Kaehlcke
     
  • qca_suspend() calls serdev_device_wait_until_sent() regardless of
    whether a transfer is pending. While it does no active harm since
    the function should return immediately it makes the code more
    confusing. Add a flag to track whether a transfer is pending and
    only call serdev_device_wait_until_sent() is needed.

    Signed-off-by: Matthias Kaehlcke
    Reviewed-by: Abhishek Pandit-Subedi
    Signed-off-by: Marcel Holtmann

    Matthias Kaehlcke
     
  • qca_suspend() removes the vote for the UART TX clock after
    writing an IBS sleep request to the serial buffer. This is
    not a good idea since there is no guarantee that the request
    has been sent at this point. Instead remove the vote after
    successfully entering IBS sleep. This also fixes the issue
    of the vote being removed in case of an aborted suspend due
    to a failure of entering IBS sleep.

    Fixes: 41d5b25fed0a0 ("Bluetooth: hci_qca: add PM support")
    Signed-off-by: Matthias Kaehlcke
    Reviewed-by: Abhishek Pandit-Subedi
    Signed-off-by: Marcel Holtmann

    Matthias Kaehlcke
     
  • The serial clocks should be on when there is a vote for at least one
    of the clocks (RX or TX), and off when there is no 'on' vote. The
    current logic to determine the combined state is a bit redundant
    in the code paths for different types of votes, use a single
    statement in the common path instead.

    Signed-off-by: Matthias Kaehlcke
    Signed-off-by: Marcel Holtmann

    Matthias Kaehlcke
     

04 Jun, 2020

1 commit

  • When a function like devm_clk_get_optional() function returns both error
    pointers on error and NULL then the NULL return means that the optional
    feature is deliberately disabled. It is a special sort of success and
    should not trigger an error message. The surrounding code should be
    written to check for NULL and not crash.

    On the other hand, if we encounter an error, then the probe from should
    clean up and return a failure.

    In this code, if devm_clk_get_optional() returns an error pointer then
    the kernel will crash inside the call to:

    clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ);

    The error handling must be updated to prevent that.

    Fixes: 77131dfec6af ("Bluetooth: hci_qca: Replace devm_gpiod_get() with devm_gpiod_get_optional()")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Marcel Holtmann

    Dan Carpenter
     

01 Jun, 2020

1 commit

  • QCA6390 memdump VSE sometimes come to bluetooth driver
    with wrong sequence number as illustrated as follows:
    frame # in dec: frame data in hex
    1396: ff fd 01 08 74 05 00 37 8f 14
    1397: ff fd 01 08 75 05 00 ff bf 38
    1414: ff fd 01 08 86 05 00 fb 5e 4b
    1399: ff fd 01 08 77 05 00 f3 44 0a
    1400: ff fd 01 08 78 05 00 ca f7 41
    it is mistook for controller missing packets, so results
    in page fault after overwriting memdump buffer allocated.

    Fixed by ignoring QCA6390 sequence number check and
    checking buffer space before writing.

    Signed-off-by: Zijun Hu
    Tested-by: Zijun Hu
    Signed-off-by: Marcel Holtmann

    Zijun Hu
     

29 May, 2020

2 commits

  • Warm reboot can not reset controller qca6390 due to
    lack of controllable power supply, so causes firmware
    download failure during enable.

    Fixed by sending VSC EDL_SOC_RESET to reset qca6390
    within added device shutdown implementation.

    Signed-off-by: Zijun Hu
    Tested-by: Zijun Hu
    Signed-off-by: Marcel Holtmann

    Zijun Hu
     
  • @dev parameter of qca_suspend()/qca_resume() represents
    serdev_device, but it is mistook for hci_dev and causes
    succedent unexpected memory access.

    Fix by taking @dev as serdev_device.

    Fixes: 41d5b25fed0 ("Bluetooth: hci_qca: add PM support")
    Signed-off-by: Zijun Hu
    Reviewed-by: Matthias Kaehlcke
    Signed-off-by: Marcel Holtmann

    Zijun Hu
     

21 May, 2020

1 commit


18 May, 2020

1 commit

  • WCN3991 supports transparent WBS (host encoded mSBC). Add a flag to the
    device match data to show WBS is supported.

    This requires the matching firmware for WCN3991 in linux-firmware:
    1a8b0dc00f77 (qca: Enable transparent WBS for WCN3991)

    Signed-off-by: Abhishek Pandit-Subedi
    Reviewed-by: Matthias Kaehlcke
    Signed-off-by: Marcel Holtmann

    Abhishek Pandit-Subedi
     

28 Apr, 2020

2 commits


02 Apr, 2020

1 commit


05 Mar, 2020

1 commit

  • This patch replaces devm_gpiod_get() with devm_gpiod_get_optional() to get
    bt_en and replaces devm_clk_get() with devm_clk_get_optional() to get
    susclk. It also uses NULL check to determine whether the resource is
    available or not.

    Fixes: 8a208b24d770 ("Bluetooth: hci_qca: Make bt_en and susclk not mandatory for QCA Rome")
    Signed-off-by: Rocky Liao
    Signed-off-by: Marcel Holtmann

    Rocky Liao
     

04 Mar, 2020

1 commit


28 Feb, 2020

1 commit


18 Feb, 2020

1 commit

  • This patch will fix the below issues
    1. Discarding memory dump events if memdump state is moved to
    MEMDUMP_TIMEOUT.
    2. Fixed race conditions between qca_hw_error() and qca_controller_memdump
    while free memory dump buffers using mutex lock
    3. Moved timeout timer to delayed work queue
    4. Injecting HW error event in a case when dumps failed to receive and HW
    error event is not yet received.
    5. Clearing hw error and command timeout function callbacks before
    sending pre shutdown command.

    Collecting memory dump will follow any of the below sequence.

    Sequence 1:
    Receiving Memory dump events from the controller
    Received entire dump in stipulated time
    Received HW error event from the controller
    Controller Reset from HOST

    Sequence 2:
    Receiving Memory dump events from the controller
    Failed to Receive entire dump in stipulated time
    A Timeout schedules and if no HW error event received a fake HW
    error event will be injected.
    Controller Reset from HOST.

    Sequence 3:
    Received HW error event
    HOST trigger SSR by sending crash packet to controller.
    Received entire dump in stipulated time
    Controller Reset from HOST

    Fixes: d841502c79e3 ("Bluetooth: hci_qca: Collect controller memory dump during SSR")
    Reported-by: Abhishek Pandit-Subedi
    Signed-off-by: Venkata Lakshmi Narayana Gubba
    Reviewed-by: Abhishek Pandit-Subedi
    Signed-off-by: Marcel Holtmann

    Venkata Lakshmi Narayana Gubba
     

05 Feb, 2020

1 commit


03 Feb, 2020

1 commit


16 Jan, 2020

3 commits

  • This patch registers hdev->shutdown() callback and also sets
    HCI_QUIRK_NON_PERSISTENT_SETUP for QCA Rome. It will power-off the BT chip
    during hci down and power-on/initialize the chip again during hci up. As
    wcn399x already enabled this, this patch also removed the callback register
    and QUIRK setting in qca_setup() for wcn399x and uniformly do this in the
    probe() routine.

    Signed-off-by: Rocky Liao
    Signed-off-by: Marcel Holtmann

    Rocky Liao
     
  • This patch adds the retry of btsoc initialization when it fails. There are
    reports that the btsoc initialization may fail on some platforms but the
    repro ratio is very low. The symptoms is the firmware downloading failed
    due to the UART write timed out. The failure may be caused by UART,
    platform HW or the btsoc itself but it's very difficlut to root cause,
    given the repro ratio is very low. Add a retry for the btsoc initialization
    can work around most of the failures and make Bluetooth finally works.

    Signed-off-by: Rocky Liao
    Reviewed-by: Matthias Kaehlcke
    Signed-off-by: Marcel Holtmann

    Rocky Liao
     
  • Current qca_power_shutdown() only supports wcn399x, this patch adds Rome
    power off support to it. For Rome it just needs to pull down the bt_en
    GPIO to power off it. This patch also replaces all the power off operation
    in qca_close() with the unified qca_power_shutdown() call.

    Signed-off-by: Rocky Liao
    Reviewed-by: Matthias Kaehlcke
    Signed-off-by: Marcel Holtmann

    Rocky Liao
     

14 Jan, 2020

1 commit


09 Jan, 2020

2 commits

  • Fixes gcc '-Wunused-but-set-variable' warning:

    drivers/bluetooth/hci_qca.c: In function 'qca_controller_memdump':
    drivers/bluetooth/hci_qca.c:980:6: warning:
    variable 'opcode' set but not used [-Wunused-but-set-variable]

    It is never used since commit d841502c79e3 ("Bluetooth: hci_qca: Collect
    controller memory dump during SSR"), so remove it.

    Reported-by: Hulk Robot
    Signed-off-by: YueHaibing
    Signed-off-by: Marcel Holtmann

    YueHaibing
     
  • Use vfree() instead of kfree() to free vmalloc()
    allocated data.

    Fixes: d841502c79e3 ("Bluetooth: hci_qca: Collect controller memory dump during SSR")
    Signed-off-by: Wei Yongjun
    Reviewed-by: Balakrishna Godavarthi
    Signed-off-by: Marcel Holtmann

    Wei Yongjun
     

04 Jan, 2020

2 commits


09 Nov, 2019

1 commit


04 Nov, 2019

1 commit

  • Add PM suspend/resume callbacks for hci_qca driver.

    BT host will make sure both Rx and Tx go into sleep state in
    qca_suspend. Without this, Tx may still remain in awake state, which
    prevents BTSOC from entering deep sleep. For example, BlueZ will send
    Set Event Mask to device when suspending and this will wake the device
    Rx up. However, the Tx idle timeout on the host side is 2000 ms. If the
    host is suspended before its Tx idle times out, it won't send
    HCI_IBS_SLEEP_IND to the device and the device Rx will remain awake.

    We implement this by canceling relevant work in workqueue, sending
    HCI_IBS_SLEEP_IND to the device and then waiting HCI_IBS_SLEEP_IND sent
    by the device.

    In order to prevent the device from being awaken again after qca_suspend
    is called, we introduce QCA_SUSPEND flag. QCA_SUSPEND is set in the
    beginning of qca_suspend to indicate system is suspending and that we'd
    like to ignore any further wake events.

    With QCA_SUSPEND and spinlock, we can avoid race condition, e.g. if
    qca_enqueue acquires qca->hci_ibs_lock before qca_suspend calls
    cancel_work_sync and then qca_enqueue adds a new qca->ws_awake_device
    work after the previous one is cancelled.

    If BTSOC wants to wake the whole system up after qca_suspend is called,
    it will keep sending HCI_IBS_WAKE_IND and uart driver will take care of
    waking the system. For example, uart driver will reconfigure its Rx pin
    to a normal GPIO pin and enable irq wake on that pin when suspending.
    Once host detects Rx falling, the system will begin resuming. Then, the
    BT host clears QCA_SUSPEND flag in qca_resume and begins dealing with
    normal HCI packets. By doing so, only a few HCI_IBS_WAKE_IND packets are
    lost and there is no data packet loss.

    Signed-off-by: Claire Chang
    Reviewed-by: Balakrishna Godavarthi
    Signed-off-by: Marcel Holtmann

    Claire Chang
     

21 Oct, 2019

1 commit

  • This reverts commit cde9dde6e11a5ab54b6462cd46d82878926783bc.

    The frame reassembly errors were root caused to a transient gpio issue.
    The missing response was root caused to an issue with properly managing
    RFR in the uart driver. Addressing those root causes occurs outside of
    hci_qca and eliminates the need for the 50ms delay, so remove it.

    Signed-off-by: Jeffrey Hugo
    Signed-off-by: Marcel Holtmann

    Jeffrey Hugo
     

17 Oct, 2019

2 commits

  • Split and rename qca_power_setup() in order to simplify each code path
    and to clarify that it is unrelated to qca_power_off() and
    qca_power_setup().

    Signed-off-by: Bjorn Andersson
    Signed-off-by: Marcel Holtmann

    Bjorn Andersson
     
  • With the regulator_set_load() and regulator_set_voltage() out of the
    enable/disable code paths the code can now use the standard
    regulator bulk enable/disable API.

    By cloning num_vregs into struct qca_power there's no need to lug around
    a reference to the struct qca_vreg_data, which further simplifies
    qca_power_setup().

    Signed-off-by: Bjorn Andersson
    Signed-off-by: Marcel Holtmann

    Bjorn Andersson