Linux MFD Driver

  • 了解Linux MFD Driver

1.Multifunction Device Drivers

  Multifunction devices embed several functions (e.g. GPIOs, touchscreens, keyboards, current regulators, power management chips, etc…) in one single integrated circuit. They usually talk to the main CPU through one or more IRQ lines and low speed data busses (SPI, I2C, etc…). They appear as one single device to the main system through the data bus and the MFD framework allows for sub devices (a.k.a. functions) to appear as discrete platform devices. MFDs are typically found on embedded platforms.

  In Create a simple platform driver, we created simple platform device driver. If there is device which can provide multiple functionalities, its driver may not go in particular subsystems. For an example, lets say there is chip which can also work as codec & sensors, its full driver can neither go in sound/soc/codec or in sensors subsystem. In this case, MFD provides way to register multiple functionalities through MFD core.

1.1.What is a multi-function device ?

  • An external peripheral or a hardware block exposing more than a single functionality
  • Examples:
    • PMICs

      • da9063: regulators, led controller, watchdog, rtc, temperature sensor, vibration motor driver, ON key
      • max77843: regulators, charger, fuel gauge, haptic feedback, LED controller, micro USB interface controller
    • atmel-hlcdc: display controller and backlight pwm

  • The main issue is to register those in different kernel subsystems. In particular the
    external peripherals are represented by only one struct device (or the specialized i2c_client or spi_device)

1.2.MFD subsystem

  • The MFD subsystem has been created to handle those devices
  • Allows to register the same device in multiple subsystems
  • The MFD driver has to multiplex access on the bus (mainly takes care of locking)
    and handle IRQs
  • May handle clocks
  • May also need to confgure the IP
  • May do variant or functions detection
  • Other beneft: allows driver reuse, multiple MFD can reuse drivers from other subsystems.

1.3.MFD APIs

  For this, MFD provides way to divide functionalities into core and specific function drivers. Generic functionalities(e.g. register access, generic initialisation, common functionalities, etc), can go in mfd while device specific functionalities(e.g. codec specific functionalities) can go in their specific driver.

  devm_mfd_add_devices() in core, registers MFD functionalities which populates individual function devices and invokes probe for those drivers.

  Functional driver may use parent device data/DT properties if needed. MFD core can pass resources(memory or IRQ) to MFD devices while registering MFD devices.

  • Defned in include/linux/mfd/core.h
  • Implemented in drivers/mfd/mfd-core.c
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值