mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 05:32:40 -05:00
fuzeplus: switch to new button driver
Change-Id: Ida1e5b4913131ec671b2d713743e26a28fca6a25
This commit is contained in:
parent
4e3e3badcf
commit
c6caf58407
1 changed files with 24 additions and 54 deletions
|
|
@ -27,10 +27,18 @@
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "power-imx233.h"
|
#include "button-imx233.h"
|
||||||
#include "touchpad.h"
|
#include "touchpad.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
|
struct imx233_button_map_t imx233_button_map[] =
|
||||||
|
{
|
||||||
|
IMX233_BUTTON(VOL_DOWN, GPIO(1, 30), "vol_down", INVERTED),
|
||||||
|
IMX233_BUTTON(POWER, PSWITCH(1), "power"),
|
||||||
|
IMX233_BUTTON(VOL_UP, PSWITCH(3), "vol_up"),
|
||||||
|
IMX233_BUTTON_(END, END(), "")
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
|
|
||||||
bool button_debug_screen(void)
|
bool button_debug_screen(void)
|
||||||
|
|
@ -329,7 +337,7 @@ static void rmi_thread(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void button_init_device(void)
|
static void touchpad_init(void)
|
||||||
{
|
{
|
||||||
/* Synaptics TouchPad information:
|
/* Synaptics TouchPad information:
|
||||||
* - product id: 1533
|
* - product id: 1533
|
||||||
|
|
@ -349,13 +357,8 @@ void button_init_device(void)
|
||||||
* - Maximum X: 3009
|
* - Maximum X: 3009
|
||||||
* - Maxumum Y: 1974
|
* - Maxumum Y: 1974
|
||||||
* - Resolution: 82
|
* - Resolution: 82
|
||||||
*
|
|
||||||
* ATTENTION line: B0P27 asserted low
|
|
||||||
*
|
|
||||||
* The B0P26 line seems to be related to the touchpad
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* touchpad power */
|
|
||||||
imx233_pinctrl_acquire(0, 26, "touchpad power");
|
imx233_pinctrl_acquire(0, 26, "touchpad power");
|
||||||
imx233_pinctrl_set_function(0, 26, PINCTRL_FUNCTION_GPIO);
|
imx233_pinctrl_set_function(0, 26, PINCTRL_FUNCTION_GPIO);
|
||||||
imx233_pinctrl_enable_gpio(0, 26, false);
|
imx233_pinctrl_enable_gpio(0, 26, false);
|
||||||
|
|
@ -385,58 +388,25 @@ void button_init_device(void)
|
||||||
imx233_pinctrl_set_function(0, 27, PINCTRL_FUNCTION_GPIO);
|
imx233_pinctrl_set_function(0, 27, PINCTRL_FUNCTION_GPIO);
|
||||||
imx233_pinctrl_enable_gpio(0, 27, false);
|
imx233_pinctrl_enable_gpio(0, 27, false);
|
||||||
imx233_pinctrl_setup_irq(0, 27, true, true, false, &rmi_attn_cb, 0);
|
imx233_pinctrl_setup_irq(0, 27, true, true, false, &rmi_attn_cb, 0);
|
||||||
/* Volume down */
|
|
||||||
imx233_pinctrl_acquire(1, 30, "volume down");
|
|
||||||
imx233_pinctrl_set_function(1, 30, PINCTRL_FUNCTION_GPIO);
|
|
||||||
imx233_pinctrl_enable_gpio(1, 30, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void button_init_device(void)
|
|
||||||
{
|
|
||||||
/* Volume down */
|
|
||||||
imx233_pinctrl_acquire(1, 30, "volume down");
|
|
||||||
imx233_pinctrl_set_function(1, 30, PINCTRL_FUNCTION_GPIO);
|
|
||||||
imx233_pinctrl_enable_gpio(1, 30, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int touchpad_read_device(void)
|
int touchpad_read_device(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void button_init_device(void)
|
||||||
|
{
|
||||||
|
#ifndef BOOTLOADER
|
||||||
|
touchpad_init();
|
||||||
|
#endif
|
||||||
|
/* generic */
|
||||||
|
imx233_button_init();
|
||||||
|
}
|
||||||
|
|
||||||
int button_read_device(void)
|
int button_read_device(void)
|
||||||
{
|
{
|
||||||
int res = 0;
|
return imx233_button_read(touchpad_filter(touchpad_read_device()));
|
||||||
if(!imx233_pinctrl_get_gpio(1, 30))
|
|
||||||
res |= BUTTON_VOL_DOWN;
|
|
||||||
/* The imx233 uses the voltage on the PSWITCH pin to detect power up/down
|
|
||||||
* events as well as recovery mode. Since the power button is the power button
|
|
||||||
* and the volume up button is recovery, it is not possible to know whether
|
|
||||||
* power button is down when volume up is down (except if there is another
|
|
||||||
* method but volume up and power don't seem to be wired to GPIO pins).
|
|
||||||
* As a probable consequence of that, it has been reported that pressing
|
|
||||||
* volume up sometimes return BUTTON_POWER instead of BUTTON_VOL_UP. The
|
|
||||||
* following volume_power_lock prevent BUTTON_POWER to happen if volume up
|
|
||||||
* has been send since a very short time. */
|
|
||||||
static int volume_power_lock = 0;
|
|
||||||
if(volume_power_lock > 0)
|
|
||||||
volume_power_lock--;
|
|
||||||
switch(BF_RD(POWER_STS, PSWITCH))
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
if(volume_power_lock == 0)
|
|
||||||
res |= BUTTON_POWER;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
res |= BUTTON_VOL_UP;
|
|
||||||
volume_power_lock = 5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return res | touchpad_filter(touchpad_read_device());
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue