replace common qcom sources with samsung ones
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
ifeq ($(shell secgetspf SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER), TRUE)
|
||||
$(warning *** SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER BT Disabled ****)
|
||||
else
|
||||
# Android makefile for BT kernel modules
|
||||
|
||||
BT_DLKM_ENABLE := true
|
||||
@@ -18,7 +21,7 @@ BT_SELECT := CONFIG_MSM_BT_POWER=m
|
||||
BT_SELECT += CONFIG_I2C_RTC6226_QCA=m
|
||||
|
||||
ifneq ($(call is-board-platform-in-list, parrot), true)
|
||||
BT_SELECT += CONFIG_FMD_ENABLE=y
|
||||
#BT_SELECT += CONFIG_FMD_ENABLE=y
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_KERNEL_DLKM_SECUREMSM_QTEE_OVERRIDE), true)
|
||||
@@ -160,3 +163,5 @@ include $(DLKM_DIR)/Build_external_kernelmodule.mk
|
||||
endif # DLKM check
|
||||
endif # supported target check
|
||||
endif # TARGET_KERNEL_DLKM_BT_OVERRIDE
|
||||
|
||||
endif # SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER
|
||||
|
@@ -1,3 +1,6 @@
|
||||
ifeq ($(shell secgetspf SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER), TRUE)
|
||||
$(warning *** SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER BT Disabled ****)
|
||||
else
|
||||
# Build BT kernel drivers
|
||||
PRODUCT_PACKAGES += $(KERNEL_MODULES_OUT)/btpower.ko
|
||||
PRODUCT_PACKAGES += $(KERNEL_MODULES_OUT)/radio-i2c-rtc6226-qca.ko
|
||||
@@ -8,3 +11,4 @@ PRODUCT_PACKAGES += $(KERNEL_MODULES_OUT)/bt_fm_swr.ko
|
||||
else
|
||||
BT_KERNEL_DRIVER += $(KERNEL_MODULES_OUT)/bt_fm_slim.ko
|
||||
endif
|
||||
endif
|
@@ -1,3 +1,6 @@
|
||||
ifeq ($(shell secgetspf SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER), TRUE)
|
||||
$(warning *** SEC_PRODUCT_FEATURE_FACTORY_SUPPORT_INTERPOSER BT Disabled ****)
|
||||
else
|
||||
# Build audio kernel driver
|
||||
ifneq ($(TARGET_BOARD_AUTO),true)
|
||||
ifeq ($(TARGET_USES_QMAA),true)
|
||||
@@ -30,3 +33,4 @@ else
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@@ -134,7 +134,8 @@ register_bt_modules(
|
||||
],
|
||||
deps = [
|
||||
":%b_btpower", ":%b_btfmcodec", ":btfmcodec_headers",
|
||||
"//vendor/qcom/opensource/audio-kernel:%b_swr_dlkm",
|
||||
"//vendor/qcom/opensource/audio-kernel:%b_modules",
|
||||
"//vendor/qcom/opensource/audio-kernel:audio_headers",
|
||||
],
|
||||
)
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <linux/module.h>
|
||||
#include "btfm_codec.h"
|
||||
#include "btfm_codec_pkt.h"
|
||||
#include "btfm_codec_btadv_interface.h"
|
||||
|
||||
#define dev_to_btfmcodec(_dev) container_of(_dev, struct btfmcodec_data, dev)
|
||||
|
||||
@@ -68,6 +67,8 @@ static int btfmcodec_dev_open(struct inode *inode, struct file *file)
|
||||
struct btfmcodec_data *btfmcodec = (struct btfmcodec_data *)btfmcodec_dev->btfmcodec;
|
||||
unsigned int active_clients = refcount_read(&btfmcodec_dev->active_clients);
|
||||
|
||||
btfmcodec->states.current_state = IDLE; /* Just a temp*/
|
||||
btfmcodec->states.next_state = IDLE;
|
||||
BTFMCODEC_INFO("for %s by %s:%d active_clients[%d]\n",
|
||||
btfmcodec_dev->dev_name, current->comm,
|
||||
task_pid_nr(current), refcount_read(&btfmcodec_dev->active_clients));
|
||||
@@ -126,6 +127,9 @@ static int btfmcodec_dev_release(struct inode *inode, struct file *file)
|
||||
if (btfmcodec_dev->wq_prepare_bearer.func)
|
||||
cancel_work_sync(&btfmcodec_dev->wq_prepare_bearer);
|
||||
|
||||
btfmcodec->states.current_state = IDLE;
|
||||
btfmcodec->states.next_state = IDLE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -139,11 +143,10 @@ static void btfmcodec_dev_rxwork(struct work_struct *work)
|
||||
{
|
||||
struct btfmcodec_char_device *btfmcodec_dev = container_of(work, struct btfmcodec_char_device, rx_work);
|
||||
struct sk_buff *skb;
|
||||
struct btfmcodec_state_machine *state = &btfmcodec->states;
|
||||
uint32_t len;
|
||||
uint8_t status;
|
||||
int idx;
|
||||
uint8_t *bearer_switch_ind, *dma_rsp;
|
||||
uint8_t *bearer_switch_ind;
|
||||
|
||||
BTFMCODEC_DBG("start");
|
||||
while ((skb = skb_dequeue(&btfmcodec_dev->rxq))) {
|
||||
@@ -161,16 +164,6 @@ static void btfmcodec_dev_rxwork(struct work_struct *work)
|
||||
&btfmcodec_dev->status[BTM_PKT_TYPE_BEARER_SWITCH_IND];
|
||||
*bearer_switch_ind = BTM_WAITING_RSP;
|
||||
btfmcodec_enqueue_transport(btfmcodec_dev, skb->data[0]);
|
||||
if (skb->data[0] == NONE &&
|
||||
btfmcodec_get_current_transport(state) == BT_Connecting &&
|
||||
btfmcodec_get_prev_transport(state) ==
|
||||
BTADV_AUDIO_Connected) {
|
||||
BTFMCODEC_INFO("KP might be awaiting for codec dma rsp");
|
||||
idx = BTM_PKT_TYPE_DMA_CONFIG_RSP;
|
||||
dma_rsp = &btfmcodec_dev->status[idx];
|
||||
*dma_rsp = BTM_FAIL_RESP_RECV;
|
||||
wake_up_interruptible(&btfmcodec_dev->rsp_wait_q[idx]);
|
||||
}
|
||||
queue_work(btfmcodec_dev->workqueue,
|
||||
&btfmcodec_dev->wq_prepare_bearer);
|
||||
} else {
|
||||
@@ -256,7 +249,7 @@ static void btfmcodec_dev_rxwork(struct work_struct *work)
|
||||
break;
|
||||
case BTM_BTFMCODEC_USECASE_START_RSP:
|
||||
idx = BTM_PKT_TYPE_USECASE_START_RSP;
|
||||
if (len == BTM_USECASE_START_RSP_LEN) {
|
||||
if (len == BTM_USECASE_START_IND_LEN) {
|
||||
status = skb->data[0];
|
||||
if (status == MSG_SUCCESS)
|
||||
btfmcodec_dev->status[idx] = BTM_RSP_RECV;
|
||||
|
@@ -305,11 +305,7 @@ void btfmcodec_prepare_bearer(struct btfmcodec_char_device *btfmcodec_dev,
|
||||
ret = btfmcodec_wait_for_bearer_ind(btfmcodec_dev);
|
||||
if (ret < 0) {
|
||||
BTFMCODEC_ERR("moving back to previous state");
|
||||
if (btfmcodec_get_current_transport(state) == IDLE) {
|
||||
BTFMCODEC_INFO("state moved to IDLE");
|
||||
} else if (current_state == btfmcodec_get_prev_transport(state)) {
|
||||
btfmcodec_revert_current_state(state);
|
||||
}
|
||||
btfmcodec_revert_current_state(state);
|
||||
if (ret == -MSG_INTERNAL_TIMEOUT) {
|
||||
btfmcodec_frame_transport_switch_ind_pkt(
|
||||
btfmcodec_dev, BTADV,
|
||||
@@ -321,7 +317,7 @@ void btfmcodec_prepare_bearer(struct btfmcodec_char_device *btfmcodec_dev,
|
||||
if (ret < 0)
|
||||
return;
|
||||
|
||||
if (current_state != IDLE && btfmcodec_is_valid_cache_avb(btfmcodec)) {
|
||||
if (btfmcodec_is_valid_cache_avb(btfmcodec)) {
|
||||
BTFMCODEC_INFO("Initiating BT port close...");
|
||||
btfmcodec_initiate_hwep_shutdown(btfmcodec_dev);
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@@ -14,7 +14,6 @@
|
||||
static struct snd_soc_dai_driver *btfmcodec_dai_info;
|
||||
uint32_t bits_per_second;
|
||||
uint8_t num_channels;
|
||||
static int btfmcodec_port_state_notify(uint8_t port_state);
|
||||
|
||||
static int btfm_codec_get_mixer_control(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
@@ -286,7 +285,6 @@ void btfmcodec_wq_hwep_shutdown(struct work_struct *work)
|
||||
list_for_each_entry_safe(hwep_configs, tmp, head, dai_list) {
|
||||
BTFMCODEC_INFO("shuting down dai id:%d", hwep_configs->stream_id);
|
||||
ret = btfmcodec_hwep_shutdown(btfmcodec, hwep_configs->stream_id, true);
|
||||
hwep_configs->is_port_opened = 0;
|
||||
if (ret < 0) {
|
||||
BTFMCODEC_ERR("failed to shutdown master with id %d", hwep_configs->stream_id);
|
||||
break;
|
||||
@@ -328,19 +326,6 @@ static void btfmcodec_dai_shutdown(struct snd_pcm_substream *substream,
|
||||
BTFMCODEC_DBG("dai->name: %s, dai->id: %d, dai->rate: %d", dai->name,
|
||||
dai->id, dai->rate);
|
||||
|
||||
if (btfmcodec_get_current_transport(state) == IDLE) {
|
||||
BTFMCODEC_INFO("%s not allowing shutdown as state is IDLE", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((btfmcodec_get_current_transport(state) == BTADV_AUDIO_Connecting &&
|
||||
btfmcodec_get_prev_transport(state) == BT_Connected) ||
|
||||
((btfmcodec_get_current_transport(state) == BT_Connecting &&
|
||||
btfmcodec_get_prev_transport(state) == BTADV_AUDIO_Connected))) {
|
||||
BTFMCODEC_INFO("%s: Informing port closure to upper layers", __func__);
|
||||
btfmcodec_port_state_notify(IDLE);
|
||||
}
|
||||
|
||||
if (btfmcodec_get_current_transport(state) == BTADV_AUDIO_Connecting &&
|
||||
btfmcodec_get_prev_transport(state) == BT_Connected) {
|
||||
BTFMCODEC_INFO("%s: closing these ports as graph stopped when CIS is active",
|
||||
@@ -356,10 +341,10 @@ static void btfmcodec_dai_shutdown(struct snd_pcm_substream *substream,
|
||||
btfmcodec_get_current_transport(state) != BT_Connected) ||
|
||||
(btfmcodec_get_current_transport(state) == BTADV_AUDIO_Connecting &&
|
||||
btfmcodec_get_prev_transport(state) != BT_Connected)) {
|
||||
BTFMCODEC_WARN("Allowing cache retention in current state:%s, prev state: %s",
|
||||
coverttostring(btfmcodec_get_current_transport(state)),
|
||||
coverttostring(btfmcodec_get_prev_transport(state)));
|
||||
return;
|
||||
BTFMCODEC_WARN("not allowing shutdown as state is:%s",
|
||||
coverttostring(btfmcodec_get_current_transport(state)));
|
||||
/* Delete stored configs */
|
||||
btfmcodec_delete_configs(btfmcodec, dai->id);
|
||||
} else {
|
||||
/* first master shutdown has to done */
|
||||
btfmcodec_hwep_shutdown(btfmcodec, dai->id, false);
|
||||
@@ -616,21 +601,11 @@ int btfmcodec_hwep_prepare(struct btfmcodec_data *btfmcodec, uint32_t sampling_r
|
||||
btfmcodec_set_current_state(state, BT_Connected);
|
||||
}
|
||||
} else if (ret == 0 && test_bit(BTADV_CONFIGURE_DMA, &hwep_info->flags)) {
|
||||
/* Don't send request to cp for fm as it is non cp */
|
||||
if (id == 0)
|
||||
return ret;
|
||||
ret = btfmcodec_configure_dma(btfmcodec, (uint8_t)id);
|
||||
if (ret < 0) {
|
||||
BTFMCODEC_ERR("failed to configure Codec DMA %d", ret);
|
||||
if (seamless == false)
|
||||
btfmcodec_set_current_state(state, IDLE);
|
||||
else {
|
||||
if (dai_drv && dai_drv->dai_ops &&
|
||||
dai_drv->dai_ops->hwep_shutdown) {
|
||||
dai_drv->dai_ops->hwep_shutdown((void *)hwep_info,
|
||||
id);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (seamless == false)
|
||||
btfmcodec_set_current_state(state, BT_Connected);
|
||||
@@ -644,7 +619,7 @@ int btfmcodec_hwep_prepare(struct btfmcodec_data *btfmcodec, uint32_t sampling_r
|
||||
}
|
||||
|
||||
static int btfmcodec_notify_usecase_start(struct btfmcodec_data *btfmcodec,
|
||||
uint8_t transport, uint8_t stream_id)
|
||||
uint8_t transport)
|
||||
{
|
||||
struct btfmcodec_char_device *btfmcodec_dev = btfmcodec->btfmcodec_dev;
|
||||
struct btm_usecase_start_ind ind;
|
||||
@@ -657,7 +632,6 @@ static int btfmcodec_notify_usecase_start(struct btfmcodec_data *btfmcodec,
|
||||
ind.opcode = BTM_BTFMCODEC_USECASE_START_REQ;
|
||||
ind.len = BTM_USECASE_START_IND_LEN;
|
||||
ind.transport = transport;
|
||||
ind.stream_id = stream_id;
|
||||
ret = btfmcodec_dev_enqueue_pkt(btfmcodec_dev, &ind, (ind.len + BTM_HEADER_LEN));
|
||||
|
||||
if (ret < 0)
|
||||
@@ -708,7 +682,9 @@ static int btfmcodec_dai_prepare(struct snd_pcm_substream *substream,
|
||||
btfmcodec_get_current_transport(state) != BT_Connected) {
|
||||
BTFMCODEC_WARN("cached required info as state is:%s",
|
||||
coverttostring(btfmcodec_get_current_transport(state)));
|
||||
ret = btfmcodec_notify_usecase_start(btfmcodec, BTADV, (uint8_t)id);
|
||||
if (direction == 0) {
|
||||
ret = btfmcodec_notify_usecase_start(btfmcodec, BTADV);
|
||||
}
|
||||
} else {
|
||||
ret = btfmcodec_hwep_prepare(btfmcodec, sampling_rate, direction, id, false);
|
||||
/* if (ret >= 0) {
|
||||
@@ -821,31 +797,16 @@ void btfmcodec_wq_hwep_configure(struct work_struct *work)
|
||||
if (ret >= 0)
|
||||
ret = btfmcodec_hwep_prepare(btfmcodec, sample_rate, direction, id, true);
|
||||
if (ret < 0) {
|
||||
hwep_configs->is_port_opened = 1;
|
||||
BTFMCODEC_ERR("failed to configure hwep %d", hwep_configs->stream_id);
|
||||
break;
|
||||
} else {
|
||||
hwep_configs->is_port_opened = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
list_for_each_entry_safe(hwep_configs, tmp, head, dai_list) {
|
||||
if (hwep_configs->is_port_opened) {
|
||||
BTFMCODEC_INFO("shuting down dai id:%d", hwep_configs->stream_id);
|
||||
ret = btfmcodec_hwep_shutdown(btfmcodec, hwep_configs->stream_id,
|
||||
true);
|
||||
hwep_configs->is_port_opened = 0;
|
||||
if (ret < 0) {
|
||||
BTFMCODEC_ERR("failed to shutdown master with id %d",
|
||||
hwep_configs->stream_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
btfmcodec_dev->status[idx] = BTM_FAIL_RESP_RECV;
|
||||
} else {
|
||||
else
|
||||
btfmcodec_dev->status[idx] = BTM_RSP_RECV;
|
||||
}
|
||||
|
||||
wake_up_interruptible(&btfmcodec_dev->rsp_wait_q[idx]);
|
||||
}
|
||||
static struct snd_soc_dai_ops btfmcodec_dai_ops = {
|
||||
@@ -891,23 +852,6 @@ static int btfmcodec_adsp_ssr_notify(struct notifier_block *nb,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int btfmcodec_port_state_notify(uint8_t port_state)
|
||||
{
|
||||
struct btm_port_state_ind state_ind;
|
||||
struct btfmcodec_data *btfmcodec;
|
||||
struct btfmcodec_char_device *btfmcodec_dev;
|
||||
|
||||
BTFMCODEC_WARN("%s: port state = %d", __func__, port_state);
|
||||
btfmcodec = btfm_get_btfmcodec();
|
||||
btfmcodec_dev = btfmcodec->btfmcodec_dev;
|
||||
state_ind.opcode = BTM_BTFMCODEC_PORT_STATE_IND;
|
||||
state_ind.len = BTM_PORT_STATE_IND_LEN;
|
||||
state_ind.port_state = (uint8_t)port_state;
|
||||
btfmcodec_dev_enqueue_pkt(btfmcodec_dev, &state_ind,
|
||||
(state_ind.len + BTM_HEADER_LEN));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int btfm_register_codec(struct hwep_data *hwep_info)
|
||||
{
|
||||
struct btfmcodec_data *btfmcodec;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_BTFM_CODEC_HW_INTERFACE_H
|
||||
@@ -29,7 +29,6 @@ struct hwep_configurations {
|
||||
uint8_t codectype;
|
||||
uint32_t direction;
|
||||
uint8_t num_channels;
|
||||
uint8_t is_port_opened;
|
||||
struct list_head dai_list;
|
||||
};
|
||||
|
||||
|
@@ -45,11 +45,10 @@ struct btm_ctrl_pkt {
|
||||
#define BTM_BTFMCODEC_TRANSPORT_SWITCH_FAILED_IND 0x58000002
|
||||
#define BTM_BTFMCODEC_ADSP_STATE_IND 0x58000003
|
||||
#define BTM_BTFMCODEC_CTRL_LOG_LVL_IND 0x58000004
|
||||
#define BTM_BTFMCODEC_PORT_STATE_IND 0x58000005
|
||||
|
||||
#define BTM_MASTER_CONFIG_REQ_LEN 13
|
||||
#define BTM_MASTER_CONFIG_RSP_TIMEOUT 5000
|
||||
#define BTM_BEARER_SWITCH_IND_TIMEOUT 25000
|
||||
#define BTM_BEARER_SWITCH_IND_TIMEOUT 17000
|
||||
#define BTM_MASTER_DMA_CONFIG_RSP_TIMEOUT 5000
|
||||
#define BTM_HEADER_LEN 8
|
||||
#define BTM_PREPARE_AUDIO_BEARER_SWITCH_RSP_LEN 2
|
||||
@@ -61,12 +60,10 @@ struct btm_ctrl_pkt {
|
||||
#define BTM_LOG_LVL_IND_LEN 1
|
||||
#define BTM_ADSP_STATE_IND_LEN 4
|
||||
#define BTM_CODEC_CONFIG_DMA_REQ_LEN 11
|
||||
#define BTM_PORT_STATE_IND_LEN 1
|
||||
|
||||
#define BTM_BTFMCODEC_USECASE_START_REQ 0x58000008
|
||||
#define BTM_BTFMCODEC_USECASE_START_RSP 0x58000009
|
||||
#define BTM_USECASE_START_IND_LEN 2
|
||||
#define BTM_USECASE_START_RSP_LEN 1
|
||||
#define BTM_USECASE_START_IND_LEN 1
|
||||
|
||||
enum rx_status {
|
||||
/* Waiting for response */
|
||||
@@ -103,7 +100,7 @@ struct btm_master_config_req {
|
||||
uint8_t num_channels;
|
||||
uint8_t channel_num;
|
||||
uint8_t codec_id;
|
||||
} __packed;
|
||||
}__attribute__((packed));
|
||||
|
||||
struct btm_dma_config_req {
|
||||
btm_opcode opcode;
|
||||
@@ -122,26 +119,19 @@ struct btm_usecase_start_ind {
|
||||
btm_opcode opcode;
|
||||
uint32_t len;
|
||||
uint8_t transport;
|
||||
uint8_t stream_id;
|
||||
} __packed;
|
||||
|
||||
struct btm_master_shutdown_req {
|
||||
btm_opcode opcode;
|
||||
uint32_t len;
|
||||
uint8_t stream_id;
|
||||
} __packed;
|
||||
}__attribute__((packed));
|
||||
|
||||
struct btm_adsp_state_ind {
|
||||
btm_opcode opcode;
|
||||
uint32_t len;
|
||||
uint32_t action;
|
||||
} __packed;
|
||||
|
||||
struct btm_port_state_ind {
|
||||
btm_opcode opcode;
|
||||
uint32_t len;
|
||||
uint8_t port_state;
|
||||
} __packed;
|
||||
} __attribute__((packed));
|
||||
|
||||
int btfmcodec_dev_enqueue_pkt(struct btfmcodec_char_device *btfmcodec_dev, void *buf, int len);
|
||||
bool btfmcodec_is_valid_cache_avb(struct btfmcodec_data *btfmcodec);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_BLUETOOTH_POWER_H
|
||||
@@ -643,7 +643,6 @@ struct platform_pwr_data {
|
||||
int bt_gpio_fmd_clk_ctrl; /* Bluetooth fmd_clk_ctrl gpio */
|
||||
int bt_gpio_debug; /* Bluetooth debug gpio */
|
||||
unsigned int wlan_sw_ctrl_gpio; /* Wlan switch control gpio*/
|
||||
int bt_gpio_resetb; /* BT RESETB GPIO */
|
||||
#ifdef CONFIG_MSM_BT_OOBS
|
||||
int bt_gpio_dev_wake; /* Bluetooth bt_wake */
|
||||
int bt_gpio_host_wake; /* Bluetooth bt_host_wake */
|
||||
@@ -675,6 +674,7 @@ struct platform_pwr_data {
|
||||
struct file *reffilp_obs;
|
||||
struct task_struct *reftask_obs;
|
||||
#endif
|
||||
struct task_struct *reftask;
|
||||
struct task_struct *reftask_bt;
|
||||
struct task_struct *reftask_uwb;
|
||||
struct btpower_state_machine btpower_state;
|
||||
@@ -717,7 +717,6 @@ int bt_aop_pdc_reconfig(struct platform_pwr_data *pdata);
|
||||
#define UWB_CMD_REGISTRATION 0xbfe3
|
||||
#define BT_CMD_ACCESS_CTRL 0xbfe4
|
||||
#define UWB_CMD_ACCESS_CTRL 0xbfe5
|
||||
#define UWB_GET_SSR_STATE 0xbfe6
|
||||
#define BT_CMD_FMD_OPERATION 0xbfb2
|
||||
|
||||
#ifdef CONFIG_MSM_BT_OOBS
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -77,9 +77,6 @@
|
||||
#define SIGIO_SSR_ON_UWB 0x00000001
|
||||
#define SIGIO_UWB_SSR_COMPLETED 0x00000002
|
||||
|
||||
#define RESETB_GPIO_HIGH 0x00000001
|
||||
#define RESETB_GPIO_LOW 0x00000000
|
||||
|
||||
#define CRASH_REASON_NOT_FOUND ((char *)"Crash reason not found")
|
||||
|
||||
#define PERI_SS (0x00)
|
||||
@@ -87,10 +84,8 @@
|
||||
#define UWB_SS (0x02)
|
||||
#define TME_SS (0x03)
|
||||
|
||||
#define INVALID_SOC 0x00
|
||||
#define PEACH_SOC_VERSION_1_0 0x01
|
||||
#define PEACH_SOC_VERSION_2_0 0x02
|
||||
#define OTHER_FMD_SUPPORTED_BT_SOC 0x03
|
||||
#define SOC_VERSION_1_0 0x01
|
||||
#define SOC_VERSION_2_0 0x02
|
||||
|
||||
/**
|
||||
* enum btpower_vreg_param: Voltage regulator TCS param
|
||||
@@ -347,6 +342,7 @@ static const struct of_device_id bt_power_match_table[] = {
|
||||
{},
|
||||
};
|
||||
|
||||
static int btpower_enable_ipa_vreg(struct platform_pwr_data *pdata);
|
||||
static struct platform_pwr_data *pwr_data;
|
||||
static bool previous;
|
||||
static struct class *bt_class;
|
||||
@@ -354,10 +350,7 @@ static int bt_major;
|
||||
static int soc_id;
|
||||
static bool probe_finished;
|
||||
static struct fmdOperationStruct fmdStruct;
|
||||
char *default_crash_reason = "Crash reason not found";
|
||||
|
||||
static int btpower_enable_ipa_vreg(struct platform_pwr_data *pdata);
|
||||
static inline int btpower_get_retenion_mode_state(void);
|
||||
static void bt_power_vote(struct work_struct *work);
|
||||
|
||||
static struct {
|
||||
@@ -727,34 +720,6 @@ static int get_fmd_mode(void)
|
||||
return pwr_data->is_fmd_mode_enable;
|
||||
}
|
||||
|
||||
static int bt_pull_resetb(int resetb_gpio, int value)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
rc = gpio_direction_output(resetb_gpio, value);
|
||||
if (rc) {
|
||||
pr_err("%s: Unable to set direction\n", __func__);
|
||||
return rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bt_resetb_operation(int resetb)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
/* making resetb to low */
|
||||
pr_info("BTON: Turn bt_resetb_gpio to low\n");
|
||||
rc = bt_pull_resetb(resetb, RESETB_GPIO_LOW);
|
||||
if (rc)
|
||||
return rc;
|
||||
msleep(20);
|
||||
/* making resetb to high after delay */
|
||||
pr_info("BTON: Turn bt_resetb_gpio to High\n");
|
||||
rc = bt_pull_resetb(resetb, RESETB_GPIO_HIGH);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bt_configure_gpios(int on)
|
||||
{
|
||||
int rc = 0;
|
||||
@@ -762,7 +727,6 @@ static int bt_configure_gpios(int on)
|
||||
int wl_reset_gpio = pwr_data->wl_gpio_sys_rst;
|
||||
int bt_sw_ctrl_gpio = pwr_data->bt_gpio_sw_ctrl;
|
||||
int bt_debug_gpio = pwr_data->bt_gpio_debug;
|
||||
int bt_resetb_gpio = pwr_data->bt_gpio_resetb;
|
||||
int assert_dbg_gpio = 0;
|
||||
|
||||
if (on) {
|
||||
@@ -772,14 +736,6 @@ static int bt_configure_gpios(int on)
|
||||
__func__, bt_reset_gpio, rc);
|
||||
return rc;
|
||||
}
|
||||
if (bt_resetb_gpio >= 0) {
|
||||
rc = gpio_request(bt_resetb_gpio, "bt_resetb_gpio_n");
|
||||
if (rc) {
|
||||
pr_err("%s: unable to request gpio %d (%d)\n",
|
||||
__func__, bt_resetb_gpio, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
pr_info("BTON:Turn Bt OFF asserting BT_EN to low\n");
|
||||
pr_info("bt-reset-gpio(%d) value(%d)\n", bt_reset_gpio,
|
||||
@@ -842,18 +798,13 @@ static int bt_configure_gpios(int on)
|
||||
}
|
||||
power_src.platform_state[BT_RESET_GPIO] =
|
||||
gpio_get_value(bt_reset_gpio);
|
||||
if (bt_resetb_gpio >= 0) {
|
||||
pr_err("BTON:Turn resetb High\n");
|
||||
bt_pull_resetb(bt_resetb_gpio, RESETB_GPIO_HIGH);
|
||||
}
|
||||
}
|
||||
pr_info("BTON: WLAN OFF waiting for 100ms delay\n");
|
||||
pr_info("for AON output to fully discharge\n");
|
||||
msleep(100);
|
||||
pr_info("BTON: WLAN OFF Asserting BT_EN to high\n");
|
||||
btpower_set_xo_clk_gpio_state(true);
|
||||
if (bt_resetb_gpio >= 0)
|
||||
bt_resetb_operation(bt_resetb_gpio);
|
||||
|
||||
rc = gpio_direction_output(bt_reset_gpio, 1);
|
||||
if (rc) {
|
||||
pr_err("%s: Unable to set direction\n", __func__);
|
||||
@@ -936,34 +887,6 @@ static int bt_configure_gpios(int on)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int handle_pwr_disable_req(int core, int reg_num, int retenion_state, int fmd_state)
|
||||
{
|
||||
struct vreg_data *vregs;
|
||||
int rc;
|
||||
|
||||
for (int i = 0; i < reg_num; i++) {
|
||||
if (core == BT_CORE)
|
||||
vregs = &pwr_data->bt_vregs[i];
|
||||
else if (core == UWB_CORE)
|
||||
vregs = &pwr_data->uwb_vregs[i];
|
||||
else if (core == PLATFORM_CORE)
|
||||
vregs = &pwr_data->platform_vregs[i];
|
||||
|
||||
if (fmd_state && vregs->fmd_mode_set) {
|
||||
if (retenion_state != RETENTION_IDLE) {
|
||||
vreg_disable_retention(vregs);
|
||||
pr_err("%s: Brought %s reg out-of retention for FMD\n",
|
||||
__func__, vregs->name);
|
||||
}
|
||||
pr_err("%s: Keeping %s reg on power-on state for FMD\n",
|
||||
__func__, vregs->name);
|
||||
} else {
|
||||
rc = vreg_disable(vregs);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bt_regulators_pwr(int pwr_state)
|
||||
{
|
||||
int i, log_indx, bt_num_vregs, rc = 0;
|
||||
@@ -1023,26 +946,26 @@ static int bt_regulators_pwr(int pwr_state)
|
||||
pr_err("%s: secure hw mode on, not allowed to access gpio",
|
||||
__func__);
|
||||
}else {
|
||||
if (!get_fmd_mode())
|
||||
bt_configure_gpios(POWER_DISABLE);
|
||||
bt_configure_gpios(POWER_DISABLE);
|
||||
}
|
||||
}
|
||||
gpio_fail:
|
||||
if (!get_fmd_mode()) {
|
||||
if (pwr_data->bt_gpio_sys_rst > 0)
|
||||
gpio_free(pwr_data->bt_gpio_sys_rst);
|
||||
if (pwr_data->bt_gpio_debug > 0)
|
||||
gpio_free(pwr_data->bt_gpio_debug);
|
||||
if (pwr_data->bt_chip_clk)
|
||||
bt_clk_disable(pwr_data->bt_chip_clk);
|
||||
if (pwr_data->bt_gpio_resetb > 0)
|
||||
gpio_free(pwr_data->bt_gpio_resetb);
|
||||
}
|
||||
if (pwr_data->bt_gpio_sys_rst > 0)
|
||||
gpio_free(pwr_data->bt_gpio_sys_rst);
|
||||
if (pwr_data->bt_gpio_debug > 0)
|
||||
gpio_free(pwr_data->bt_gpio_debug);
|
||||
if (pwr_data->bt_chip_clk)
|
||||
bt_clk_disable(pwr_data->bt_chip_clk);
|
||||
regulator_fail:
|
||||
rc = handle_pwr_disable_req(BT_CORE,
|
||||
bt_num_vregs,
|
||||
btpower_get_retenion_mode_state(),
|
||||
get_fmd_mode());
|
||||
for (i = 0; i < bt_num_vregs; i++) {
|
||||
bt_vregs = &pwr_data->bt_vregs[i];
|
||||
if (get_fmd_mode() && bt_vregs->fmd_mode_set) {
|
||||
pr_err("%s: FMD Mode Set: Skipping regulator %s\n",
|
||||
__func__, bt_vregs->name);
|
||||
continue;
|
||||
}
|
||||
rc = vreg_disable(bt_vregs);
|
||||
}
|
||||
} else if (pwr_state == POWER_RETENTION) {
|
||||
/* Retention mode */
|
||||
for (i = 0; i < bt_num_vregs; i++) {
|
||||
@@ -1208,10 +1131,17 @@ gpio_failed:
|
||||
gpio_free(pwr_data->bt_gpio_debug);
|
||||
}
|
||||
regulator_failed:
|
||||
rc = handle_pwr_disable_req(PLATFORM_CORE,
|
||||
platform_num_vregs,
|
||||
btpower_get_retenion_mode_state(),
|
||||
get_fmd_mode());
|
||||
for (i = 0; i < platform_num_vregs; i++) {
|
||||
platform_vregs = &pwr_data->platform_vregs[i];
|
||||
pr_err("%s: FMD MODE regulator %s\n",
|
||||
__func__, platform_vregs->name);
|
||||
if (get_fmd_mode() && platform_vregs->fmd_mode_set) {
|
||||
pr_err("%s: FMD Mode Set: Skipping regulator %s\n",
|
||||
__func__, platform_vregs->name);
|
||||
continue;
|
||||
}
|
||||
rc = vreg_disable(platform_vregs);
|
||||
}
|
||||
break;
|
||||
case POWER_RETENTION:
|
||||
for (i = 0; i < platform_num_vregs; i++) {
|
||||
@@ -1304,7 +1234,7 @@ static int btpower_rfkill_probe(struct platform_device *pdev)
|
||||
pdev->dev.platform_data);
|
||||
|
||||
if (!rfkill) {
|
||||
dev_err(&pdev->dev, "rfkill allocate failed\n");
|
||||
pr_err("btpower : rfkill allocate failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1319,7 +1249,7 @@ static int btpower_rfkill_probe(struct platform_device *pdev)
|
||||
|
||||
ret = rfkill_register(rfkill);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "rfkill register failed=%d\n", ret);
|
||||
pr_err("btpower : rfkill register failed=%d\n", ret);
|
||||
rfkill_destroy(rfkill);
|
||||
return ret;
|
||||
}
|
||||
@@ -1355,6 +1285,8 @@ static int dt_parse_vreg_info(struct device *dev, struct device_node *child,
|
||||
if (!child)
|
||||
np = dev->of_node;
|
||||
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
snprintf(prop_name, sizeof(prop_name), "%s-supply", vreg_name);
|
||||
if (of_parse_phandle(np, prop_name, 0)) {
|
||||
vreg->reg = regulator_get(dev, vreg_name);
|
||||
@@ -1408,7 +1340,7 @@ static int bt_dt_parse_clk_info(struct device *dev,
|
||||
struct bt_power_clk_data *clk = NULL;
|
||||
struct device_node *np = dev->of_node;
|
||||
|
||||
pr_debug("%s\n", __func__);
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
*clk_data = NULL;
|
||||
if (of_parse_phandle(np, "clocks", 0)) {
|
||||
@@ -1454,6 +1386,8 @@ static void bt_power_vreg_put(void)
|
||||
struct vreg_data *bt_vregs = NULL;
|
||||
int bt_num_vregs = pwr_data->bt_num_vregs;
|
||||
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
for (; i < bt_num_vregs; i++) {
|
||||
bt_vregs = &pwr_data->bt_vregs[i];
|
||||
if (bt_vregs->reg)
|
||||
@@ -1468,8 +1402,11 @@ static int get_gpio_dt_pinfo(struct platform_device *pdev)
|
||||
struct pinctrl *pinctrl1;
|
||||
#ifdef CONFIG_FMD_ENABLE
|
||||
struct pinctrl_state *sw_ctrl;
|
||||
struct pinctrl_state *bt_en;
|
||||
|
||||
#endif
|
||||
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
child = pdev->dev.of_node;
|
||||
|
||||
pinctrl1 = devm_pinctrl_get(&pdev->dev);
|
||||
@@ -1486,13 +1423,6 @@ static int get_gpio_dt_pinfo(struct platform_device *pdev)
|
||||
pr_err("%s: wl-reset-gpio not provided in device tree\n",
|
||||
__func__);
|
||||
|
||||
pwr_data->bt_gpio_resetb =
|
||||
of_get_named_gpio(child,
|
||||
"qcom,wl-resetb-gpio", 0);
|
||||
if (pwr_data->bt_gpio_resetb < 0)
|
||||
pr_err("%s: bt_gpio_resetb not provided in device tree\n",
|
||||
__func__);
|
||||
|
||||
pwr_data->bt_gpio_sw_ctrl =
|
||||
of_get_named_gpio(child,
|
||||
"qcom,bt-sw-ctrl-gpio", 0);
|
||||
@@ -1511,6 +1441,7 @@ static int get_gpio_dt_pinfo(struct platform_device *pdev)
|
||||
pr_warn("sw_cntrl-gpio not provided in devicetree\n");
|
||||
}
|
||||
#ifdef CONFIG_FMD_ENABLE
|
||||
pr_warn("CONFIG_FMD_ENABLE\n");
|
||||
if (pinctrl1) {
|
||||
sw_ctrl = pinctrl_lookup_state(pinctrl1, "sw_ctrl");
|
||||
if (IS_ERR_OR_NULL(sw_ctrl)) {
|
||||
@@ -1521,15 +1452,6 @@ static int get_gpio_dt_pinfo(struct platform_device *pdev)
|
||||
if (ret)
|
||||
pr_err("Failed to select sw_ctrl state, err = %d\n", ret);
|
||||
}
|
||||
bt_en = pinctrl_lookup_state(pinctrl1, "bt_en");
|
||||
if (IS_ERR_OR_NULL(bt_en)) {
|
||||
ret = PTR_ERR(bt_en);
|
||||
pr_err("Failed to get bt_en state, err = %d\n", ret);
|
||||
} else {
|
||||
ret = pinctrl_select_state(pinctrl1, bt_en);
|
||||
if (ret)
|
||||
pr_err("Failed to select bt_en state, err = %d\n", ret);
|
||||
}
|
||||
} else {
|
||||
pr_err("%s: pinctrl is null\n", __func__);
|
||||
}
|
||||
@@ -1568,6 +1490,8 @@ static int get_power_dt_pinfo(struct platform_device *pdev)
|
||||
int rc, i;
|
||||
const struct pwr_data *data;
|
||||
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
data = of_device_get_match_data(&pdev->dev);
|
||||
if (!data) {
|
||||
pr_err("%s: failed to get dev node\n", __func__);
|
||||
@@ -1634,6 +1558,8 @@ static int bt_power_populate_dt_pinfo(struct platform_device *pdev)
|
||||
struct device_node *of_node;
|
||||
int rc;
|
||||
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
if (!pwr_data)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1723,6 +1649,8 @@ static int bt_power_probe(struct platform_device *pdev)
|
||||
int ret = 0;
|
||||
int itr;
|
||||
|
||||
pr_err("btpower : %s\n", __func__);
|
||||
|
||||
/* Fill whole array with -2 i.e NOT_AVAILABLE state by default
|
||||
* for any GPIO or Reg handle.
|
||||
*/
|
||||
@@ -1734,15 +1662,16 @@ static int bt_power_probe(struct platform_device *pdev)
|
||||
|
||||
pwr_data = kzalloc(sizeof(*pwr_data), GFP_KERNEL);
|
||||
|
||||
if (!pwr_data)
|
||||
if (!pwr_data) {
|
||||
pr_err("btpower : %s !pwr_data\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
pwr_data->pdev = pdev;
|
||||
pwr_data->reftask_bt = NULL;
|
||||
pwr_data->reftask_uwb = NULL;
|
||||
|
||||
struct device *devi = &pwr_data->pdev->dev;
|
||||
int rc = 0;
|
||||
|
||||
pr_info("%s: Get FMD nvmem-cells\n", __func__);
|
||||
/* Get fmd_set NVMEM Cell Handler */
|
||||
pwr_data->nvmem_cell_fmd_set =
|
||||
@@ -1841,8 +1770,10 @@ static int bt_power_probe(struct platform_device *pdev)
|
||||
goto free_pdata;
|
||||
}
|
||||
|
||||
if (btpower_rfkill_probe(pdev) < 0)
|
||||
if (btpower_rfkill_probe(pdev) < 0) {
|
||||
pr_err("btpower : %s btpower_rfkill_probe<0 \n", __func__);
|
||||
goto free_pdata;
|
||||
}
|
||||
|
||||
bt_power_pdc_init_params(pwr_data);
|
||||
btpower_aop_mbox_init(pwr_data);
|
||||
@@ -2056,21 +1987,10 @@ int power_enable (enum SubSystem SubSystemType)
|
||||
void send_signal_to_subsystem(int SubSystemType, int state)
|
||||
{
|
||||
pwr_data->wrkq_signal_state = state;
|
||||
if (SubSystemType == BLUETOOTH) {
|
||||
if (!pwr_data->reftask_bt) {
|
||||
pr_err("%s: BT client is not register to send signal\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
if (SubSystemType == BLUETOOTH)
|
||||
queue_work(pwr_data->workq, &pwr_data->bt_wq);
|
||||
} else {
|
||||
if (!pwr_data->reftask_uwb) {
|
||||
pr_err("%s: UWB client is not register to send signal\n",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
else
|
||||
queue_work(pwr_data->workq, &pwr_data->uwb_wq);
|
||||
}
|
||||
}
|
||||
|
||||
int power_disable (enum SubSystem SubSystemType)
|
||||
@@ -2167,19 +2087,34 @@ static int client_state_notified(int SubSystemType)
|
||||
|
||||
if (SubSystemType == BLUETOOTH) {
|
||||
update_sub_state(SSR_ON_BT);
|
||||
if (get_pwr_state() == ALL_CLIENTS_ON)
|
||||
if (get_pwr_state() == ALL_CLIENTS_ON) {
|
||||
if (!pwr_data->reftask_uwb) {
|
||||
pr_err("%s: UWB PID is not register to send signal\n",
|
||||
__func__);
|
||||
return -1;
|
||||
}
|
||||
send_signal_to_subsystem(UWB, SSR_ON_BT);
|
||||
}
|
||||
} else {
|
||||
update_sub_state(SSR_ON_UWB);
|
||||
if (get_pwr_state() == ALL_CLIENTS_ON)
|
||||
if (get_pwr_state() == ALL_CLIENTS_ON) {
|
||||
if (!pwr_data->reftask_bt) {
|
||||
pr_err("%s: BT PID is not register to send signal\n",
|
||||
__func__);
|
||||
return -1;
|
||||
}
|
||||
send_signal_to_subsystem(BLUETOOTH,
|
||||
(SIGIO_NOTIFICATION_SIGNAL|SIGIO_SSR_ON_UWB));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btpower_register_client(int client, int cmd)
|
||||
{
|
||||
|
||||
//pr_err("btpower_retenion : %s\n", __func__);
|
||||
|
||||
if (cmd == REG_BT_PID) {
|
||||
pwr_data->reftask_bt = get_current();
|
||||
pr_info("%s: Registering BT Service(PID-%d) with Power driver\n",
|
||||
@@ -2224,6 +2159,8 @@ int btpower_retenion(enum plt_pwr_state client)
|
||||
int current_pwr_state = get_pwr_state();
|
||||
int retention_mode_state = btpower_get_retenion_mode_state();
|
||||
|
||||
//pr_err("btpower_retenion : %s\n", __func__);
|
||||
|
||||
if (current_pwr_state == IDLE) {
|
||||
pr_err("%s: invalid retention_mode request", __func__);
|
||||
return -1;
|
||||
@@ -2262,6 +2199,7 @@ int btpower_retenion(enum plt_pwr_state client)
|
||||
|
||||
int btpower_off(enum plt_pwr_state client)
|
||||
{
|
||||
pr_err("btpower : %s\n", __func__);
|
||||
return power_disable((client == POWER_OFF_BT) ? BLUETOOTH : UWB);
|
||||
}
|
||||
|
||||
@@ -2271,6 +2209,8 @@ int btpower_on(enum plt_pwr_state client)
|
||||
int current_ssr_state = get_sub_state();
|
||||
int retention_mode_state = btpower_get_retenion_mode_state();
|
||||
|
||||
pr_err("btpower : %s\n", __func__);
|
||||
|
||||
if (retention_mode_state == UWB_IN_RETENTION ||
|
||||
retention_mode_state == BT_IN_RETENTION) {
|
||||
ret = platform_regulators_pwr(POWER_DISABLE_RETENTION);
|
||||
@@ -2686,37 +2626,39 @@ int perform_fmd_operation(void)
|
||||
int ret = 0;
|
||||
switch ((enum FmdOperation) fmdStruct.fmdOperation) {
|
||||
case UPDATE_SOC_VER: {
|
||||
if ((fmdStruct.socFwVer == INVALID_SOC) ||
|
||||
(fmdStruct.socFwVer > OTHER_FMD_SUPPORTED_BT_SOC)) {
|
||||
pr_err("%s: Invalid SOC VERSION sent = %d\n",
|
||||
__func__, fmdStruct.socFwVer);
|
||||
return -EINVAL;
|
||||
}
|
||||
pwr_data->is_fmd_mode_enable = true;
|
||||
if (fmdStruct.socFwVer == PEACH_SOC_VERSION_1_0) {
|
||||
pr_info("%s: UPDATE_SOC_VER :: PEACH_SOC_VER_1_0\n",
|
||||
if (fmdStruct.socFwVer == SOC_VERSION_1_0) {
|
||||
pr_info("%s: UPDATE_SOC_VER :: SOC_VERSION_1_0\n",
|
||||
__func__);
|
||||
} else if (fmdStruct.socFwVer == PEACH_SOC_VERSION_2_0) {
|
||||
pr_info("%s: UPDATE_SOC_VER :: PEACH_SOC_VERSION_2_0\n",
|
||||
pwr_data->is_fmd_mode_enable = true;
|
||||
if (pwr_data->bt_chip_clk) {
|
||||
ret = bt_clk_enable(pwr_data->bt_chip_clk);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to bt_chip_clk\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
} else if (fmdStruct.socFwVer == SOC_VERSION_2_0) {
|
||||
pr_info("%s: UPDATE_SOC_VER :: SOC_VERSION_2_0\n",
|
||||
__func__);
|
||||
pwr_data->is_fmd_mode_enable = true;
|
||||
#ifdef CONFIG_FMD_ENABLE
|
||||
cnss_utils_fmd_status(true);
|
||||
#endif
|
||||
if (vote_wlan_reg_for_fmd() < 0) {
|
||||
pr_err("%s: failed to vote wlan_reg\n", __func__);
|
||||
pr_err("%s: failed to vote_wlan_reg_for_fmd\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (pwr_data->bt_chip_clk) {
|
||||
ret = bt_clk_enable(pwr_data->bt_chip_clk);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to bt_chip_clk\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pr_info("%s: UPDATE_SOC_VER :: OTHER_FMD_SUPPORT_BT_SOC\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
if (pwr_data->bt_chip_clk) {
|
||||
ret = bt_clk_enable(pwr_data->bt_chip_clk);
|
||||
if (ret < 0) {
|
||||
pr_err("%s: failed to bt_chip_clk\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
pr_err("%s: Invalid SOC VERSION sent = %d\n",
|
||||
__func__, fmdStruct.socFwVer);
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2753,31 +2695,6 @@ int perform_fmd_operation(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int bt_kernel_panic(char *arg) {
|
||||
int ret = 0;
|
||||
|
||||
pr_info("%s\n", __func__);
|
||||
|
||||
if (copy_from_user(&CrashInfo, (char *)arg, sizeof(CrashInfo))) {
|
||||
pr_err("%s: failed copy to panic reason from BT-Transport\n",
|
||||
__func__);
|
||||
memset(&CrashInfo, 0, sizeof(CrashInfo));
|
||||
strscpy(CrashInfo. PrimaryReason,
|
||||
default_crash_reason, strlen(default_crash_reason));
|
||||
strscpy(CrashInfo. SecondaryReason,
|
||||
default_crash_reason, strlen(default_crash_reason));
|
||||
ret = -EFAULT;
|
||||
}
|
||||
|
||||
pr_err("%s: BT kernel panic Primary reason = %s, Secondary reason = %s\n",
|
||||
__func__, CrashInfo.PrimaryReason, CrashInfo.SecondaryReason);
|
||||
|
||||
panic("%s: BT kernel panic Primary reason = %s, Secondary reason = %s\n",
|
||||
__func__, CrashInfo.PrimaryReason, CrashInfo.SecondaryReason);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MSM_BT_OOBS
|
||||
int bt_oobs_handler(enum btpower_obs_param clk_cntrl)
|
||||
{
|
||||
@@ -2819,10 +2736,9 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
int chipset_version = 0;
|
||||
unsigned long panic_reason = 0;
|
||||
unsigned short primary_reason = 0, sec_reason = 0, source_subsystem = 0;
|
||||
int current_ssr_state = SUB_STATE_IDLE;
|
||||
|
||||
if (!pwr_data || !probe_finished) {
|
||||
pr_err("%s: BTPower Probing Pending.Try Again\n", __func__);
|
||||
pr_err("%s: BTPower Probing Pending.Try Again command[%d]\n", __func__, cmd);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
@@ -2930,7 +2846,16 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
|
||||
pr_err("%s: BT_CMD_KERNEL_PANIC\n", __func__);
|
||||
|
||||
ret = bt_kernel_panic((char *)arg);
|
||||
if (copy_from_user(&CrashInfo, (char *)arg, sizeof(CrashInfo))) {
|
||||
pr_err("%s: copy to user failed\n", __func__);
|
||||
ret = -EFAULT;
|
||||
}
|
||||
|
||||
pr_err("%s: BT kernel panic Primary reason = %s, Secondary reason = %s\n",
|
||||
__func__, CrashInfo.PrimaryReason, CrashInfo.SecondaryReason);
|
||||
|
||||
panic("%s: BT kernel panic Primary reason = %s, Secondary reason = %s\n",
|
||||
__func__, CrashInfo.PrimaryReason, CrashInfo.SecondaryReason);
|
||||
|
||||
break;
|
||||
case UWB_CMD_KERNEL_PANIC:
|
||||
@@ -2948,17 +2873,6 @@ static long bt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
sec_reason, GetUwbSecondaryCrashReason(sec_reason),
|
||||
source_subsystem, GetSourceSubsystemString(source_subsystem));
|
||||
break;
|
||||
case UWB_GET_SSR_STATE:
|
||||
current_ssr_state = get_sub_state();
|
||||
pr_err("%s: UWB_GET_SSR_STATE current_ssr_state:%d\n", __func__,
|
||||
current_ssr_state);
|
||||
if (copy_to_user((void __user *)arg, ¤t_ssr_state,
|
||||
sizeof(current_ssr_state))) {
|
||||
pr_err("%s: copy to user failed\n", __func__);
|
||||
ret = -EFAULT;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
@@ -2982,6 +2896,8 @@ static int __init btpower_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
//pr_err("btpower : %s\n", __func__);
|
||||
|
||||
probe_finished = false;
|
||||
ret = platform_driver_register(&bt_power_driver);
|
||||
if (ret) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
@@ -38,15 +38,13 @@ int btfm_get_bt_soc_index(int chipset_ver)
|
||||
switch (chipset_ver) {
|
||||
case QCA_GANGES_SOC_ID_0100:
|
||||
case QCA_GANGES_SOC_ID_0200:
|
||||
case QCA_ORNE_SOC_ID_0100:
|
||||
case QCA_COLOGNE_SOC_ID_0100:
|
||||
return GANGES;
|
||||
case QCA_EVROS_SOC_ID_0100:
|
||||
case QCA_EVROS_SOC_ID_0200:
|
||||
return EVROS;
|
||||
default:
|
||||
BTFMSWR_ERR("no BT SOC id defined, returning GANGES");
|
||||
return GANGES;
|
||||
BTFMSWR_ERR("no BT SOC id defined, returning EVROS");
|
||||
return EVROS;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
@@ -34,9 +34,7 @@ enum {
|
||||
FMAUDIO_TX = 0,
|
||||
BTAUDIO_TX,
|
||||
BTAUDIO_RX,
|
||||
// align definitions to stream id definitions in CP
|
||||
BTAUDIO_RX2,
|
||||
BTAUDIO_TX2,
|
||||
BTAUDIO_A2DP_SINK_TX,
|
||||
BTFM_NUM_CODEC_DAIS
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
@@ -137,12 +137,9 @@ static void btfm_swr_dai_shutdown(void *dai, int id)
|
||||
case BTAUDIO_RX:
|
||||
port_type = BT_AUDIO_RX1;
|
||||
break;
|
||||
case BTAUDIO_TX2:
|
||||
case BTAUDIO_A2DP_SINK_TX:
|
||||
port_type = BT_AUDIO_TX2;
|
||||
break;
|
||||
case BTAUDIO_RX2:
|
||||
port_type = BT_AUDIO_RX2;
|
||||
break;
|
||||
case BTFM_NUM_CODEC_DAIS:
|
||||
default:
|
||||
BTFMSWR_ERR("dai->id is invalid:%d", id);
|
||||
@@ -207,11 +204,6 @@ static int btfm_swr_dai_prepare(void *dai, uint32_t sampling_rate, uint32_t dire
|
||||
bt_soc_enable_status = 0;
|
||||
BTFMSWR_INFO("dai->id: %d, dai->rate: %d direction: %d", id, sampling_rate, direction);
|
||||
|
||||
if (btfmswr == NULL || btfmswr->p_dai_port == NULL) {
|
||||
BTFMSWR_INFO("port open might have called without hw_init\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
btfm_get_sampling_rate(&sampling_rate);
|
||||
btfmswr->sample_rate = sampling_rate;
|
||||
|
||||
@@ -225,12 +217,9 @@ static int btfm_swr_dai_prepare(void *dai, uint32_t sampling_rate, uint32_t dire
|
||||
case BTAUDIO_RX:
|
||||
port_type = BT_AUDIO_RX1;
|
||||
break;
|
||||
case BTAUDIO_TX2:
|
||||
case BTAUDIO_A2DP_SINK_TX:
|
||||
port_type = BT_AUDIO_TX2;
|
||||
break;
|
||||
case BTAUDIO_RX2:
|
||||
port_type = BT_AUDIO_RX2;
|
||||
break;
|
||||
case BTFM_NUM_CODEC_DAIS:
|
||||
default:
|
||||
BTFMSWR_ERR("dai->id is invalid:%d", id);
|
||||
@@ -277,12 +266,11 @@ static int btfm_swr_dai_get_channel_map(void *dai,
|
||||
switch (id) {
|
||||
case FMAUDIO_TX:
|
||||
case BTAUDIO_TX:
|
||||
case BTAUDIO_TX2:
|
||||
case BTAUDIO_A2DP_SINK_TX:
|
||||
*tx_num = btfmswr->num_channels;
|
||||
*tx_slot = btfmswr->num_channels == 2 ? TWO_CHANNEL_MASK : ONE_CHANNEL_MASK;
|
||||
break;
|
||||
case BTAUDIO_RX:
|
||||
case BTAUDIO_RX2:
|
||||
*rx_num = btfmswr->num_channels;
|
||||
*rx_slot = btfmswr->num_channels == 2 ? TWO_CHANNEL_MASK : ONE_CHANNEL_MASK;
|
||||
break;
|
||||
@@ -301,7 +289,7 @@ int btfm_swr_dai_get_configs(void *dai, void *config, uint8_t id)
|
||||
struct btfmswr *btfmswr = dev_get_drvdata(hwep_info->dev);
|
||||
struct hwep_dma_configurations *hwep_config;
|
||||
|
||||
BTFMSWR_INFO("DAI id %u", id);
|
||||
BTFMSWR_DBG("");
|
||||
hwep_config = (struct hwep_dma_configurations *)config;
|
||||
|
||||
hwep_config->stream_id = id;
|
||||
@@ -313,14 +301,7 @@ int btfm_swr_dai_get_configs(void *dai, void *config, uint8_t id)
|
||||
hwep_config->active_channel_mask = (btfmswr->num_channels == 2 ?
|
||||
TWO_CHANNEL_MASK : ONE_CHANNEL_MASK);
|
||||
hwep_config->lpaif = LPAIF_AUD;
|
||||
|
||||
if (id == BTAUDIO_RX2 || id == BTAUDIO_TX2) {
|
||||
BTFMSWR_INFO("using interface index 2 for DAI id %u", id);
|
||||
hwep_config->inf_index = 2;
|
||||
} else {
|
||||
BTFMSWR_INFO("using interface index 1 for DAI id %u", id);
|
||||
hwep_config->inf_index = 1;
|
||||
}
|
||||
hwep_config->inf_index = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -388,14 +369,13 @@ static struct hwep_dai_driver btfmswr_dai_driver[] = {
|
||||
},
|
||||
.dai_ops = &btfmswr_hw_dai_ops,
|
||||
},
|
||||
{ /* Bluetooth A2DP sink, HFP client: bt -> lpass */
|
||||
.dai_name = "btaudio_tx2",
|
||||
.id = BTAUDIO_TX2,
|
||||
{ /* Bluetooth A2DP sink: bt -> lpass */
|
||||
.dai_name = "btfm_a2dp_sink_swr_tx",
|
||||
.id = BTAUDIO_A2DP_SINK_TX,
|
||||
.capture = {
|
||||
.stream_name = "BT Audio SWR Tx2 Capture",
|
||||
.stream_name = "A2DP sink TX Capture",
|
||||
/* 8/16/44.1/48/88.2/96/192 Khz */
|
||||
.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000
|
||||
| SNDRV_PCM_RATE_8000_192000
|
||||
| SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000
|
||||
| SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000
|
||||
| SNDRV_PCM_RATE_192000,
|
||||
@@ -406,26 +386,7 @@ static struct hwep_dai_driver btfmswr_dai_driver[] = {
|
||||
.channels_max = 1,
|
||||
},
|
||||
.dai_ops = &btfmswr_hw_dai_ops,
|
||||
},
|
||||
{ /* Bluetooth audio downlink2: lpass -> bt */
|
||||
.dai_name = "btaudio_rx2",
|
||||
.id = BTAUDIO_RX2,
|
||||
.playback = {
|
||||
.stream_name = "BT Audio SWR Rx2 Playback",
|
||||
/* 8/16/44.1/48/88.2/96 Khz */
|
||||
.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000
|
||||
| SNDRV_PCM_RATE_8000_192000
|
||||
| SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000
|
||||
| SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000
|
||||
| SNDRV_PCM_RATE_192000,
|
||||
.formats = SNDRV_PCM_FMTBIT_S16_LE, /* 16 bits */
|
||||
.rate_max = 192000,
|
||||
.rate_min = 8000,
|
||||
.channels_min = 1,
|
||||
.channels_max = 1,
|
||||
},
|
||||
.dai_ops = &btfmswr_hw_dai_ops,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
static struct hwep_comp_drv btfmswr_hw_driver = {
|
||||
@@ -456,7 +417,7 @@ int btfm_swr_register_hw_ep(struct btfmswr *btfm_swr)
|
||||
hwep_info->drv = &btfmswr_hw_driver;
|
||||
hwep_info->dai_drv = btfmswr_dai_driver;
|
||||
hwep_info->num_dai = ARRAY_SIZE(btfmswr_dai_driver);
|
||||
BTFMSWR_INFO("num_dai is: %lu", ARRAY_SIZE(btfmswr_dai_driver));
|
||||
hwep_info->num_dai = 4;
|
||||
hwep_info->num_mixer_ctrl = ARRAY_SIZE(status_controls);
|
||||
hwep_info->mixer_ctrl = status_controls;
|
||||
/* Register to hardware endpoint */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
@@ -11,40 +11,34 @@ struct soc_port_mapping slave_port[] = {
|
||||
// Evros
|
||||
{
|
||||
.ea = EVROS_EA,
|
||||
.port_info[FMAUDIO_TX].dai_id = FMAUDIO_TX,
|
||||
.port_info[FMAUDIO_TX].port = 5,
|
||||
.port_info[0].dai_id = FMAUDIO_TX,
|
||||
.port_info[0].port = 5,
|
||||
|
||||
.port_info[BTAUDIO_TX].dai_id = BTAUDIO_TX,
|
||||
.port_info[BTAUDIO_TX].port = 3,
|
||||
.port_info[1].dai_id = BTAUDIO_TX,
|
||||
.port_info[1].port = 3,
|
||||
|
||||
.port_info[BTAUDIO_RX].dai_id = BTAUDIO_RX,
|
||||
.port_info[BTAUDIO_RX].port = 1,
|
||||
.port_info[2].dai_id = BTAUDIO_RX,
|
||||
.port_info[2].port = 1,
|
||||
|
||||
.port_info[BTAUDIO_RX2].dai_id = BTAUDIO_RX2,
|
||||
.port_info[BTAUDIO_RX2].port = 2,
|
||||
|
||||
.port_info[BTAUDIO_TX2].dai_id = BTAUDIO_TX2,
|
||||
.port_info[BTAUDIO_TX2].port = 4,
|
||||
.port_info[3].dai_id = BTAUDIO_A2DP_SINK_TX,
|
||||
.port_info[3].port = 4,
|
||||
},
|
||||
|
||||
// Ganges
|
||||
{
|
||||
.ea = GANGES_EA,
|
||||
// FM is not supported on Ganges. populate with invalid port number
|
||||
.port_info[FMAUDIO_TX].dai_id = FMAUDIO_TX,
|
||||
.port_info[FMAUDIO_TX].port = BTFM_INVALID_PORT,
|
||||
.port_info[0].dai_id = FMAUDIO_TX,
|
||||
.port_info[0].port = BTFM_INVALID_PORT,
|
||||
|
||||
.port_info[BTAUDIO_TX].dai_id = BTAUDIO_TX,
|
||||
.port_info[BTAUDIO_TX].port = 4,
|
||||
.port_info[1].dai_id = BTAUDIO_TX,
|
||||
.port_info[1].port = 4,
|
||||
|
||||
.port_info[BTAUDIO_RX].dai_id = BTAUDIO_RX,
|
||||
.port_info[BTAUDIO_RX].port = 1,
|
||||
.port_info[2].dai_id = BTAUDIO_RX,
|
||||
.port_info[2].port = 1,
|
||||
|
||||
.port_info[BTAUDIO_RX2].dai_id = BTAUDIO_RX2,
|
||||
.port_info[BTAUDIO_RX2].port = 2,
|
||||
|
||||
.port_info[BTAUDIO_TX2].dai_id = BTAUDIO_TX2,
|
||||
.port_info[BTAUDIO_TX2].port = 5,
|
||||
.port_info[3].dai_id = BTAUDIO_A2DP_SINK_TX,
|
||||
.port_info[3].port = 5,
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2023-2025 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
@@ -33,13 +33,6 @@ enum {
|
||||
QCA_EVROS_SOC_ID_0200 = 0x40200200,
|
||||
};
|
||||
|
||||
enum {
|
||||
QCA_ORNE_SOC_ID_0100 = 0x40262100,
|
||||
};
|
||||
|
||||
enum {
|
||||
QCA_COLOGNE_SOC_ID_0100 = 0x40292100,
|
||||
};
|
||||
|
||||
enum {
|
||||
EVROS_EA = 0x0108170220,
|
||||
|
@@ -34,7 +34,7 @@ def define_sun():
|
||||
"CONFIG_BTFM_CODEC",
|
||||
# "CONFIG_BT_HW_SECURE_DISABLE",
|
||||
"CONFIG_BTFM_SWR",
|
||||
"CONFIG_FMD_ENABLE",
|
||||
#"CONFIG_FMD_ENABLE",
|
||||
]
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user