Files
android_kernel_samsung_sm86…/btfmcodec/include/btfm_codec_pkt.h
Balakrishna Godavarthi e7e85692a1 btfmcodec: unblock waiting threads during usecase shutdown
This change notifies waiting thread when usecase shutdown
is triggered and also flush work queues.

Change-Id: If523e806dc23fc256e82c4eac30f7aa79b119f55
2023-01-27 19:31:49 -08:00

98 lines
2.6 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __LINUX_BTFM_CODEC_PKT_H
#define __LINUX_BTFM_CODEC_PKT_H
typedef uint32_t btm_opcode;
struct btm_req {
btm_opcode opcode;
uint32_t len;
uint8_t *data;
}__attribute__((packed));
struct btm_rsp {
btm_opcode opcode;
uint8_t status;
}__attribute__((packed));
struct btm_ind {
btm_opcode opcode;
uint32_t len;
uint8_t *data;
}__attribute__((packed));
struct btm_ctrl_pkt {
btm_opcode opcode;
uint32_t len;
uint8_t active_transport;
uint8_t status;
}__attribute__((packed));
#define BTM_BTFMCODEC_PREPARE_AUDIO_BEARER_SWITCH_REQ 0x50000000
#define BTM_BTFMCODEC_PREPARE_AUDIO_BEARER_SWITCH_RSP 0x50000001
#define BTM_BTFMCODEC_MASTER_CONFIG_REQ 0x50000002
#define BTM_BTFMCODEC_MASTER_CONFIG_RSP 0x50000003
#define BTM_BTFMCODEC_MASTER_SHUTDOWN_REQ 0x50000004
#define BTM_BTFMCODEC_CTRL_MASTER_SHUTDOWN_RSP 0x50000005
#define BTM_BTFMCODEC_BEARER_SWITCH_IND 0x58000001
#define BTM_BTFMCODEC_TRANSPORT_SWITCH_FAILED_IND 0x58000002
#define BTM_MASTER_CONFIG_REQ_LEN 13
#define BTM_MASTER_CONFIG_RSP_TIMEOUT 1000
#define BTM_HEADER_LEN 8
#define BTM_PREPARE_AUDIO_BEARER_SWITCH_RSP_LEN 2
#define BTM_MASTER_CONFIG_RSP_LEN 2
#define BTM_MASTER_SHUTDOWN_REQ_LEN 1
#define BTM_PREPARE_AUDIO_BEARER_SWITCH_REQ_LEN 1
#define BTM_BEARER_SWITCH_IND_LEN 1
enum rx_status {
/* Waiting for response */
BTM_WAITING_RSP,
/* Response recevied */
BTM_RSP_RECV,
/* Response recevied with failure status*/
BTM_FAIL_RESP_RECV,
/* Response not recevied, but client killed */
BTM_RSP_NOT_RECV_CLIENT_KILLED,
};
enum btfm_kp_status {
/* KP processed message succesfully */
MSG_SUCCESS = 0,
/* Error while processing the message */
MSG_FAILED,
/* Wrong transport type selected by BTADV audio manager */
MSG_WRONG_TRANSPORT_TYPE,
/* Timeout triggered to receive bearer switch indications*/
MSG_INTERNAL_TIMEOUT,
MSG_FAILED_TO_CONFIGURE_HWEP,
MSG_FAILED_TO_SHUTDOWN_HWEP,
MSG_ERR_WHILE_SHUTING_DOWN_HWEP,
};
struct btm_master_config_req {
btm_opcode opcode;
uint32_t len;
uint8_t stream_id;
uint32_t device_id;
uint32_t sample_rate;
uint8_t bit_width;
uint8_t num_channels;
uint8_t channel_num;
uint8_t codec_id;
}__attribute__((packed));
struct btm_master_shutdown_req {
btm_opcode opcode;
uint32_t len;
uint8_t stream_id;
}__attribute__((packed));
int btfmcodec_dev_enqueue_pkt(struct btfmcodec_char_device *, void *, int);
bool btfmcodec_is_valid_cache_avb(struct btfmcodec_data *);
#endif /* __LINUX_BTFM_CODEC_PKT_H*/