Skip to content

Conversation

@ljq-ctrl
Copy link

No description provided.

# Audio Codec options
#

source "drivers/audio/Kconfig.sf32lb"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the correct position, it should be placed here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not depend audio codec, not use codec.h API, so the menu place out ot the audio codec menu


config AUDIO_CODEC_SF32LB
bool "sf32lb codec driver support"
select USE_SIFLI_HAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the HAL be selected at the SoC level?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USE_SIFLI_HAL is sco low chip driver

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is ‘sco’ ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USE_SIFLI_HAL will using \zephyrproject\modules\hal\sifli,
remote url is https://github.com/zephyrproject-rtos/hal_sifli

extern void HAL_TURN_ON_PLL();
extern void HAL_TURN_OFF_PLL();


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one blank line?

.start = sf32lb_codec_start,
.stop = sf32lb_codec_stop,
.set_dac_volume = sf32lb_codec_set_dac_volume,
.set_dac_mute = sf32lb_codec_set_dac_mute,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a driver API named set_dac_volume?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self defined API in sf32lb_codec.h

@@ -0,0 +1,189 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are not using zephyr codec device driver model?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Zephyr audio codec interface cannot support some functions. For example, during HFP calls, it cannot strictly control the order of opening the mic and speaker. Both the mic and speaker may be opened simultaneously. After sending data, there is no event callback, so the app does not know when it can send the next frame of data. ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better to open mic & speaker simultaneously for Echo cancellation using WEBRTC or other algorithm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you probably need to extend the codec driver API

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, now codec only has AUDIO_DAI_TYPE_I2S, only has one config for i2s.
typedef union {
struct i2s_config i2s; /**< I2S configuration /
/
Other DAI types go here */
} audio_dai_cfg_t;
i'll add new DAI type AUDIO_DAI_TYPE_PCM for pcm playback and capture using onchip codec
and add playback and capture data coming callback interface.
for i2s capture, I not see a sample can notify app to read data or callback to app with incoming data.
I'll add these in new DAI type config.

@ZhaoxiangJin
Copy link
Contributor

Please take a look at https://docs.zephyrproject.org/latest/contribute/guidelines.html, your commit message does not comply with Zephyr conventions.

Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has some fundamental issues, see my comments. Also please, do not introduce platform specific samples for drivers that are supposed to offer a vendor-agnostic interface. Only use these samples if you have to extend standard interface with vendor-specific extra APIs.

Comment on lines 29 to 30
extern void HAL_TURN_ON_PLL();
extern void HAL_TURN_OFF_PLL();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely -1, we need clock control driver to be extended.

Comment on lines +34 to +42
#define AUDCODEC_ADC0_DMA_IRQ DMAC1_CH4_IRQn
#define AUDCODEC_ADC0_DMA_IRQ_PRIO 0
#define AUDCODEC_ADC0_DMA_INSTANCE DMA1_Channel4
#define AUDCODEC_ADC0_DMA_REQUEST 39

#define AUDCODEC_DAC0_DMA_IRQ DMAC1_CH1_IRQn
#define AUDCODEC_DAC0_DMA_IRQ_PRIO 0
#define AUDCODEC_DAC0_DMA_INSTANCE DMA1_Channel1
#define AUDCODEC_DAC0_DMA_REQUEST 41
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1, this needs to be properly described in devicetree, use DMA driver

Comment on lines 86 to 90
#undef LOG_INF
#define LOG_INF printf
#if (LOG_LEVEL >= LOG_LEVEL_DEBUG)
#else
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-1

Comment on lines +167 to +169
HAL_PMU_EnableAudio(1);
HAL_RCC_EnableModule(RCC_MOD_AUDCODEC_HP);
HAL_RCC_EnableModule(RCC_MOD_AUDCODEC_LP);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's clock control driver for this

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants