当前位置:网站首页>Platform of ASoC framework driven by alsa
Platform of ASoC framework driven by alsa
2022-06-12 05:02:00 【Facing the sea 0902】
One 、 register cpu_dai
I said before. machine Is the connection platform and Codec The bridge , stay machine In the chapter zx297520v3_nau8810_dai_link There is cpu_dai_name and platform_name, as follows :
static struct snd_soc_dai_link zx297520v3_nau8810_dai_link[] =
{
{
.name = "NAU8810_Media",
.stream_name = "MultiMedia",
.codec_name = "nau8810.1-001a", //nau8810.1-001a
.codec_dai_name = "nau8810-hifi",
.cpu_dai_name = "MultiMedia",
.ops = &zx297520v3_nau8810_ops,
.init = zx297520v3_nau8810_init_paiftx,
.platform_name = "zx29-pcm-audio",
},
{
.name = "voice_call",
.stream_name = "voice",
.codec_name = "nau8810.1-001a",
.codec_dai_name = "nau8810-hifi",
.cpu_dai_name = "voice", //"snd-soc-dummy-dai",
.platform_name = "snd-soc-dummy",
.init = zx297520v3_nau8810_init_paiftx,
.ops = &zx297520v3_nau8810_ops1,
}
};
Search in code engineering cpu_dai_name “MultiMedia”, stay zx29_i2s.c Find snd_soc_dai_driver Structure :
static struct snd_soc_dai_driver zx_i2s_dais[] = {
{
.name = "MultiMedia",
.probe = zx29_i2s_dai_probe,
.suspend = zx29_i2s_suspend,
.resume = zx29_i2s_resume,
.playback = {
.stream_name = "MultiMedia Playback",
.channels_min = 1,
.channels_max = 8,
.rates = ZX29_I2S_RATES,
.formats = ZX29_I2S_FMTBIT,
},
.capture = {
.stream_name = "MultiMedia Capture",
.channels_min = 1,
.channels_max = 2,
.rates = ZX29_I2S_RATES,
.formats = ZX29_I2S_FMTBIT,
},
.ops = &zx29_i2s_dai_ops,
},
{
.name = "voice",
.probe = zx29_i2s_dai_probe1,
.playback = {
.stream_name = "voice Playback",
.rates = ZX29_I2S_RATES,
.formats = ZX29_I2S_FMTBIT,
.channels_min = 1,
.channels_max = 2,
},
.capture = {
.stream_name = "voice Capture",
.rates = ZX29_I2S_RATES,
.formats = ZX29_I2S_FMTBIT,
.channels_min = 1,
.channels_max = 2,
},
}
};
snd_soc_dai_driver Structure ops Point to snd_soc_dai_ops structure , Used to configure and control the dai;playback snd_soc_pcm_stream structure , Used to indicate the dai Number of channels supported , Bit rate , Data format and other capabilities ;capture snd_soc_pcm_stream structure , Used to indicate the dai Number of channels supported , Bit rate , Data format and other capabilities ;
snd_soc_dai_ops Examples are as follows ,
static const struct snd_soc_dai_ops zx29_i2s_dai_ops = {
.trigger = zx29_i2s_trigger,
.hw_params = zx29_i2s_hw_params,
.set_fmt = zx29_i2s_set_fmt,
.set_sysclk = zx29_i2s_set_sysclk,
.startup = zx29_i2s_startup,
.shutdown = zx29_i2s_shutdown,
};
trigger: The beginning of data transmission , Pause , When resuming and stopping , This function will be called .
hw_params: Driven hw_params Stage , This function will be called .
set_fmt: Set up dai The format of
set_sysclk: Set up dai The master clock of
Look at the registration as a whole cpu_dai The process is as follows , adopt snd_soc_register_dais Just put the above snd_soc_dai_driver zx_i2s_dais It's connected
zx29_i2s_dev_probe
—>snd_soc_register_dais
static __devinit int zx29_i2s_dev_probe(struct platform_device *pdev)
{
... ...
return snd_soc_register_dais(&pdev->dev, zx_i2s_dais, ARRAY_SIZE(zx_i2s_dais));
}
static struct platform_driver zx29_i2s_driver = {
.probe = zx29_i2s_dev_probe,
.remove = __devexit_p(zx29_i2s_dev_remove),
.driver = {
.name = "zx29_i2s",
.owner = THIS_MODULE,
},
};
Two 、 register platform
Search in code engineering platform_name"zx29-pcm-audio", stay zx29_pcm.c Found in file platform_driver asoc_dma_driver as follows :
static int __devinit zx29_asoc_platform_probe(struct platform_device *pdev)
{
return snd_soc_register_platform(&pdev->dev, &zx_asoc_platform);
}
static int __devexit zx29_asoc_platform_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
return 0;
}
static struct platform_driver asoc_dma_driver = {
.driver = {
.name = "zx29-pcm-audio",
.owner = THIS_MODULE,
},
.probe = zx29_asoc_platform_probe,
.remove = __devexit_p(zx29_asoc_platform_remove),
};
In addition to here snd_soc_register_platform Function registration platform Outside , Also pay attention to snd_soc_platform_driver zx_asoc_platform as follows :
static struct snd_soc_platform_driver zx_asoc_platform = {
.ops = &dma_ops,
.pcm_new = zx29_dma_new,
.pcm_free = zx29_dma_free_dma_buffers,
};
static struct snd_pcm_ops dma_ops = {
.open = zx29_dma_open,
.close = zx29_dma_close,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = zx29_dma_hw_params,
.hw_free = zx29_dma_hw_free,
.prepare = zx29_dma_prepare,
.trigger = zx29_dma_trigger,
.pointer = zx29_dma_pointer,
.mmap = zx29_dma_mmap,
};
about DMA Application for interpretation 、 Put into use pcm_new、pcm_free, For configuring and starting the transfer, use dma_ops Set of operation functions to complete .
thus ALSA drive asoc Framework machine、ALSA drive asoc Framework Codec、 And this chapter ALSA drive asoc Framework Platform That's it .
边栏推荐
- 12.24 day exercise -- Programming summation, 99 multiplication table, while loop and for loop exercises
- Ray. Tune visual adjustment super parameter tensorflow 2.0
- [backtracking method] backtracking method to solve the problem of Full Permutation
- L1-064 AI core code valued at 100 million (20 points)
- Minigui3 runs on Hisilicon hi3520d/hi3531 platform
- Pupanvr- an open source embedded NVR system (1)
- PostgreSQL age XID maintenance prevents the database from being read-only
- 2022 low voltage electrician test questions and simulation test
- How to quickly reference uview UL in uniapp, and introduce and use uviewui in uni app
- Spatial distribution data of China's tertiary watershed / national new area distribution data /npp net primary productivity data / spatial distribution data of vegetation cover / land use data /ndvi d
猜你喜欢

Install pycharm under Kali and create a shortcut access

Pupanvr- an open source embedded NVR system (1)

Interview must ask: summary of ten classic sorting algorithms

2022 fusion welding and thermal cutting recurrent training question bank and simulation examination

Bearpi IOT serial port transceiver 1- normal mode

Microsoft announces that it will discontinue support for older versions of visual studio

2022 self study materials for Zhejiang computer level III network and security technology examination (1) (updated on 2.28)

Three. JS import model demo analysis (with notes)

Sentinel-2 data introduction and download

2022 "college entrance examination memory" has been packaged, please check!
随机推荐
kali_ Nat mode, bridging Internet / host only_ detailed
Musk promotes the development of fascinating new products partners remind important questions
Yolo opencv scale identification scale reading identification water gauge identification water level identification source code
Detailed tutorial on the use of yolov5 and training your own dataset with yolov5
Interview must ask: summary of ten classic sorting algorithms
Qinglong wool - Kaka
LabVIEW about TDMS and binary storage speeds
Accumulated temperature spatial distribution data, temperature distribution data, sunshine data, rainfall distribution, solar radiation data, surface runoff data, land use data, NPP data, NDVI data
What is reverse repurchase of treasury bonds? Is the reverse repurchase of treasury bonds safe?
2022 fusion welding and thermal cutting recurrent training question bank and simulation examination
Layer sublayer assigns values to the page elements of the parent layer to achieve the effect of transferring values to the page of the parent layer
1006 next spread
JWT學習與使用
Force/release learning arrangement in IC Verification (5) research on the influence of reg type signals
Classes and objects, methods and encapsulation
LabVIEW about TDMS and Binary Storage Speed
[GIS tutorial] land use transfer matrix
Install pycharm under Kali and create a shortcut access
[backtracking] backtracking method to solve combinatorial problems
12.24 day exercise -- Programming summation, 99 multiplication table, while loop and for loop exercises