mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 23:29:46 +00:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: matrix_keypad - make matrix keymap size dynamic Input: wistron_btns - support Prestigio Wifi RF kill button Input: i8042 - add Asus G1S to noloop exception list
This commit is contained in:
commit
385861206c
@ -27,6 +27,7 @@ struct matrix_keypad {
|
|||||||
const struct matrix_keypad_platform_data *pdata;
|
const struct matrix_keypad_platform_data *pdata;
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
unsigned short *keycodes;
|
unsigned short *keycodes;
|
||||||
|
unsigned int row_shift;
|
||||||
|
|
||||||
uint32_t last_key_state[MATRIX_MAX_COLS];
|
uint32_t last_key_state[MATRIX_MAX_COLS];
|
||||||
struct delayed_work work;
|
struct delayed_work work;
|
||||||
@ -136,7 +137,7 @@ static void matrix_keypad_scan(struct work_struct *work)
|
|||||||
if ((bits_changed & (1 << row)) == 0)
|
if ((bits_changed & (1 << row)) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
code = (row << 4) + col;
|
code = MATRIX_SCAN_CODE(row, col, keypad->row_shift);
|
||||||
input_event(input_dev, EV_MSC, MSC_SCAN, code);
|
input_event(input_dev, EV_MSC, MSC_SCAN, code);
|
||||||
input_report_key(input_dev,
|
input_report_key(input_dev,
|
||||||
keypad->keycodes[code],
|
keypad->keycodes[code],
|
||||||
@ -317,6 +318,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
struct matrix_keypad *keypad;
|
struct matrix_keypad *keypad;
|
||||||
struct input_dev *input_dev;
|
struct input_dev *input_dev;
|
||||||
unsigned short *keycodes;
|
unsigned short *keycodes;
|
||||||
|
unsigned int row_shift;
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@ -332,14 +334,11 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!keymap_data->max_keymap_size) {
|
row_shift = get_count_order(pdata->num_col_gpios);
|
||||||
dev_err(&pdev->dev, "invalid keymap data supplied\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL);
|
keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL);
|
||||||
keycodes = kzalloc(keymap_data->max_keymap_size *
|
keycodes = kzalloc((pdata->num_row_gpios << row_shift) *
|
||||||
sizeof(keypad->keycodes),
|
sizeof(*keycodes),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
input_dev = input_allocate_device();
|
input_dev = input_allocate_device();
|
||||||
if (!keypad || !keycodes || !input_dev) {
|
if (!keypad || !keycodes || !input_dev) {
|
||||||
@ -350,6 +349,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
keypad->input_dev = input_dev;
|
keypad->input_dev = input_dev;
|
||||||
keypad->pdata = pdata;
|
keypad->pdata = pdata;
|
||||||
keypad->keycodes = keycodes;
|
keypad->keycodes = keycodes;
|
||||||
|
keypad->row_shift = row_shift;
|
||||||
keypad->stopped = true;
|
keypad->stopped = true;
|
||||||
INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan);
|
INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan);
|
||||||
spin_lock_init(&keypad->lock);
|
spin_lock_init(&keypad->lock);
|
||||||
@ -363,7 +363,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
input_dev->keycode = keycodes;
|
input_dev->keycode = keycodes;
|
||||||
input_dev->keycodesize = sizeof(*keycodes);
|
input_dev->keycodesize = sizeof(*keycodes);
|
||||||
input_dev->keycodemax = keymap_data->max_keymap_size;
|
input_dev->keycodemax = pdata->num_row_gpios << keypad->row_shift;
|
||||||
|
|
||||||
for (i = 0; i < keymap_data->keymap_size; i++) {
|
for (i = 0; i < keymap_data->keymap_size; i++) {
|
||||||
unsigned int key = keymap_data->keymap[i];
|
unsigned int key = keymap_data->keymap[i];
|
||||||
@ -371,7 +371,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
|
|||||||
unsigned int col = KEY_COL(key);
|
unsigned int col = KEY_COL(key);
|
||||||
unsigned short code = KEY_VAL(key);
|
unsigned short code = KEY_VAL(key);
|
||||||
|
|
||||||
keycodes[(row << 4) + col] = code;
|
keycodes[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
|
||||||
__set_bit(code, input_dev->keybit);
|
__set_bit(code, input_dev->keybit);
|
||||||
}
|
}
|
||||||
__clear_bit(KEY_RESERVED, input_dev->keybit);
|
__clear_bit(KEY_RESERVED, input_dev->keybit);
|
||||||
|
@ -611,6 +611,20 @@ static struct key_entry keymap_wistron_generic[] __initdata = {
|
|||||||
{ KE_END, 0 }
|
{ KE_END, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct key_entry keymap_prestigio[] __initdata = {
|
||||||
|
{ KE_KEY, 0x11, {KEY_PROG1} },
|
||||||
|
{ KE_KEY, 0x12, {KEY_PROG2} },
|
||||||
|
{ KE_WIFI, 0x30 },
|
||||||
|
{ KE_KEY, 0x22, {KEY_REWIND} },
|
||||||
|
{ KE_KEY, 0x23, {KEY_FORWARD} },
|
||||||
|
{ KE_KEY, 0x24, {KEY_PLAYPAUSE} },
|
||||||
|
{ KE_KEY, 0x25, {KEY_STOPCD} },
|
||||||
|
{ KE_KEY, 0x31, {KEY_MAIL} },
|
||||||
|
{ KE_KEY, 0x36, {KEY_WWW} },
|
||||||
|
{ KE_END, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If your machine is not here (which is currently rather likely), please send
|
* If your machine is not here (which is currently rather likely), please send
|
||||||
* a list of buttons and their key codes (reported when loading this module
|
* a list of buttons and their key codes (reported when loading this module
|
||||||
@ -971,6 +985,8 @@ static int __init select_keymap(void)
|
|||||||
if (keymap_name != NULL) {
|
if (keymap_name != NULL) {
|
||||||
if (strcmp (keymap_name, "1557/MS2141") == 0)
|
if (strcmp (keymap_name, "1557/MS2141") == 0)
|
||||||
keymap = keymap_wistron_ms2141;
|
keymap = keymap_wistron_ms2141;
|
||||||
|
else if (strcmp (keymap_name, "prestigio") == 0)
|
||||||
|
keymap = keymap_prestigio;
|
||||||
else if (strcmp (keymap_name, "generic") == 0)
|
else if (strcmp (keymap_name, "generic") == 0)
|
||||||
keymap = keymap_wistron_generic;
|
keymap = keymap_wistron_generic;
|
||||||
else {
|
else {
|
||||||
|
@ -77,6 +77,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
|
|||||||
DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
|
DMI_MATCH(DMI_BOARD_VERSION, "Rev E"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.ident = "ASUS G1S",
|
||||||
|
.matches = {
|
||||||
|
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
|
||||||
|
DMI_MATCH(DMI_BOARD_NAME, "G1S"),
|
||||||
|
DMI_MATCH(DMI_BOARD_VERSION, "1.0"),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
/* AUX LOOP command does not raise AUX IRQ */
|
/* AUX LOOP command does not raise AUX IRQ */
|
||||||
.ident = "ASUS P65UP5",
|
.ident = "ASUS P65UP5",
|
||||||
|
@ -15,12 +15,13 @@
|
|||||||
#define KEY_COL(k) (((k) >> 16) & 0xff)
|
#define KEY_COL(k) (((k) >> 16) & 0xff)
|
||||||
#define KEY_VAL(k) ((k) & 0xffff)
|
#define KEY_VAL(k) ((k) & 0xffff)
|
||||||
|
|
||||||
|
#define MATRIX_SCAN_CODE(row, col, row_shift) (((row) << (row_shift)) + (col))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct matrix_keymap_data - keymap for matrix keyboards
|
* struct matrix_keymap_data - keymap for matrix keyboards
|
||||||
* @keymap: pointer to array of uint32 values encoded with KEY() macro
|
* @keymap: pointer to array of uint32 values encoded with KEY() macro
|
||||||
* representing keymap
|
* representing keymap
|
||||||
* @keymap_size: number of entries (initialized) in this keymap
|
* @keymap_size: number of entries (initialized) in this keymap
|
||||||
* @max_keymap_size: maximum size of keymap supported by the device
|
|
||||||
*
|
*
|
||||||
* This structure is supposed to be used by platform code to supply
|
* This structure is supposed to be used by platform code to supply
|
||||||
* keymaps to drivers that implement matrix-like keypads/keyboards.
|
* keymaps to drivers that implement matrix-like keypads/keyboards.
|
||||||
@ -28,14 +29,13 @@
|
|||||||
struct matrix_keymap_data {
|
struct matrix_keymap_data {
|
||||||
const uint32_t *keymap;
|
const uint32_t *keymap;
|
||||||
unsigned int keymap_size;
|
unsigned int keymap_size;
|
||||||
unsigned int max_keymap_size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct matrix_keypad_platform_data - platform-dependent keypad data
|
* struct matrix_keypad_platform_data - platform-dependent keypad data
|
||||||
* @keymap_data: pointer to &matrix_keymap_data
|
* @keymap_data: pointer to &matrix_keymap_data
|
||||||
* @row_gpios: array of gpio numbers reporesenting rows
|
* @row_gpios: pointer to array of gpio numbers representing rows
|
||||||
* @col_gpios: array of gpio numbers reporesenting colums
|
* @col_gpios: pointer to array of gpio numbers reporesenting colums
|
||||||
* @num_row_gpios: actual number of row gpios used by device
|
* @num_row_gpios: actual number of row gpios used by device
|
||||||
* @num_col_gpios: actual number of col gpios used by device
|
* @num_col_gpios: actual number of col gpios used by device
|
||||||
* @col_scan_delay_us: delay, measured in microseconds, that is
|
* @col_scan_delay_us: delay, measured in microseconds, that is
|
||||||
@ -48,8 +48,9 @@ struct matrix_keymap_data {
|
|||||||
struct matrix_keypad_platform_data {
|
struct matrix_keypad_platform_data {
|
||||||
const struct matrix_keymap_data *keymap_data;
|
const struct matrix_keymap_data *keymap_data;
|
||||||
|
|
||||||
unsigned int row_gpios[MATRIX_MAX_ROWS];
|
const unsigned int *row_gpios;
|
||||||
unsigned int col_gpios[MATRIX_MAX_COLS];
|
const unsigned int *col_gpios;
|
||||||
|
|
||||||
unsigned int num_row_gpios;
|
unsigned int num_row_gpios;
|
||||||
unsigned int num_col_gpios;
|
unsigned int num_col_gpios;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user