summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233
diff options
context:
space:
mode:
authorLorenzo Miori <memoryS60@gmail.com>2017-05-06 15:10:48 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-05-16 12:10:50 +1000
commite9f7385bdfcec5b01e4342ba1c4bacefd95042f5 (patch)
treef36b2324f9d13ca800994961b96c62db98270d33 /firmware/target/arm/imx233
parent6e69e3adaa697dd8e7113dc2367cc44b0982086f (diff)
downloadrockbox-e9f7385bdfcec5b01e4342ba1c4bacefd95042f5.tar.gz
rockbox-e9f7385bdfcec5b01e4342ba1c4bacefd95042f5.zip
Samsung YP-Z5: keypad adaption to the new button API
After compiling the ypz5 target, I have discovered that the keypad system was refusing to compile, due to a much newer button API. This patch adapts the target to the current imx233 implementation. Additonally, some ADC button values have been re-adjusted. Change-Id: Ib9bfd6aeec5e9e8dfef5887c4147201dd9028a44
Diffstat (limited to 'firmware/target/arm/imx233')
-rw-r--r--firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
index c2e53117e5..91fe059c31 100644
--- a/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
+++ b/firmware/target/arm/imx233/samsung-ypz5/button-ypz5.c
@@ -26,6 +26,7 @@
26#include "power-imx233.h" 26#include "power-imx233.h"
27#include "button-lradc-imx233.h" 27#include "button-lradc-imx233.h"
28#include "button-target.h" 28#include "button-target.h"
29#include "button-imx233.h"
29 30
30#ifndef BOOTLOADER 31#ifndef BOOTLOADER
31#include "touchscreen.h" 32#include "touchscreen.h"
@@ -35,15 +36,21 @@
35#include "action.h" 36#include "action.h"
36#endif 37#endif
37 38
38struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = 39#define CHAN 0 /* ADC channel for the buttons */
40#define I_VDDIO 0 /* Mock button to define the relative voltage to compute voltage from ADC steps */
41
42struct imx233_button_map_t imx233_button_map[] =
39{ 43{
40 {455, BUTTON_VOL_UP}, 44 [I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3760), "vddio"), /* we need VDDIO for relative */
41 {900, BUTTON_VOL_DOWN}, 45 IMX233_BUTTON_(HOLD, GPIO(0, 13), "hold"),
42 {1410, BUTTON_BACK}, 46 IMX233_BUTTON(POWER, PSWITCH(1), "power"),
43 {1868, BUTTON_FF}, 47 IMX233_BUTTON(SELECT, PSWITCH(3), "select"),
44 {2311, BUTTON_REW}, 48 IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 485, I_VDDIO), "vol up"),
45 {2700, 0}, 49 IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 975, I_VDDIO), "vol down"),
46 {3300, IMX233_BUTTON_LRADC_END}, 50 IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1521, I_VDDIO), "back"),
51 IMX233_BUTTON(FF, LRADC_REL(CHAN, 2000, I_VDDIO), "ff"),
52 IMX233_BUTTON(REW, LRADC_REL(CHAN, 2480, I_VDDIO), "rew"),
53 IMX233_BUTTON_(END, END(), "")
47}; 54};
48 55
49#ifndef BOOTLOADER 56#ifndef BOOTLOADER
@@ -93,7 +100,8 @@ void touchpad_pin_setup(void)
93 100
94void button_init_device(void) 101void button_init_device(void)
95{ 102{
96 imx233_button_lradc_init(); 103 /* init button subsystem */
104 imx233_button_init();
97#ifndef BOOTLOADER 105#ifndef BOOTLOADER
98 touchpad_pin_setup(); 106 touchpad_pin_setup();
99 /* Now that is powered up, proceed with touchpad initialization */ 107 /* Now that is powered up, proceed with touchpad initialization */
@@ -102,11 +110,6 @@ void button_init_device(void)
102#endif /* BOOTLOADER */ 110#endif /* BOOTLOADER */
103} 111}
104 112
105bool button_hold(void)
106{
107 return imx233_button_lradc_hold();
108}
109
110/* X, Y, RadiusX, RadiusY */ 113/* X, Y, RadiusX, RadiusY */
111#define TOUCH_UP 2400, 1050, 650, 250 114#define TOUCH_UP 2400, 1050, 650, 250
112#define TOUCH_DOWN 2057, 3320, 500, 350 115#define TOUCH_DOWN 2057, 3320, 500, 350
@@ -123,13 +126,8 @@ int button_read_device(void)
123{ 126{
124 int res = 0; 127 int res = 0;
125 128
126 switch(imx233_power_read_pswitch())
127 {
128 case 1: res |= BUTTON_POWER; break;
129 case 3: res |= BUTTON_SELECT; break;
130 }
131
132#ifndef BOOTLOADER 129#ifndef BOOTLOADER
130 /* handle the touchpad events */
133 touching = imx233_touchscreen_get_touch(&last_x, &last_y); 131 touching = imx233_touchscreen_get_touch(&last_x, &last_y);
134 if(touching) 132 if(touching)
135 { 133 {
@@ -151,7 +149,8 @@ int button_read_device(void)
151 } 149 }
152 } 150 }
153#endif /* BOOTLOADER */ 151#endif /* BOOTLOADER */
154 return imx233_button_lradc_read(res); 152 /* handle the generic events */
153 return imx233_button_read(res);
155} 154}
156 155
157#ifndef BOOTLOADER 156#ifndef BOOTLOADER