Files
android_kernel_samsung_sm86…/btfmcodec/include/btfm_codec.h
Balakrishna Godavarthi 4a2649332e btfmcodec: Add btadv audio support
This change adds below support for BT advance audio
* Add support for codec type mixer control
* Update slim driver to read master id, channel number.
* Update slim driver to support HW EP.
* Add support for transport switch based on the request

CRs-Fixed: 3298745
Change-Id: Ica349cb6f3615f4dc51bbc3070c90d43eeba1cdd
2023-01-17 10:20:36 +05:30

85 lines
2.3 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __LINUX_BTFM_CODEC_H
#define __LINUX_BTFM_CODEC_H
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/printk.h>
#include <linux/cdev.h>
#include <linux/skbuff.h>
#include "btfm_codec_hw_interface.h"
#define BTFMCODEC_DBG(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)
#define BTFMCODEC_INFO(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)
#define BTFMCODEC_ERR(fmt, arg...) pr_err("%s: " fmt "\n", __func__, ## arg)
#define BTFMCODEC_WARN(fmt, arg...) pr_warn("%s: " fmt "\n", __func__, ## arg)
#define DEVICE_NAME_MAX_LEN 64
typedef enum btfmcodec_states {
/*Default state of kernel proxy driver */
IDLE = 0,
/* Waiting for BT bearer indication after configuring HW ports */
BT_Connecting = 1,
/* When BT is active transport */
BT_Connected = 2,
/* Waiting for BTADV Audio bearer switch indications */
BTADV_AUDIO_Connecting = 3,
/* When BTADV audio is active transport */
BTADV_AUDIO_Connected = 4
} btfmcodec_state;
enum btfm_pkt_type {
BTM_PKT_TYPE_PREPARE_REQ = 0,
BTM_PKT_TYPE_MASTER_CONFIG_RSP,
BTM_PKT_TYPE_MASTER_SHUTDOWN_RSP,
BTM_PKT_TYPE_BEARER_SWITCH_IND,
BTM_PKT_TYPE_HWEP_SHUTDOWN,
BTM_PKT_TYPE_HWEP_CONFIG,
BTM_PKT_TYPE_MAX,
};
char *coverttostring(enum btfmcodec_states);
struct btfmcodec_state_machine {
struct mutex state_machine_lock;
btfmcodec_state prev_state;
btfmcodec_state current_state;
btfmcodec_state next_state;
};
struct btfmcodec_char_device {
struct cdev cdev;
refcount_t active_clients;
struct mutex lock;
int reuse_minor;
char dev_name[DEVICE_NAME_MAX_LEN];
struct workqueue_struct *workqueue;
struct sk_buff_head rxq;
struct work_struct rx_work;
struct work_struct wq_hwep_shutdown;
struct work_struct wq_prepare_bearer;
struct work_struct wq_hwep_configure;
wait_queue_head_t readq;
spinlock_t tx_queue_lock;
struct sk_buff_head txq;
wait_queue_head_t rsp_wait_q[BTM_PKT_TYPE_MAX];
uint8_t status[BTM_PKT_TYPE_MAX];
void *btfmcodec;
};
struct btfmcodec_data {
struct device dev;
struct btfmcodec_state_machine states;
struct btfmcodec_char_device *btfmcodec_dev;
struct hwep_data *hwep_info;
struct list_head config_head;
};
struct btfmcodec_data *btfm_get_btfmcodec(void);
#endif /*__LINUX_BTFM_CODEC_H */