diff options
author | Szymon Dziok <b0hoon@o2.pl> | 2010-02-06 19:15:43 +0000 |
---|---|---|
committer | Szymon Dziok <b0hoon@o2.pl> | 2010-02-06 19:15:43 +0000 |
commit | 8a36f0bad4846b9e7d49b2c598c23c0443c2d1b5 (patch) | |
tree | d1e93f78729f9b0124103dfd6c6dbcc90a62fc31 | |
parent | 179afba31e561c89833cbfdcf9af619f4739e887 (diff) | |
download | rockbox-8a36f0bad4846b9e7d49b2c598c23c0443c2d1b5.tar.gz rockbox-8a36f0bad4846b9e7d49b2c598c23c0443c2d1b5.zip |
Packard Bell Vibe 500: touchpad code rework. Improve touch sensivity a bit by setting the MEP parameters in the power_init() function. Implement new function in synaptics-mep driver (touchpad_set_parameter) necessary for it. Move the button lights code to the target backlight file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24541 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/synaptics-mep.c | 42 | ||||
-rw-r--r-- | firmware/export/synaptics-mep.h | 1 | ||||
-rw-r--r-- | firmware/target/arm/pbell/vibe500/backlight-vibe500.c | 9 | ||||
-rw-r--r-- | firmware/target/arm/pbell/vibe500/power-vibe500.c | 12 |
4 files changed, 40 insertions, 24 deletions
diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c index 87b78d09c1..d200e7ca79 100644 --- a/firmware/drivers/synaptics-mep.c +++ b/firmware/drivers/synaptics-mep.c | |||
@@ -580,6 +580,27 @@ int touchpad_read_device(char *data, int len) | |||
580 | return val; | 580 | return val; |
581 | } | 581 | } |
582 | 582 | ||
583 | int touchpad_set_parameter(char par_nr, unsigned int param) | ||
584 | { | ||
585 | char data[4]; | ||
586 | int val=0; | ||
587 | |||
588 | if (syn_status) | ||
589 | { | ||
590 | syn_enable_int(false); | ||
591 | |||
592 | data[0]=0x03; /* header - addr:0,global:0,control:0,len:3 */ | ||
593 | data[1]=0x40+par_nr; /* parameter number */ | ||
594 | data[2]=(param >> 8) & 0xff; /* param_hi */ | ||
595 | data[3]=param & 0xff; /* param_lo */ | ||
596 | syn_send(data,4); | ||
597 | val=syn_read(data,1); /* get the simple ACK = 0x18 */ | ||
598 | |||
599 | syn_enable_int(true); | ||
600 | } | ||
601 | return val; | ||
602 | } | ||
603 | |||
583 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness) | 604 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness) |
584 | { | 605 | { |
585 | char data[6]; | 606 | char data[6]; |
@@ -588,26 +609,7 @@ int touchpad_set_buttonlights(unsigned int led_mask, char brightness) | |||
588 | if (syn_status) | 609 | if (syn_status) |
589 | { | 610 | { |
590 | syn_enable_int(false); | 611 | syn_enable_int(false); |
591 | #if defined(PBELL_VIBE500) | ||
592 | /* In Packard Bell Vibe 500 leds are controlled through the MEP parameters 0x62 - 0x63 | ||
593 | There is no 0x31 order - grup led control */ | ||
594 | |||
595 | /* Make sure we have a led_block_mask = 0 - obtained experimentally */ | ||
596 | data[0] = 0x03; /* header - addr:0,global:0,control:0,len:3 */ | ||
597 | data[1] = 0x63; /* parameter nr: 0x23 (-0x40) - led_block_mask */ | ||
598 | data[2] = 0x00; /* par_hi = 0 */ | ||
599 | data[3] = 0x00; /* par_lo = 0 */ | ||
600 | syn_send(data,4); | ||
601 | val = syn_read(data, 1); /* get the simple ACK = 0x18 */ | ||
602 | 612 | ||
603 | /* Turn on/off the lights (there is no brightness control) - obtained experimentally */ | ||
604 | data[0] = 0x03; /* header - addr:0,global:0,control:0,len:3 */ | ||
605 | data[1] = 0x62; /* parameter nr: 0x22 (-0x40) - led_mask */ | ||
606 | data[2] = 0x00; /* par_hi = 0 */ | ||
607 | data[3] = (led_mask & 0x0f) | (brightness&0); /* par_lo = led_mask */ | ||
608 | syn_send(data,4); | ||
609 | val = syn_read(data, 1); /* get the simple ACK = 0x18 */ | ||
610 | #else | ||
611 | /* turn on all touchpad leds */ | 613 | /* turn on all touchpad leds */ |
612 | data[0] = 0x05; | 614 | data[0] = 0x05; |
613 | data[1] = 0x31; | 615 | data[1] = 0x31; |
@@ -619,7 +621,7 @@ int touchpad_set_buttonlights(unsigned int led_mask, char brightness) | |||
619 | 621 | ||
620 | /* device responds with a single-byte ACK packet */ | 622 | /* device responds with a single-byte ACK packet */ |
621 | val = syn_read(data, 2); | 623 | val = syn_read(data, 2); |
622 | #endif | 624 | |
623 | syn_enable_int(true); | 625 | syn_enable_int(true); |
624 | } | 626 | } |
625 | 627 | ||
diff --git a/firmware/export/synaptics-mep.h b/firmware/export/synaptics-mep.h index 225891383e..aa45e70475 100644 --- a/firmware/export/synaptics-mep.h +++ b/firmware/export/synaptics-mep.h | |||
@@ -24,5 +24,6 @@ | |||
24 | int touchpad_init(void); | 24 | int touchpad_init(void); |
25 | int touchpad_read_device(char *data, int len); | 25 | int touchpad_read_device(char *data, int len); |
26 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness); | 26 | int touchpad_set_buttonlights(unsigned int led_mask, char brightness); |
27 | int touchpad_set_parameter(char par_nr, unsigned int param); | ||
27 | 28 | ||
28 | #endif | 29 | #endif |
diff --git a/firmware/target/arm/pbell/vibe500/backlight-vibe500.c b/firmware/target/arm/pbell/vibe500/backlight-vibe500.c index 727370633b..321484cd9a 100644 --- a/firmware/target/arm/pbell/vibe500/backlight-vibe500.c +++ b/firmware/target/arm/pbell/vibe500/backlight-vibe500.c | |||
@@ -64,16 +64,16 @@ void _buttonlight_on(void) | |||
64 | { | 64 | { |
65 | if (!buttonlight_status) | 65 | if (!buttonlight_status) |
66 | { | 66 | { |
67 | touchpad_set_buttonlights(0x0f, 0); | 67 | touchpad_set_parameter(0x22, 0x000f); /* 0x22 - GPO_ENABLE */ |
68 | buttonlight_status = 1; | 68 | buttonlight_status = 1; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | void _buttonlight_off(void) | 72 | void _buttonlight_off(void) |
73 | { | 73 | { |
74 | if (buttonlight_status) | 74 | if (buttonlight_status) |
75 | { | 75 | { |
76 | touchpad_set_buttonlights(0x00, 0); | 76 | touchpad_set_parameter(0x22, 0x0000); /* 0x22 - GPO_ENABLE */ |
77 | buttonlight_status = 0; | 77 | buttonlight_status = 0; |
78 | } | 78 | } |
79 | } | 79 | } |
@@ -81,7 +81,8 @@ void _buttonlight_off(void) | |||
81 | void _buttonlight_set_brightness(int brightness) | 81 | void _buttonlight_set_brightness(int brightness) |
82 | { | 82 | { |
83 | /* no brightness control, but lights stays on - for compatibility */ | 83 | /* no brightness control, but lights stays on - for compatibility */ |
84 | touchpad_set_buttonlights(0x0f, brightness); | 84 | (void)brightness; |
85 | touchpad_set_parameter(0x22, 0x000f); /* 0x22 - GPO_ENABLE */ | ||
85 | buttonlight_status = 1; | 86 | buttonlight_status = 1; |
86 | } | 87 | } |
87 | #endif | 88 | #endif |
diff --git a/firmware/target/arm/pbell/vibe500/power-vibe500.c b/firmware/target/arm/pbell/vibe500/power-vibe500.c index e55c69e033..45ab7fb1fd 100644 --- a/firmware/target/arm/pbell/vibe500/power-vibe500.c +++ b/firmware/target/arm/pbell/vibe500/power-vibe500.c | |||
@@ -46,6 +46,18 @@ void power_init(void) | |||
46 | { | 46 | { |
47 | logf("touchpad not ready"); | 47 | logf("touchpad not ready"); |
48 | } | 48 | } |
49 | /* Max touch sensivity = 0x77, Rate=80/s,NoFilter=0, | ||
50 | KeyMatrix=0,Buttons=1,Relative=0,Absolute=1. | ||
51 | MEP parameter 0x20 - Report Modes */ | ||
52 | touchpad_set_parameter(0x20,0x7785); | ||
53 | /* MinAbsReporting=0, NotAllCapButtons=0,SingleCapButton=0, | ||
54 | 50msDebounce=0,MotionReporting=1 (reduce transmission overhead), | ||
55 | ClipZifnoFinger=0,DisableDeceleration=0,Dribble=0. | ||
56 | MEP parameter 0x21 - Enhanced Operating Configuration */ | ||
57 | touchpad_set_parameter(0x21,0x0008); | ||
58 | /* Set the GPO_LEVEL = 0 - for the button lights */ | ||
59 | touchpad_set_parameter(0x23,0x0000); | ||
60 | |||
49 | /* Sound unmute (on) */ | 61 | /* Sound unmute (on) */ |
50 | GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x10); | 62 | GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x10); |
51 | } | 63 | } |