Revert "Merge "dsp: codecs: Synchronize the audio_aio_open and SSR event""

This reverts commit ed43bdaa54
reversing changes made to 53feb46e27.

Change-Id: Ic9fdc04d08c9bfd4b0be2f29c315e1602375bddd
Signed-off-by: Harshal Ahire <hahire@codeaurora.org>
This commit is contained in:
Harshal Ahire 2021-01-20 17:50:21 +05:30 • committed by Gerrit - the friendly Code Review server
commit d914a0bc22
14 changed files with 34 additions and 122 deletions

View file

@ -355,24 +355,20 @@ static int audio_open(struct inode *inode, struct file *file)
struct q6audio_aio *audio = NULL;
int rc = 0;
struct msm_audio_aac_config *aac_config = NULL;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_aac_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_aac_config),
GFP_KERNEL);
if (audio->codec_cfg == NULL) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
aac_config = audio->codec_cfg;
@ -393,17 +389,14 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -259,22 +259,18 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_alac_" + 5];
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (!audio) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (!audio)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_alac_config),
GFP_KERNEL);
if (!audio->codec_cfg) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -290,17 +286,14 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -3,7 +3,7 @@
*
* Copyright (C) 2008 Google, Inc.
* Copyright (C) 2008 HTC Corporation
* Copyright (c) 2011-2017, 2019-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2017, 2019, 2021 The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -122,18 +122,15 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_amrnb_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->pcm_cfg.buffer_size = PCM_BUFSZ_MIN;
audio->miscdevice = &audio_amrnb_misc;
@ -146,17 +143,14 @@ static int audio_open(struct inode *inode, struct file *file)
if (!audio->ac) {
pr_err("Could not allocate memory for audio client\n");
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -115,18 +115,16 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_amrwb_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->pcm_cfg.buffer_size = PCM_BUFSZ_MIN;
audio->miscdevice = &audio_amrwb_misc;
audio->wakelock_voted = false;
@ -138,17 +136,15 @@ static int audio_open(struct inode *inode, struct file *file)
if (!audio->ac) {
pr_err("Could not allocate memory for audio client\n");
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -295,21 +295,16 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->codec_cfg =
kzalloc(sizeof(struct msm_audio_amrwbplus_config_v2), GFP_KERNEL);
if (audio->codec_cfg == NULL) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
audio->pcm_cfg.buffer_size = PCM_BUFSZ_MIN;
@ -324,17 +319,15 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -240,22 +240,18 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_ape_" + 5];
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (!audio) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (!audio)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_ape_config),
GFP_KERNEL);
if (!audio->codec_cfg) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -271,17 +267,14 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -76,19 +76,16 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_evrc_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
/* Settings will be re-config at AUDIO_SET_CONFIG,
* but at least we need to have initial config
*/
@ -103,17 +100,15 @@ static int audio_open(struct inode *inode, struct file *file)
if (!audio->ac) {
pr_err("Could not allocate memory for audio client\n");
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -214,22 +214,17 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_g711_" + 5];
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (!audio) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (!audio)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_g711_dec_config),
GFP_KERNEL);
if (!audio->codec_cfg) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -248,17 +243,14 @@ static int audio_open(struct inode *inode, struct file *file)
__func__);
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */ /*foramt:G711_ALAW*/
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -212,22 +212,17 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_g711_" + 5];
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (!audio) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (!audio)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_g711_dec_config),
GFP_KERNEL);
if (!audio->codec_cfg) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -246,17 +241,14 @@ static int audio_open(struct inode *inode, struct file *file)
__func__);
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */ /*foramt:G711_ALAW*/
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -81,19 +81,16 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_mp3_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->pcm_cfg.buffer_size = PCM_BUFSZ_MIN;
audio->miscdevice = &audio_mp3_misc;
audio->wakelock_voted = false;
@ -105,17 +102,15 @@ static int audio_open(struct inode *inode, struct file *file)
if (!audio->ac) {
pr_err("Could not allocate memory for audio client\n");
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -411,24 +411,20 @@ static int audio_open(struct inode *inode, struct file *file)
struct q6audio_aio *audio = NULL;
int rc = 0;
struct msm_audio_aac_config *aac_config = NULL;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_multi_aac_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_aac_config),
GFP_KERNEL);
if (audio->codec_cfg == NULL) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -447,17 +443,14 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {

View file

@ -78,18 +78,15 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_qcelp_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
/* Settings will be re-config at AUDIO_SET_CONFIG,
* but at least we need to have initial config
@ -110,17 +107,15 @@ static int audio_open(struct inode *inode, struct file *file)
if (!audio->ac) {
pr_err("Could not allocate memory for audio client\n");
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -230,23 +230,20 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_wma_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_wma_config_v2),
GFP_KERNEL);
if (audio->codec_cfg == NULL) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -262,17 +259,14 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
rc = audio_aio_open(audio, file);
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,

View file

@ -302,23 +302,20 @@ static int audio_open(struct inode *inode, struct file *file)
{
struct q6audio_aio *audio = NULL;
int rc = 0;
unsigned long flags = 0;
#ifdef CONFIG_DEBUG_FS
/* 4 bytes represents decoder number, 1 byte for terminate string */
char name[sizeof "msm_wmapro_" + 5];
#endif
spin_lock_irqsave(&enc_dec_lock, flags);
audio = kzalloc(sizeof(struct q6audio_aio), GFP_KERNEL);
if (audio == NULL) {
spin_unlock_irqrestore(&enc_dec_lock, flags);
if (audio == NULL)
return -ENOMEM;
}
audio->codec_cfg = kzalloc(sizeof(struct msm_audio_wmapro_config),
GFP_KERNEL);
if (audio->codec_cfg == NULL) {
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -335,7 +332,6 @@ static int audio_open(struct inode *inode, struct file *file)
pr_err("Could not allocate memory for audio client\n");
kfree(audio->codec_cfg);
kfree(audio);
spin_unlock_irqrestore(&enc_dec_lock, flags);
return -ENOMEM;
}
@ -343,10 +339,8 @@ static int audio_open(struct inode *inode, struct file *file)
if (rc < 0) {
pr_err_ratelimited("%s: audio_aio_open rc=%d\n",
__func__, rc);
spin_unlock_irqrestore(&enc_dec_lock, flags);
goto fail;
}
spin_unlock_irqrestore(&enc_dec_lock, flags);
/* open in T/NT mode */
if ((file->f_mode & FMODE_WRITE) && (file->f_mode & FMODE_READ)) {
rc = q6asm_open_read_write(audio->ac, FORMAT_LINEAR_PCM,