Skip to content

Commit

Permalink
blade2: huge cleanup and update for new USB driver
Browse files Browse the repository at this point in the history
  • Loading branch information
Daz Jones committed Dec 28, 2012
1 parent f5e34b7 commit 3e2ed55
Show file tree
Hide file tree
Showing 4 changed files with 1,045 additions and 1,865 deletions.
12 changes: 1 addition & 11 deletions arch/arm/configs/blade2_jb_p736e_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1793,18 +1793,8 @@ CONFIG_USB_GADGET_DUALSPEED=y
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
CONFIG_USB_ANDROID=y
# CONFIG_USB_ANDROID_ACM is not set
CONFIG_USB_ANDROID_ADB=y
CONFIG_USB_ANDROID_DIAG=y
CONFIG_USB_ANDROID_MASS_STORAGE=y
CONFIG_USB_G_ANDROID=y
CONFIG_USB_CSW_HACK=y
# CONFIG_USB_ANDROID_MTP is not set
CONFIG_USB_ANDROID_RNDIS=y
# CONFIG_USB_ANDROID_RNDIS_WCEIS is not set
# CONFIG_USB_ANDROID_RMNET is not set
CONFIG_USB_F_SERIAL=y
CONFIG_MODEM_SUPPORT=y
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_NOKIA is not set
# CONFIG_USB_G_MULTI is not set
Expand Down
12 changes: 1 addition & 11 deletions arch/arm/configs/blade2_jb_p736v_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1793,18 +1793,8 @@ CONFIG_USB_GADGET_DUALSPEED=y
# CONFIG_USB_G_SERIAL is not set
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
CONFIG_USB_ANDROID=y
# CONFIG_USB_ANDROID_ACM is not set
CONFIG_USB_ANDROID_ADB=y
CONFIG_USB_ANDROID_DIAG=y
CONFIG_USB_ANDROID_MASS_STORAGE=y
CONFIG_USB_G_ANDROID=y
CONFIG_USB_CSW_HACK=y
# CONFIG_USB_ANDROID_MTP is not set
CONFIG_USB_ANDROID_RNDIS=y
# CONFIG_USB_ANDROID_RNDIS_WCEIS is not set
# CONFIG_USB_ANDROID_RMNET is not set
CONFIG_USB_F_SERIAL=y
CONFIG_MODEM_SUPPORT=y
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_NOKIA is not set
# CONFIG_USB_G_MULTI is not set
Expand Down
86 changes: 28 additions & 58 deletions arch/arm/mach-msm/board-zte-blade2-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,22 @@

#include <asm/mach-types.h>


//static unsigned int keypad_row_gpios[] = {33, 31, 28};
static unsigned int keypad_row_gpios[] = {34, 28, 33};
static unsigned int keypad_col_gpios[] = {37, 41, 40};
static unsigned int keypad_row_gpios[] = {34, 28, 33};
static unsigned int keypad_col_gpios[] = {37, 41, 40};

#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(keypad_col_gpios) + (col))

#if 0
static const unsigned short keypad_keymap_blade2[ARRAY_SIZE(keypad_col_gpios) *
ARRAY_SIZE(keypad_row_gpios)] = {
/* row, col */
[KEYMAP_INDEX(0, 0)] = KEY_BACK,
[KEYMAP_INDEX(0, 1)] = 0,
[KEYMAP_INDEX(0, 2)] = KEY_MENU,
[KEYMAP_INDEX(1, 0)] = 0,
[KEYMAP_INDEX(1, 1)] = 0,
[KEYMAP_INDEX(1, 2)] = KEY_HOME,
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
[KEYMAP_INDEX(2, 1)] = KEY_VOLUMEDOWN,
[KEYMAP_INDEX(2, 2)] = 0,
};
#endif
static const unsigned short keypad_keymap_blade2[ARRAY_SIZE(keypad_col_gpios) *
ARRAY_SIZE(keypad_row_gpios)] = {
/* row, col */
[KEYMAP_INDEX(0, 0)] = 0,
ARRAY_SIZE(keypad_row_gpios)] = {
[KEYMAP_INDEX(0, 0)] = 0,
[KEYMAP_INDEX(0, 1)] = 0,
[KEYMAP_INDEX(0, 2)] = KEY_MENU,
[KEYMAP_INDEX(1, 0)] = KEY_VOLUMEUP,
[KEYMAP_INDEX(1, 1)] = KEY_VOLUMEDOWN,
[KEYMAP_INDEX(1, 1)] = KEY_VOLUMEDOWN,
[KEYMAP_INDEX(1, 2)] = 0,
[KEYMAP_INDEX(2, 0)] = KEY_BACK,
[KEYMAP_INDEX(2, 1)] = 0,
[KEYMAP_INDEX(2, 2)] =KEY_HOME,
[KEYMAP_INDEX(2, 1)] = 0,
[KEYMAP_INDEX(2, 2)] = KEY_HOME,
};

static const unsigned short blade2_keypad_virtual_keys[] = {
Expand All @@ -62,46 +44,37 @@ static const unsigned short blade2_keypad_virtual_keys[] = {
const unsigned short *p_keypad_keymap;
void zte_get_gpio_for_key(int *keycode)
{
int gpio_wakeup_col; //which col the gpio is in keypad_col_gpios
int gpio_wakeup_col; //which col the gpio is in keypad_col_gpios
int col_array_size = ARRAY_SIZE(keypad_col_gpios);
int r=0;
int keymap_index= 0;
int r = 0;
int keymap_index = 0;
pr_info("[IRQWAKE] wakeup APP keycode %d\n",*keycode);
while((*keycode != p_keypad_keymap[keymap_index]) && keymap_index <= (ARRAY_SIZE(keypad_col_gpios) * ARRAY_SIZE(keypad_row_gpios)))
{
keymap_index ++;
keymap_index++;
}

//pr_info("[IRQWAKE] keymap_index %d\n",keymap_index);

do{
do {
gpio_wakeup_col = keymap_index - r * col_array_size;
r++;
}while(gpio_wakeup_col > col_array_size);

//pr_info("[IRQWAKE] gpio_col %d\n",gpio_wakeup_col);
} while(gpio_wakeup_col > col_array_size);

*keycode = keypad_col_gpios[gpio_wakeup_col];
pr_info("[IRQWAKE] wakeup gpio_num %d\n",*keycode);

pr_info("[IRQWAKE] wakeup gpio_num %d\n", *keycode);
}

#endif

/* blade2 keypad platform device information */
static struct gpio_event_matrix_info blade2_keypad_matrix_info = {
.info.func = gpio_event_matrix_func,
.keymap = keypad_keymap_blade2,
.info.func = gpio_event_matrix_func,
.keymap = keypad_keymap_blade2,
.output_gpios = keypad_row_gpios,
.input_gpios = keypad_col_gpios,
.noutputs = ARRAY_SIZE(keypad_row_gpios),
.ninputs = ARRAY_SIZE(keypad_col_gpios),
.settle_time.tv.nsec = 0,
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
#if 1 // chenjun
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
GPIOKPF_PRINT_UNMAPPED_KEYS
#else
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | GPIOKPF_ACTIVE_HIGH | GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
#endif
.noutputs = ARRAY_SIZE(keypad_row_gpios),
.ninputs = ARRAY_SIZE(keypad_col_gpios),
.settle_time.tv.nsec = 0,
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | GPIOKPF_PRINT_UNMAPPED_KEYS
};

static struct gpio_event_info *blade2_keypad_info[] = {
Expand All @@ -116,26 +89,24 @@ static struct gpio_event_platform_data blade2_keypad_data = {

struct platform_device keypad_device_blade2 = {
.name = GPIO_EVENT_DEV_NAME,
.id = -1,
.id = -1,
.dev = {
.platform_data = &blade2_keypad_data,
},
};


#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
extern int zte_get_ftm_flag(void);
#endif

static int __init blade2_init_keypad(void)
{

#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
#ifdef CONFIG_ZTE_FTM_FLAG_SUPPORT
int ftm_flag;
ftm_flag = zte_get_ftm_flag();
if (1 ==ftm_flag)return 0;
#endif
if (1 == ftm_flag) return 0;
#endif

blade2_keypad_matrix_info.keymap = keypad_keymap_blade2;
#ifdef CONFIG_MSM_GPIO_WAKE
p_keypad_keymap = blade2_keypad_matrix_info.keymap;
Expand All @@ -144,4 +115,3 @@ static int __init blade2_init_keypad(void)
}

device_initcall(blade2_init_keypad);

Loading

0 comments on commit 3e2ed55

Please sign in to comment.