This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | resources:tools-software:linux-drivers:multifunction-device:adp5520 [06 May 2011 23:25] – [Supported Devices] andyr | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== ADP5520/01 driver ====== | ||
+ | |||
+ | ===== Supported Devices ===== | ||
+ | |||
+ | The driver for the [[adi> | ||
+ | |||
+ | ===== 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. | ||
+ | |||
+ | < | ||
+ | digraph { | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== 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/ | ||
+ | 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/ | ||
+ | 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/ | ||
+ | |||
+ | LED: | ||
+ | * Up to 3 LEDs configurable | ||
+ | * Configurable Fade On/Off times | ||
+ | * LED Blink On/Off times | ||
+ | * Configurable Brightness/ | ||
+ | |||
+ | | ||
+ | * 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 ===== | ||
+ | |||
+ | ^ Source | ||
+ | | [[bfgit> | ||
+ | |||
+ | |||
+ | ===== Files ===== | ||
+ | |||
+ | ^ Function ^ File ^ | ||
+ | | MFD-CORE | ||
+ | | include | ||
+ | | BACKLIGHT | [[git.linux.org> | ||
+ | | LED | [[git.linux.org> | ||
+ | | GPIO | [[git.linux.org> | ||
+ | | KEYPAD | ||
+ | |||
+ | ====== Example platform device initialization ====== | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | <note important> | ||
+ | Since Keypad, GPIO and optional LEDs (2, 3) are multiplexed, | ||
+ | </ | ||
+ | |||
+ | ^ 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 | | ||
+ | |||
+ | <note tip> | ||
+ | Please refer to [[git.linux.org> | ||
+ | </ | ||
+ | |||
+ | ==== Backlight ===== | ||
+ | |||
+ | <source trunk/ | ||
+ | |||
+ | ==== LED ===== | ||
+ | |||
+ | <source trunk/ | ||
+ | |||
+ | <source trunk/ | ||
+ | |||
+ | ==== GPIO ===== | ||
+ | |||
+ | <source trunk/ | ||
+ | |||
+ | ==== Keypad ===== | ||
+ | |||
+ | <source trunk/ | ||
+ | <source trunk/ | ||
+ | |||
+ | |||
+ | ==== ADP5520/ | ||
+ | |||
+ | {{page> | ||
+ | |||
+ | <source trunk/ | ||
+ | <source trunk/ | ||
+ | |||
+ | <note tip> | ||
+ | **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 | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | ==== LED ===== | ||
+ | |||
+ | < | ||
+ | Device Drivers | ||
+ | [*] LED Support | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | ==== GPIO ===== | ||
+ | |||
+ | < | ||
+ | Device Drivers | ||
+ | [*] GPIO Support | ||
+ | [*] / | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | ==== Keypad ===== | ||
+ | |||
+ | < | ||
+ | Device Drivers | ||
+ | Input device support | ||
+ | <*> Generic input layer (needed for keyboard, mouse, ...) | ||
+ | < | ||
+ | [*] | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | ====== Hardware configuration ====== | ||
+ | |||
+ | {{: | ||
+ | |||
+ | There is no dedicated Blackfin STAMP evaluation board for the ADP5520. | ||
+ | During test and driver development we used the ADP5520 Demo Mother/ | ||
+ | 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 | ||
+ | ^ PIN ^ Function ^ PIN/ | ||
+ | | 5 | SCL | SCL | | ||
+ | | 6 | SDA| SDA | | ||
+ | | 10 | GPIO_PG0 | nINT | | ||
+ | | 20 | GND | GND | | ||
+ | |||
+ | |||
+ | ====== Driver testing ====== | ||
+ | |||
+ | |||
+ | ==== Backlight ===== | ||
+ | |||
+ | < | ||
+ | root:/> **modprobe adp5520_bl** | ||
+ | root:/> | ||
+ | |||
+ | root:/> cd sys/ | ||
+ | root:/ | ||
+ | -r--r--r-- | ||
+ | -rw-r--r-- | ||
+ | -rw-r--r-- | ||
+ | -rw-rw-r-- | ||
+ | -rw-rw-r-- | ||
+ | -rw-rw-r-- | ||
+ | -rw-rw-r-- | ||
+ | lrwxrwxrwx | ||
+ | -r--r--r-- | ||
+ | -rw-rw-r-- | ||
+ | -rw-rw-r-- | ||
+ | drwxr-xr-x | ||
+ | lrwxrwxrwx | ||
+ | |||
+ | root:/ | ||
+ | root:/ | ||
+ | root:/ | ||
+ | </ | ||
+ | |||
+ | __**For more information on Backlight handling in Linux read:**__ [[git.linux.org> | ||
+ | |||
+ | ==== LED ===== | ||
+ | |||
+ | < | ||
+ | root:/> **modprobe leds-adp5520** | ||
+ | Registered led device: adp5520-led1 | ||
+ | Registered led device: adp5520-led2 | ||
+ | Registered led device: adp5520-led3 | ||
+ | |||
+ | root:/> cd sys/ | ||
+ | sys/ | ||
+ | sys/ | ||
+ | |||
+ | root:/> cd sys/ | ||
+ | root:/ | ||
+ | -rw-r--r-- | ||
+ | lrwxrwxrwx | ||
+ | drwxr-xr-x | ||
+ | lrwxrwxrwx | ||
+ | -rw-r--r-- | ||
+ | root:/ | ||
+ | root:/ | ||
+ | root:/ | ||
+ | |||
+ | root:/> **modprobe -r leds-adp5520** | ||
+ | root:/> | ||
+ | </ | ||
+ | |||
+ | __**For more information on LEDs handling in Linux read:**__ [[git.linux.org> | ||
+ | |||
+ | ==== GPIO ===== | ||
+ | < | ||
+ | root:/> **modprobe adp5520-gpio** | ||
+ | root:/> cd sys/ | ||
+ | root:/ | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | -r--r--r-- | ||
+ | drwxr-xr-x | ||
+ | lrwxrwxrwx | ||
+ | -rw-r--r-- | ||
+ | root:/ | ||
+ | root:/> | ||
+ | </ | ||
+ | Note that you will have to enable the event_test utility under " | ||
+ | < | ||
+ | --- Blackfin test programs | ||
+ | [*] Input event device test | ||
+ | </ | ||
+ | |||
+ | __**For more information on GPIO handling in Linux read:**__ [[git.linux.org> | ||
+ | |||
+ | |||
+ | ==== Keypad ===== | ||
+ | |||
+ | < | ||
+ | root:/> **modprobe adp5520-keys** | ||
+ | input: adp5520-keys as / | ||
+ | |||
+ | root:/> **event_test / | ||
+ | Input driver version is 1.0.0 | ||
+ | Input device ID: bus 0x18 vendor 0x1 product 0x5520 version 0x1 | ||
+ | Input device name: " | ||
+ | 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, | ||
+ | Event: time 1415788674.340000, | ||
+ | Event: time 1415788674.516000, | ||
+ | Event: time 1415788674.516000, | ||
+ | Event: time 1415788674.912000, | ||
+ | Event: time 1415788674.912000, | ||
+ | Event: time 1415788675.140000, | ||
+ | Event: time 1415788675.140000, | ||
+ | Event: time 1415788675.892000, | ||
+ | Event: time 1415788675.892000, | ||
+ | Event: time 1415788676.092000, | ||
+ | Event: time 1415788676.092000, | ||
+ | |||
+ | root:/> **modprobe -r adp5520-keys** | ||
+ | root:/> | ||
+ | </ | ||
+ | |||
+ | __**For more information on Input handling in Linux read:**__ [[git.linux.org> | ||