diff --git a/include/audio/audio_dsp_if.h b/include/audio/audio_dsp_if.h index ae72f096bf03e26d215e471fec74174db336a359..31d42a88e88890a3428a642d962fe0984959cbd8 100755 --- a/include/audio/audio_dsp_if.h +++ b/include/audio/audio_dsp_if.h @@ -39,8 +39,8 @@ struct DspData { const char *drvDspName; /* dsp driver callbacks */ int32_t (*DspInit)(const struct DspDevice *device); - int32_t (*Read)(struct DspDevice *, uint8_t *, uint32_t); - int32_t (*Write)(struct DspDevice *, uint8_t *, uint32_t); + int32_t (*Read)(const struct DspDevice *, uint8_t *, uint32_t); + int32_t (*Write)(const struct DspDevice *, uint8_t *, uint32_t); int32_t (*decode)(const struct AudioCard *, const uint8_t *, const struct DspDevice *); int32_t (*encode)(const struct AudioCard *, const uint8_t *, const struct DspDevice *); int32_t (*Equalizer)(const struct AudioCard *, const uint8_t *, const struct DspDevice *); diff --git a/include/audio/audio_platform_if.h b/include/audio/audio_platform_if.h index 6ac044d686358c1458b922746264d98908d2753b..c2cc766b839dbbe38d708e6049706371cd5ac015 100755 --- a/include/audio/audio_platform_if.h +++ b/include/audio/audio_platform_if.h @@ -84,8 +84,8 @@ struct AudioPlatformOps { uint32_t (*Pointer)(struct AudioCard *); int32_t (*Write)(const struct AudioCard *, struct AudioTxData *); int32_t (*Read)(const struct AudioCard *, struct AudioRxData *); - int32_t (*MmapWrite)(const struct AudioCard *, struct AudioTxMmapData *); - int32_t (*MmapRead)(const struct AudioCard *, struct AudioRxMmapData *); + int32_t (*MmapWrite)(const struct AudioCard *, const struct AudioTxMmapData *); + int32_t (*MmapRead)(const struct AudioCard *, const struct AudioRxMmapData *); int32_t (*RenderPrepare)(const struct AudioCard *); int32_t (*CapturePrepare)(const struct AudioCard *); int32_t (*RenderStart)(struct AudioCard *); diff --git a/model/audio/common/src/audio_platform_base.c b/model/audio/common/src/audio_platform_base.c index 29337f0e476b210301bf8493045be98d9c01256b..3f6747519579c1ef6ebfc3c4b1d4945d5568d813 100755 --- a/model/audio/common/src/audio_platform_base.c +++ b/model/audio/common/src/audio_platform_base.c @@ -10,7 +10,6 @@ #include "audio_core.h" #define HDF_LOG_TAG audio_platform_base - struct PlatformData *PlatformDataFromDevice(const struct AudioCard *card) { if (card == NULL || card->rtd == NULL || card->rtd->platform == NULL) { @@ -41,34 +40,40 @@ int32_t PlatformCreatePlatformHost(const struct AudioCard *card, struct Platform int32_t AudioDataBigEndianChange(char *srcData, uint32_t audioLen, enum DataBitWidth bitWidth) { - uint64_t i; - uint16_t framesize; - char temp; if (srcData == NULL) { AUDIO_DRIVER_LOG_ERR("srcData is NULL."); return HDF_FAILURE; } + uint64_t i; + uint16_t framesize; + char *changeData = srcData; + uint32_t *pData = (uint32_t *)changeData; switch (bitWidth) { case DATA_BIT_WIDTH8: - framesize = 1; /* 1 byte */ - break; - case DATA_BIT_WIDTH16: - framesize = 2; /* 2 bytes */ - break; + return HDF_SUCCESS; case DATA_BIT_WIDTH24: - framesize = 3; /* 3 bytes */ + framesize = 3; /* 3 byte , convert step is 3 byte */ + for (i = 0; i < audioLen; i += framesize) { + // swap the first and the third byte, second and fourth unchanged + *pData = ((((*pData) >> 0x10) & 0x000000FF) | + ((*pData) & 0xFF00FF00) | + (((*pData) << 0x10) & 0x00FF0000)); + changeData += framesize; + pData = (uint32_t *)changeData; + } break; + case DATA_BIT_WIDTH16: default: - framesize = 2; /* default 2 bytes */ + framesize = 4; /* 2 byte, convert step is 4 byte */ + for (i = 0; i < audioLen; i += framesize) { + // swap the first and second byte, swap the third and fourth byte + *pData = ((((*pData) << 0x08) & 0xFF00FF00) | + (((*pData) >> 0x08) & 0x00FF00FF)); + pData++; + } break; } - - for (i = 0; i < audioLen; i += framesize) { - temp = srcData[i]; - srcData[i] = srcData[i + framesize - 1]; - srcData[i + framesize - 1] = temp; - } AUDIO_DRIVER_LOG_DEBUG("audioLen = %d\n", audioLen); return HDF_SUCCESS; } diff --git a/model/audio/core/include/audio_control.h b/model/audio/core/include/audio_control.h index cc674f739729ae8c27eecf8607fb9161d1755f2c..76ec94c6aca6bd558f1abf6b50ceb94bbb939ca4 100755 --- a/model/audio/core/include/audio_control.h +++ b/model/audio/core/include/audio_control.h @@ -11,7 +11,6 @@ #include "hdf_dlist.h" - #ifdef __cplusplus #if __cplusplus extern "C" { diff --git a/model/audio/core/include/audio_core.h b/model/audio/core/include/audio_core.h index 6235bbb7a169698ac3bba7f587ffa5dc3918e106..32a2f860c47c93070e8dc952ddf5c2456deb9650 100755 --- a/model/audio/core/include/audio_core.h +++ b/model/audio/core/include/audio_core.h @@ -29,6 +29,15 @@ extern "C" { #define AUDIO_DAI_LINK_COMPLETE 1 #define AUDIO_DAI_LINK_UNCOMPLETE 0 +#ifdef __LITEOS__ +#define AUDIO_DRIVER_LOG_DEBUG(fmt, arg...) do { \ + } while (0) +#else +#define AUDIO_DRIVER_LOG_DEBUG(fmt, arg...) do { \ + HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ + } while (0) +#endif + #define AUDIO_DRIVER_LOG_ERR(fmt, arg...) do { \ HDF_LOGE("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ } while (0) @@ -41,10 +50,6 @@ extern "C" { HDF_LOGW("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ } while (0) -#define AUDIO_DRIVER_LOG_DEBUG(fmt, arg...) do { \ - HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ - } while (0) - enum AudioDeviceType { AUDIO_DAI_DEVICE, AUDIO_DSP_DEVICE, @@ -88,7 +93,7 @@ int32_t AudioCodecWriteReg(const struct CodecDevice *codec, uint32_t reg, uint32 int32_t AudioAccessoryReadReg(const struct AccessoryDevice *accessory, uint32_t reg, uint32_t *val); int32_t AudioAccessoryWriteReg(const struct AccessoryDevice *accessory, uint32_t reg, uint32_t val); int32_t AudioCodecAiaoReadReg(const struct CodecDevice *codec, uint32_t reg, uint32_t *val); -int32_t AudioCodecAiaoWriteReg(struct CodecDevice *codec, uint32_t reg, uint32_t val); +int32_t AudioCodecAiaoWriteReg(const struct CodecDevice *codec, uint32_t reg, uint32_t val); int32_t AudioAccessoryAiaoReadReg(const struct AccessoryDevice *accessory, uint32_t reg, uint32_t *val); int32_t AudioAccessoryAiaoWriteReg(const struct AccessoryDevice *accessory, uint32_t reg, uint32_t val); diff --git a/model/audio/core/include/audio_host.h b/model/audio/core/include/audio_host.h index afc51ac34af535b9f5d74fa5d9a2dfc5ac63c1f3..e49c6b0e5770285e9085915c69d2280e0131c429 100755 --- a/model/audio/core/include/audio_host.h +++ b/model/audio/core/include/audio_host.h @@ -24,6 +24,15 @@ extern "C" { #endif #endif /* __cplusplus */ +#ifdef __LITEOS__ +#define ADM_LOG_DEBUG(fmt, arg...) do { \ + } while (0) +#else +#define ADM_LOG_DEBUG(fmt, arg...) do { \ + HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ + } while (0) +#endif + #define ADM_LOG_ERR(fmt, arg...) do { \ HDF_LOGE("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ } while (0) @@ -36,10 +45,6 @@ extern "C" { HDF_LOGW("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ } while (0) -#define ADM_LOG_DEBUG(fmt, arg...) do { \ - HDF_LOGD("[%s][line:%d]: " fmt, __func__, __LINE__, ##arg); \ - } while (0) - #define BUFF_SIZE_MAX 64 #define AUDIO_LIST_HEAD_INIT(name) { &(name), &(name) } @@ -47,6 +52,22 @@ extern "C" { #define AUDIO_LIST_HEAD(name) \ struct DListHead name = AUDIO_LIST_HEAD_INIT(name) +enum AudioFormat { + AUDIO_FORMAT_PCM_8_BIT = 0x1u, /**< audio 8-bit PCM */ + AUDIO_FORMAT_PCM_16_BIT = 0x2u, /**< audio16-bit PCM */ + AUDIO_FORMAT_PCM_24_BIT = 0x3u, /**< audio 24-bit PCM */ + AUDIO_FORMAT_PCM_32_BIT = 0x4u, /**< audio 32-bit PCM */ + AUDIO_FORMAT_AAC_MAIN = 0x1000001u, /**< audio AAC main */ + AUDIO_FORMAT_AAC_LC = 0x1000002u, /**< audio AAC LC */ + AUDIO_FORMAT_AAC_LD = 0x1000003u, /**< audio AAC LD */ + AUDIO_FORMAT_AAC_ELD = 0x1000004u, /**< audio AAC ELD */ + AUDIO_FORMAT_AAC_HE_V1 = 0x1000005u, /**< audio AAC HE_V1 */ + AUDIO_FORMAT_AAC_HE_V2 = 0x1000006u, /**< audio AAC HE_V2 */ + AUDIO_FORMAT_G711A = 0x2000001u, /**< audio G711A */ + AUDIO_FORMAT_G711U = 0x2000002u, /**< audio G711u */ + AUDIO_FORMAT_G726 = 0x2000003u, /**< audio G726 */ +}; + struct AudioConfigData { const char *cardServiceName; const char *codecName; @@ -59,22 +80,6 @@ struct AudioConfigData { const char *dspDaiName; }; -enum AudioFormat { - AUDIO_FORMAT_PCM_8_BIT = 0x1u, /**< 8-bit PCM */ - AUDIO_FORMAT_PCM_16_BIT = 0x2u, /**< 16-bit PCM */ - AUDIO_FORMAT_PCM_24_BIT = 0x3u, /**< 24-bit PCM */ - AUDIO_FORMAT_PCM_32_BIT = 0x4u, /**< 32-bit PCM */ - AUDIO_FORMAT_AAC_MAIN = 0x1000001u, /**< AAC main */ - AUDIO_FORMAT_AAC_LC = 0x1000002u, /**< AAC LC */ - AUDIO_FORMAT_AAC_LD = 0x1000003u, /**< AAC LD */ - AUDIO_FORMAT_AAC_ELD = 0x1000004u, /**< AAC ELD */ - AUDIO_FORMAT_AAC_HE_V1 = 0x1000005u, /**< AAC HE_V1 */ - AUDIO_FORMAT_AAC_HE_V2 = 0x1000006u, /**< AAC HE_V2 */ - AUDIO_FORMAT_G711A = 0x2000001u, /**< G711A */ - AUDIO_FORMAT_G711U = 0x2000002u, /**< G711u */ - AUDIO_FORMAT_G726 = 0x2000003u, /**< G726 */ -}; - struct AudioCard { struct AudioRuntimeDeivces *rtd; struct AudioConfigData configData; diff --git a/model/audio/core/src/audio_core.c b/model/audio/core/src/audio_core.c index fb3581ed4ec55c6215e50a6c6763301d69f25085..a3a546d9b8e7356addfea0b0f2f0f842b1314f7b 100755 --- a/model/audio/core/src/audio_core.c +++ b/model/audio/core/src/audio_core.c @@ -698,7 +698,7 @@ int32_t AudioAccessoryWriteReg(const struct AccessoryDevice *accessory, uint32_t return HDF_SUCCESS; } -int32_t AudioCodecAiaoWriteReg(struct CodecDevice *codec, uint32_t reg, uint32_t val) +int32_t AudioCodecAiaoWriteReg(const struct CodecDevice *codec, uint32_t reg, uint32_t val) { int32_t ret; if (codec == NULL || codec->devData == NULL || codec->devData->AiaoWrite == NULL) { diff --git a/model/audio/core/src/audio_host.c b/model/audio/core/src/audio_host.c index 61c2434c3cbd7a8619258f2004fb3a340371e5ba..e5a74f2a533b5a26e232533bff427a74e3689f13 100755 --- a/model/audio/core/src/audio_host.c +++ b/model/audio/core/src/audio_host.c @@ -256,7 +256,7 @@ static int32_t AudioDspDaiDevInit(const struct AudioCard *audioCard) { struct AudioRuntimeDeivces *rtd = NULL; struct DaiDevice *dspDai = NULL; - int ret; + int ret = HDF_SUCCESS; if (audioCard == NULL) { ADM_LOG_ERR("audioCard is NULL."); diff --git a/model/audio/dispatch/src/audio_stream_dispatch.c b/model/audio/dispatch/src/audio_stream_dispatch.c index 70e26609a2d607fd7bac995cefe7010d6b6830ef..0bb697ed63469f763b45700488164273b05702bf 100755 --- a/model/audio/dispatch/src/audio_stream_dispatch.c +++ b/model/audio/dispatch/src/audio_stream_dispatch.c @@ -208,7 +208,7 @@ int32_t StreamHostHwParams(const struct HdfDeviceIoClient *client, struct HdfSBu struct StreamHost *streamHost = NULL; struct AudioCard *audioCard = NULL; char *cardName = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if ((client == NULL || client->device == NULL) || (data == NULL)) { @@ -295,7 +295,7 @@ int32_t StreamHostCapturePrepare(const struct HdfDeviceIoClient *client, struct struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -336,7 +336,7 @@ int32_t StreamHostRenderPrepare(const struct HdfDeviceIoClient *client, struct H struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -374,7 +374,7 @@ int32_t StreamHostRenderPrepare(const struct HdfDeviceIoClient *client, struct H static int32_t StreamTransferWrite(const struct AudioCard *audioCard, struct AudioTxData *transfer) { struct PlatformDevice *platform = NULL; - int32_t ret; + int32_t ret = HDF_SUCCESS; if (audioCard == NULL || audioCard->rtd == NULL || transfer == NULL) { ADM_LOG_ERR("input param is NULL."); @@ -400,7 +400,7 @@ static int32_t StreamTransferWrite(const struct AudioCard *audioCard, struct Aud static int32_t StreamTransferMmapWrite(const struct AudioCard *audioCard, struct AudioTxMmapData *txMmapData) { struct PlatformDevice *platform = NULL; - int32_t ret; + int32_t ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (audioCard == NULL || audioCard->rtd == NULL || txMmapData == NULL) { @@ -428,7 +428,7 @@ static int32_t StreamTransferMmapWrite(const struct AudioCard *audioCard, struct static int32_t StreamTransferMmapRead(const struct AudioCard *audioCard, struct AudioRxMmapData *rxMmapData) { struct PlatformDevice *platform = NULL; - int32_t ret; + int32_t ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (audioCard == NULL || audioCard->rtd == NULL || rxMmapData == NULL) { @@ -457,7 +457,7 @@ int32_t StreamHostWrite(const struct HdfDeviceIoClient *client, struct HdfSBuf * { struct AudioTxData transfer; struct AudioCard *audioCard = NULL; - int32_t ret; + int32_t ret = HDF_SUCCESS; uint32_t dataSize = 0; ADM_LOG_DEBUG("entry."); @@ -501,7 +501,7 @@ int32_t StreamHostRead(const struct HdfDeviceIoClient *client, struct HdfSBuf *d struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; struct AudioRxData rxData; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL || reply == NULL) { @@ -696,7 +696,7 @@ int32_t StreamHostRenderStart(const struct HdfDeviceIoClient *client, struct Hdf struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -736,7 +736,7 @@ int32_t StreamHostCaptureStart(const struct HdfDeviceIoClient *client, struct Hd struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -777,7 +777,7 @@ int32_t StreamHostRenderStop(const struct HdfDeviceIoClient *client, struct HdfS struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -817,7 +817,7 @@ int32_t StreamHostCaptureStop(const struct HdfDeviceIoClient *client, struct Hdf struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -857,7 +857,7 @@ int32_t StreamHostRenderPause(const struct HdfDeviceIoClient *client, struct Hdf struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -898,7 +898,7 @@ int32_t StreamHostCapturePause(const struct HdfDeviceIoClient *client, struct Hd struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -939,7 +939,7 @@ int32_t StreamHostRenderResume(const struct HdfDeviceIoClient *client, struct Hd struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -980,7 +980,7 @@ int32_t StreamHostCaptureResume(const struct HdfDeviceIoClient *client, struct H struct AudioRuntimeDeivces *rtd = NULL; struct PlatformDevice *platform = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("entry."); if (client == NULL) { @@ -1021,7 +1021,7 @@ int32_t StreamHostDspDecode(const struct HdfDeviceIoClient *client, struct HdfSB struct AudioRuntimeDeivces *rtd = NULL; struct DspDevice *dspDev = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("Dsp Decode Entry."); if (client == NULL) { @@ -1060,7 +1060,7 @@ int32_t StreamHostDspEncode(const struct HdfDeviceIoClient *client, struct HdfSB struct AudioRuntimeDeivces *rtd = NULL; struct DspDevice *dspDev = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("Dsp Encode Entry."); if (client == NULL) { @@ -1099,7 +1099,7 @@ int32_t StreamHostDspEqualizer(const struct HdfDeviceIoClient *client, struct Hd struct AudioRuntimeDeivces *rtd = NULL; struct DspDevice *dspDev = NULL; struct AudioCard *audioCard = NULL; - int ret; + int ret = HDF_SUCCESS; ADM_LOG_DEBUG("Dsp Equalizer Entry."); if (client == NULL) { @@ -1158,7 +1158,7 @@ static struct StreamDispCmdHandleList g_streamDispCmdHandle[] = { int32_t StreamDispatch(struct HdfDeviceIoClient *client, int cmdId, struct HdfSBuf *data, struct HdfSBuf *reply) { - unsigned int i; + unsigned int i = 0; if ((client == NULL) || (data == NULL) || (reply == NULL)) { return HDF_ERR_INVALID_PARAM; diff --git a/model/audio/sapm/src/audio_sapm.c b/model/audio/sapm/src/audio_sapm.c index b3d60c0176ecbe15b578b331e1d0416eac428b77..e5791e71ddd1a5ff31021577894d7c8c62c07842 100755 --- a/model/audio/sapm/src/audio_sapm.c +++ b/model/audio/sapm/src/audio_sapm.c @@ -383,8 +383,9 @@ static void MuxValueSetPathStatus(const struct AudioSapmComponent *sapmComponent val = val >> shift; for (item = 0; item < enumKtl->max; item++) { - if (val == enumKtl->values[item]) + if (val == enumKtl->values[item]) { break; + } } path->connect = UNCONNECT_SINK_AND_SOURCE; @@ -475,7 +476,7 @@ static int32_t AudioSapmConnectMixer(struct AudioCard *audioCard, struct AudioSapmComponent *source, struct AudioSapmComponent *sink, struct AudioSapmpath *path, const char *controlName) { - int i; + int i = 0; if ((audioCard == NULL) || (source == NULL) || (sink == NULL) || (path == NULL) || (controlName == NULL)) { @@ -579,13 +580,15 @@ static void AudioSampExtComponentsCheck(struct AudioSapmComponent *cptSource, st /* check for external components */ if (cptSink->sapmType == AUDIO_SAPM_INPUT) { if (cptSource->sapmType == AUDIO_SAPM_MICBIAS || cptSource->sapmType == AUDIO_SAPM_MIC || - cptSource->sapmType == AUDIO_SAPM_LINE || cptSource->sapmType == AUDIO_SAPM_OUTPUT) + cptSource->sapmType == AUDIO_SAPM_LINE || cptSource->sapmType == AUDIO_SAPM_OUTPUT) { cptSink->external = EXIST_EXTERNAL_WIDGET; + } } if (cptSource->sapmType == AUDIO_SAPM_OUTPUT) { if (cptSink->sapmType == AUDIO_SAPM_SPK || cptSink->sapmType == AUDIO_SAPM_HP || - cptSink->sapmType == AUDIO_SAPM_LINE || cptSink->sapmType == AUDIO_SAPM_INPUT) + cptSink->sapmType == AUDIO_SAPM_LINE || cptSink->sapmType == AUDIO_SAPM_INPUT) { cptSource->external = EXIST_EXTERNAL_WIDGET; + } } return; @@ -953,7 +956,7 @@ int32_t AudioSapmSleep(const struct AudioCard *audioCard) int32_t AudioSapmNewControls(struct AudioCard *audioCard) { struct AudioSapmComponent *sapmComponent = NULL; - int ret; + int ret = HDF_SUCCESS; if (audioCard == NULL) { ADM_LOG_ERR("input param audioCard is NULL."); @@ -983,7 +986,7 @@ int32_t AudioSapmNewControls(struct AudioCard *audioCard) case AUDIO_SAPM_MUX: case AUDIO_SAPM_VIRT_MUX: case AUDIO_SAPM_VALUE_MUX: - ret =AudioSapmNewMuxControls(sapmComponent, audioCard); + ret = AudioSapmNewMuxControls(sapmComponent, audioCard); break; default: ret = HDF_SUCCESS; @@ -1013,7 +1016,7 @@ static int32_t MixerUpdatePowerStatus(const struct AudioKcontrol *kcontrol, uint { struct AudioCard *audioCard = NULL; struct AudioSapmpath *path = NULL; - int ret; + int ret = HDF_SUCCESS; if (kcontrol == NULL || kcontrol->pri == NULL) { ADM_LOG_ERR("input param kcontrol is NULL."); @@ -1127,6 +1130,7 @@ int32_t AudioCodecSapmSetCtrlOps(const struct AudioKcontrol *kcontrol, const str ADM_LOG_ERR("update power status is failure!"); return HDF_FAILURE; } + curValue &= mixerCtrl->mask << mixerCtrl->shift; value = (value & mixerCtrl->mask) << mixerCtrl->shift; if (curValue != value) {