ASoC: msm: qdsp6v2: move adsp_err to c source file
In preparation to add more debugging hooks to LPASS driver, convert adsp error code and string conversion functions to C source file. CRs-fixed: 968775 Change-Id: Ic074a318ede4188a8fd603efddce71ed820ee560 Signed-off-by: Patrick Lai <plai@codeaurora.org> Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
This commit is contained in:
parent
47c274395a
commit
45f43cddf9
3 changed files with 116 additions and 99 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -14,103 +14,8 @@
|
|||
#ifndef __ADSP_ERR__
|
||||
#define __ADSP_ERR__
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <sound/apr_audio-v2.h>
|
||||
int adsp_err_get_lnx_err_code(u32 adsp_error);
|
||||
|
||||
|
||||
/* ERROR STRING */
|
||||
/* Success. The operation completed with no errors. */
|
||||
#define ADSP_EOK_STR "ADSP_EOK"
|
||||
/* General failure. */
|
||||
#define ADSP_EFAILED_STR "ADSP_EFAILED"
|
||||
/* Bad operation parameter. */
|
||||
#define ADSP_EBADPARAM_STR "ADSP_EBADPARAM"
|
||||
/* Unsupported routine or operation. */
|
||||
#define ADSP_EUNSUPPORTED_STR "ADSP_EUNSUPPORTED"
|
||||
/* Unsupported version. */
|
||||
#define ADSP_EVERSION_STR "ADSP_EVERSION"
|
||||
/* Unexpected problem encountered. */
|
||||
#define ADSP_EUNEXPECTED_STR "ADSP_EUNEXPECTED"
|
||||
/* Unhandled problem occurred. */
|
||||
#define ADSP_EPANIC_STR "ADSP_EPANIC"
|
||||
/* Unable to allocate resource. */
|
||||
#define ADSP_ENORESOURCE_STR "ADSP_ENORESOURCE"
|
||||
/* Invalid handle. */
|
||||
#define ADSP_EHANDLE_STR "ADSP_EHANDLE"
|
||||
/* Operation is already processed. */
|
||||
#define ADSP_EALREADY_STR "ADSP_EALREADY"
|
||||
/* Operation is not ready to be processed. */
|
||||
#define ADSP_ENOTREADY_STR "ADSP_ENOTREADY"
|
||||
/* Operation is pending completion. */
|
||||
#define ADSP_EPENDING_STR "ADSP_EPENDING"
|
||||
/* Operation could not be accepted or processed. */
|
||||
#define ADSP_EBUSY_STR "ADSP_EBUSY"
|
||||
/* Operation aborted due to an error. */
|
||||
#define ADSP_EABORTED_STR "ADSP_EABORTED"
|
||||
/* Operation preempted by a higher priority. */
|
||||
#define ADSP_EPREEMPTED_STR "ADSP_EPREEMPTED"
|
||||
/* Operation requests intervention to complete. */
|
||||
#define ADSP_ECONTINUE_STR "ADSP_ECONTINUE"
|
||||
/* Operation requests immediate intervention to complete. */
|
||||
#define ADSP_EIMMEDIATE_STR "ADSP_EIMMEDIATE"
|
||||
/* Operation is not implemented. */
|
||||
#define ADSP_ENOTIMPL_STR "ADSP_ENOTIMPL"
|
||||
/* Operation needs more data or resources. */
|
||||
#define ADSP_ENEEDMORE_STR "ADSP_ENEEDMORE"
|
||||
/* Operation does not have memory. */
|
||||
#define ADSP_ENOMEMORY_STR "ADSP_ENOMEMORY"
|
||||
/* Item does not exist. */
|
||||
#define ADSP_ENOTEXIST_STR "ADSP_ENOTEXIST"
|
||||
/* Unexpected error code. */
|
||||
#define ADSP_ERR_MAX_STR "ADSP_ERR_MAX"
|
||||
|
||||
|
||||
struct adsp_err_code {
|
||||
int lnx_err_code;
|
||||
char *adsp_err_str;
|
||||
};
|
||||
|
||||
|
||||
static struct adsp_err_code adsp_err_code_info[ADSP_ERR_MAX+1] = {
|
||||
{ 0, ADSP_EOK_STR},
|
||||
{ -ENOTRECOVERABLE, ADSP_EFAILED_STR},
|
||||
{ -EINVAL, ADSP_EBADPARAM_STR},
|
||||
{ -ENOSYS, ADSP_EUNSUPPORTED_STR},
|
||||
{ -ENOPROTOOPT, ADSP_EVERSION_STR},
|
||||
{ -ENOTRECOVERABLE, ADSP_EUNEXPECTED_STR},
|
||||
{ -ENOTRECOVERABLE, ADSP_EPANIC_STR},
|
||||
{ -ENOSPC, ADSP_ENORESOURCE_STR},
|
||||
{ -EBADR, ADSP_EHANDLE_STR},
|
||||
{ -EALREADY, ADSP_EALREADY_STR},
|
||||
{ -EPERM, ADSP_ENOTREADY_STR},
|
||||
{ -EINPROGRESS, ADSP_EPENDING_STR},
|
||||
{ -EBUSY, ADSP_EBUSY_STR},
|
||||
{ -ECANCELED, ADSP_EABORTED_STR},
|
||||
{ -EAGAIN, ADSP_EPREEMPTED_STR},
|
||||
{ -EAGAIN, ADSP_ECONTINUE_STR},
|
||||
{ -EAGAIN, ADSP_EIMMEDIATE_STR},
|
||||
{ -EAGAIN, ADSP_ENOTIMPL_STR},
|
||||
{ -ENODATA, ADSP_ENEEDMORE_STR},
|
||||
{ -EADV, ADSP_ERR_MAX_STR},
|
||||
{ -ENOMEM, ADSP_ENOMEMORY_STR},
|
||||
{ -ENODEV, ADSP_ENOTEXIST_STR},
|
||||
{ -EADV, ADSP_ERR_MAX_STR},
|
||||
};
|
||||
|
||||
static inline int adsp_err_get_lnx_err_code(u32 adsp_error)
|
||||
{
|
||||
if (adsp_error > ADSP_ERR_MAX)
|
||||
return adsp_err_code_info[ADSP_ERR_MAX].lnx_err_code;
|
||||
else
|
||||
return adsp_err_code_info[adsp_error].lnx_err_code;
|
||||
}
|
||||
|
||||
static inline char *adsp_err_get_err_str(u32 adsp_error)
|
||||
{
|
||||
if (adsp_error > ADSP_ERR_MAX)
|
||||
return adsp_err_code_info[ADSP_ERR_MAX].adsp_err_str;
|
||||
else
|
||||
return adsp_err_code_info[adsp_error].adsp_err_str;
|
||||
}
|
||||
char *adsp_err_get_err_str(u32 adsp_error);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,8 @@ snd-soc-qdsp6v2-objs += msm-dai-q6-v2.o msm-pcm-q6-v2.o msm-pcm-routing-v2.o \
|
|||
msm-pcm-voice-v2.o msm-dai-q6-hdmi-v2.o \
|
||||
msm-lsm-client.o msm-pcm-host-voice-v2.o \
|
||||
msm-audio-effects-q6-v2.o msm-pcm-loopback-v2.o \
|
||||
msm-dai-slim.o
|
||||
msm-dai-slim.o \
|
||||
adsp_err.o
|
||||
obj-$(CONFIG_SND_SOC_QDSP6V2) += snd-soc-qdsp6v2.o msm-pcm-dtmf-v2.o \
|
||||
msm-dai-stub-v2.o
|
||||
obj-$(CONFIG_SND_HWDEP) += msm-pcm-routing-devdep.o
|
||||
|
|
111
sound/soc/msm/qdsp6v2/adsp_err.c
Normal file
111
sound/soc/msm/qdsp6v2/adsp_err.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* Copyright (c) 2016, Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <sound/apr_audio-v2.h>
|
||||
|
||||
|
||||
/* ERROR STRING */
|
||||
/* Success. The operation completed with no errors. */
|
||||
#define ADSP_EOK_STR "ADSP_EOK"
|
||||
/* General failure. */
|
||||
#define ADSP_EFAILED_STR "ADSP_EFAILED"
|
||||
/* Bad operation parameter. */
|
||||
#define ADSP_EBADPARAM_STR "ADSP_EBADPARAM"
|
||||
/* Unsupported routine or operation. */
|
||||
#define ADSP_EUNSUPPORTED_STR "ADSP_EUNSUPPORTED"
|
||||
/* Unsupported version. */
|
||||
#define ADSP_EVERSION_STR "ADSP_EVERSION"
|
||||
/* Unexpected problem encountered. */
|
||||
#define ADSP_EUNEXPECTED_STR "ADSP_EUNEXPECTED"
|
||||
/* Unhandled problem occurred. */
|
||||
#define ADSP_EPANIC_STR "ADSP_EPANIC"
|
||||
/* Unable to allocate resource. */
|
||||
#define ADSP_ENORESOURCE_STR "ADSP_ENORESOURCE"
|
||||
/* Invalid handle. */
|
||||
#define ADSP_EHANDLE_STR "ADSP_EHANDLE"
|
||||
/* Operation is already processed. */
|
||||
#define ADSP_EALREADY_STR "ADSP_EALREADY"
|
||||
/* Operation is not ready to be processed. */
|
||||
#define ADSP_ENOTREADY_STR "ADSP_ENOTREADY"
|
||||
/* Operation is pending completion. */
|
||||
#define ADSP_EPENDING_STR "ADSP_EPENDING"
|
||||
/* Operation could not be accepted or processed. */
|
||||
#define ADSP_EBUSY_STR "ADSP_EBUSY"
|
||||
/* Operation aborted due to an error. */
|
||||
#define ADSP_EABORTED_STR "ADSP_EABORTED"
|
||||
/* Operation preempted by a higher priority. */
|
||||
#define ADSP_EPREEMPTED_STR "ADSP_EPREEMPTED"
|
||||
/* Operation requests intervention to complete. */
|
||||
#define ADSP_ECONTINUE_STR "ADSP_ECONTINUE"
|
||||
/* Operation requests immediate intervention to complete. */
|
||||
#define ADSP_EIMMEDIATE_STR "ADSP_EIMMEDIATE"
|
||||
/* Operation is not implemented. */
|
||||
#define ADSP_ENOTIMPL_STR "ADSP_ENOTIMPL"
|
||||
/* Operation needs more data or resources. */
|
||||
#define ADSP_ENEEDMORE_STR "ADSP_ENEEDMORE"
|
||||
/* Operation does not have memory. */
|
||||
#define ADSP_ENOMEMORY_STR "ADSP_ENOMEMORY"
|
||||
/* Item does not exist. */
|
||||
#define ADSP_ENOTEXIST_STR "ADSP_ENOTEXIST"
|
||||
/* Unexpected error code. */
|
||||
#define ADSP_ERR_MAX_STR "ADSP_ERR_MAX"
|
||||
|
||||
|
||||
struct adsp_err_code {
|
||||
int lnx_err_code;
|
||||
char *adsp_err_str;
|
||||
};
|
||||
|
||||
|
||||
static struct adsp_err_code adsp_err_code_info[ADSP_ERR_MAX+1] = {
|
||||
{ 0, ADSP_EOK_STR},
|
||||
{ -ENOTRECOVERABLE, ADSP_EFAILED_STR},
|
||||
{ -EINVAL, ADSP_EBADPARAM_STR},
|
||||
{ -ENOSYS, ADSP_EUNSUPPORTED_STR},
|
||||
{ -ENOPROTOOPT, ADSP_EVERSION_STR},
|
||||
{ -ENOTRECOVERABLE, ADSP_EUNEXPECTED_STR},
|
||||
{ -ENOTRECOVERABLE, ADSP_EPANIC_STR},
|
||||
{ -ENOSPC, ADSP_ENORESOURCE_STR},
|
||||
{ -EBADR, ADSP_EHANDLE_STR},
|
||||
{ -EALREADY, ADSP_EALREADY_STR},
|
||||
{ -EPERM, ADSP_ENOTREADY_STR},
|
||||
{ -EINPROGRESS, ADSP_EPENDING_STR},
|
||||
{ -EBUSY, ADSP_EBUSY_STR},
|
||||
{ -ECANCELED, ADSP_EABORTED_STR},
|
||||
{ -EAGAIN, ADSP_EPREEMPTED_STR},
|
||||
{ -EAGAIN, ADSP_ECONTINUE_STR},
|
||||
{ -EAGAIN, ADSP_EIMMEDIATE_STR},
|
||||
{ -EAGAIN, ADSP_ENOTIMPL_STR},
|
||||
{ -ENODATA, ADSP_ENEEDMORE_STR},
|
||||
{ -EADV, ADSP_ERR_MAX_STR},
|
||||
{ -ENOMEM, ADSP_ENOMEMORY_STR},
|
||||
{ -ENODEV, ADSP_ENOTEXIST_STR},
|
||||
{ -EADV, ADSP_ERR_MAX_STR},
|
||||
};
|
||||
|
||||
int adsp_err_get_lnx_err_code(u32 adsp_error)
|
||||
{
|
||||
if (adsp_error > ADSP_ERR_MAX)
|
||||
return adsp_err_code_info[ADSP_ERR_MAX].lnx_err_code;
|
||||
else
|
||||
return adsp_err_code_info[adsp_error].lnx_err_code;
|
||||
}
|
||||
|
||||
char *adsp_err_get_err_str(u32 adsp_error)
|
||||
{
|
||||
if (adsp_error > ADSP_ERR_MAX)
|
||||
return adsp_err_code_info[ADSP_ERR_MAX].adsp_err_str;
|
||||
else
|
||||
return adsp_err_code_info[adsp_error].adsp_err_str;
|
||||
}
|
Loading…
Add table
Reference in a new issue