summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/pp/system-pp502x.c4
-rw-r--r--firmware/target/arm/samsung/adc-target.h8
-rw-r--r--firmware/target/arm/samsung/button-target.h10
-rw-r--r--firmware/target/arm/samsung/button-yh82x_yh92x.c60
4 files changed, 75 insertions, 7 deletions
diff --git a/firmware/target/arm/pp/system-pp502x.c b/firmware/target/arm/pp/system-pp502x.c
index 697b52cf51..99b536e132 100644
--- a/firmware/target/arm/pp/system-pp502x.c
+++ b/firmware/target/arm/pp/system-pp502x.c
@@ -154,6 +154,10 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
154 else if (CPU_HI_INT_STAT & GPIO0_MASK) { 154 else if (CPU_HI_INT_STAT & GPIO0_MASK) {
155 if (GPIOD_INT_STAT & 0x10) 155 if (GPIOD_INT_STAT & 0x10)
156 usb_insert_int(); 156 usb_insert_int();
157#if !defined(SAMSUNG_YH820)
158 if (GPIOD_INT_STAT & 0x01)
159 remote_int();
160#endif
157 } 161 }
158/* end SAMSUNG_YHxxx */ 162/* end SAMSUNG_YHxxx */
159#elif defined(PBELL_VIBE500) 163#elif defined(PBELL_VIBE500)
diff --git a/firmware/target/arm/samsung/adc-target.h b/firmware/target/arm/samsung/adc-target.h
index 1f6a9dcb17..9cca223804 100644
--- a/firmware/target/arm/samsung/adc-target.h
+++ b/firmware/target/arm/samsung/adc-target.h
@@ -28,14 +28,10 @@
28#define ADC_CHANNEL_2 2 28#define ADC_CHANNEL_2 2
29#define ADC_CHANNEL_3 3 29#define ADC_CHANNEL_3 3
30 30
31#define ADC_REMOTE ADC_CHANNEL_0
31#define ADC_BATTERY ADC_CHANNEL_1 32#define ADC_BATTERY ADC_CHANNEL_1
32/*
33#define ADC_UNKNOWN_1 1
34#define ADC_REMOTE 2
35#define ADC_SCROLLPAD 3
36*/
37#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
38 33
34#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
39 35
40/* Force a scan now */ 36/* Force a scan now */
41unsigned short adc_scan(int channel); 37unsigned short adc_scan(int channel);
diff --git a/firmware/target/arm/samsung/button-target.h b/firmware/target/arm/samsung/button-target.h
index 61561dc86d..400c4ed768 100644
--- a/firmware/target/arm/samsung/button-target.h
+++ b/firmware/target/arm/samsung/button-target.h
@@ -26,6 +26,10 @@
26 26
27/* Button codes for Samsung YH-820, 920, 925 */ 27/* Button codes for Samsung YH-820, 920, 925 */
28 28
29#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
30void remote_int(void);
31#endif /* (SAMSUNG_YH920) || (SAMSUNG_YH925) */
32
29/* Main unit's buttons */ 33/* Main unit's buttons */
30/* Left = Menu, Right = Sel */ 34/* Left = Menu, Right = Sel */
31#define BUTTON_LEFT 0x00000001 35#define BUTTON_LEFT 0x00000001
@@ -39,6 +43,12 @@
39 43
40#define BUTTON_MAIN 0x000000ff 44#define BUTTON_MAIN 0x000000ff
41 45
46#define BUTTON_RC_PLUS BUTTON_UP
47#define BUTTON_RC_MINUS BUTTON_DOWN
48#define BUTTON_RC_PLAY BUTTON_PLAY
49#define BUTTON_RC_REW BUTTON_REW
50#define BUTTON_RC_FFWD BUTTON_FFWD
51
42#define POWEROFF_BUTTON BUTTON_PLAY 52#define POWEROFF_BUTTON BUTTON_PLAY
43#define POWEROFF_COUNT 15 53#define POWEROFF_COUNT 15
44 54
diff --git a/firmware/target/arm/samsung/button-yh82x_yh92x.c b/firmware/target/arm/samsung/button-yh82x_yh92x.c
index 1ed8089b90..2874a4a48a 100644
--- a/firmware/target/arm/samsung/button-yh82x_yh92x.c
+++ b/firmware/target/arm/samsung/button-yh82x_yh92x.c
@@ -22,11 +22,64 @@
22#include "system.h" 22#include "system.h"
23#include "button.h" 23#include "button.h"
24#include "backlight.h" 24#include "backlight.h"
25#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
26#include "adc.h"
25 27
28static int int_btn = BUTTON_NONE;
29
30void button_init_device(void)
31{
32 /* remote interrupt - low when key is pressed */
33 GPIOD_ENABLE |= 0x01;
34 GPIOD_OUTPUT_EN &= ~0x01;
35
36 /* disable/reset int */
37 GPIOD_INT_EN &= ~0x01;
38 GPIOD_INT_CLR |= 0x01;
39
40 /* enable int */
41 GPIOD_INT_LEV &= ~0x01;
42 GPIOD_INT_EN |= 0x01;
43
44 /* remote PLAY */
45 GPIOD_ENABLE |= 0x02;
46 GPIOD_OUTPUT_EN &= ~0x02;
47}
48
49/* Remote buttons */
50void remote_int(void)
51{
52 int state = 0x01 & ~GPIOD_INPUT_VAL;
53
54 GPIO_CLEAR_BITWISE(GPIOD_INT_EN, 0x01);
55 GPIO_WRITE_BITWISE(GPIOD_INT_LEV, state, 0x01);
56
57 if (state != 0)
58 {
59 /* necessary delay 1msec */
60 udelay(1000);
61 unsigned int val = adc_scan(ADC_REMOTE);
62 if (val > 750) int_btn = BUTTON_RC_MINUS;
63 else
64 if (val > 375) int_btn = BUTTON_RC_PLUS;
65 else
66 if (val > 100) int_btn = BUTTON_RC_REW;
67 else
68 int_btn = BUTTON_RC_FFWD;
69 }
70 else
71 int_btn = BUTTON_NONE;
72
73 GPIO_SET_BITWISE(GPIOD_INT_CLR, 0x01);
74 GPIO_SET_BITWISE(GPIOD_INT_EN, 0x01);
75}
76#else
26void button_init_device(void) 77void button_init_device(void)
27{ 78{
28 /* TODO...for now, hardware initialisation is done by the OF bootloader */ 79 /* nothing */
29} 80}
81#endif /* (SAMSUNG_YH920) || (SAMSUNG_YH925) */
82
30 83
31bool button_hold(void) 84bool button_hold(void)
32{ 85{
@@ -38,7 +91,11 @@ bool button_hold(void)
38 */ 91 */
39int button_read_device(void) 92int button_read_device(void)
40{ 93{
94#if defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
95 int btn = int_btn;
96#else
41 int btn = BUTTON_NONE; 97 int btn = BUTTON_NONE;
98#endif /* (SAMSUNG_YH920) || (SAMSUNG_YH925) */
42 static bool hold_button = false; 99 static bool hold_button = false;
43 bool hold_button_old; 100 bool hold_button_old;
44 101
@@ -65,6 +122,7 @@ int button_read_device(void)
65 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY; 122 if ( GPIOB_INPUT_VAL & 0x80) btn |= BUTTON_PLAY;
66#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925) 123#elif defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
67 if ( GPIOD_INPUT_VAL & 0x04) btn |= BUTTON_PLAY; 124 if ( GPIOD_INPUT_VAL & 0x04) btn |= BUTTON_PLAY;
125 if ( GPIOD_INPUT_VAL & 0x02) btn |= BUTTON_RC_PLAY; /* Remote PLAY */
68#endif 126#endif
69 } 127 }
70 128