mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
fs1815:correct rotation code
use fs1815 algo to switch output left/right channel according to rotation states. correct fs1815 rotation code. Change-Id: I90971371ab5645ab346e8aa16b42f2bd43804106 Signed-off-by: liaohj <liaohj@lenovo.com> Reviewed-on: https://gerrit.mot.com/2716100 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jiefeng Ou <oujf@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
0fe0a0e889
commit
1a5de603e9
2 changed files with 17 additions and 32 deletions
|
|
@ -15,7 +15,6 @@ static int g_dev_inited = 0;
|
|||
static atomic_t fsm_amp_switch;
|
||||
static atomic_t fsm_adsp_enable;
|
||||
|
||||
|
||||
//include "q6fsm-v3.h"
|
||||
extern int q6fsm_set_rotation(int angle);
|
||||
extern int q6fsm_set_rx_enable(int enable);
|
||||
|
|
@ -1645,6 +1644,10 @@ int fsm_rotation_put(struct snd_kcontrol *kcontrol,
|
|||
}
|
||||
|
||||
pr_info("angle: %d", angle);
|
||||
|
||||
if(cfg->next_angle == angle)
|
||||
return 0;
|
||||
|
||||
if(q6fsm_set_rotation(angle) == 0){
|
||||
cfg->next_angle = angle;
|
||||
}
|
||||
|
|
@ -1735,11 +1738,11 @@ void fsm_speaker_onn(void)
|
|||
cfg->cur_angle = cfg->next_angle;
|
||||
cfg->speaker_on = true;
|
||||
|
||||
if(fsm_check_scene_status() == 0) {
|
||||
q6fsm_fsm_check_scene_status(true);
|
||||
} else {
|
||||
q6fsm_fsm_check_scene_status(false);
|
||||
}
|
||||
if(fsm_check_scene_status() == 0) {
|
||||
q6fsm_fsm_check_scene_status(true);
|
||||
} else {
|
||||
q6fsm_fsm_check_scene_status(false);
|
||||
}
|
||||
|
||||
pr_debug("done");
|
||||
fsm_mutex_unlock();
|
||||
|
|
@ -1763,6 +1766,8 @@ void fsm_speaker_off(void)
|
|||
}
|
||||
fsm_list_func(fsm_dev, fsm_stub_shut_down);
|
||||
cfg->speaker_on = false;
|
||||
cfg->next_angle = 0;
|
||||
atomic_set(&fsm_adsp_enable, 0);
|
||||
q6fsm_fsm_check_scene_status(false);
|
||||
fsm_mutex_unlock();
|
||||
fsm_set_scene(0); // scene music
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ struct q6fsm_afe {
|
|||
bool monitor_en;
|
||||
int bsg_version;
|
||||
struct bsg_config_v2 config;
|
||||
int angle;
|
||||
};
|
||||
|
||||
typedef enum _fs__chann_t
|
||||
|
|
@ -260,7 +259,7 @@ static int q6fsm_afe_get_params(struct param_hdr_v3 *param_hdr,
|
|||
bool q6fsm_get_rx_status(void)
|
||||
{
|
||||
struct param_hdr_v3 param_hdr;
|
||||
int enable;
|
||||
uint32_t enable;
|
||||
int ret;
|
||||
|
||||
if (!q6fsm_check_dsp_ready()) {
|
||||
|
|
@ -287,13 +286,10 @@ EXPORT_SYMBOL(q6fsm_get_rx_status);
|
|||
|
||||
int q6fsm_set_rx_enable(int enable)
|
||||
{
|
||||
struct q6fsm_afe *q6fsm = g_fsm_afe;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
uint32_t param;
|
||||
int ret;
|
||||
|
||||
if (q6fsm == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if (!q6fsm_check_dsp_ready()) {
|
||||
fsm_info("DSP not ready yet!");
|
||||
|
|
@ -305,7 +301,7 @@ int q6fsm_set_rx_enable(int enable)
|
|||
param_hdr.instance_id = 0;
|
||||
param_hdr.reserved = 0;
|
||||
param_hdr.param_id = CAPI_V2_PARAM_FSADSP_RX_ENABLE;
|
||||
param_hdr.param_size = sizeof(int);
|
||||
param_hdr.param_size = sizeof(param);
|
||||
ret = q6fsm_afe_set_params(¶m_hdr,
|
||||
(uint8_t *)¶m, sizeof(param));
|
||||
if (ret) {
|
||||
|
|
@ -319,28 +315,22 @@ EXPORT_SYMBOL(q6fsm_set_rx_enable);
|
|||
|
||||
int q6fsm_set_rotation(int angle)
|
||||
{
|
||||
struct q6fsm_afe *q6fsm = g_fsm_afe;
|
||||
struct param_hdr_v3 param_hdr;
|
||||
fsm_rotation_info_t param = {0};
|
||||
int ret;
|
||||
|
||||
if (q6fsm == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if (!q6fsm_get_rx_status()) {
|
||||
fsm_info("RX module isn't ready");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if(q6fsm->angle == angle){
|
||||
fsm_info("no need to rotation angle");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(angle == 0){
|
||||
param.angle = 0;
|
||||
param.ch_sequence[0] = 0;
|
||||
param.ch_sequence[1] = 1;
|
||||
}else if(angle == 1){
|
||||
param.angle = 180;
|
||||
param.ch_sequence[0] = 1;
|
||||
param.ch_sequence[1] = 0;
|
||||
}else{
|
||||
|
|
@ -348,14 +338,13 @@ int q6fsm_set_rotation(int angle)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
param.angle = angle;
|
||||
param_hdr.module_id = AFE_MODULE_ID_FSADSP_RX;
|
||||
param_hdr.instance_id = 0;
|
||||
param_hdr.reserved = 0;
|
||||
param_hdr.param_id = CAPI_V2_PARAM_FSADSP_ROTATION;
|
||||
param_hdr.param_size = sizeof(int);
|
||||
param_hdr.param_size = sizeof(fsm_rotation_info_t);
|
||||
ret = q6fsm_afe_set_params(¶m_hdr,
|
||||
(uint8_t *)¶m, sizeof(param));
|
||||
(uint8_t *)¶m, sizeof(fsm_rotation_info_t));
|
||||
if (ret) {
|
||||
fsm_err("Set params fail:%d", ret);
|
||||
return ret;
|
||||
|
|
@ -365,15 +354,6 @@ int q6fsm_set_rotation(int angle)
|
|||
}
|
||||
EXPORT_SYMBOL(q6fsm_set_rotation);
|
||||
|
||||
int q6fsm_get_rotation(int *angle)
|
||||
{
|
||||
struct q6fsm_afe *q6fsm = g_fsm_afe;
|
||||
|
||||
*angle = q6fsm->angle;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(q6fsm_get_rotation);
|
||||
|
||||
void q6fsm_fsm_check_scene_status(bool status)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue