ALSA驅動 裝置函式呼叫關係

2021-06-01 23:02:20 字數 2595 閱讀 4853

soc_probe

==> snd_soc_register_card或者snd_soc_register_dai或者snd_soc_register_platform或者snd_soc_register_codec

==> snd_soc_instantiate_cards

==> snd_soc_instantiate_card

==> codec_dev->probe

==> uda134x_soc_probe

==> snd_soc_new_pcms

==> soc_new_pcm

==> snd_pcm_new

snd_soc_new_pcms

snd_card_create

snd_ctl_create

snd_ctl_dev_register建立"controlc%i"音效卡對應的控制節點,

他的fops為snd_ctl_f_ops

snd_pcm_dev_register

snd_register_device_for_dev

建立"pcmc%id%ip"或者"pcmc%id%ic"裝置節點,它的fops為snd_pcm_f_ops[2]

snd_pcm_f_ops[2]

==> snd_pcm_playback_open或者snd_pcm_capture_open

==> snd_pcm_open或者oss的snd_pcm_oss_f_reg.snd_pcm_oss_open,這就對應/dev/dsp了

==> snd_pcm_open_file或者oss的snd_pcm_oss_open_file

==> snd_pcm_open_substream

==> soc_pcm_open

/* asoc pcm operations */

static struct snd_pcm_ops soc_pcm_ops = ;

==> soc_pcm_open

cpu_dai->ops->startup // 無

platform->pcm_ops->open // s3c_dma_open 分配dma空間

codec_dai->ops->startup // uda134x_startup

card_dai_link->ops->startup // s3c24xx_uda134x_startup 獲取clock時鐘源

// cpu_dai單元

struct snd_soc_dai s3c24xx_i2s_dai = ,

.capture = ,

.ops = &s3c24xx_i2s_dai_ops,

};//platform單元

struct snd_soc_platform s3c24xx_soc_platform = ;

static struct snd_pcm_ops s3c_dma_ops = ;

// codec_dai單元

struct snd_soc_dai uda134x_dai = ,

/* capture capabilities */

.capture = ,

/* pcm operations */

.ops = &uda134x_dai_ops,

};//card_dai_link單元

static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = ;

pcm.c

snd_pcm_control_ioctl()

case sndrv_ctl_ioctl_pcm_info:

* s1:get params infofrom userspace arg*

* s2:get info->device

* s3:get info->stream

* s4:get info->subdevice

* s5:get pcm from matching special card and device

* s1:get pstrfrom &pcm->streams[stream]

* s2:get substreamfrom pstr->substream

* s3:now! we got struct snd_pcm_substream*substream

* which contents the struct snd_pcm_runtime*runtime;

snd_pcm_runtime裡面有

/* -- hardware description -- */

struct snd_pcm_hardware hw;

struct snd_pcm_hw_constraintshw_constraints;

xx_pcm.c

xx_pcm_hardware

xx_pcm_open()

xx_pcm_ops

xx_soc_platform

snd_soc_register_platform()

xx_soc_platform_init()

module_init

ALSA驅動 裝置函式呼叫關係

soc probe snd soc register card或者snd soc register dai或者snd soc register platform或者snd soc register codec snd soc instantiate cards snd soc instantiate...

ALSA驅動 裝置函式呼叫關係

原址 soc probe snd soc register card或者snd soc register dai或者snd soc register platform或者snd soc register codec snd soc instantiate cards snd soc instanti...

匯流排,裝置,驅動之間關係

匯流排,裝置,驅動之間關係 再看i2c驅動迷茫時候看到 從需求的角度去理解linux系列 匯流排 裝置和驅動 感覺豁然開朗,根據部落格內容簡單總結一下。1 匯流排 匯流排代表同類裝置需要共同遵守的時序,不同匯流排硬體的通訊時序也是不同的,如i2c匯流排 usb匯流排 pci匯流排 2 裝置 裝置代表...