summaryrefslogtreecommitdiff
path: root/firmware/target/arm/samsung
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/samsung')
-rw-r--r--firmware/target/arm/samsung/button-target.h13
-rw-r--r--firmware/target/arm/samsung/button-yh82x_yh92x.c23
2 files changed, 36 insertions, 0 deletions
diff --git a/firmware/target/arm/samsung/button-target.h b/firmware/target/arm/samsung/button-target.h
index 400c4ed768..5ccf2adace 100644
--- a/firmware/target/arm/samsung/button-target.h
+++ b/firmware/target/arm/samsung/button-target.h
@@ -39,9 +39,22 @@ void remote_int(void);
39#define BUTTON_PLAY 0x00000010 39#define BUTTON_PLAY 0x00000010
40#define BUTTON_REW 0x00000020 40#define BUTTON_REW 0x00000020
41#define BUTTON_FFWD 0x00000040 41#define BUTTON_FFWD 0x00000040
42#if defined(SAMSUNG_YH820) /* YH820 has record button */
42#define BUTTON_REC 0x00000080 43#define BUTTON_REC 0x00000080
44#else /* virtual buttons for record switch state change on YH92x */
45#define BUTTON_REC_SW_ON 0x00000080
46#define BUTTON_REC_SW_OFF 0x00000100
47/* TODO: most of the plugin keymaps rely on the REC button,
48 so I kept the following line to prevent compile errors.
49 This line has to be removed as soon as all plugin keymaps are fixed! */
50#define BUTTON_REC 0x00000200
51#endif
43 52
53#if defined(SAMSUNG_YH820)
44#define BUTTON_MAIN 0x000000ff 54#define BUTTON_MAIN 0x000000ff
55#else
56#define BUTTON_MAIN 0x000001ff
57#endif
45 58
46#define BUTTON_RC_PLUS BUTTON_UP 59#define BUTTON_RC_PLUS BUTTON_UP
47#define BUTTON_RC_MINUS BUTTON_DOWN 60#define BUTTON_RC_MINUS BUTTON_DOWN
diff --git a/firmware/target/arm/samsung/button-yh82x_yh92x.c b/firmware/target/arm/samsung/button-yh82x_yh92x.c
index 2874a4a48a..ff8a580d2a 100644
--- a/firmware/target/arm/samsung/button-yh82x_yh92x.c
+++ b/firmware/target/arm/samsung/button-yh82x_yh92x.c
@@ -20,12 +20,15 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22#include "system.h" 22#include "system.h"
23#include "kernel.h"
23#include "button.h" 24#include "button.h"
24#include "backlight.h" 25#include "backlight.h"
25#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 26#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
27#include "powermgmt.h"
26#include "adc.h" 28#include "adc.h"
27 29
28static int int_btn = BUTTON_NONE; 30static int int_btn = BUTTON_NONE;
31static unsigned int rec_switch;
29 32
30void button_init_device(void) 33void button_init_device(void)
31{ 34{
@@ -44,6 +47,9 @@ void button_init_device(void)
44 /* remote PLAY */ 47 /* remote PLAY */
45 GPIOD_ENABLE |= 0x02; 48 GPIOD_ENABLE |= 0x02;
46 GPIOD_OUTPUT_EN &= ~0x02; 49 GPIOD_OUTPUT_EN &= ~0x02;
50
51 /* current record switch state */
52 rec_switch = ~GPIOA_INPUT_VAL & 0x40;
47} 53}
48 54
49/* Remote buttons */ 55/* Remote buttons */
@@ -117,7 +123,24 @@ int button_read_device(void)
117 if (~GPIOA_INPUT_VAL & 0x08) btn |= BUTTON_DOWN; 123 if (~GPIOA_INPUT_VAL & 0x08) btn |= BUTTON_DOWN;
118 if (~GPIOA_INPUT_VAL & 0x02) btn |= BUTTON_FFWD; 124 if (~GPIOA_INPUT_VAL & 0x02) btn |= BUTTON_FFWD;
119 if (~GPIOA_INPUT_VAL & 0x80) btn |= BUTTON_REW; 125 if (~GPIOA_INPUT_VAL & 0x80) btn |= BUTTON_REW;
126#if defined(SAMSUNG_YH820)
120 if (~GPIOA_INPUT_VAL & 0x40) btn |= BUTTON_REC; 127 if (~GPIOA_INPUT_VAL & 0x40) btn |= BUTTON_REC;
128#else
129 if ((~GPIOA_INPUT_VAL & 0x40) != rec_switch)
130 {
131 if (rec_switch) {
132 queue_post(&button_queue,BUTTON_REC_SW_OFF,0);
133 queue_post(&button_queue,BUTTON_REC_SW_OFF|BUTTON_REL,0);
134 }
135 else {
136 queue_post(&button_queue,BUTTON_REC_SW_ON,0);
137 queue_post(&button_queue,BUTTON_REC_SW_ON|BUTTON_REL,0);
138 }
139 rec_switch = ~GPIOA_INPUT_VAL & 0x40;
140 backlight_on();
141 reset_poweroff_timer();
142 }
143#endif
121#if defined(SAMSUNG_YH820) 144#if defined(SAMSUNG_YH820)
122 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY; 145 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY;
123#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 146#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)