linux/drivers/bluetooth/btmtksdio.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 MediaTek Inc.

/*
 * Bluetooth support for MediaTek SDIO devices
 *
 * This file is written based on btsdio.c and btmtkuart.c.
 *
 * Author: Sean Wang <[email protected]>
 *
 */

#include <asm/unaligned.h>
#include <linux/atomic.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/iopoll.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/pm_runtime.h>
#include <linux/skbuff.h>
#include <linux/usb.h>

#include <linux/mmc/host.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/sdio_func.h>

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

#include "h4_recv.h"
#include "btmtk.h"

#define VERSION

#define MTKBTSDIO_AUTOSUSPEND_DELAY

static bool enable_autosuspend =;

struct btmtksdio_data {};

static const struct btmtksdio_data mt7663_data =;

static const struct btmtksdio_data mt7668_data =;

static const struct btmtksdio_data mt7921_data =;

static const struct sdio_device_id btmtksdio_table[] =;
MODULE_DEVICE_TABLE(sdio, btmtksdio_table);

#define MTK_REG_CHLPCR
#define C_INT_EN_SET
#define C_INT_EN_CLR
#define C_FW_OWN_REQ_SET
#define C_COM_DRV_OWN
#define C_FW_OWN_REQ_CLR

#define MTK_REG_CSDIOCSR
#define SDIO_RE_INIT_EN
#define SDIO_INT_CTL

#define MTK_REG_CHCR
#define C_INT_CLR_CTRL
#define BT_RST_DONE

/* CHISR have the same bits field definition with CHIER */
#define MTK_REG_CHISR
#define MTK_REG_CHIER
#define FW_OWN_BACK_INT
#define RX_DONE_INT
#define TX_EMPTY
#define TX_FIFO_OVERFLOW
#define FW_MAILBOX_INT
#define INT_MASK
#define RX_PKT_LEN

#define MTK_REG_CSICR
#define CSICR_CLR_MBOX_ACK
#define MTK_REG_PH2DSM0R
#define PH2DSM0R_DRIVER_OWN
#define MTK_REG_PD2HRM0R
#define PD2HRM0R_DRV_OWN

#define MTK_REG_CTDR

#define MTK_REG_CRDR

#define MTK_REG_CRPLR

#define MTK_SDIO_BLOCK_SIZE

#define BTMTKSDIO_TX_WAIT_VND_EVT
#define BTMTKSDIO_HW_TX_READY
#define BTMTKSDIO_FUNC_ENABLED
#define BTMTKSDIO_PATCH_ENABLED
#define BTMTKSDIO_HW_RESET_ACTIVE
#define BTMTKSDIO_BT_WAKE_ENABLED

struct mtkbtsdio_hdr {} __packed;

struct btmtksdio_dev {};

static int mtk_hci_wmt_sync(struct hci_dev *hdev,
			    struct btmtk_hci_wmt_params *wmt_params)
{}

static int btmtksdio_tx_packet(struct btmtksdio_dev *bdev,
			       struct sk_buff *skb)
{}

static u32 btmtksdio_drv_own_query(struct btmtksdio_dev *bdev)
{}

static u32 btmtksdio_drv_own_query_79xx(struct btmtksdio_dev *bdev)
{}

static u32 btmtksdio_chcr_query(struct btmtksdio_dev *bdev)
{}

static int btmtksdio_fw_pmctrl(struct btmtksdio_dev *bdev)
{}

static int btmtksdio_drv_pmctrl(struct btmtksdio_dev *bdev)
{}

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

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

static const struct h4_recv_pkt mtk_recv_pkts[] =;

static int btmtksdio_rx_packet(struct btmtksdio_dev *bdev, u16 rx_size)
{}

static void btmtksdio_txrx_work(struct work_struct *work)
{}

static void btmtksdio_interrupt(struct sdio_func *func)
{}

static int btmtksdio_open(struct hci_dev *hdev)
{}

static int btmtksdio_close(struct hci_dev *hdev)
{}

static int btmtksdio_flush(struct hci_dev *hdev)
{}

static int btmtksdio_func_query(struct hci_dev *hdev)
{}

static int mt76xx_setup(struct hci_dev *hdev, const char *fwname)
{}

static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)
{}

static int btmtksdio_mtk_reg_read(struct hci_dev *hdev, u32 reg, u32 *val)
{}

static int btmtksdio_mtk_reg_write(struct hci_dev *hdev, u32 reg, u32 val, u32 mask)
{}

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

static int btmtksdio_get_codec_config_data(struct hci_dev *hdev,
					   __u8 link, struct bt_codec *codec,
					   __u8 *ven_len, __u8 **ven_data)
{}

static int btmtksdio_sco_setting(struct hci_dev *hdev)
{}

static int btmtksdio_reset_setting(struct hci_dev *hdev)
{}

static int btmtksdio_setup(struct hci_dev *hdev)
{}

static int btmtksdio_shutdown(struct hci_dev *hdev)
{}

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

static void btmtksdio_cmd_timeout(struct hci_dev *hdev)
{}

static bool btmtksdio_sdio_inband_wakeup(struct hci_dev *hdev)
{}

static bool btmtksdio_sdio_wakeup(struct hci_dev *hdev)
{}

static int btmtksdio_probe(struct sdio_func *func,
			   const struct sdio_device_id *id)
{}

static void btmtksdio_remove(struct sdio_func *func)
{}

#ifdef CONFIG_PM
static int btmtksdio_runtime_suspend(struct device *dev)
{}

static int btmtksdio_system_suspend(struct device *dev)
{}

static int btmtksdio_runtime_resume(struct device *dev)
{}

static int btmtksdio_system_resume(struct device *dev)
{}

static const struct dev_pm_ops btmtksdio_pm_ops =;

#define BTMTKSDIO_PM_OPS
#else	/* CONFIG_PM */
#define BTMTKSDIO_PM_OPS
#endif	/* CONFIG_PM */

static struct sdio_driver btmtksdio_driver =;

module_sdio_driver();

module_param(enable_autosuspend, bool, 0644);
MODULE_PARM_DESC();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();