Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
matrix_keypad.h File Reference
#include <linux/types.h>
#include <linux/input.h>
#include <linux/of.h>

Go to the source code of this file.

Data Structures

struct  matrix_keymap_data
 
struct  matrix_keypad_platform_data
 

Macros

#define MATRIX_MAX_ROWS   32
 
#define MATRIX_MAX_COLS   32
 
#define KEY(row, col, val)
 
#define KEY_ROW(k)   (((k) >> 24) & 0xff)
 
#define KEY_COL(k)   (((k) >> 16) & 0xff)
 
#define KEY_VAL(k)   ((k) & 0xffff)
 
#define MATRIX_SCAN_CODE(row, col, row_shift)   (((row) << (row_shift)) + (col))
 

Functions

int matrix_keypad_build_keymap (const struct matrix_keymap_data *keymap_data, const char *keymap_name, unsigned int rows, unsigned int cols, unsigned short *keymap, struct input_dev *input_dev)
 

Macro Definition Documentation

#define KEY (   row,
  col,
  val 
)
Value:
((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\
(((col) & (MATRIX_MAX_COLS - 1)) << 16) |\
((val) & 0xffff))

Definition at line 11 of file matrix_keypad.h.

#define KEY_COL (   k)    (((k) >> 16) & 0xff)

Definition at line 16 of file matrix_keypad.h.

#define KEY_ROW (   k)    (((k) >> 24) & 0xff)

Definition at line 15 of file matrix_keypad.h.

#define KEY_VAL (   k)    ((k) & 0xffff)

Definition at line 17 of file matrix_keypad.h.

#define MATRIX_MAX_COLS   32

Definition at line 9 of file matrix_keypad.h.

#define MATRIX_MAX_ROWS   32

Definition at line 8 of file matrix_keypad.h.

#define MATRIX_SCAN_CODE (   row,
  col,
  row_shift 
)    (((row) << (row_shift)) + (col))

Definition at line 19 of file matrix_keypad.h.

Function Documentation

int matrix_keypad_build_keymap ( const struct matrix_keymap_data keymap_data,
const char keymap_name,
unsigned int  rows,
unsigned int  cols,
unsigned short keymap,
struct input_dev *  input_dev 
)

matrix_keypad_build_keymap - convert platform keymap into matrix keymap : keymap supplied by the platform code : name of device tree property containing keymap (if device tree support is enabled). : number of rows in target keymap array : number of cols in target keymap array : expanded version of keymap that is suitable for use by matrix keyboard driver : input devices for which we are setting up the keymap

This function converts platform keymap (encoded with KEY() macro) into an array of keycodes that is suitable for using in a standard matrix keyboard driver that uses row and col as indices.

If is not supplied and device tree support is enabled it will attempt load the keymap from property specified by argument (or "linux,keymap" if is NULL).

Callers are expected to set up input_dev->dev.parent before calling this function.

Definition at line 129 of file matrix-keymap.c.