資料介紹
Table of Contents
ADP5520/01 MFD Linux Driver
Supported Devices
Evaluation Boards
Description
The ADP5520/01 driver utilizes several Linux device-driver subsystems and provides various software interfaces. It is therefore implemented as a multifunction device (MFD). In this particular case the ADP5520 backlight driver and I/O expander, concurrently leverages the Linux backlight, LED, GPIO, and input subsystems for its keypad functionality.
Core
The ADP5520/01 core driver in drivers/mfd provides common services for the subsystem drivers. These services include register access, control and shared interrupt management.
The core registers/enumerates platform devices for the various subsystems via the platform device and driver system.
When a platform driver for one of the subsystems is instantiated, the core initializes the chip (which may be specified by the platform data).
The ADP5520/01 platform drivers follow the standard driver model convention, where discovery/enumeration is handled outside the drivers, and drivers provide probe() and remove() methods.
Resources
Each peripheral (subsystem device) has a view of the device which is implicitly narrowed to the specific set of resources that peripheral requires in order to function correctly.
Configuration
The device driver uses a set of platform data to pass configurations through to the core and the subsidiary drivers so that there can be support for multiple ADP5520/01 devices built into a single kernel image.
Software configurable features
Backlight:
- Ambient Light Sensor Support
- Configurable Fade On/Off times
- Configurable Brightness/Intensity in 127 steps
LED:
- Up to 3 LEDs configurable
- Configurable Fade On/Off times
- LED Blink On/Off times
- Configurable Brightness/Intensity in 64 steps from [0..255]
Keypad:
- Configurable keypad size matrix (rows, columns) up to 16 keys
- Enabling and disabling automatic key repeat feature.
GPIO:
- Configurable number of dedicated GPIOs, up to 8 GPIOs
- Configurable Pull-Ups
Source Code
Status
Files
Function | File |
---|---|
MFD-CORE | drivers/mfd/adp5520.c |
include | include/linux/mfd/adp5520.h |
BACKLIGHT | drivers/video/backlight/adp5520_bl.c |
LED | drivers/led/leds-adp5520.c |
GPIO | drivers/gpio/adp5520-gpio.c1) |
KEYPAD | drivers/input/keyboard/adp5520-keys.c2) |
Example platform device initialization
For compile time configuration, it’s common Linux practice to keep board- and application-specific configuration out of the main driver file, instead putting it into the board support file.
For devices on custom boards, as typical of embedded and SoC-(system-on-chip) based hardware, Linux uses platform_data to point to board-specific structures describing devices and how they are connected to the SoC. This can include available ports, chip variants, preferred modes, default initialization, additional pin roles, and so on. This shrinks the board-support packages (BSPs) and minimizes board and application specific #ifdefs in drivers.
Since Keypad, GPIO and optional LEDs (2, 3) are multiplexed, you need to avoid double configurations. Please refer to the table below.
ADP5520 PIN | R3 | R2 | R1 | R0 | C0 | C1 | C2 | C3 |
---|---|---|---|---|---|---|---|---|
GPIO | GPIO_R3 | GPIO_R2 | GPIO_R1 | GPIO_R0 | GPIO_C0 | GPIO_C1 | GPIO_C2 | GPIO_C3 |
Keypad | ROW_R3 | ROW_R2 | ROW_R1 | ROW_R0 | COL_C0 | COL_C1 | COL_C2 | COL_C3 |
LED | LED3 | LED2 |
Please refer to include/linux/mfd/adp5520.h for detailed configuration defines.
Backlight
LED
GPIO
Keypad
ADP5520/ADP5501 MFD Core Support
Declaring I2C devices
Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each I2C bus segment, and what address these devices are using. For this reason, the kernel code must instantiate I2C devices explicitly. There are different ways to achieve this, depending on the context and requirements. However the most common method is to declare the I2C devices by bus number.
This method is appropriate when the I2C bus is a system bus, as in many embedded systems, wherein each I2C bus has a number which is known in advance. It is thus possible to pre-declare the I2C devices that inhabit this bus. This is done with an array of struct i2c_board_info, which is registered by calling i2c_register_board_info().
So, to enable such a driver one need only edit the board support file by adding an appropriate entry to i2c_board_info.
For more information see: Documentation/i2c/instantiating-devices
ADP5520 IRQ Usage:
If you aren’t planning to utilize the Keypad interface, you don’t need to specify an IRQ in bfin_i2c_board_info.
Adding Linux driver support
Fist of all you need to enable i2c support followed by the ADP5520 MFD Core Driver. Then you may select individual components like LCD backlight, LEDs, GPIOs and Keypad under the corresponding menus.
ADP5520 MFD Core Support
Device Drivers ---> <*> I2C support ---> <*> Blackfin TWI I2C support Or: <*> GPIO-based bitbanging I2C Device Drivers ---> Multifunction device drivers ---> [*] Analog Devices ADP5520/01 MFD PMIC Core Support
Backlight
Device Drivers ---> Graphics support ---> [*] Backlight & LCD device support ---> <*> Lowlevel Backlight controlsBacklight Driver for ADP5520/ADP5501 using WLED
LED
Device Drivers ---> [*] LED Support ---> <*> LED Class SupportLED Support for ADP5520/ADP5501 PMIC
GPIO
Device Drivers ---> [*] GPIO Support ---> [*] /sys/class/gpio/... (sysfs interface)GPIO Support for ADP5520 PMIC
Keypad
Device Drivers ---> Input device support ---> <*> Generic input layer (needed for keyboard, mouse, ...) <*> Event interface [*] Keyboards --->Keypad Support for ADP5520 PMIC
Hardware configuration
There is no dedicated Blackfin STAMP evaluation board for the ADP5520. During test and driver development we used the ADP5520 Demo Mother/Daughter Board. Connect the ADP5520 Demo Mother to an USB port.
It can be easily wired to the Blackfin STAMP TWI/I2C header.
BF537-STAMP (P10) TWI/I2C header | ADP5520 Daughter Board | |
---|---|---|
PIN | Function | PIN/Function |
5 | SCL | SCL |
6 | SDA | SDA |
10 | GPIO_PG0 | nINT |
20 | GND | GND |
Driver testing
Backlight
root:/> modprobe adp5520_bl root:/> root:/> cd sys/class/backlight/adp5520-backlight/ root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/backlight/adp5520-backlight> ls -l -r--r--r-- 1 root root 4096 Nov 12 10:31 actual_brightness -rw-r--r-- 1 root root 4096 Nov 12 10:31 bl_power -rw-r--r-- 1 root root 4096 Nov 12 10:31 brightness -rw-rw-r-- 1 root root 4096 Nov 12 10:31 dark_dim -rw-rw-r-- 1 root root 4096 Nov 12 10:31 dark_max -rw-rw-r-- 1 root root 4096 Nov 12 10:31 daylight_dim -rw-rw-r-- 1 root root 4096 Nov 12 10:31 daylight_max lrwxrwxrwx 1 root root 0 Nov 12 10:31 device -> ../../../0-0032 -r--r--r-- 1 root root 4096 Nov 12 10:31 max_brightness -rw-rw-r-- 1 root root 4096 Nov 12 10:31 office_dim -rw-rw-r-- 1 root root 4096 Nov 12 10:31 office_max drwxr-xr-x 2 root root 0 Nov 12 10:31 power lrwxrwxrwx 1 root root 0 Nov 12 10:31 subsystem -> ../../../../../../../../class/backlight root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/backlight/adp5520-backlight> echo 127 > brightness root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/backlight/adp5520-backlight> echo 50 > brightness root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/backlight/adp5520-backlight> echo 0 > brightness
For more information on Backlight handling in Linux read: Documentation/ABI/stable/sysfs-class-backlight
LED
root:/> modprobe leds-adp5520 Registered led device: adp5520-led1 Registered led device: adp5520-led2 Registered led device: adp5520-led3 root:/> cd sys/class/leds/adp5520-led sys/class/leds/adp5520-led1/ sys/class/leds/adp5520-led3/ sys/class/leds/adp5520-led2/ root:/> cd sys/class/leds/adp5520-led1 root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/leds/adp5520-led1> ls -l -rw-r--r-- 1 root root 4096 Nov 12 10:34 brightness lrwxrwxrwx 1 root root 0 Nov 12 10:34 device -> ../../../0-0032 drwxr-xr-x 2 root root 0 Nov 12 10:34 power lrwxrwxrwx 1 root root 0 Nov 12 10:34 subsystem -> ../../../../../../../../class/leds -rw-r--r-- 1 root root 4096 Nov 12 10:34 trigger root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/leds/adp5520-led1> echo 10 > brightness root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/leds/adp5520-led1> echo 255 > brightness root:/sys/devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/leds/adp5520-led1> echo 0 > brightness root:/> modprobe -r leds-adp5520 root:/>
For more information on LEDs handling in Linux read: Documentation/leds-class.txt
GPIO
root:/> modprobe adp5520-gpio root:/> cd sys/class/gpio/gpiochip50/ root:/sys/devices/virtual/gpio/gpiochip50> ls -l -r--r--r-- 1 root root 4096 Nov 12 10:37 base -r--r--r-- 1 root root 4096 Nov 12 10:37 label -r--r--r-- 1 root root 4096 Nov 12 10:37 ngpio drwxr-xr-x 2 root root 0 Nov 12 10:37 power lrwxrwxrwx 1 root root 0 Nov 12 10:37 subsystem -> ../../../../class/gpio -rw-r--r-- 1 root root 4096 Nov 12 10:37 uevent root:/sys/devices/virtual/gpio/gpiochip50> cd root:/>Note that you will have to enable the event_test utility under “Blackfin test programs” in your user space configuration.
--- Blackfin test programs [*] Input event device test
For more information on GPIO handling in Linux read: Documentation/gpio.txt
Keypad
root:/> modprobe adp5520-keys input: adp5520-keys as /devices/platform/i2c-bfin-twi.0/i2c-adapter/i2c-0/0-0032/adp5520-keys.5520/input/input0 root:/> event_test /dev/input/event0 Input driver version is 1.0.0 Input device ID: bus 0x18 vendor 0x1 product 0x5520 version 0x1 Input device name: "adp5520-keys" Supported events: Event type 0 (Reset) Event code 0 (Reset) Event code 1 (Key) Event type 1 (Key) Event code 2 (1) Event code 3 (2) Event code 4 (3) Event code 5 (4) Event code 6 (5) Event code 7 (6) Event code 8 (7) Event code 9 (8) Event code 10 (9) Event code 11 (0) Event code 12 (Minus) Event code 13 (Equal) Event code 28 (Enter) Event code 41 (Grave) Event code 43 (BackSlash) Testing ... (interrupt to exit) Event: time 1415788674.340000, type 1 (Key), code 41 (Grave), value 1 Event: time 1415788674.340000, type 0 (Reset), code 0 (Reset), value 0 Event: time 1415788674.516000, type 1 (Key), code 41 (Grave), value 0 Event: time 1415788674.516000, type 0 (Reset), code 0 (Reset), value 0 Event: time 1415788674.912000, type 1 (Key), code 2 (1), value 1 Event: time 1415788674.912000, type 0 (Reset), code 0 (Reset), value 0 Event: time 1415788675.140000, type 1 (Key), code 2 (1), value 0 Event: time 1415788675.140000, type 0 (Reset), code 0 (Reset), value 0 Event: time 1415788675.892000, type 1 (Key), code 6 (5), value 1 Event: time 1415788675.892000, type 0 (Reset), code 0 (Reset), value 0 Event: time 1415788676.092000, type 1 (Key), code 6 (5), value 0 Event: time 1415788676.092000, type 0 (Reset), code 0 (Reset), value 0 root:/> modprobe -r adp5520-keys root:/>
For more information on Input handling in Linux read: Documentation/input/input.txt
More Information
- LTC3676 Linux驅動程序
- ADP5520:帶I/O擴展器的背光驅動器產品手冊
- ADP150穩壓器固定電壓Linux驅動程序
- ADP5520 LED驅動器
- ADP5589輸入鍵盤和GPIO Linux驅動程序
- ADP5588 GPIO Linux驅動程序
- ADP5588輸入鍵盤和GPIO Linux驅動程序
- Linux的LEDS GPIO驅動程序免費下載 3次下載
- 嵌入式Linux設備驅動程序開發基礎知識總結免費下載 13次下載
- Linux驅動程序缺陷檢測研究 9次下載
- Linux系統網絡驅動程序的編寫 0次下載
- 基于Linux下的LCD驅動程序實現 12次下載
- 第9章 Linux驅動程序設計 3次下載
- ADP5520,datasheet,pdf(Backligh
- 步進電機的Linux驅動程序
- 怎么編寫Framebuffer驅動程序 403次閱讀
- 自動刪除SDK/Vitis下驅動程序的舊版本的Linux腳本 558次閱讀
- 如何寫一個Linux設備驅動程序 4314次閱讀
- 米爾科技LINUX設備驅動程序教程 1967次閱讀
- 嵌入式Linux內核的驅動程序開發是怎樣的 1415次閱讀
- 淺談電腦驅動程序的工作原理 詳解電腦驅動程序意義 2.9w次閱讀
- 基于嵌入式Linux內核的系統設備驅動程序開發設計 1113次閱讀
- 基于Linux2.6.30開發DS18B20的驅動程序的類型和文件操作接口函數詳解 1377次閱讀
- 可動態安裝的Linux設備驅動程序 957次閱讀
- 如何用嵌入式Linux系統編寫鍵盤驅動 1312次閱讀
- 8255A驅動程序 3193次閱讀
- 8155驅動程序 3057次閱讀
- 深入了解USB驅動之總線驅動程序 8685次閱讀
- Xilinx設備的驅動程序 7967次閱讀
- PCI驅動程序開發實例 6702次閱讀
下載排行
本周
- 1電子電路原理第七版PDF電子教材免費下載
- 0.00 MB | 1491次下載 | 免費
- 2單片機典型實例介紹
- 18.19 MB | 95次下載 | 1 積分
- 3S7-200PLC編程實例詳細資料
- 1.17 MB | 27次下載 | 1 積分
- 4筆記本電腦主板的元件識別和講解說明
- 4.28 MB | 18次下載 | 4 積分
- 5開關電源原理及各功能電路詳解
- 0.38 MB | 11次下載 | 免費
- 6100W短波放大電路圖
- 0.05 MB | 4次下載 | 3 積分
- 7基于單片機和 SG3525的程控開關電源設計
- 0.23 MB | 4次下載 | 免費
- 8基于AT89C2051/4051單片機編程器的實驗
- 0.11 MB | 4次下載 | 免費
本月
- 1OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234313次下載 | 免費
- 2PADS 9.0 2009最新版 -下載
- 0.00 MB | 66304次下載 | 免費
- 3protel99下載protel99軟件下載(中文版)
- 0.00 MB | 51209次下載 | 免費
- 4LabView 8.0 專業版下載 (3CD完整版)
- 0.00 MB | 51043次下載 | 免費
- 5555集成電路應用800例(新編版)
- 0.00 MB | 33562次下載 | 免費
- 6接口電路圖大全
- 未知 | 30320次下載 | 免費
- 7Multisim 10下載Multisim 10 中文版
- 0.00 MB | 28588次下載 | 免費
- 8開關電源設計實例指南
- 未知 | 21539次下載 | 免費
總榜
- 1matlab軟件下載入口
- 未知 | 935053次下載 | 免費
- 2protel99se軟件下載(可英文版轉中文版)
- 78.1 MB | 537793次下載 | 免費
- 3MATLAB 7.1 下載 (含軟件介紹)
- 未知 | 420026次下載 | 免費
- 4OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234313次下載 | 免費
- 5Altium DXP2002下載入口
- 未知 | 233046次下載 | 免費
- 6電路仿真軟件multisim 10.0免費下載
- 340992 | 191183次下載 | 免費
- 7十天學會AVR單片機與C語言視頻教程 下載
- 158M | 183277次下載 | 免費
- 8proe5.0野火版下載(中文版免費下載)
- 未知 | 138039次下載 | 免費
評論
查看更多