linux/drivers/bluetooth/hci_qca.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  Bluetooth Software UART Qualcomm protocol
 *
 *  HCI_IBS (HCI In-Band Sleep) is Qualcomm's power management
 *  protocol extension to H4.
 *
 *  Copyright (C) 2007 Texas Instruments, Inc.
 *  Copyright (c) 2010, 2012, 2018 The Linux Foundation. All rights reserved.
 *
 *  Acknowledgements:
 *  This file is based on hci_ll.c, which was...
 *  Written by Ohad Ben-Cohen <[email protected]>
 *  which was in turn based on hci_h4.c, which was written
 *  by Maxim Krasnyansky and Marcel Holtmann.
 */

#include <linux/kernel.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/devcoredump.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/acpi.h>
#include <linux/platform_device.h>
#include <linux/pwrseq/consumer.h>
#include <linux/regulator/consumer.h>
#include <linux/serdev.h>
#include <linux/mutex.h>
#include <linux/unaligned.h>

#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>

#include "hci_uart.h"
#include "btqca.h"

/* HCI_IBS protocol messages */
#define HCI_IBS_SLEEP_IND
#define HCI_IBS_WAKE_IND
#define HCI_IBS_WAKE_ACK
#define HCI_MAX_IBS_SIZE

#define IBS_WAKE_RETRANS_TIMEOUT_MS
#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS
#define IBS_HOST_TX_IDLE_TIMEOUT_MS
#define CMD_TRANS_TIMEOUT_MS
#define MEMDUMP_TIMEOUT_MS
#define IBS_DISABLE_SSR_TIMEOUT_MS
#define FW_DOWNLOAD_TIMEOUT_MS

/* susclk rate */
#define SUSCLK_RATE_32KHZ

/* Controller debug log header */
#define QCA_DEBUG_HANDLE

/* max retry count when init fails */
#define MAX_INIT_RETRIES

/* Controller dump header */
#define QCA_SSR_DUMP_HANDLE
#define QCA_DUMP_PACKET_SIZE
#define QCA_LAST_SEQUENCE_NUM
#define QCA_CRASHBYTE_PACKET_LEN
#define QCA_MEMDUMP_BYTE

enum qca_flags {};

enum qca_capabilities {};

/* HCI_IBS transmit side sleep protocol states */
enum tx_ibs_states {};

/* HCI_IBS receive side sleep protocol states */
enum rx_states {};

/* HCI_IBS transmit and receive side clock state vote */
enum hci_ibs_clock_state_vote {};

/* Controller memory dump states */
enum qca_memdump_states {};

struct qca_memdump_info {};

struct qca_memdump_event_hdr {} __packed;


struct qca_dump_size {} __packed;

struct qca_data {};

enum qca_speed_type {};

/*
 * Voltage regulator information required for configuring the
 * QCA Bluetooth chipset
 */
struct qca_vreg {};

struct qca_device_data {};

/*
 * Platform data for the QCA Bluetooth power driver.
 */
struct qca_power {};

struct qca_serdev {};

static int qca_regulator_enable(struct qca_serdev *qcadev);
static void qca_regulator_disable(struct qca_serdev *qcadev);
static void qca_power_shutdown(struct hci_uart *hu);
static int qca_power_off(struct hci_dev *hdev);
static void qca_controller_memdump(struct work_struct *work);
static void qca_dmp_hdr(struct hci_dev *hdev, struct sk_buff *skb);

static enum qca_btsoc_type qca_soc_type(struct hci_uart *hu)
{}

static const char *qca_get_firmware_name(struct hci_uart *hu)
{}

static void __serial_clock_on(struct tty_struct *tty)
{}

static void __serial_clock_off(struct tty_struct *tty)
{}

/* serial_clock_vote needs to be called with the ibs lock held */
static void serial_clock_vote(unsigned long vote, struct hci_uart *hu)
{}

/* Builds and sends an HCI_IBS command packet.
 * These are very simple packets with only 1 cmd byte.
 */
static int send_hci_ibs_cmd(u8 cmd, struct hci_uart *hu)
{}

static void qca_wq_awake_device(struct work_struct *work)
{}

static void qca_wq_awake_rx(struct work_struct *work)
{}

static void qca_wq_serial_rx_clock_vote_off(struct work_struct *work)
{}

static void qca_wq_serial_tx_clock_vote_off(struct work_struct *work)
{}

static void hci_ibs_tx_idle_timeout(struct timer_list *t)
{}

static void hci_ibs_wake_retrans_timeout(struct timer_list *t)
{}


static void qca_controller_memdump_timeout(struct work_struct *work)
{}


/* Initialize protocol */
static int qca_open(struct hci_uart *hu)
{}

static void qca_debugfs_init(struct hci_dev *hdev)
{}

/* Flush protocol data */
static int qca_flush(struct hci_uart *hu)
{}

/* Close protocol */
static int qca_close(struct hci_uart *hu)
{}

/* Called upon a wake-up-indication from the device.
 */
static void device_want_to_wakeup(struct hci_uart *hu)
{}

/* Called upon a sleep-indication from the device.
 */
static void device_want_to_sleep(struct hci_uart *hu)
{}

/* Called upon wake-up-acknowledgement from the device
 */
static void device_woke_up(struct hci_uart *hu)
{}

/* Enqueue frame for transmittion (padding, crc, etc) may be called from
 * two simultaneous tasklets.
 */
static int qca_enqueue(struct hci_uart *hu, struct sk_buff *skb)
{}

static int qca_ibs_sleep_ind(struct hci_dev *hdev, struct sk_buff *skb)
{}

static int qca_ibs_wake_ind(struct hci_dev *hdev, struct sk_buff *skb)
{}

static int qca_ibs_wake_ack(struct hci_dev *hdev, struct sk_buff *skb)
{}

static int qca_recv_acl_data(struct hci_dev *hdev, struct sk_buff *skb)
{}

static void qca_dmp_hdr(struct hci_dev *hdev, struct sk_buff *skb)
{}

static void qca_controller_memdump(struct work_struct *work)
{}

static int qca_controller_memdump_event(struct hci_dev *hdev,
					struct sk_buff *skb)
{}

static int qca_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
{}

#define QCA_IBS_SLEEP_IND_EVENT

#define QCA_IBS_WAKE_IND_EVENT

#define QCA_IBS_WAKE_ACK_EVENT

static const struct h4_recv_pkt qca_recv_pkts[] =;

static int qca_recv(struct hci_uart *hu, const void *data, int count)
{}

static struct sk_buff *qca_dequeue(struct hci_uart *hu)
{}

static uint8_t qca_get_baudrate_value(int speed)
{}

static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
{}

static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed)
{}

static int qca_send_power_pulse(struct hci_uart *hu, bool on)
{}

static unsigned int qca_get_speed(struct hci_uart *hu,
				  enum qca_speed_type speed_type)
{}

static int qca_check_speeds(struct hci_uart *hu)
{}

static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
{}

static int qca_send_crashbuffer(struct hci_uart *hu)
{}

static void qca_wait_for_dump_collection(struct hci_dev *hdev)
{}

static void qca_hw_error(struct hci_dev *hdev, u8 code)
{}

static void qca_cmd_timeout(struct hci_dev *hdev)
{}

static bool qca_wakeup(struct hci_dev *hdev)
{}

static int qca_port_reopen(struct hci_uart *hu)
{}

static int qca_regulator_init(struct hci_uart *hu)
{}

static int qca_power_on(struct hci_dev *hdev)
{}

static void hci_coredump_qca(struct hci_dev *hdev)
{}

static int qca_get_data_path_id(struct hci_dev *hdev, __u8 *data_path_id)
{}

static int qca_configure_hfp_offload(struct hci_dev *hdev)
{}

static int qca_setup(struct hci_uart *hu)
{}

static const struct hci_uart_proto qca_proto =;

static const struct qca_device_data qca_soc_data_wcn3988 __maybe_unused =;

static const struct qca_device_data qca_soc_data_wcn3990 __maybe_unused =;

static const struct qca_device_data qca_soc_data_wcn3991 __maybe_unused =;

static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused =;

static const struct qca_device_data qca_soc_data_qca2066 __maybe_unused =;

static const struct qca_device_data qca_soc_data_qca6390 __maybe_unused =;

static const struct qca_device_data qca_soc_data_wcn6750 __maybe_unused =;

static const struct qca_device_data qca_soc_data_wcn6855 __maybe_unused =;

static const struct qca_device_data qca_soc_data_wcn7850 __maybe_unused =;

static void qca_power_shutdown(struct hci_uart *hu)
{}

static int qca_power_off(struct hci_dev *hdev)
{}

static int qca_regulator_enable(struct qca_serdev *qcadev)
{}

static void qca_regulator_disable(struct qca_serdev *qcadev)
{}

static int qca_init_regulators(struct qca_power *qca,
				const struct qca_vreg *vregs, size_t num_vregs)
{}

static void qca_clk_disable_unprepare(void *data)
{}

static int qca_serdev_probe(struct serdev_device *serdev)
{}

static void qca_serdev_remove(struct serdev_device *serdev)
{}

static void qca_serdev_shutdown(struct device *dev)
{}

static int __maybe_unused qca_suspend(struct device *dev)
{}

static int __maybe_unused qca_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(qca_pm_ops, qca_suspend, qca_resume);

#ifdef CONFIG_OF
static const struct of_device_id qca_bluetooth_of_match[] =;
MODULE_DEVICE_TABLE(of, qca_bluetooth_of_match);
#endif

#ifdef CONFIG_ACPI
static const struct acpi_device_id qca_bluetooth_acpi_match[] =;
MODULE_DEVICE_TABLE(acpi, qca_bluetooth_acpi_match);
#endif

#ifdef CONFIG_DEV_COREDUMP
static void hciqca_coredump(struct device *dev)
{}
#endif

static struct serdev_device_driver qca_serdev_driver =;

int __init qca_init(void)
{}

int __exit qca_deinit(void)
{}