forked from len0rd/rockbox
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
This commit is contained in:
parent
179afba31e
commit
8a36f0bad4
4 changed files with 40 additions and 24 deletions
|
@ -580,6 +580,27 @@ int touchpad_read_device(char *data, int len)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int touchpad_set_parameter(char par_nr, unsigned int param)
|
||||||
|
{
|
||||||
|
char data[4];
|
||||||
|
int val=0;
|
||||||
|
|
||||||
|
if (syn_status)
|
||||||
|
{
|
||||||
|
syn_enable_int(false);
|
||||||
|
|
||||||
|
data[0]=0x03; /* header - addr:0,global:0,control:0,len:3 */
|
||||||
|
data[1]=0x40+par_nr; /* parameter number */
|
||||||
|
data[2]=(param >> 8) & 0xff; /* param_hi */
|
||||||
|
data[3]=param & 0xff; /* param_lo */
|
||||||
|
syn_send(data,4);
|
||||||
|
val=syn_read(data,1); /* get the simple ACK = 0x18 */
|
||||||
|
|
||||||
|
syn_enable_int(true);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
int touchpad_set_buttonlights(unsigned int led_mask, char brightness)
|
int touchpad_set_buttonlights(unsigned int led_mask, char brightness)
|
||||||
{
|
{
|
||||||
char data[6];
|
char data[6];
|
||||||
|
@ -588,26 +609,7 @@ int touchpad_set_buttonlights(unsigned int led_mask, char brightness)
|
||||||
if (syn_status)
|
if (syn_status)
|
||||||
{
|
{
|
||||||
syn_enable_int(false);
|
syn_enable_int(false);
|
||||||
#if defined(PBELL_VIBE500)
|
|
||||||
/* In Packard Bell Vibe 500 leds are controlled through the MEP parameters 0x62 - 0x63
|
|
||||||
There is no 0x31 order - grup led control */
|
|
||||||
|
|
||||||
/* Make sure we have a led_block_mask = 0 - obtained experimentally */
|
|
||||||
data[0] = 0x03; /* header - addr:0,global:0,control:0,len:3 */
|
|
||||||
data[1] = 0x63; /* parameter nr: 0x23 (-0x40) - led_block_mask */
|
|
||||||
data[2] = 0x00; /* par_hi = 0 */
|
|
||||||
data[3] = 0x00; /* par_lo = 0 */
|
|
||||||
syn_send(data,4);
|
|
||||||
val = syn_read(data, 1); /* get the simple ACK = 0x18 */
|
|
||||||
|
|
||||||
/* Turn on/off the lights (there is no brightness control) - obtained experimentally */
|
|
||||||
data[0] = 0x03; /* header - addr:0,global:0,control:0,len:3 */
|
|
||||||
data[1] = 0x62; /* parameter nr: 0x22 (-0x40) - led_mask */
|
|
||||||
data[2] = 0x00; /* par_hi = 0 */
|
|
||||||
data[3] = (led_mask & 0x0f) | (brightness&0); /* par_lo = led_mask */
|
|
||||||
syn_send(data,4);
|
|
||||||
val = syn_read(data, 1); /* get the simple ACK = 0x18 */
|
|
||||||
#else
|
|
||||||
/* turn on all touchpad leds */
|
/* turn on all touchpad leds */
|
||||||
data[0] = 0x05;
|
data[0] = 0x05;
|
||||||
data[1] = 0x31;
|
data[1] = 0x31;
|
||||||
|
@ -619,7 +621,7 @@ int touchpad_set_buttonlights(unsigned int led_mask, char brightness)
|
||||||
|
|
||||||
/* device responds with a single-byte ACK packet */
|
/* device responds with a single-byte ACK packet */
|
||||||
val = syn_read(data, 2);
|
val = syn_read(data, 2);
|
||||||
#endif
|
|
||||||
syn_enable_int(true);
|
syn_enable_int(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,5 +24,6 @@
|
||||||
int touchpad_init(void);
|
int touchpad_init(void);
|
||||||
int touchpad_read_device(char *data, int len);
|
int touchpad_read_device(char *data, int len);
|
||||||
int touchpad_set_buttonlights(unsigned int led_mask, char brightness);
|
int touchpad_set_buttonlights(unsigned int led_mask, char brightness);
|
||||||
|
int touchpad_set_parameter(char par_nr, unsigned int param);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,7 +64,7 @@ void _buttonlight_on(void)
|
||||||
{
|
{
|
||||||
if (!buttonlight_status)
|
if (!buttonlight_status)
|
||||||
{
|
{
|
||||||
touchpad_set_buttonlights(0x0f, 0);
|
touchpad_set_parameter(0x22, 0x000f); /* 0x22 - GPO_ENABLE */
|
||||||
buttonlight_status = 1;
|
buttonlight_status = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ void _buttonlight_off(void)
|
||||||
{
|
{
|
||||||
if (buttonlight_status)
|
if (buttonlight_status)
|
||||||
{
|
{
|
||||||
touchpad_set_buttonlights(0x00, 0);
|
touchpad_set_parameter(0x22, 0x0000); /* 0x22 - GPO_ENABLE */
|
||||||
buttonlight_status = 0;
|
buttonlight_status = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,8 @@ void _buttonlight_off(void)
|
||||||
void _buttonlight_set_brightness(int brightness)
|
void _buttonlight_set_brightness(int brightness)
|
||||||
{
|
{
|
||||||
/* no brightness control, but lights stays on - for compatibility */
|
/* no brightness control, but lights stays on - for compatibility */
|
||||||
touchpad_set_buttonlights(0x0f, brightness);
|
(void)brightness;
|
||||||
|
touchpad_set_parameter(0x22, 0x000f); /* 0x22 - GPO_ENABLE */
|
||||||
buttonlight_status = 1;
|
buttonlight_status = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,6 +46,18 @@ void power_init(void)
|
||||||
{
|
{
|
||||||
logf("touchpad not ready");
|
logf("touchpad not ready");
|
||||||
}
|
}
|
||||||
|
/* Max touch sensivity = 0x77, Rate=80/s,NoFilter=0,
|
||||||
|
KeyMatrix=0,Buttons=1,Relative=0,Absolute=1.
|
||||||
|
MEP parameter 0x20 - Report Modes */
|
||||||
|
touchpad_set_parameter(0x20,0x7785);
|
||||||
|
/* MinAbsReporting=0, NotAllCapButtons=0,SingleCapButton=0,
|
||||||
|
50msDebounce=0,MotionReporting=1 (reduce transmission overhead),
|
||||||
|
ClipZifnoFinger=0,DisableDeceleration=0,Dribble=0.
|
||||||
|
MEP parameter 0x21 - Enhanced Operating Configuration */
|
||||||
|
touchpad_set_parameter(0x21,0x0008);
|
||||||
|
/* Set the GPO_LEVEL = 0 - for the button lights */
|
||||||
|
touchpad_set_parameter(0x23,0x0000);
|
||||||
|
|
||||||
/* Sound unmute (on) */
|
/* Sound unmute (on) */
|
||||||
GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x10);
|
GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x10);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue