+ if (machine_is_omap_h6300() &&
+ ((col == 1) || (col == _H6300_JOYPAD_REPORT_COLUMN)))
+ {
+ if (col == _H6300_JOYPAD_REPORT_COLUMN)
+ {
+ continue;
+ }
+ if ((joypad_checked == 0) &&
+ ((key == _H6300_JOYPAD_KEY_OK) ||
+ (key == _h6300_JOYPAD_UP_LEFT) ||
+ (key == _H6300_JOYPAD_UP_RIGHT) ||
+ (key == _H6300_JOYPAD_DOWN_RIGHT) ||
+ (key == _h6300_JOYPAD_DOWN_LEFT)))
+ {
+ if (is_key_down(new_state, col, row))
+ {
+ /*
+ * only enter pressed
+ * 1 0 0 _H6300_JOYPAD_KEY_OK 0 0
+ * --> 100100 == 36
+ */
+ if (new_state[1] == 36)
+ {
+ joypad_checked = 1;
+ prevJoypadKeycodePressEmulated = KEY_ENTER;
+ new_state[_H6300_JOYPAD_REPORT_COLUMN] = 48; //110000
+ report_key = prevJoypadKeycodePressEmulated;
+ report_col = _H6300_JOYPAD_REPORT_COLUMN;
+ report_row = 4;
+ input_report_key(omap_kp_data->input,
+ report_key,
+ new_state[report_col] & (1 << report_row));
+ }
+ /*
+ * enter, up_left and up_right sensors pressed.
+ * 1 _H6300_JOYPAD_UP_RIGHT 0 _H6300_JOYPAD_KEY_OK 0 _h6300_JOYPAD_UP_LEFT
+ * --> 110101 == 53
+ * OR
+ * 1 KEY_UP_RIGHT 0 0 0 _h6300_JOYPAD_UP_LEFT
+ * --> 110001 == 42
+ * --> move to up
+ */
+ else if ((new_state[1] == 53) ||
+ (new_state[1] == 49))
+ {
+ joypad_checked = 1;
+ prevJoypadKeycodePressEmulated = KEY_UP;
+ new_state[_H6300_JOYPAD_REPORT_COLUMN] = 40; //101000
+ report_key = prevJoypadKeycodePressEmulated;
+ report_col = _H6300_JOYPAD_REPORT_COLUMN;
+ report_row = 3;
+ input_report_key(omap_kp_data->input,
+ report_key,
+ new_state[report_col] & (1 << report_row));
+ }
+ /*
+ * enter, down_left and down_right sensors pressed
+ * --> 101110 == 46
+ * OR
+ * down_left and down_right
+ * -->101010 == 42
+ * --> move to down
+ */
+ else if ((new_state[1] == 46) ||
+ (new_state[1] == 42))
+ {
+ joypad_checked = 1;
+ prevJoypadKeycodePressEmulated = KEY_DOWN;
+ new_state[_H6300_JOYPAD_REPORT_COLUMN] = 34; //100010
+ report_key = prevJoypadKeycodePressEmulated;
+ report_col = _H6300_JOYPAD_REPORT_COLUMN;
+ report_row = 1;
+ input_report_key(omap_kp_data->input,
+ report_key,
+ new_state[report_col] & (1 << report_row));
+ }
+ /*
+ * enter, up_right and down_right sensors pressed
+ * --> 111100 == 60
+ * or
+ * down_right and up_right
+ * --> 111000 == 56
+ * --> move to right
+ */
+ else if ((new_state[1] == 60) ||
+ (new_state[1] == 56))
+ {
+ joypad_checked = 1;
+ prevJoypadKeycodePressEmulated = KEY_RIGHT;
+ new_state[_H6300_JOYPAD_REPORT_COLUMN] = 33; //100001
+ report_key = prevJoypadKeycodePressEmulated;
+ report_col = _H6300_JOYPAD_REPORT_COLUMN;
+ report_row = 0;
+ input_report_key(omap_kp_data->input,
+ report_key,
+ new_state[report_col] & (1 << report_row));
+ }
+ /*
+ * enter, up_left and down_left sensors pressed
+ * --> 100111 == 39
+ * or up_left and down_left
+ * --> 100011 == 35
+ * --> move to left
+ */
+ else if ((new_state[1] == 39) ||
+ (new_state[1] == 35))
+ {
+ joypad_checked = 1;
+ prevJoypadKeycodePressEmulated = KEY_LEFT;
+ new_state[_H6300_JOYPAD_REPORT_COLUMN] = 36; //100100
+ report_key = prevJoypadKeycodePressEmulated;
+ report_col = _H6300_JOYPAD_REPORT_COLUMN;
+ report_row = 2;
+ input_report_key(omap_kp_data->input,
+ report_key,
+ new_state[report_col] & (1 << report_row));
+ }
+ else
+ {
+ //printk("missed new_state = %d\n", new_state[1]);
+ }
+ }
+ else
+ {
+ if (prevJoypadKeycodePressEmulated != 0)
+ {
+ // report key up event
+ joypad_checked = 1;
+ new_state[_H6300_JOYPAD_REPORT_COLUMN] = 32; //100000
+ report_key = prevJoypadKeycodePressEmulated;
+ report_col = _H6300_JOYPAD_REPORT_COLUMN;
+ switch(prevJoypadKeycodePressEmulated)
+ {
+ case KEY_RIGHT:
+ report_row = 0;
+ break;
+ case KEY_DOWN:
+ report_row = 1;
+ break;
+ case KEY_LEFT:
+ report_row = 2;
+ break;
+ case KEY_UP:
+ report_row = 3;
+ break;
+ case KEY_ENTER:
+ report_row = 4;
+ break;
+ default:
+ printk(KERN_WARNING "Unknown iPAQ h6300 column 1 key = %d released. This should newer happen!\n",
+ key);
+ report_row = 0;
+ }
+ input_report_key(omap_kp_data->input,
+ report_key,
+ new_state[report_col] & (1 << report_row));
+ prevJoypadKeycodePressEmulated = 0;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!(kp_cur_group == (key & GROUP_MASK) ||
+ kp_cur_group == -1))
+ continue;
+
+ kp_cur_group = key & GROUP_MASK;
+ input_report_key(omap_kp_data->input, key & ~GROUP_MASK,
+ !!(new_state[col] & (1 << row)));
+ }