
linux driver
mnlife_
这个作者很懒,什么都没留下…
展开
-
The Road to Linux Kernel - platform driver interface
platform driver驱动,下面这样的方式是其中一种注册方式, 驱动会注册到形如**__initcall**的段中,然后在start_kernel时进行调用。 static struct platform_driver tegra_ahb_driver = { .probe = tegra_ahb_probe, .driver = { .name = DRV_NAME, .of_match_table = tegra_ahb_of_match, .pm = &tegra_ah原创 2020-07-04 22:29:34 · 260 阅读 · 1 评论 -
The Road to Linux Kernel - Devres - Managed Device Resource
devres是内核为驱动开发者提供的用来申请资源的机制,函数名都是以devm开头。总的来说,在大多数情况下,调用这类接口不需要关心资源的释放问题。 在驱动进行probe时,可以调用这类接口,若probe失败,申请的资源也会释放。 以devm_request_threaded_irq接口为例,简单了解下这个机制。 函数开始调用devres_alloc将devm_irq_release保存在dr->node.release节点下,然后返回dr->data,再然后通过返回的节点,把调用relase时需原创 2020-07-04 21:25:52 · 332 阅读 · 0 评论 -
Route Configuration Process: Element to Codec Register
amixer.c | v cset | v snd_ctl_elem_write | v snd_ctl_hw_elem_write | v ioctl(hw->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, control) | v snd_ctl_f_ops | v snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | v snd_ctl原创 2020-06-07 11:14:26 · 164 阅读 · 0 评论 -
The Road to Linux Kernel - GPIO Subsystem - GPIO Devres, Managed Device Resource(3)
GPIO Devres 之前常用的gpio接口,需要对申请的资源进行管理,如果要管理多个资源,这是很麻烦的一件事,Is there a easier way? 调用下面的接口,将申请的资源与device绑定,就不需要手动管理这些资源了: devm_gpiod_get() devm_gpiod_get_index() devm_gpiod_get_index_optional() devm_gpiod_get_optional() devm_gpiod_put() devm_gpiod原创 2020-06-05 22:06:28 · 897 阅读 · 0 评论