mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-07-21 03:35:25 -04:00
@@ -52,7 +52,7 @@ struct CodecData {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*Init)(struct AudioCard *audioCard, struct CodecDevice *codec);
|
||||
int32_t (*Init)(struct AudioCard *audioCard, const struct CodecDevice *codec);
|
||||
|
||||
/**
|
||||
* @brief Defines Codec device reg read.
|
||||
|
||||
@@ -120,7 +120,7 @@ struct DspData {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*Read)(const struct DspDevice *dsp, void *msgs, uint32_t len);
|
||||
int32_t (*Read)(const struct DspDevice *dsp, const void *msgs, const uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief Defines Dsp device msgs write.
|
||||
@@ -134,7 +134,7 @@ struct DspData {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*Write)(const struct DspDevice *dsp, void *msgs, uint32_t len);
|
||||
int32_t (*Write)(const struct DspDevice *dsp, const void *msgs, const uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief Defines Dsp device decode.
|
||||
|
||||
@@ -68,7 +68,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaBufAlloc)(struct PlatformData *platformData, enum AudioStreamType streamType);
|
||||
int32_t (*DmaBufAlloc)(struct PlatformData *platformData, const enum AudioStreamType streamType);
|
||||
|
||||
/**
|
||||
* @brief Defines dma buffer free.
|
||||
@@ -81,7 +81,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaBufFree)(struct PlatformData *platformData, enum AudioStreamType streamType);
|
||||
int32_t (*DmaBufFree)(struct PlatformData *platformData, const enum AudioStreamType streamType);
|
||||
|
||||
/**
|
||||
* @brief Defines dma request channel.
|
||||
@@ -93,7 +93,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaRequestChannel)(struct PlatformData *platformData);
|
||||
int32_t (*DmaRequestChannel)(const struct PlatformData *platformData);
|
||||
|
||||
/**
|
||||
* @brief Defines dma channel config.
|
||||
@@ -105,7 +105,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaConfigChannel)(struct PlatformData *platformData);
|
||||
int32_t (*DmaConfigChannel)(const struct PlatformData *platformData);
|
||||
|
||||
/**
|
||||
* @brief Defines dma prepare function.
|
||||
@@ -117,7 +117,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaPrep)(struct PlatformData *platformData);
|
||||
int32_t (*DmaPrep)(const struct PlatformData *platformData);
|
||||
|
||||
/**
|
||||
* @brief Defines dma submit function.
|
||||
@@ -129,7 +129,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaSubmit)(struct PlatformData *platformData);
|
||||
int32_t (*DmaSubmit)(const struct PlatformData *platformData);
|
||||
|
||||
/**
|
||||
* @brief Defines dma pending function.
|
||||
@@ -165,7 +165,7 @@ struct AudioDmaOps {
|
||||
* @since 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t (*DmaResume)(struct PlatformData *platformData);
|
||||
int32_t (*DmaResume)(const struct PlatformData *platformData);
|
||||
|
||||
/**
|
||||
* @brief Defines Get the function of the current playback or recording position.
|
||||
|
||||
@@ -23,7 +23,7 @@ int32_t CodecGetServiceName(const struct HdfDeviceObject *device, const char **d
|
||||
int32_t CodecGetDaiName(const struct HdfDeviceObject *device, const char **drvDaiName);
|
||||
int32_t CodecGetConfigInfo(const struct HdfDeviceObject *device, struct CodecData *codecData);
|
||||
int32_t CodecSetConfigInfo(struct CodecData *codeData, struct DaiData *daiData);
|
||||
int32_t CodecSetCtlFunc(struct CodecData *codeData, void *aiaoGetCtrl, void *aiaoSetCtrl);
|
||||
int32_t CodecSetCtlFunc(struct CodecData *codeData,const void *aiaoGetCtrl,const void *aiaoSetCtrl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -108,6 +108,8 @@ int32_t AccessoryI2cReadWrite(struct AudioAddrConfig *regAttr, uint16_t rwFlag)
|
||||
int16_t transferMsgCount = 1;
|
||||
uint8_t regs[I2C_REG_LEN];
|
||||
struct I2cMsg msgs[I2C_MSG_NUM];
|
||||
(void)memset_s(msgs, sizeof(struct I2cMsg) * I2C_MSG_NUM, 0, sizeof(struct I2cMsg) * I2C_MSG_NUM);
|
||||
|
||||
AUDIO_DRIVER_LOG_DEBUG("entry.\n");
|
||||
if (regAttr == NULL || rwFlag < 0 || rwFlag > 1) {
|
||||
AUDIO_DRIVER_LOG_ERR("invalid parameter.");
|
||||
@@ -298,9 +300,10 @@ int32_t AcessoryDeviceFrequencyParse(uint32_t rate, uint16_t *freq)
|
||||
int32_t AccessoryDeviceCfgGet(struct AccessoryData *accessoryData,
|
||||
struct AccessoryTransferData *accessoryTransferData)
|
||||
{
|
||||
int32_t ret, index;
|
||||
struct AudioControlConfig *ctlcfgItem = NULL;
|
||||
uint32_t audioCfgCtrlCount;
|
||||
int32_t ret;
|
||||
int32_t index;
|
||||
int32_t audioCfgCtrlCount;
|
||||
|
||||
ret = (accessoryData == NULL || accessoryData->regConfig == NULL || accessoryTransferData == NULL);
|
||||
if (ret) {
|
||||
AUDIO_DRIVER_LOG_ERR("input para is NULL.");
|
||||
@@ -317,7 +320,7 @@ int32_t AccessoryDeviceCfgGet(struct AccessoryData *accessoryData,
|
||||
AUDIO_DRIVER_LOG_ERR("parsing params is NULL.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
ctlcfgItem = g_audioRegCfgGroupNode[AUDIO_CTRL_CFG_GROUP]->ctrlCfgItem;
|
||||
struct AudioControlConfig *ctlcfgItem = g_audioRegCfgGroupNode[AUDIO_CTRL_CFG_GROUP]->ctrlCfgItem;
|
||||
audioCfgCtrlCount = g_audioRegCfgGroupNode[AUDIO_CTRL_CFG_GROUP]->itemNum;
|
||||
g_audioControls = (struct AudioKcontrol *)OsalMemCalloc(audioCfgCtrlCount * sizeof(struct AudioKcontrol));
|
||||
accessoryTransferData->accessoryRegCfgGroupNode = g_audioRegCfgGroupNode;
|
||||
|
||||
@@ -101,14 +101,14 @@ int32_t CodecGetConfigInfo(const struct HdfDeviceObject *device, struct CodecDat
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t SapmCtrlToSapmComp(struct AudioSapmComponent *sapmComponents,
|
||||
struct AudioSapmCtrlConfig *sapmCompItem, uint16_t index)
|
||||
static int32_t SapmCtrlToSapmComp(struct AudioSapmComponent *sapmComponents,
|
||||
const struct AudioSapmCtrlConfig *sapmCompItem, uint16_t index)
|
||||
{
|
||||
if (sapmComponents == NULL || sapmCompItem == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("input para is NULL.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
sapmComponents[index].componentName =
|
||||
g_audioSapmCompNameList[sapmCompItem[index].compNameIndex];
|
||||
sapmComponents[index].reg = sapmCompItem[index].reg;
|
||||
@@ -231,7 +231,7 @@ int32_t CodecSetConfigInfo(struct CodecData *codeData, struct DaiData *daiData)
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t CodecSetCtlFunc(struct CodecData *codeData, void *aiaoGetCtrl, void *aiaoSetCtrl)
|
||||
int32_t CodecSetCtlFunc(struct CodecData *codeData,const void *aiaoGetCtrl,const void *aiaoSetCtrl)
|
||||
{
|
||||
uint32_t index;
|
||||
if (codeData == NULL || codeData->regConfig == NULL ||
|
||||
@@ -240,9 +240,14 @@ int32_t CodecSetCtlFunc(struct CodecData *codeData, void *aiaoGetCtrl, void *aia
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
struct AudioRegCfgGroupNode **regCfgGroup = codeData->regConfig->audioRegParams;
|
||||
if (regCfgGroup == NULL || regCfgGroup[AUDIO_CTRL_CFG_GROUP] == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("regCfgGroup or regCfgGroup[AUDIO_CTRL_CFG_GROUP] is NULL.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
struct AudioControlConfig *compItem = regCfgGroup[AUDIO_CTRL_CFG_GROUP]->ctrlCfgItem;
|
||||
if (regCfgGroup == NULL || compItem == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("regCfgGroup or compItem is NULL.");
|
||||
if (compItem == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("compItem is NULL.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,10 @@ int32_t DaiSetConfigInfo(struct DaiData *data)
|
||||
|
||||
for (index = 0; index < data->numControls; index++) {
|
||||
data->controls[index].iface = item[index].iface;
|
||||
if (item[index].arrayIndex >= AUDIO_CTRL_LIST_MAX) {
|
||||
AUDIO_DRIVER_LOG_ERR("Array super index.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
data->controls[index].name = g_audioControlsList[item[index].arrayIndex];
|
||||
data->controls[index].Info = AudioInfoCtrlOps;
|
||||
data->controls[index].privateValue = (unsigned long)&patRegCfgItemTmp[index];
|
||||
|
||||
@@ -207,14 +207,14 @@ int32_t AudioSetCaptureBufInfo(struct PlatformData *data, const struct AudioPcmH
|
||||
|
||||
int32_t AudioWriteProcBigEndian(const struct PlatformData *data, struct AudioTxData *txData)
|
||||
{
|
||||
uint64_t buffSize;
|
||||
uint32_t buffSize;
|
||||
|
||||
if (data == NULL || txData == NULL || txData->buf == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("input param is null.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
buffSize = txData->frames * data->pcmInfo.frameSize;
|
||||
buffSize = (uint32_t)txData->frames * data->pcmInfo.frameSize;
|
||||
if (data->pcmInfo.isBigEndian) {
|
||||
if (AudioDataBigEndianChange(txData->buf, buffSize, data->pcmInfo.bitWidth) != HDF_SUCCESS) {
|
||||
AUDIO_DRIVER_LOG_ERR("AudioDataBigEndianChange: failed.");
|
||||
@@ -228,12 +228,11 @@ static enum CriBuffStatus AudioDmaBuffStatus(const struct AudioCard *card)
|
||||
{
|
||||
uint32_t dataAvailable;
|
||||
uint32_t residual;
|
||||
uint32_t pointer;
|
||||
struct PlatformData *data = NULL;
|
||||
uint32_t pointer = 0;
|
||||
uint32_t wptr;
|
||||
uint32_t rptr;
|
||||
|
||||
data = PlatformDataFromCard(card);
|
||||
struct PlatformData *data = PlatformDataFromCard(card);
|
||||
if (data == NULL || data->ops == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("PlatformDataFromCard failed.");
|
||||
return HDF_FAILURE;
|
||||
@@ -468,7 +467,7 @@ static int32_t AudioMmapWriteTransfer(const struct AudioCard *card)
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t totalSize = data->mmapData.totalBufferFrames * data->pcmInfo.frameSize;
|
||||
uint32_t totalSize = (uint32_t)data->mmapData.totalBufferFrames * data->pcmInfo.frameSize;
|
||||
uint32_t lastBuffSize = ((totalSize % MIN_PERIOD_SIZE) == 0) ? MIN_PERIOD_SIZE : (totalSize % MIN_PERIOD_SIZE);
|
||||
uint32_t loopTimes = (lastBuffSize == MIN_PERIOD_SIZE) ?
|
||||
(totalSize / MIN_PERIOD_SIZE) : (totalSize / MIN_PERIOD_SIZE + 1);
|
||||
@@ -596,21 +595,21 @@ int32_t AudioMmapReadTransfer(const struct AudioCard *card, const struct AudioMm
|
||||
uint32_t offset = 0;
|
||||
enum CriBuffStatus status;
|
||||
uint32_t timeout = 0;
|
||||
struct PlatformData *data = NULL;
|
||||
|
||||
if (!card || !rxMmapData || !rxMmapData->memoryAddress || rxMmapData->totalBufferFrames <= 0) {
|
||||
if (card == NULL || rxMmapData == NULL || rxMmapData->memoryAddress == NULL ||
|
||||
rxMmapData->totalBufferFrames <= 0) {
|
||||
AUDIO_DRIVER_LOG_ERR("param is invalid.");
|
||||
return HDF_ERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
data = PlatformDataFromCard(card);
|
||||
struct PlatformData *data = PlatformDataFromCard(card);
|
||||
if (data == NULL) {
|
||||
AUDIO_DRIVER_LOG_ERR("PlatformDataFromCard failed.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t frameSize = data->pcmInfo.frameSize;
|
||||
uint32_t totalSize = rxMmapData->totalBufferFrames * frameSize;
|
||||
uint32_t totalSize = (uint32_t)rxMmapData->totalBufferFrames * frameSize;
|
||||
data->captureBufInfo.pointer = 0;
|
||||
data->captureBufInfo.curTrafSize = data->captureBufInfo.trafBufSize;
|
||||
if (data->captureBufInfo.virtAddr == NULL) {
|
||||
|
||||
@@ -39,7 +39,8 @@ int32_t AudioUpdateCodecRegBits(struct CodecDevice *codec,
|
||||
const struct AudioMixerControl *mixerControl, uint32_t value);
|
||||
int32_t AudioUpdateAccessoryRegBits(struct AccessoryDevice *accessory,
|
||||
const struct AudioMixerControl *mixerControl, uint32_t value);
|
||||
int32_t AudioUpdateDaiRegBits(const struct DaiDevice *dai, struct AudioMixerControl *mixerControl, uint32_t value);
|
||||
int32_t AudioUpdateDaiRegBits(const struct DaiDevice *dai, const struct AudioMixerControl *mixerControl,
|
||||
uint32_t value);
|
||||
|
||||
struct DaiDevice *AudioKcontrolGetCpuDai(const struct AudioKcontrol *kcontrol);
|
||||
struct CodecDevice *AudioKcontrolGetCodec(const struct AudioKcontrol *kcontrol);
|
||||
|
||||
@@ -19,19 +19,22 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define AUDIO_CONFIG_MAX_ITEM 100
|
||||
#define AUDIO_CTRL_LIST_MAX 10
|
||||
#define AUDIO_SAPM_COMP_NAME_LIST_MAX 9
|
||||
#define AUDIO_SAPM_CFG_NAME_LIST_MAX 4
|
||||
|
||||
static const char *g_audioControlsList[] = {
|
||||
static const char *g_audioControlsList[AUDIO_CTRL_LIST_MAX] = {
|
||||
"Main Playback Volume", "Main Capture Volume",
|
||||
"Playback Mute", "Capture Mute", "Mic Left Gain",
|
||||
"Mic Right Gain", "External Codec Enable",
|
||||
"Internally Codec Enable", "Render Channel Mode", "Captrue Channel Mode"
|
||||
};
|
||||
|
||||
static char *g_audioSapmCompNameList[] = {
|
||||
static char *g_audioSapmCompNameList[AUDIO_SAPM_COMP_NAME_LIST_MAX] = {
|
||||
"ADCL", "ADCR", "DACL", "DACR", "LPGA", "RPGA", "SPKL", "SPKR", "MIC"
|
||||
};
|
||||
|
||||
static char *g_audioSapmCfgNameList[] = {
|
||||
static char *g_audioSapmCfgNameList[AUDIO_SAPM_CFG_NAME_LIST_MAX] = {
|
||||
"LPGA MIC Switch", "RPGA MIC Switch", "Dacl enable", "Dacr enable"
|
||||
};
|
||||
|
||||
|
||||
@@ -439,7 +439,7 @@ int32_t AudioUpdateAccessoryRegBits(struct AccessoryDevice *accessory,
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t AudioUpdateDaiRegBits(const struct DaiDevice *dai, struct AudioMixerControl *mixerControl, uint32_t value)
|
||||
int32_t AudioUpdateDaiRegBits(const struct DaiDevice *dai, const struct AudioMixerControl *mixerControl, uint32_t value)
|
||||
{
|
||||
int32_t ret;
|
||||
uint32_t curValue = 0;
|
||||
|
||||
@@ -129,7 +129,7 @@ static uint32_t GetAudioRegGroupNameIndex(const char *name)
|
||||
return index;
|
||||
}
|
||||
|
||||
static uint32_t* GetRegArray(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
static uint32_t* GetRegArray(const struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
struct AudioRegCfgGroupNode* group, uint32_t indexMax)
|
||||
{
|
||||
int32_t ret;
|
||||
@@ -151,7 +151,7 @@ static uint32_t* GetRegArray(struct DeviceResourceIface *parser, const struct De
|
||||
return NULL;
|
||||
}
|
||||
|
||||
group->itemNum = (num + 1) / indexMax;
|
||||
group->itemNum = num / indexMax;
|
||||
|
||||
uint32_t *buf = (uint32_t *)OsalMemCalloc(sizeof(uint32_t) * num);
|
||||
if (buf == NULL) {
|
||||
@@ -168,7 +168,7 @@ static uint32_t* GetRegArray(struct DeviceResourceIface *parser, const struct De
|
||||
return buf;
|
||||
}
|
||||
|
||||
static int32_t ParseAudioRegItem(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
static int32_t ParseAudioRegItem(const struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
struct AudioRegCfgGroupNode* group)
|
||||
{
|
||||
int32_t step;
|
||||
@@ -211,7 +211,7 @@ static int32_t ParseAudioRegItem(struct DeviceResourceIface *parser, const struc
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t ParseAudioSapmItem(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
static int32_t ParseAudioSapmItem(const struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
struct AudioRegCfgGroupNode* group)
|
||||
{
|
||||
int32_t step;
|
||||
@@ -253,7 +253,7 @@ static int32_t ParseAudioSapmItem(struct DeviceResourceIface *parser, const stru
|
||||
}
|
||||
|
||||
|
||||
static int32_t ParseAudioCtrlItem(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
static int32_t ParseAudioCtrlItem(const struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
struct AudioRegCfgGroupNode* group)
|
||||
{
|
||||
int32_t step;
|
||||
@@ -289,14 +289,14 @@ static int32_t ParseAudioCtrlItem(struct DeviceResourceIface *parser, const stru
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t ParseAudioAddrItem(struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
static int32_t ParseAudioAddrItem(const struct DeviceResourceIface *parser, const struct DeviceResourceNode *regNode,
|
||||
struct AudioRegCfgGroupNode* group)
|
||||
{
|
||||
int32_t step;
|
||||
int32_t index = group->groupIndex;
|
||||
int32_t index;
|
||||
|
||||
if (parser == NULL || regNode == NULL || g_audioRegGroupName[index] == NULL || group == NULL) {
|
||||
ADM_LOG_ERR("Input para check error: groupName=%p", g_audioRegGroupName[index]);
|
||||
if (parser == NULL || regNode == NULL || group == NULL) {
|
||||
ADM_LOG_ERR("Input para check error.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
@@ -315,7 +315,6 @@ static int32_t ParseAudioAddrItem(struct DeviceResourceIface *parser, const stru
|
||||
|
||||
for (index = 0; index < group->itemNum; ++index) {
|
||||
step = AUDIO_ADDR_CFG_INDEX_MAX * index;
|
||||
|
||||
group->addrCfgItem[index].addr = buf[step + AUDIO_ADDR_CFG_REG_INDEX];
|
||||
group->addrCfgItem[index].value = buf[step + AUDIO_ADDR_CFG_VALUE_INDEX];
|
||||
}
|
||||
@@ -323,7 +322,7 @@ static int32_t ParseAudioAddrItem(struct DeviceResourceIface *parser, const stru
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t ParseAudioRegGroup(struct DeviceResourceIface *parser,
|
||||
static int32_t ParseAudioRegGroup(const struct DeviceResourceIface *parser,
|
||||
const struct DeviceResourceNode *regCfgNode, struct AudioRegCfgGroupNode **groupNode, uint32_t index)
|
||||
{
|
||||
int32_t ret = HDF_FAILURE;
|
||||
@@ -394,7 +393,7 @@ static void ReleaseAudioAllRegConfig(struct AudioRegCfgData *config)
|
||||
}
|
||||
}
|
||||
|
||||
static int32_t ParseAudioAttr(struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode,
|
||||
static int32_t ParseAudioAttr(const struct DeviceResourceIface *parser, const struct DeviceResourceNode *attrNode,
|
||||
struct AudioIdInfo *config)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#define BUFF_SIZE_MAX 64
|
||||
|
||||
static inline struct StreamHost *StreamHostFromDevice(struct HdfDeviceObject *device)
|
||||
static inline struct StreamHost *StreamHostFromDevice(const struct HdfDeviceObject *device)
|
||||
{
|
||||
return (device == NULL) ? NULL : (struct StreamHost *)device->service;
|
||||
}
|
||||
@@ -169,9 +169,13 @@ static int32_t HwParamsDispatch(const struct AudioCard *audioCard, const struct
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t CpuDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice *cpuDai)
|
||||
static int32_t CpuDaiDevStartup(const struct AudioCard *audioCard, const struct DaiDevice *cpuDai)
|
||||
{
|
||||
int32_t ret;
|
||||
if (audioCard == NULL || audioCard->rtd == NULL) {
|
||||
ADM_LOG_ERR("audioCard is null.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
if (cpuDai != NULL && cpuDai->devData != NULL && cpuDai->devData->ops != NULL &&
|
||||
cpuDai->devData->ops->Startup != NULL) {
|
||||
ret = cpuDai->devData->ops->Startup(audioCard, cpuDai);
|
||||
@@ -185,7 +189,7 @@ static int32_t CpuDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice *c
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t CodecDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice *codecDai)
|
||||
static int32_t CodecDaiDevStartup(const struct AudioCard *audioCard, const struct DaiDevice *codecDai)
|
||||
{
|
||||
int32_t ret;
|
||||
if (audioCard == NULL || audioCard->rtd == NULL) {
|
||||
@@ -206,7 +210,7 @@ static int32_t CodecDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t DspDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice *dspDai)
|
||||
static int32_t DspDaiDevStartup(const struct AudioCard *audioCard, const struct DaiDevice *dspDai)
|
||||
{
|
||||
int32_t ret;
|
||||
if (audioCard == NULL || audioCard->rtd == NULL) {
|
||||
@@ -226,7 +230,7 @@ static int32_t DspDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice *d
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t AccessoryDaiDevStartup(struct AudioCard *audioCard, struct DaiDevice *accessoryDai)
|
||||
static int32_t AccessoryDaiDevStartup(const struct AudioCard *audioCard, const struct DaiDevice *accessoryDai)
|
||||
{
|
||||
int32_t ret;
|
||||
if (audioCard == NULL || audioCard->rtd == NULL) {
|
||||
@@ -246,7 +250,7 @@ static int32_t AccessoryDaiDevStartup(struct AudioCard *audioCard, struct DaiDev
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t AudioDaiDeviceStartup(struct AudioCard *audioCard)
|
||||
static int32_t AudioDaiDeviceStartup(const struct AudioCard *audioCard)
|
||||
{
|
||||
struct DaiDevice *cpuDai = NULL;
|
||||
struct DaiDevice *codecDai = NULL;
|
||||
@@ -779,6 +783,10 @@ static int32_t StreamHostMmapWrite(const struct HdfDeviceIoClient *client, struc
|
||||
}
|
||||
|
||||
txMmapData.memoryAddress = (void *)((uintptr_t)mAddress);
|
||||
if (txMmapData.memoryAddress == NULL) {
|
||||
ADM_LOG_ERR("txMmapData.memoryAddress is NULL.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
if (!HdfSbufReadInt32(data, (uint32_t *)&(txMmapData.memoryFd))) {
|
||||
ADM_LOG_ERR("render mmap read request memory fd failed!");
|
||||
@@ -849,6 +857,10 @@ static int32_t StreamHostMmapRead(const struct HdfDeviceIoClient *client, struct
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
rxMmapData.memoryAddress = (void *)((uintptr_t)mAddress);
|
||||
if (rxMmapData.memoryAddress == NULL) {
|
||||
ADM_LOG_ERR("rxMmapData.memoryAddress is NULL.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
|
||||
if (!HdfSbufReadInt32(data, (uint32_t *)&(rxMmapData.memoryFd))) {
|
||||
ADM_LOG_ERR("capture mmap read request memory fd failed!");
|
||||
@@ -905,12 +917,13 @@ static int32_t StreamHostMmapPositionRead(const struct HdfDeviceIoClient *client
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t StreamTriggerRouteImpl(struct AudioCard *audioCard, struct AudioRuntimeDeivces *rtd,
|
||||
static int32_t StreamTriggerRouteImpl(const struct AudioCard *audioCard, const struct AudioRuntimeDeivces *rtd,
|
||||
enum StreamDispMethodCmd methodCmd)
|
||||
{
|
||||
int32_t ret = HDF_SUCCESS;
|
||||
struct DaiDevice *cpuDai = NULL;
|
||||
struct DaiDevice *codecDai = NULL;
|
||||
struct DaiDevice *accessoryDai = NULL;
|
||||
struct DaiDevice *dspDai = NULL;
|
||||
if (audioCard == NULL || rtd == NULL) {
|
||||
ADM_LOG_ERR("input param is NULL.");
|
||||
@@ -934,6 +947,15 @@ static int32_t StreamTriggerRouteImpl(struct AudioCard *audioCard, struct AudioR
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
}
|
||||
accessoryDai = rtd->accessoryDai;
|
||||
if (accessoryDai != NULL && accessoryDai->devData != NULL && accessoryDai->devData->ops != NULL &&
|
||||
accessoryDai->devData->ops->Trigger != NULL) {
|
||||
ret = accessoryDai->devData->ops->Trigger(audioCard, methodCmd, accessoryDai);
|
||||
if (ret != HDF_SUCCESS) {
|
||||
ADM_LOG_ERR("accessoryDai Trigger failed.");
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
}
|
||||
dspDai = rtd->dspDai;
|
||||
if (dspDai != NULL && dspDai->devData != NULL && dspDai->devData->ops != NULL &&
|
||||
dspDai->devData->ops->Trigger != NULL) {
|
||||
@@ -943,11 +965,9 @@ static int32_t StreamTriggerRouteImpl(struct AudioCard *audioCard, struct AudioR
|
||||
return HDF_FAILURE;
|
||||
}
|
||||
}
|
||||
ADM_LOG_DEBUG("success.");
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int32_t StreamHostRenderStart(const struct HdfDeviceIoClient *client, struct HdfSBuf *data, struct HdfSBuf *reply)
|
||||
{
|
||||
struct AudioRuntimeDeivces *rtd = NULL;
|
||||
@@ -1447,10 +1467,10 @@ static struct StreamDispCmdHandleList g_streamDispCmdHandle[] = {
|
||||
};
|
||||
|
||||
static int32_t StreamDispatch(struct HdfDeviceIoClient *client, int cmdId,
|
||||
struct HdfSBuf *data, struct HdfSBuf *reply)
|
||||
struct HdfSBuf *data, struct HdfSBuf *reply)
|
||||
{
|
||||
unsigned int count = sizeof(g_streamDispCmdHandle) / sizeof(g_streamDispCmdHandle[0]);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
if ((cmdId == (int)(g_streamDispCmdHandle[i].cmd)) && (g_streamDispCmdHandle[i].func != NULL)) {
|
||||
return g_streamDispCmdHandle[i].func(client, data, reply);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ static int32_t ConnectedInputEndPoint(const struct AudioSapmComponent *sapmCompo
|
||||
{
|
||||
struct AudioSapmpath *path = NULL;
|
||||
int32_t count = 0;
|
||||
int32_t endPointVal = 1;
|
||||
const int32_t endPointVal = 1;
|
||||
|
||||
if (sapmComponent == NULL) {
|
||||
ADM_LOG_ERR("input param sapmComponent is NULL.");
|
||||
@@ -114,7 +114,7 @@ static int32_t ConnectedOutputEndPoint(const struct AudioSapmComponent *sapmComp
|
||||
{
|
||||
struct AudioSapmpath *path = NULL;
|
||||
int32_t count = 0;
|
||||
int32_t endPointVal = 1;
|
||||
const int32_t endPointVal = 1;
|
||||
|
||||
if (sapmComponent == NULL) {
|
||||
ADM_LOG_ERR("input param sapmComponent is NULL.");
|
||||
@@ -404,7 +404,7 @@ static void MuxSetPathStatus(const struct AudioSapmComponent *sapmComponent, str
|
||||
int32_t ret;
|
||||
uint32_t val = 0;
|
||||
int32_t item;
|
||||
uint32_t reg = 0;
|
||||
const uint32_t reg = 0;
|
||||
uint32_t shift;
|
||||
|
||||
if ((sapmComponent == NULL || sapmComponent->codec == NULL) || (path == NULL || path->name == NULL) ||
|
||||
@@ -443,7 +443,7 @@ static void MuxValueSetPathStatus(const struct AudioSapmComponent *sapmComponent
|
||||
int32_t ret;
|
||||
uint32_t val = 0;
|
||||
uint32_t item;
|
||||
uint32_t reg = 0;
|
||||
const uint32_t reg = 0;
|
||||
uint32_t shift;
|
||||
if ((sapmComponent == NULL || sapmComponent->codec == NULL) || (path == NULL || path->name == NULL) ||
|
||||
(enumKtl == NULL || enumKtl->texts == NULL)) {
|
||||
@@ -756,7 +756,7 @@ int32_t AudioSapmAddRoutes(struct AudioCard *audioCard, const struct AudioSapmRo
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t AudioSapmNewMixerControls(struct AudioSapmComponent *sapmComponent, struct AudioCard *audioCard)
|
||||
int32_t AudioSapmNewMixerControls(const struct AudioSapmComponent *sapmComponent, struct AudioCard *audioCard)
|
||||
{
|
||||
struct AudioSapmpath *path = NULL;
|
||||
int32_t i;
|
||||
@@ -768,7 +768,8 @@ int32_t AudioSapmNewMixerControls(struct AudioSapmComponent *sapmComponent, stru
|
||||
|
||||
for (i = 0; i < sapmComponent->kcontrolsNum; i++) {
|
||||
DLIST_FOR_EACH_ENTRY(path, &sapmComponent->sources, struct AudioSapmpath, listSink) {
|
||||
if (path->name == NULL || sapmComponent->kcontrolNews[i].name == NULL) {
|
||||
if (path->name == NULL || sapmComponent->kcontrolNews == NULL
|
||||
|| sapmComponent->kcontrolNews[i].name == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -958,6 +959,7 @@ static void AudioSapmPowerDownSeqRun(const struct DListHead *list)
|
||||
|
||||
static int AudioSapmPowerComponents(struct AudioCard *audioCard)
|
||||
{
|
||||
int32_t ret;
|
||||
struct AudioSapmComponent *sapmComponent = NULL;
|
||||
struct DListHead upList;
|
||||
struct DListHead downList;
|
||||
@@ -978,7 +980,10 @@ static int AudioSapmPowerComponents(struct AudioCard *audioCard)
|
||||
}
|
||||
|
||||
if (g_audioSapmIsStandby && sapmComponent->PowerClockOp != NULL) {
|
||||
sapmComponent->PowerClockOp(sapmComponent);
|
||||
ret = sapmComponent->PowerClockOp(sapmComponent);
|
||||
if (ret != HDF_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
AudioSapmSetPower(audioCard, sapmComponent, sapmComponent->newPower, &upList, &downList);
|
||||
@@ -1327,7 +1332,7 @@ int32_t AudioSampSetPowerMonitor(struct AudioCard *card, bool powerMonitorState)
|
||||
return HDF_SUCCESS;
|
||||
}
|
||||
|
||||
static void AudioSapmEnterSleepSub(uintptr_t para, struct AudioSapmComponent *sapmComponent)
|
||||
static void AudioSapmEnterSleepSub(const uintptr_t para, struct AudioSapmComponent *sapmComponent)
|
||||
{
|
||||
struct DListHead downList;
|
||||
struct AudioCard *audioCard = (struct AudioCard *)para;
|
||||
|
||||
Reference in New Issue
Block a user